AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • Início
  • system&network
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • Início
  • system&network
    • Recentes
    • Highest score
    • tags
  • Ubuntu
    • Recentes
    • Highest score
    • tags
  • Unix
    • Recentes
    • tags
  • DBA
    • Recentes
    • tags
  • Computer
    • Recentes
    • tags
  • Coding
    • Recentes
    • tags
Início / user-137083

akkarin's questions

Martin Hope
akkarin
Asked: 2017-10-25 04:22:53 +0800 CST

Por que o Oracle produz vários níveis por linha nesta consulta hierárquica?

  • 0

Estou tentando reproduzir o primeiro exemplo simples deste tutorial .

No entanto, não entendo por que recebo tantas linhas de volta. Eu esperaria que 1 reportasse a 2 apenas no nível 1 e não no nível 2 também.

SQL> select employee_id, reports_to from employees;

EMPLOYEE_ID REPORTS_TO
----------- ----------
      1      2
      2
      3      2
      4      2
      5      2
      6      5
      7      5
      8      2
      9      5

9 rows selected.

SQL> select employee_id, reports_to, LEVEL from employees connect by prior employee_id = reports_to;

EMPLOYEE_ID REPORTS_TO      LEVEL
----------- ---------- ----------
      1      2      1
      8      2      1
      5      2      1
      6      5      2
      9      5      2
      7      5      2
      4      2      1
      3      2      1
      6      5      1
      9      5      1
      7      5      1

EMPLOYEE_ID REPORTS_TO      LEVEL
----------- ---------- ----------
      2         1
      1      2      2
      8      2      2
      5      2      2
      6      5      3
      9      5      3
      7      5      3
      4      2      2
      3      2      2

20 rows selected.
oracle hierarchy
  • 1 respostas
  • 473 Views
Martin Hope
akkarin
Asked: 2017-10-23 02:34:53 +0800 CST

Configurando o Oracle XE no Linux

  • -1

Estou tentando configurar o oracle-xe na minha máquina Linux. Só preciso de um ambiente para jogar com Oracle SQL; isso não é para produção.

Quando tento iniciar o SQLPLUS, continuo recebendo um dos seguintes erros:

ORA-12541: TNS:no listener

ORA-28547: connection to server failed, probable Oracle Net admin error

Existem alguns posts sobre problemas semelhantes, mas mesmo depois de tentar muitas "soluções" diferentes, ainda estou perdido.

Provavelmente estou fazendo algo terrivelmente errado. Veja as seguintes saídas:

[oracle@roshan ~]$ whoami
oracle
[oracle@roshan ~]$ pwd
/usr/lib/oracle
[oracle@roshan ~]$ echo $ORACLE_HOME
/usr/lib/oracle/product/11.2.0/xe
[oracle@roshan ~]$ echo $ORACLE_SID
PLSExtProc
[oracle@roshan ~]$ cat product/11.2.0/xe/network/admin/tnsnames.ora 
# tnsnames.ora Network Configuration File:

XE =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = XE)
    )
  )

EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC_FOR_XE))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )

SQL_AUTHENTICATION_SERVICES = (NONE)
[oracle@roshan ~]$ product/11.2.0/xe/bin/lsnrctl start    

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 22-OCT-2017 12:24:03

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

TNS-01106: Listener using listener name LISTENER has already been started
[oracle@roshan ~]$ product/11.2.0/xe/bin/lsnrctl status

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 22-OCT-2017 12:24:07

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                22-OCT-2017 12:21:18
Uptime                    0 days 0 hr. 2 min. 48 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /usr/lib/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File         /usr/lib/oracle/diag/tnslsnr/roshan/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=roshan.localdomain)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@roshan ~]$ sqlplus SYSTEM/foobar@localhost:8080/PLSExtProc


SQL*Plus: Release 12.2.0.1.0 Production on Sun Oct 22 12:24:14 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

ERROR:
ORA-12541: TNS:no listener


Enter user-name: %                                                              [oracle@roshan ~]$ sqlplus SYSTEM/foobar@localhost:1521/PLSExtProc


SQL*Plus: Release 12.2.0.1.0 Production on Sun Oct 22 12:24:27 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

ERROR:
ORA-28547: connection to server failed, probable Oracle Net admin error


