$ORACLE_HOME/network/admin路径下配置
tnsnames.ora里面的service_name需要与initdg.ora(参数文件)中的DB_UNIQUE_NAME参数保持一致
启动监听lsnrctl start
配置完后,可以使用tnsping来判断是否配置正确
例主库上:tnsping dg22tnsping dg24
备库上:tnsping dg22tnsping dg24
或启动主库到open状态
主库上:sqlplus system/oracle@dg22
备库上:sqlplus system/oracle@dg22
主库:
listener.ora
# listener.ora Network Configuration File: /opt/oracle/10g/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/10g)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = pri.localdomain)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle/10g/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
dg24=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.24)(PORT = 1521))
(LOAD_BALANCE = on)
)
(CONNECT_DATA =
(SERVICE_NAME = dg24)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
dg22=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.22)(PORT = 1521))
(LOAD_BALANCE = on)
)
(CONNECT_DATA =
(SERVICE_NAME = dg22)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
备库:
listener.ora
# listener.ora Network Configuration File: /opt/oracle/10g/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /opt/oracle/10g)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = std.localdomain)(PORT = 1521))
)
)
tnsnames.ora
# tnsnames.ora Network Configuration File: /opt/oracle/10g/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
dg24=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.24)(PORT = 1521))
(LOAD_BALANCE = on)
)
(CONNECT_DATA =
(SERVICE_NAME = dg24)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)
dg22=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.22)(PORT = 1521))
(LOAD_BALANCE = on)
)
(CONNECT_DATA =
(SERVICE_NAME = dg22)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)