oracle动态注册和静态注册的区别:动态监听不需要在listener.ora文件中记录关于数据的任何信息,只需要将监听器的配置信息写入到该文件。例如:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS=(PROTOCOL = IPC) (KEY=EXTPRO1))
(ADDRESS=(PROTOCOL = TCP)(HOST = 192.168.2.29)(PORT = 1521))
)
)
客户端的tnsnames.ora配置信息,需要加入每个service_name,其他的任何东西不需要改动,例如
YUCESHI1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.29)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test1)
)
)
YUCESHI2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.29)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test2)
)
)
YUCESH3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.29)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test3)
)
)
动态监听步骤:
服务器端配置如下:
设置service_names:
alter system set service_names=test1,test2,test3;
2. 编写listener.ora文件:
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS=(PROTOCOL = IPC) (KEY=EXTPRO1))
(ADDRESS=(PROTOCOL = TCP)(HOST = 192.168.2.29)(PORT = 1521))
)
)
3.重新启动oracle实例,这样做才能使service_names生效。(前提是oracle处于open状态下才执行)
conn /as sysdba;
shutdown immediate;
startup;
客户端配置:
1.编辑tnsnames.ora,保存后立即生效。
YUCESHI1 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.29)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test1)
)
)
YUCESHI2 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.29)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test2)
)
)
YUCESH3 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.2.29)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test3)
)
)
以上动态注册配置完毕。以上改为静态注册步骤。
只需要在服务器端修改listener.ora