一、動態監聽

 

1.監聽檔

 

[oracle@node1 admin]$ more /u01/oracle/network/admin/listener.ora

 

SID_LIST_LISTENER =

 

(SID_LIST =

 

(SID_DESC =

 

(SID_NAME = PLSExtProc)

 

(ORACLE_HOME = /u01/oracle)

 

(PROGRAM = extproc)

 

)

 

)

 

LISTENER =

 

(DESCRIPTION_LIST =

 

(DESCRIPTION =

 

(ADDRESS = (PROTOCOL = TCP)(HOST = node1)(PORT = 1521))

 

(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))

 

)

 

)

 

2.監聽狀態

 

[oracle@node1 admin]$ lsnrctl status

 

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-JAN-2012 13:38:42

 

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

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=node1)(PORT=1521)))

 

STATUS of the LISTENER

 

------------------------

 

Alias LISTENER

 

Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production

 

Start Date 18-JAN-2012 13:32:49

 

Uptime 0 days 0 hr. 5 min. 53 sec

 

Trace Level off

 

Security ON: Local OS Authentication

 

SNMP OFF

 

Listener Parameter File /u01/oracle/network/admin/listener.ora

 

Listener Log File /u01/oracle/network/log/listener.log

 

Listening Endpoints Summary...

 

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=node1)(PORT=1521)))

 

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

 

Services Summary...

 

Service "+ASM" has 1 instance(s).

 

Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...

 

Service "+ASM_XPT" has 1 instance(s).

 

Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...

 

Service "PLSExtProc" has 1 instance(s).

 

Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...

 

Service "chf" has 1 instance(s).

 

Instance "chf", status READY, has 1 handler(s) for this service...

 

Service "chfXDB" has 1 instance(s).

 

Instance "chf", status READY, has 1 handler(s) for this service...

 

Service "chf_XPT" has 1 instance(s).

 

Instance "chf", status READY, has 1 handler(s) for this service...

 

The command completed successfully

 

3.用戶端tns檔[有部分測試加上了(UR=A)]

 

vm_asm =

 

(DESCRIPTION =

 

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521))

 

(CONNECT_DATA =

 

(SERVICE_NAME = +ASM)

 

(INSTANCE_NAME = +ASM)

 

(UR=A) #分存在和不存在測試

 

)

 

)

 

vm_chf =

 

(DESCRIPTION =

 

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521))

 

(CONNECT_DATA =

 

(SERVICE_NAME = chf)

 

(INSTANCE_NAME = chf)

 

)

 

)

 

4.無測試(UR=A)

 

C:\Users\XIFENFEI>tnsping vm_asm

 

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 -

 

2012 22:15:10

 

Copyright (c) 1997, 2010, Oracle. All rights reserved.

 

已使用的參數檔:

 

e:\oracle\11_2_0\network\admin\sqlnet.ora

 

已使用 TNSNAMES 配接器來解析別名

 

嘗試連接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT =

 

1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM)))

 

OK (10 毫秒)

 

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:15:14 2012

 

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

 

ERROR:

 

ORA-12514: TNS: 監聽程式當前無法識別連接描述項中請求的服務

 

請輸入使用者名:

 

ERROR:

 

ORA-12560: TNS: 協定配接器錯誤

 

請輸入使用者名:

 

ERROR:

 

ORA-12560: TNS: 協定配接器錯誤

 

SP2-0157: 在 3 次嘗試之後無法連接到 ORACLE, 退出 SQL*Plus

 

--通過下面的資料庫實例測試,證明動態監聽是正常工作的,可以訪問資料庫 www.it165.net

 

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_chf as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 21:55:03 2012

 

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

 

連接到:

 

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

 

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> select instance_name from v$instance;

 

INSTANCE_NAME

 

----------------

 

chf

 

5.含(UR=A)測試

 

C:\Users\XIFENFEI>tnsping vm_asm

 

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 -

 

2012 22:16:49

 

Copyright (c) 1997, 2010, Oracle. All rights reserved.

 

已使用的參數檔:

 

