客户端使用scnaip连接11g rac数据库报错ora-12545解决
客户端配置及报错:
[oracle@bys3 admin]$ cat tnsnames.ora
bysrac =
(description =
(address = (protocol = tcp)(host = 192.168.1.228)(port = 1521)) --其中host = 192.168.1.228 这里的ip为rac的scanip。
(connect_data =
(server = dedicated)
(service_name = bysrac)
)
)
[oracle@bys3 admin]$ tnsping bysrac
tns ping utility for linux: version 11.2.0.4.0 - production on 01-jan-2014 20:25:19
copyright (c) 1997, 2013, oracle. all rights reserved.
used parameter files:
used tnsnames adapter to resolve the alias
attempting to contact (description = (address = (protocol = tcp)(host = 192.168.1.228)(port = 1521)) (connect_data = (server = dedicated) (service_name = bysrac)))
ok (10 msec) --tnsping可以正常联通。
客户端的使用sqlplus bys/bys@bysrac登陆时报错:ora-12545: connect failed because target host or object does not exist
[oracle@bys3 admin]$ sqlplus bys/bys@bysrac
sql*plus: release 11.2.0.4.0 production on wed jan 1 20:10:31 2014
copyright (c) 1982, 2013, oracle. all rights reserved.
error:
ora-12545: connect failed because target host or object does not exist
################
解决方法:修改rac的local_listener参数,将参数值中host=的值改为当前节点的vip或者scanip注意:host主机参数为当前节点vip的ip地址时,客户端通过scanip或者vip都可以连接到rac数据库库--我这里就是修改为vip的ip。--其实应该修改为scanip,客户端统一使用scanip来连接。
host主机参数为scanip地址,则修改完参数后,scanip能够正常使用,但如果有客户端配置使用vip的话,连接时则会出现错误:ora-12514: tns:listener does not currently know of service requested in connect descriptor。
具体修改步骤:
查看rac的scanip状态及监听状态[oracle@bysrac1 ~]$ su - grid
password:
[grid@bysrac1 ~]$ srvctl config scan
scan name: bysrac-cluster-scan, network: 1/192.168.1.128/255.255.255.128/eth0
scan vip name: scan1, ip: /bysrac-cluster/192.168.1.228
[grid@bysrac1 ~]$ srvctl status scan
scan vip scan1 is enabled
scan vip scan1 is running on node bysrac1
[grid@bysrac1 ~]$ lsnrctl status
lsnrctl for linux: version 11.2.0.1.0 - production on 01-jan-2014 20:10:13
copyright (c) 1991, 2009, oracle. all rights reserved.
connecting to (description=(address=(protocol=ipc)(key=listener)))
status of the listener
------------------------
alias listener
version tnslsnr for linux: version 11.2.0.1.0 - production
start date 28-dec-2013 20:06:56
uptime 4 days 0 hr. 3 min. 17 sec
trace level off
security on: local os authentication
snmp off
listener parameter file /g01/app/11.2.0/grid/network/admin/listener.ora
listener log file /g01/app/grid/diag/tnslsnr/bysrac1/listener/alert/log.xml
listening endpoints summary...
(description=(address=(protocol=ipc)(key=listener)))
(description=(address=(protocol=tcp)(host=192.168.1.226)(port=1521)))
(description=(address=(protocol=tcp)(host=192.168.1.221)(port=1521)))
services summary...
service +asm has 1 instance(s).
instance +asm1, status ready, has 1 handler(s) for this service...
service bysrac has 1 instance(s).
instance bysrac1, status ready, has 1 handler(s) for this service...
service caiwu has 1 instance(s).
instance bysrac1, status ready, has 1 handler(s) for this service...
service jiaoyi has 1 instance(s).
instance bysrac1, status ready, has 1 handler(s) for this service...
the command completed successfully
[grid@bysrac1 ~]$ exit
[oracle@bysrac1 ~]$ cat /etc/hosts
# do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6
192.168.1.221 bysrac1 bysrac1.bys.com
192.168.1.226 bysrac1-vip
192.168.1.222 bysrac2 bysrac2.bys.com
192.168.1.227 bysrac2-vip
192.168.10.1 bysrac1-priv
192.168.10.2 bysrac2-priv
192.168.1.228 bysrac-cluster bysrac-cluster-scan
实验1:修改rac的local_listener参数,将参数值中host=的值改为当前节点的vip值--rac多节点都需要改[oracle@bysrac1 ~]$ sqlplus bys/bys
bys@ bysrac>select instance_name from v$instance;
instance_name
----------------
bysrac1
bys@ bysrac1>show parameter local_l -------查看local_listener 参数的值
name type value
------------------------------------ ----------- ------------------------------
local_listener string (description=(address_list=(ad
dress=(protocol=tcp)(host=bysr
ac1-vip)(port=1521))))
bys@ bysrac1>alter system set local_listener='(description=(address_list=(address=(protocol=tcp)(host=192.168.1.226)(port=1521))))' sid='bysrac1';
system altered. --这里host=192.168.1.226,修改为该节点vip的ip值。我这里只修改了一个节点的,如果多个节点,照此方法在其它节点修改。
bys@ bysrac1>show parameter local_l
name type value
------------------------------------ ----------- ------------------------------
local_listener string (description=(address_list=(ad
dress=(protocol=tcp)(host=192.
168.1.226)(port=1521))))
bys@ bysrac1>exit ---退出前可以手工注册下监听alter system register; 我这里没做也是可以的。
相关阅读:
oracle ora-01555 快照过旧 说明
ora-01078 和 lrm-00109 报错解决方法
ora-01555超长的query duration时间
ora-00471 处理方法笔记
ora-00314,redolog 损坏,或丢失处理方法
ora-00257 归档日志过大导致无法存储的解决办法
,