远程客户端 访问 ASM 实例(一)

2014-11-24 18:25:56 · 作者: · 浏览: 0

我们可以直接在服务器器上访问ASM 实例,只需要指定ASM 实例名,在用sqlplus连接就可以了。 如果我们想从远程的客户端访问ASM 实例,可以参考如下的配置方法。




一.官网的配置说明



EXAMPLE


SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = +ASM)
(ORACLE_HOME = c:/oracle/app/product/11.1.0/db_1)
)
)



d) Stop the listener


lsnrctl stop



e) restart the listener


lsnrctl start




2) Edit the tnsnames.ora on the client

a) Logon to the client machine that will be used to connect to the ASM instance
NOTE: the client machine can also be the ASM/Database server (ie for DBCONTROL)
b) Locate your tnsnames.ora (typically in the $ORACLE_HOME/network/admin)


c) Add an entry (tnsalias) for your ASM instance (see example)



EXAMPLE


ASM =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = kbcook-1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID_NAME = +ASM)
(UR=A)
)
)



3) Setup your remote login password for your ASM instance on the ASM server

a) Logon to the ASM/Database server
b) Locate the parameter file for your ASM instance (typically $ORACLE_HOME/dbs/init+ASM.ora [unix] or $ORACLE_HOME/dbs/init+ASM.ora [windows] )
c) Edit the parameter file and add
remote_login_passwordfile = exclusive ... for stand alone ASM setups
remote_login_passwordfile = shared ... for ASM setups that also use Real Application Cluster (RAC)

d) Save the file


NOTE: It may be required that an PFILE be created from an SPFILE in order to be able to edit the file properly ... once the line have been added ... the process can be reversed


For more details Note 249664.1 Pfile vs SPfile ... may be used

4) Set your SYS password using ORAPWD for the ASM instance
a) Logon to the ASM/Database server
b) Locate your orapw file for your ASM instance (typically $ORACLE_HOME/dbs/orapw+ASM)
c) Rename the file to orapw.old
d) Run orapwd to reset the password (see example below)

EXAMPLE


mv "orapw+ASM" "orapw+ASM.old"
orapwd file=orapw+ASM password=kbcook



5) Use the properly formatted connect string for your tool

Connnect to the ASM instance using the password (#4 above) and the tnsalias (#2 above)

EXAMPLES


C:/oracle/app/product/11.1.0/db_1/BIN/SQLPLUS.EXE "sys/kbcook@asm as sysdba"


sqlplus "sys/kbcook@asm as sysdba"


sqlplus "sys@asm as sysdba" ... then supply the password when prompted





二. 测试


这里我们已连接ASM 实例1为例,所以只修改这个节点上的ASM 相关配置参数。 如果要配置2个节点,就修改2个节点的LISTENER.ORA文件。 内容一样。 然后在客户端监听tnsnames.ora 文件里修改IP地址就可以了。



2.1 服务器配置



在目录$ORACLE_HOME/network/admin下,修改ASM实例的LISTENER.ORA文件,添加红色部分,然后重启监听。


SID_LIST_LISTENER_RAC1 =


(SID_LIST =


(SID_DESC =


(SID_NAME = PLSExtProc)


(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)


(PROGRAM = extproc)


)


(SID_DESC =


(SID_NAME = +ASM) -- ASM 实例名是+ASM1+ASM2 但这里与ASM 实例的service_names 参数一致


(ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)


)


)




重启监听:



[oracle@rac1 admin]$ lsnrctl stop



LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-SEP-2010 00:03:08



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



Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))


The command completed successfully


[oracle@rac1 admin]$ lsnrctl start



LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 23-SEP-2010 00:03:18



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



Starting /u01/app/oracle/product/10.2.0/db_1/bin/tnslsnr: please wait...



TNSLSNR for Linux: Version 10.2.0.1.0 - Production


System parameter file is /u01/app/