e:\oracle\11_2_0\network\admin\sqlnet.ora

 

已使用 TNSNAMES 配接器來解析別名

 

嘗試連接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT =

 

1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM) (UR=A)))

 

OK (20 毫秒)

 

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:16:52 2012

 

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

 

連接到:

 

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

 

With the Partitioning, OLAP, Data Mining and Real Application Testing options

 

SQL> select instance_name from v$instance;

 

INSTANCE_NAME

 

--------------------------------

 

+ASM

 

二、靜態監聽

 

1.監聽檔

 

[oracle@node1 admin]$ more listener.ora

 

SID_LIST_LISTENER =

 

(SID_LIST =

 

(SID_DESC =

 

(GLOBAL_DBNAME = chf)

 

(ORACLE_HOME = /u01/oracle)

 

(SID_NAME = chf)

 

)

 

(SID_DESC =

 

(GLOBAL_DBNAME = +ASM)

 

(ORACLE_HOME = /u01/oracle)

 

(SID_NAME = +ASM)

 

)

 

)

 

LISTENER =

 

(DESCRIPTION_LIST =

 

(DESCRIPTION =

 

(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT = 1521))

)

)

2.監聽狀態

[oracle@node1 admin]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 18-JAN-2012 13:53:52

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.30)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production

Start Date 18-JAN-2012 13:51:48

Uptime 0 days 0 hr. 2 min. 4 sec

Trace Level off

Security ON: Local OS Authentication

SNMP OFF

Listener Parameter File /u01/oracle/network/admin/listener.ora

Listener Log File /u01/oracle/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.30)(PORT=1521)))

Services Summary...

Service "+ASM" has 2 instance(s).

Instance "+ASM", status UNKNOWN, has 1 handler(s) for this service...

Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...

Service "+ASM_XPT" has 1 instance(s).

Instance "+ASM", status BLOCKED, has 1 handler(s) for this service...

Service "chf" has 2 instance(s).

Instance "chf", status UNKNOWN, has 1 handler(s) for this service...

Instance "chf", status READY, has 1 handler(s) for this service...

Service "chfXDB" has 1 instance(s).

Instance "chf", status READY, has 1 handler(s) for this service...

Service "chf_XPT" has 1 instance(s).

Instance "chf", status READY, has 1 handler(s) for this service...

The command completed successfully

3.無(UR=A)測試

C:\Users\XIFENFEI>tnsping vm_asm

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 -

2012 22:11:34

Copyright (c) 1997, 2010, Oracle. All rights reserved.

已使用的參數檔:

e:\oracle\11_2_0\network\admin\sqlnet.ora

已使用 TNSNAMES 配接器來解析別名

嘗試連接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT =

1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM)))

OK (20 毫秒)

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:11:06 2012

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

連接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME

--------------------------------

+ASM

4.含(UR=A)測試

C:\Users\XIFENFEI>tnsping vm_asm

TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 23-2月 -

2012 22:12:49

Copyright (c) 1997, 2010, Oracle. All rights reserved.

已使用的參數檔:

e:\oracle\11_2_0\network\admin\sqlnet.ora

已使用 TNSNAMES 配接器來解析別名

嘗試連接 (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.30)(PORT =

1521)) (CONNECT_DATA = (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM) (UR=A)))

OK (10 毫秒)

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@vm_asm as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:12:53 2012

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

連接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME

--------------------------------

+ASM

5.easy connect訪問asm實例

C:\Users\XIFENFEI>SQLPLUS sys/xifenfei@192.168.1.30/+asm as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on 星期四 2月 23 22:27:42 2012

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

連接到:

Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME

--------------------------------

+ASM

三、總結

1.在動態監聽中,只有設置了(UR=A)才能夠遠端存取ASM實例;

2.在靜態監聽中,無論是否設置(UR=A)均可遠端存取ASM實例,甚至可以使用easy connect方法方法ASM實例。

 

創作者介紹
創作者 shadow 的頭像
shadow

資訊園

shadow 發表在 痞客邦 留言(0) 人氣()