OS: linux
DB: oracle10.1.0.2
背景:公司正在跑的生产库,其中一台的OS和DB的字符和语言都是US7ASCII
开发的产品OS和DB的字符是AL32UTF8,由于资源缺乏,并且急着上线
领导要求把开发的产品放在正在跑的生产库上。也就是在正在跑的生产库
上建多一个实例,字符为AL32UTF8
过程:
1 服务器为C,已经上线的DB实例为A,准备上线的DB实例为B
2 在服务器C上,创建B实例,建用户,IMP数据(记得export ORACLE_SID=B)
3 先STOP监听,然后配置服务器C的listener.ora(A,B共用这个文件)
以下为未修改前的监听文件:
ID_LIST_LISTENER=
(SID_LIST =
(SID_DESC =
(SID_NAME = A)
(ORACLE_HOME = /home/oracle/10.1.0.2)
)
)
LISTENER=
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.64.59)(PORT = 1521))
)
)
)
修改后的监听文件:
ID_LIST_LISTENER1 =
(SID_LIST =
(SID_DESC =
(SID_NAME = A)
(SID_NAME = B)
(ORACLE_HOME = /home/oracle/10.1.0.2)
)
)
LISTENER1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.64.59)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.64.59)(PORT = 2481))
)
)
)
修改后REBOOT服务器,然后STOP 监听,START监听,可以看到如下
Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.1.0.2.0 - Production
Start Date 19-AUG-2005 10:33:03
Uptime 0 days 1 hr. 8 min. 51 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/10.1.0.2/network/admin/listener.ora
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=spreader)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=8080))(Presentation=HTTP)(Session=RAW))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=2100))(Presentation=FTP)(Session=RAW))
Services Summary...
Service "B" has 1 instance(s).
Instance "B", status READY, has 1 handler(s) for this service...
Service "BXDB" has 1 instance(s).
Instance "B", status READY, has 1 handler(s) for this service...
Service "A" has 1 instance(s).
Instance "A", status READY, has 1 handler(s) for this service...
Service "AXDB" has 1 instance(s).
Instance "A", status READY, has 1 handler(s) for this service...
The command completed successfully
表示已经配置两个监听,并且成功运行
由于原来的监听文件为ID_LIST_LISTENER,添加了一个实例后RESTART监听的话,会报地址已被使用的情况,所以修改监听文件名,重启服务器后再RESTART监听就可以了。
4 配置WEB服务器即客户端的TNSNAMES.ORA文件
未修改前的文件:
A =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.64.59)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = A)
)
修改后的文件为:
A =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.64.59)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = A)
)
)
B =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.64.59)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = B)
)
重启一下客户端的监听,然后分别进行两个实例的连接:
[oracle@www91ka admin]$ sqlplus spreader/spreader@A
SQL*Plus: Release 9.2.0.1.0 - Production on Fri Aug 19 11:45:45 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning and Data Mining options
SQL>
[oracle@www91ka admin]$ sqlplus webadm/webadm@B
SQL*Plus: Release 9.2.0.1.0 - Production on Fri Aug 19 11:46:59 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning and Data Mining options
SQL>
一切OK!,经过两个项目组的测试,没有发现任何问题。