12C 連接方式和 Oracle Easy Connect Naming method


1.12C 連接方式

 

PDB is not an instance, so using SID in the connection string will not work.

When the database is an Oracle Database 12c container database, the client must specify a service name in order to connect to it. 

Listener status shows TEST as only a service :

Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.oracle.com)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(PIPENAME=\\.\pipe\EXTPROC1521ipc))) Services Summary...
Service "CDB1" has 1 instance(s).
Instance "cdb1", status READY, has 1 handler(s) for this service... Service "CDB1XDB" has 1 instance(s).
Instance "cdb1", status READY, has 1 handler(s) for this service...
Service "CLRExtProc" has 1 instance(s).
Instance "CLRExtProc", status UNKNOWN, has 1 handler(s) for this service.
Service "TEST" has 1 instance(s). I
nstance "cdb1", status READY, has 1 handler(s) for this service... The command completed successfully 

 

 

2.Oracle Easy Connect Naming method

 

sqlplus hddtusr/hddtusr_0824@//192.168.27.145:15021/phddtuat

 

 

在Oracle 10g中,Oracle還提供了一種稱為“Oracle Easy Connect Naming method"
的連接方式。這種方法是對hostnaming method的一種改進,因為hostnaming method
只能使用缺省的1521 port,而Oracle Easy Connect Naming method則可以指定自己的
port.
配置Oracle Easy Connect Naming method基本要求:
1)Oracle 10g Net Serrices必須安裝在client端
2)在服務端和客戶端必須同時支持TCP/IP協議
3)使用這種連接方式,不支持比較高級的連接符,比如連接池和外部過程 調用(external procedure calls)
語法比較簡單:只需要按照如下的格式指定HOST:PORT/SERVICE_NAME就可以了。 但如果通過url連接的話,
需要在@后面增加2個反斜杠"//"
比如:
sqlplus study/study@localhost:1522/study
sqlplus study/study@//10.10.10.1/study
備注: 1)如果使用默認port,可以不指定:PORT部分,直接HOST/SERVICE_NAME
2)在10g中當安裝了Oracle Net后,這種連接方式被自動配置
3)對應sqlnet.ora中names.diretory_path中的方法EZCONNECT
NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT,HOSTNAME)
下面測試一下看看。

C:sqlplus study/study@127.0.0.1:1521/study
SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 6月 11 16:52:44 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
連接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options
SQL> exit 從 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options 斷開


C:sqlplus study/study@127.0.0.1/study


SQL*Plus: Release 10.2.0.1.0 - Production on 星期一 6月 11 16:52:51 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
連接到: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options
SQL> exit

從 Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning, OLAP and Data Mining options 斷開
C:


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM