Oracle 11.2.0.4 RAC上调整SCAN 及 遇到的问题
原hosts
#for RAC scan
192.168.80.135 scan-racdb scan-racdb.localdomain
实验一、/******修改scan的IP地址
目标 Hosts
#for RAC scan
192.168.80.165 scan-racdb scan-racdb.localdomain
1、停止scan
[oracle@node1 ~]$ srvctl stop scan_listener
[oracle@node1 ~]$ srvctl stop scan
2、修改hosts文件
192.168.80.165 scan-racdb scan.localdomain
3、modify scan
[root@node1 桌面]# /u01/app/grid/product/11.2.4/db_1/bin/srvctl modify scan -n scan-racdb
4、启动scan
[oracle@node1 ~]$ srvctl start scan
[oracle@node1 ~]$ srvctl start scan_listener
eth0:2 Link encap:Ethernet HWaddr 00:0C:29:7D:D8:ED
inet addr:192.168.80.165 Bcast:192.168.80.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
5、测试连接
[oracle@node1 bin]$ sqlplus system/Oracle123@racdb
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:01:02 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
[oracle@node1 bin]$ sqlplus system/Oracle123@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=scan-racdb)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=racdb)))"
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:01:19 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
发现无法连接.....
5、修改remote_listener参数,并重启监听
SQL> show parameter remo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_dependencies_mode string TIMESTAMP
remote_listener string scan:1521
create pfile='/home/oracle/backpfile.ora' from spfile;
alter system set remote_listener="scan-racdb:1521" scope=spfile sid='*';
[oracle@node1 bin]$ srvctl stop listener -l LISTENER
[oracle@node1 bin]$ srvctl start listener -l LISTENER
[oracle@node1 bin]$ sqlplus system/Oracle123@racdb
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:03:29 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
[oracle@node1 bin]$ sqlplus system/Oracle123@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=scan-racdb)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=racdb)))"
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:03:35 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
依然无法连接...
6、 重启一个实例后测试连接
SQL> shutdown immediate;
SQL> startup;
[oracle@node1 bin]$ sqlplus system/Oracle123@racdb
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:05:13 2015
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 Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
[oracle@node1 bin]$ sqlplus system/Oracle123@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=scan-racdb)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=racdb)))"
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:05:17 2015
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 Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
测试总结及问题:
在 11g R2 RAC (11.2.0.4)版本中 如果不重启数据库,sqlplus system/Oracle123@racdb 会报错ORA-12514: TNS:listener does not currently know of service requested in connectdescriptor,
但是 重启数据库或者重启一个实例之后,sqlplus system/Oracle123@racdb 从客户端 可以连接。
实验二、/******* 修改scan的名称
目标hosts
#for RAC scan
192.168.80.135 scan scan.localdomain
1、停止scan
[oracle@node1 ~]$ srvctl config scan
SCAN 名称: scan-racdb, 网络: 1/192.168.80.0/255.255.255.0/eth0
SCAN VIP 名称: scan1, IP: /scan-racdb/192.168.80.135
srvctl stop scan_listener
srvctl stop scan
2、修改hosts文件
192.168.80.135 scan scan.localdomain
3、modify scan
[root@node1 桌面]# /u01/app/grid/product/11.2.4/db_1/bin/srvctl modify scan -n scan
[oracle@node1 ~]$ srvctl config scan
SCAN 名称: scan, 网络: 1/192.168.80.0/255.255.255.0/eth0
SCAN VIP 名称: scan1, IP: /scan/192.168.80.135
4、修改remoe_listener
SQL> show parameter remote
remote_listener string scan-racdb:1521
create pfile='/home/oracle/backpfile.ora' from spfile;'
alter system set remote_listener="scan:1521" scope=both sid='*';
SQL> show parameter remote
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_dependencies_mode string TIMESTAMP
remote_listener string scan:1521
5、启动scan
srvctl start scan
srvctl start scan_listener
6、连接测试:
修改tnsnames.ora
RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
)
)
[oracle@node1 ~]$ sqlplus system/Oracle123@racdb
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
总结:
[oracle@node1 ~]$ srvctl stop database -d racdb
[oracle@node1 ~]$ srvctl start database -d racdb
[oracle@node1 ~]$ sqlplus system/Oracle123@racdb
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
实验三/******* 修改scan的名称和IP
目标 Hosts
#for RAC scan
192.168.80.185 scan scan.junshi.com
1、停止scan
[oracle@node1 bin]$ srvctl stop scan_listener
[oracle@node1 bin]$ srvctl stop scan
2、修改hosts文件
#for RAC scan
192.168.80.185 scan scan.junshi.com
3、modify
[root@node1 桌面]# /u01/app/grid/product/11.2.4/db_1/bin/srvctl modify scan -n scan
4、启动scan
[oracle@node1 bin]$ srvctl start scan
[oracle@node1 bin]$ srvctl start scan_listener
5、连接测试:
修改tnsnames.ora
RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
)
)
[oracle@node1 bin]$ sqlplus system/Oracle123@racdb
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 16:35:07 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
说明:没有修改remote_listener参数之前,无法通过tns方式连接到数据库
6、修改remote_listener
SQL> show parameter remote
remote_listener string scan-racdb:1521
create pfile='/home/oracle/backpfile.ora' from spfile;
alter system set remote_listener="scan:1521" scope=both sid='*';
SQL> show parameter remote
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_dependencies_mode string TIMESTAMP
remote_listener string scan:1521
再次测试
[oracle@node1 bin]$ sqlplus system/Oracle123@racdb
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 16:36:05 2015
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 Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> exit
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
[oracle@node1 bin]$ sqlplus system/Oracle123@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=scan)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=racdb)))"
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
测试 可用。
但是 在Oracle 11.2.0.1 中 只是修改scan的IP地址的话,需要重启实例(可以重启一个实例),没搞明白为什么,奇怪。
原hosts
#for RAC scan
192.168.80.135 scan-racdb scan-racdb.localdomain
实验一、/******修改scan的IP地址
目标 Hosts
#for RAC scan
192.168.80.165 scan-racdb scan-racdb.localdomain
1、停止scan
[oracle@node1 ~]$ srvctl stop scan_listener
[oracle@node1 ~]$ srvctl stop scan
2、修改hosts文件
192.168.80.165 scan-racdb scan.localdomain
3、modify scan
[root@node1 桌面]# /u01/app/grid/product/11.2.4/db_1/bin/srvctl modify scan -n scan-racdb
4、启动scan
[oracle@node1 ~]$ srvctl start scan
[oracle@node1 ~]$ srvctl start scan_listener
eth0:2 Link encap:Ethernet HWaddr 00:0C:29:7D:D8:ED
inet addr:192.168.80.165 Bcast:192.168.80.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
5、测试连接
[oracle@node1 bin]$ sqlplus system/Oracle123@racdb
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:01:02 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
[oracle@node1 bin]$ sqlplus system/Oracle123@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=scan-racdb)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=racdb)))"
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:01:19 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
发现无法连接.....
5、修改remote_listener参数,并重启监听
SQL> show parameter remo
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_dependencies_mode string TIMESTAMP
remote_listener string scan:1521
create pfile='/home/oracle/backpfile.ora' from spfile;
alter system set remote_listener="scan-racdb:1521" scope=spfile sid='*';
[oracle@node1 bin]$ srvctl stop listener -l LISTENER
[oracle@node1 bin]$ srvctl start listener -l LISTENER
[oracle@node1 bin]$ sqlplus system/Oracle123@racdb
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:03:29 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
[oracle@node1 bin]$ sqlplus system/Oracle123@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=scan-racdb)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=racdb)))"
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:03:35 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
依然无法连接...
6、 重启一个实例后测试连接
SQL> shutdown immediate;
SQL> startup;
[oracle@node1 bin]$ sqlplus system/Oracle123@racdb
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:05:13 2015
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 Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
[oracle@node1 bin]$ sqlplus system/Oracle123@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=scan-racdb)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=racdb)))"
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 17:05:17 2015
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 Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
测试总结及问题:
在 11g R2 RAC (11.2.0.4)版本中 如果不重启数据库,sqlplus system/Oracle123@racdb 会报错ORA-12514: TNS:listener does not currently know of service requested in connectdescriptor,
但是 重启数据库或者重启一个实例之后,sqlplus system/Oracle123@racdb 从客户端 可以连接。
实验二、/******* 修改scan的名称
目标hosts
#for RAC scan
192.168.80.135 scan scan.localdomain
1、停止scan
[oracle@node1 ~]$ srvctl config scan
SCAN 名称: scan-racdb, 网络: 1/192.168.80.0/255.255.255.0/eth0
SCAN VIP 名称: scan1, IP: /scan-racdb/192.168.80.135
srvctl stop scan_listener
srvctl stop scan
2、修改hosts文件
192.168.80.135 scan scan.localdomain
3、modify scan
[root@node1 桌面]# /u01/app/grid/product/11.2.4/db_1/bin/srvctl modify scan -n scan
[oracle@node1 ~]$ srvctl config scan
SCAN 名称: scan, 网络: 1/192.168.80.0/255.255.255.0/eth0
SCAN VIP 名称: scan1, IP: /scan/192.168.80.135
4、修改remoe_listener
SQL> show parameter remote
remote_listener string scan-racdb:1521
create pfile='/home/oracle/backpfile.ora' from spfile;'
alter system set remote_listener="scan:1521" scope=both sid='*';
SQL> show parameter remote
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_dependencies_mode string TIMESTAMP
remote_listener string scan:1521
5、启动scan
srvctl start scan
srvctl start scan_listener
6、连接测试:
修改tnsnames.ora
RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
)
)
[oracle@node1 ~]$ sqlplus system/Oracle123@racdb
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
总结:
这样操作,不需要重启数据库。
重启数据库后,也没有什么变化。[oracle@node1 ~]$ srvctl stop database -d racdb
[oracle@node1 ~]$ srvctl start database -d racdb
[oracle@node1 ~]$ sqlplus system/Oracle123@racdb
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
实验三/******* 修改scan的名称和IP
目标 Hosts
#for RAC scan
192.168.80.185 scan scan.junshi.com
1、停止scan
[oracle@node1 bin]$ srvctl stop scan_listener
[oracle@node1 bin]$ srvctl stop scan
2、修改hosts文件
#for RAC scan
192.168.80.185 scan scan.junshi.com
3、modify
[root@node1 桌面]# /u01/app/grid/product/11.2.4/db_1/bin/srvctl modify scan -n scan
4、启动scan
[oracle@node1 bin]$ srvctl start scan
[oracle@node1 bin]$ srvctl start scan_listener
5、连接测试:
修改tnsnames.ora
RACDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = scan)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = racdb)
)
)
[oracle@node1 bin]$ sqlplus system/Oracle123@racdb
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 16:35:07 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
说明:没有修改remote_listener参数之前,无法通过tns方式连接到数据库
6、修改remote_listener
SQL> show parameter remote
remote_listener string scan-racdb:1521
create pfile='/home/oracle/backpfile.ora' from spfile;
alter system set remote_listener="scan:1521" scope=both sid='*';
SQL> show parameter remote
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
remote_dependencies_mode string TIMESTAMP
remote_listener string scan:1521
再次测试
[oracle@node1 bin]$ sqlplus system/Oracle123@racdb
SQL*Plus: Release 11.2.0.4.0 Production on Tue Dec 29 16:36:05 2015
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 Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL> exit
测试 域名 scan.junshi.com 是否可用
[oracle@node1 bin]$ sqlplus system/Oracle123@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=scan.junshi.com)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=racdb)))"Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
[oracle@node1 bin]$ sqlplus system/Oracle123@"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=scan)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=racdb)))"
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
SQL>
测试 可用。
总结:
on Oracle Linux 6
但是 在Oracle 11.2.0.1 中 只是修改scan的IP地址的话,需要重启实例(可以重启一个实例),没搞明白为什么,奇怪。