Veja:
Selecionar tudo
gilberto@ti-des05:~> echo $TNS_ADMIN
/opt/oracle/product/10.1.0.2.0/db_1/network/admin
gilberto@ti-des05:~> ll /opt/oracle/product/10.1.0.2.0/db_1/network/admin
total 28
drwxrwxr-x 3 oracle oinstall 4096 2007-10-15 14:01 .
drwxrwxr-x 11 oracle oinstall 4096 2007-10-15 13:56 ..
-rwxrwxr-x 1 oracle oinstall 92 2006-08-09 10:07 protocol.obs
-rwxrwxr-x 1 oracle oinstall 87 2006-08-09 10:01 protocol.ora
drwxrwxr-x 2 oracle oinstall 4096 2006-01-24 14:28 samples
-rwxrwxr-x 1 oracle oinstall 287 2006-08-09 10:33 sqlnet.ora
-rwxrwxr-x 1 oracle oinstall 1460 2007-10-15 14:01 tnsnames.ora
gilberto@ti-des05:~>
Não há listener estático!
Também não há entrada alguma de minha instância (MEU) no arquivo tnsnames.ora:
Selecionar tudo
gilberto@ti-des05:~> cat /opt/oracle/oracleDevSuite/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle/oracleDevSuite/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
gilberto@ti-des05:~>
Mas eu consigo ver que o listener dinâmico está funcionando:
Selecionar tudo
oracle@ti-des05:~> lsnrctl status
LSNRCTL for Linux: Version 10.1.0.2.0 - Production on 15-OUT-2007 16:07:30
Copyright (c) 1991, 2004, Oracle. All rights reserved.
Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.1.0.2.0 - Production
Start Date 15-OUT-2007 16:07:11
Uptime 0 days 0 hr. 0 min. 19 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Log File /opt/oracle/product/10.1.0.2.0/db_1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ti-des05.local.secad)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ti-des05.local.secad)(PORT=8081))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ti-des05.local.secad)(PORT=2111))(Presentation=FTP)(Session=RAW))
Services Summary...
Service "meu" has 1 instance(s).
Instance "meu", status READY, has 1 handler(s) for this service...
Service "meuXDB" has 1 instance(s).
Instance "meu", status READY, has 1 handler(s) for this service...
The command completed successfully
oracle@ti-des05:~>
Mas se abro outra sessão no cliente e tento conectar:
(No cliente)
Selecionar tudo
gilberto@ti-des05:~> sqlplus scott/tiger@meu
SQL*Plus: Release 10.1.0.2.0 - Production on Seg Out 15 16:08:17 2007
Copyright (c) 1982, 2004, Oracle. All rights reserved.
ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified
Enter user-name: scott
Enter password:
ERROR:
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux Error: 2: No such file or directory
gilberto@ti-des05:~> tnsping meu
TNS Ping Utility for Linux: Version 10.1.0.2.0 - Production on 15-OUT-2007 16:13:31
Copyright (c) 1997, 2003, Oracle. All rights reserved.
Used parameter files:
/opt/oracle/oracleDevSuite/network/admin/admin/sqlnet.ora
TNS-03505: Failed to resolve name
Isso acontece porque no cliente precisamos configurar o arquivo tnsnames.ora, para acessar aquela instância (SID) que está escutando no servidor remoto:
(No cliente)
Selecionar tudo
oracle@ti-des05:~> vi /opt/oracle/oracleDevSuite/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle/oracleDevSuite/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
MEU =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.121.1.42)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = meu)
)
)
Agora podemos conectar:
(No cliente)
Selecionar tudo
gilberto@ti-des05:~> tnsping meu
TNS Ping Utility for Linux: Version 10.1.0.2.0 - Production on 15-OUT-2007 16:15:24
Copyright (c) 1997, 2003, Oracle. All rights reserved.
Used parameter files:
/opt/oracle/oracleDevSuite/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10.121.1.42)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = meu)))
OK (0 msec)
gilberto@ti-des05:~> sqlplus scott/tiger@meu
SQL*Plus: Release 10.1.0.2.0 - Production on Seg Out 15 16:15:29 2007
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
scott@MEU>
Gilberto