Enter user-name: %   
[oracle@roshan ~]$ su
Password: 
[root@roshan oracle]# /etc/rc.d/oracle-xe status

LSNRCTL for Linux: Version 11.2.0.2.0 - Production on 22-OCT-2017 12:32:06

Copyright (c) 1991, 2011, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC_FOR_XE)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.2.0 - Production
Start Date                22-OCT-2017 12:21:18
Uptime                    0 days 0 hr. 10 min. 47 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Default Service           XE
Listener Parameter File   /usr/lib/oracle/product/11.2.0/xe/network/admin/listener.ora
Listener Log File         /usr/lib/oracle/diag/tnslsnr/roshan/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC_FOR_XE)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=roshan.localdomain)(PORT=1521)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "XE" has 1 instance(s).
  Instance "XE", status READY, has 1 handler(s) for this service...
The command completed successfully

Algum destes parece muito errado?

oracle oracle-11g
  • 2 respostas
  • 1014 Views

Sidebar

Stats

  • Perguntas 205573
  • respostas 270741
  • best respostas 135370
  • utilizador 68524
  • Highest score
  • respostas
  • Marko Smith

    conectar ao servidor PostgreSQL: FATAL: nenhuma entrada pg_hba.conf para o host

    • 12 respostas
  • Marko Smith

    Como fazer a saída do sqlplus aparecer em uma linha?

    • 3 respostas
  • Marko Smith

    Selecione qual tem data máxima ou data mais recente

    • 3 respostas
  • Marko Smith

    Como faço para listar todos os esquemas no PostgreSQL?

    • 4 respostas
  • Marko Smith

    Listar todas as colunas de uma tabela especificada

    • 5 respostas
  • Marko Smith

    Como usar o sqlplus para se conectar a um banco de dados Oracle localizado em outro host sem modificar meu próprio tnsnames.ora

    • 4 respostas
  • Marko Smith

    Como você mysqldump tabela (s) específica (s)?

    • 4 respostas
  • Marko Smith

    Listar os privilégios do banco de dados usando o psql

    • 10 respostas
  • Marko Smith

    Como inserir valores em uma tabela de uma consulta de seleção no PostgreSQL?

    • 4 respostas
  • Marko Smith

    Como faço para listar todos os bancos de dados e tabelas usando o psql?

    • 7 respostas
  • Martin Hope
    Jin conectar ao servidor PostgreSQL: FATAL: nenhuma entrada pg_hba.conf para o host 2014-12-02 02:54:58 +0800 CST
  • Martin Hope
    Stéphane Como faço para listar todos os esquemas no PostgreSQL? 2013-04-16 11:19:16 +0800 CST
  • Martin Hope
    Mike Walsh Por que o log de transações continua crescendo ou fica sem espaço? 2012-12-05 18:11:22 +0800 CST
  • Martin Hope
    Stephane Rolland Listar todas as colunas de uma tabela especificada 2012-08-14 04:44:44 +0800 CST
  • Martin Hope
    haxney O MySQL pode realizar consultas razoavelmente em bilhões de linhas? 2012-07-03 11:36:13 +0800 CST
  • Martin Hope
    qazwsx Como posso monitorar o andamento de uma importação de um arquivo .sql grande? 2012-05-03 08:54:41 +0800 CST
  • Martin Hope
    markdorison Como você mysqldump tabela (s) específica (s)? 2011-12-17 12:39:37 +0800 CST
  • Martin Hope
    Jonas Como posso cronometrar consultas SQL usando psql? 2011-06-04 02:22:54 +0800 CST
  • Martin Hope
    Jonas Como inserir valores em uma tabela de uma consulta de seleção no PostgreSQL? 2011-05-28 00:33:05 +0800 CST
  • Martin Hope
    Jonas Como faço para listar todos os bancos de dados e tabelas usando o psql? 2011-02-18 00:45:49 +0800 CST

Hot tag

sql-server mysql postgresql sql-server-2014 sql-server-2016 oracle sql-server-2008 database-design query-performance sql-server-2017

Explore

  • Início
  • Perguntas
    • Recentes
    • Highest score
  • tag
  • help

Footer

AskOverflow.Dev

About Us

  • About Us
  • Contact Us

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve