首页 > 代码库 > listener 配置小练习之方法二
listener 配置小练习之方法二
作业:1521 1526
环境里存在一个数据库实例A
实现:
1521监听A数据库
A数据库的信息主动注册到1526监听器上
并且通过easy connect和sqlplus sys/oracle@网络服务名 as sysdba 方式验证
下面我想用另一种方式来实现:数据库WDD都是动态向1521 1526注册数据库
1 编辑listener.ora配置文件
LSNR2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.195.60)(PORT = 1526))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.195.60)(PORT = 1521))
)
)
2 编辑tnsnames.ora配置文件
LSNR2 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.195.60)(PORT = 1526))
)
)
3 数据库设置local_listener
alter system set local_listener=‘LSNR2‘;这里的LSNR2跟tnsnames里的名字是相同的
4 启动监听
lsnrctl start lsnr2
如果看到如下信息,证明配置正确
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.195.60)(PORT=1526)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.16.195.60)(PORT=1521)))
Services Summary...
Service "WDDXDB.dba.oracle.com" has 1 instance(s).
Instance "WDD", status READY, has 1 handler(s) for this service...
Service "wsweididi.dba.oracle.com" has 1 instance(s).
Instance "WDD", status READY, has 1 handler(s) for this service...
The command completed successfully
5 客户端验证
客户端tnsnames配置文件
WDD1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.195.60)(PORT = 1521))
)
(CONNECT_DATA =http://www.mamicode.com/
(SERVER = DEDICATED)
(SERVICE_NAME = wsweididi.dba.oracle.com)
)
)
WDD2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.195.60)(PORT = 1526))
)
(CONNECT_DATA =http://www.mamicode.com/
(SERVER = DEDICATED)
(SERVICE_NAME = wsweididi.dba.oracle.com)
)
)
验证
1 sqlplus system/oracle@WDD1
2 sqlplus system/oracle@WDD2
3 sqlplus system/oracle@172.16.195.60:1521/wsweididi.dba.oracle.com
4 sqlplus system/oracle@172.16.195.60:1526/wsweididi.dba.oracle.com
listener 配置小练习之方法二