Connecting to ASM through the TNS Listener from a Client Desktop

Contents

Introduction

By default, the Oracle Database Configuration Assistant (DBCA) does not configure the TNS listener to accept client requests to an ASM instance running from a different node. Access will be denied for clients like SQL*Plus, Perl DBI:DBD, and JDBC when attempting to connect to an ASM instance from a node other than the node running the ASM instance. When the service is created for an ASM instance, its status is BLOCKED:


[oracle@linux1 ~]$ lsnrctl status LISTENER_LINUX1 | grep ASM Service "+ASM" has 1 instance(s). Instance "+ASM1", status , has 1 handler(s) for this service... Service "+ASM_XPT" has 1 instance(s). Instance "+ASM1", status , has 1 handler(s) for this service...

This limitation puts restrictions on scripts and other client tools that want to monitor and manage an ASM instance from a different node. Getting around this restriction however is an easy task that involves manually creating a service name for the ASM instance.

This article presents the steps required to access an ASM instance through the TNS listener from a client desktop. The database used in this article is a two-node Oracle RAC 10g clustered database where in fact there will two ASM instances (one ASM instance for each Oracle instance in the cluster). The database version is Oracle 10g Release 2 (10.2.0.3.0) running on CentOS 4.5 (or RHEL 4.5):

Node 1
Machine Namelinux1.idevelopment.info
Oracle SIDorcl1
ASM SID+ASM1
ASM Global DB Name (service name)+ASM

Node 2
Machine Namelinux2.idevelopment.info
Oracle SIDorcl2
ASM SID+ASM2
ASM Global DB Name (service name)+ASM

Modify the listener.ora for the ASM Instances

The first step is to modify the listener.ora file for the ORACLE_HOME running ASM on all nodes in the RAC cluster by adding a new service:

Node 1 - (listener.ora)


LISTENER_LINUX1 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = linux1-vip)(PORT = 1521)(IP = FIRST)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.100)(PORT = 1521)(IP = FIRST)) ) ) SID_LIST_LISTENER_LINUX1 = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) (PROGRAM = extproc) ) )

Node 2 - (listener.ora)


LISTENER_LINUX2 = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = linux2-vip)(PORT = 1521)(IP = FIRST)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.101)(PORT = 1521)(IP = FIRST)) ) ) SID_LIST_LISTENER_LINUX2 = (SID_LIST = (SID_DESC = (SID_NAME = PLSExtProc) (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1) (PROGRAM = extproc) ) )

Add ASM Entries to the tnsnames.ora File on the Client Machine

The next step is to add ASM entries to the tnsnames.ora file on the client machine that will be connecting to the ASM instance(s). The client machine in this example is named alex.idevelopment.info. A separate tnsnames entry will be created for each ASM instance in the two-node RAC. The two tnsnames entries for this example are named ORCL1_ASM1 and ORCL2_ASM2:

Client Node - (tnsnames.ora)


ORCL = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = linux1-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = linux2-vip)(PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.idevelopment.info) ) ) ORCL1 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = linux1-vip)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.idevelopment.info) (INSTANCE_NAME = orcl1) ) ) ORCL2 = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = linux2-vip)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.idevelopment.info) (INSTANCE_NAME = orcl2) ) ) ORCL_TAF = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = linux1-vip)(PORT = 1521)) (ADDRESS = (PROTOCOL = TCP)(HOST = linux2-vip)(PORT = 1521)) (LOAD_BALANCE = yes) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl_taf.idevelopment.info) (FAILOVER_MODE = (TYPE = SELECT) (METHOD = BASIC) (RETRIES = 180) (DELAY = 5) ) ) )

Bounce the TNS Listener

The final step is to bounce the Oracle TNS Listener. Remember that the listener process will need to be bounced on both of the nodes in the RAC cluster:


# ----------- # FROM linux1 # ----------- [oracle@linux1 ~]$ lsnrctl stop LISTENER_LINUX1 [oracle@linux1 ~]$ lsnrctl start LISTENER_LINUX1 # ----------- # FROM linux2 # ----------- [oracle@linux2 ~]$ lsnrctl stop LISTENER_LINUX2 [oracle@linux2 ~]$ lsnrctl start LISTENER_LINUX2

After restarting the TNS listener, the new service should be available from both nodes in the RAC cluster:


# ----------- # FROM linux1 # ----------- [oracle@linux1 ~]$ lsnrctl status LISTENER_LINUX1 | grep ASM Service "+ASM" has 2 instance(s). Instance "+ASM1", status , has 1 handler(s) for this service... 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... # ----------- # FROM linux2 # ----------- [oracle@linux2 ~]$ lsnrctl status LISTENER_LINUX2 | grep ASM Service "+ASM" has 2 instance(s). Instance "+ASM2", status , has 1 handler(s) for this service... Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service... Service "+ASM_XPT" has 1 instance(s). Instance "+ASM2", status BLOCKED, has 1 handler(s) for this service...

Test Access to ASM from the Client Machine

After the new ASM service(s) have been added and the TNS listener successfully restarted, test access to the ASM instances from the client machine using SQL*Plus:


ORA10G on alex: sqlplus "sys/@orcl1_asm1 as sysdba" @asm_diskgroups.sql Disk Group Sector Block Allocation Name Size Size Unit Size State Type Total Size (MB) Used Size (MB) Pct. Used -------------------- ------- ------- ------------ ----------- ------ --------------- -------------- --------- FLASH_RECOVERY_AREA 512 4,096 1,048,576 MOUNTED EXTERN 596,985 339 .06 ORCL_DATA1 512 4,096 1,048,576 MOUNTED EXTERN 597,017 40,784 6.83 --------------- -------------- Grand Total: 1,194,002 41,123 ORA10G on alex: sqlplus "sys/@orcl2_asm2 as sysdba" @asm_diskgroups.sql Disk Group Sector Block Allocation Name Size Size Unit Size State Type Total Size (MB) Used Size (MB) Pct. Used -------------------- ------- ------- ------------ ----------- ------ --------------- -------------- --------- FLASH_RECOVERY_AREA 512 4,096 1,048,576 MOUNTED EXTERN 596,985 339 .06 ORCL_DATA1 512 4,096 1,048,576 MOUNTED EXTERN 597,017 40,784 6.83 --------------- -------------- Grand Total: 1,194,002 41,123

About the Author

Jeffrey Hunter is an Oracle Certified Professional, Java Development Certified Professional, Author, and an Oracle ACE. Jeff currently works as a Senior Database Administrator for The DBA Zone, Inc. located in Pittsburgh, Pennsylvania. His work includes advanced performance tuning, Java and PL/SQL programming, developing high availability solutions, capacity planning, database security, and physical / logical database design in a UNIX, Linux, and Windows server environment. Jeff's other interests include mathematical encryption theory, programming language processors (compilers and interpreters) in Java and C, LDAP, writing web-based database administration tools, and of course Linux. He has been a Sr. Database Administrator and Software Engineer for over 16 years and maintains his own website site at: http://www.iDevelopment.info. Jeff graduated from Stanislaus State University in Turlock, California, with a Bachelor's degree in Computer Science.


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13024285/viewspace-682259/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/13024285/viewspace-682259/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值