關於UR=A的測試
當資料庫在nomount,mount或者restricted這類特殊狀態下,同時動態監聽顯示狀態為BLOCKED,客戶端無法直接連線到例項,此時可通過配置UR=A進行連線。最常見的場景就是10g版本的RAC,配置OGG時需要訪問ASM例項的情況(實測11.2版本的RAC ASM例項動態監聽的顯示狀態為Ready,無需新增UR=A配置即可連線)。下面是測試過程:
- 1.測試10.2.0.5連線ASM
- 2.測試11.2.0.4連線ASM
1.測試10.2.0.5連線ASM
環境:Oracle 10.2.0.5 RAC + ASM
tnsnames.ora配置如下:
ASM = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.171)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM1) )
監聽狀態如下:
[oracle@rac1-server admin]$ lsnrctl status LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 14-FEB-2019 19:37:22 Copyright (c) 1991, 2010, Oracle.All rights reserved. Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521)) STATUS of the LISTENER ------------------------ AliasLISTENER_RAC1-SERVER VersionTNSLSNR for Linux: Version 10.2.0.5.0 - Production Start Date12-FEB-2019 12:59:06 Uptime2 days 6 hr. 38 min. 15 sec Trace Leveloff SecurityON: Local OS Authentication SNMPOFF Listener Parameter File/s01/oracle/product/10.2.0/db_1/network/admin/listener.ora Listener Log File/s01/oracle/product/10.2.0/db_1/network/log/listener_rac1-server.log Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.172)(PORT=1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.171)(PORT=1521))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status BLOCKED, has 1 handler(s) for this service... Service "+ASM_XPT" has 1 instance(s). Instance "+ASM1", 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 "SYS$SYS.KUPC$S_1_20170912101328.JY.ORACLE.COM" has 1 instance(s). Instance "jy2", status READY, has 1 handler(s) for this service... Service "jy.oracle.com" has 1 instance(s). Instance "jy2", status READY, has 1 handler(s) for this service... Service "jyXDB.oracle.com" has 1 instance(s). Instance "jy2", status READY, has 1 handler(s) for this service... Service "jy_XPT.oracle.com" has 1 instance(s). Instance "jy2", status READY, has 1 handler(s) for this service... Service "orcl" has 2 instance(s). Instance "orcl1", status READY, has 2 handler(s) for this service... Instance "orcl2", status READY, has 1 handler(s) for this service... Service "orclXDB" has 2 instance(s). Instance "orcl1", status READY, has 1 handler(s) for this service... Instance "orcl2", status READY, has 1 handler(s) for this service... Service "orcl_XPT" has 2 instance(s). Instance "orcl1", status READY, has 2 handler(s) for this service... Instance "orcl2", status READY, has 1 handler(s) for this service... The command completed successfully [oracle@rac1-server admin]$
此時如果通過網路連線ASM例項,會報錯ORA-12528:
[oracle@rac1-server admin]$ sqlplus sys/oracle@asm as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Thu Feb 14 19:25:52 2019 Copyright (c) 1982, 2010, Oracle.All Rights Reserved. ERROR: ORA-12528: TNS:listener: all appropriate instances are blocking new connections Enter user-name:
修改tnsnames.ora,增加UR=A配置:
ASM = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.171)(PORT = 1521)) (CONNECT_DATA = (UR=A) (SERVER = DEDICATED) (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM1) )
再次嘗試通過網路連線ASM例項,可成功連線:
[oracle@rac1-server admin]$ sqlplus sys/oracle@asm as sysdba SQL*Plus: Release 10.2.0.5.0 - Production on Thu Feb 14 19:26:26 2019 Copyright (c) 1982, 2010, Oracle.All Rights Reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production With the Partitioning, Real Application Clusters, OLAP, Data Mining and Real Application Testing options SQL>
2.測試11.2.0.4連線ASM
環境:Oracle 11.2.0.4 RAC + ASM
tnsnames.ora配置如下:
ASM = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.107)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = +ASM) (INSTANCE_NAME = +ASM1) ) )
監聽狀態如下:
[grid@db01 admin]$ lsnrctl status LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 14-FEB-2019 19:41:59 Copyright (c) 1991, 2013, Oracle.All rights reserved. Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER))) STATUS of the LISTENER ------------------------ AliasLISTENER VersionTNSLSNR for Linux: Version 11.2.0.4.0 - Production Start Date13-FEB-2019 11:28:44 Uptime1 days 8 hr. 13 min. 14 sec Trace Leveloff SecurityON: Local OS Authentication SNMPOFF Listener Parameter File/opt/app/11.2.0/grid/network/admin/listener.ora Listener Log File/opt/app/grid/diag/tnslsnr/db01/listener/alert/log.xml Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.107)(PORT=1522))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.1.117)(PORT=1522))) Services Summary... Service "+ASM" has 1 instance(s). Instance "+ASM1", status READY, has 1 handler(s) for this service... Service "A" has 1 instance(s). Instance "orcl1", status READY, has 1 handler(s) for this service... Service "B" has 1 instance(s). Instance "orcl1", status READY, has 1 handler(s) for this service... Service "orcl" has 1 instance(s). Instance "orcl1", status READY, has 1 handler(s) for this service... Service "orclXDB" has 1 instance(s). Instance "orcl1", status READY, has 1 handler(s) for this service... The command completed successfully [grid@db01 admin]$
在沒有配置UR=A的情況下,就可以正常連線到ASM例項:
--沒有指定as sysasm會報錯ORA-15000: [oracle@db01 admin]$ sqlplus sys/oracle@asm SQL*Plus: Release 11.2.0.4.0 Production on Thu Feb 14 19:23:57 2019 Copyright (c) 1982, 2013, Oracle.All rights reserved. ERROR: ORA-15000: command disallowed by current instance type Enter user-name: ^C --指定後就可以正常連線: [oracle@db01 admin]$ sqlplus sys/oracle@asm as sysasm SQL*Plus: Release 11.2.0.4.0 Production on Thu Feb 14 19:24:00 2019 Copyright (c) 1982, 2013, Oracle.All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Real Application Clusters and Automatic Storage Management options SQL>
由此驗證了11.2.0.4環境下,通過網路連線ASM例項,不再需要UR=A的配置。