在安装oracle的时候创建了默认的数据库实例orcl,后来想创建一个恢复目录数据库,有创建了一个实例:catalog。
1.oracle服务端的配置
listener.ora文件
SID_LIST_LISTENER =(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(SID_NAME = orcl)
)
(SID_DESC =
(GLOBAL_DBNAME = CATALOG)
(ORACLE_HOME = D:\oracle\product\10.2.0\db_1)
(SID_NAME = catalog)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = llj)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = llj)(PORT = 1522))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
tnsnames.ora文件
ORCL =(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = llj)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl)
)
)
CATALOG =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = llj)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = CATALOG)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
修改好之后的效果如下:
一个侦听器侦听多个数据库,如下配置,数据库名和SID分别是orcl和catalog:
(3).在oracle\product\10.2.0\db_1\BIN里面运行LSNRCTL.EXE,先执行stop,再执行start。用status查看监听器的状态。
2.Oracle客户端的配置
tnsnames.ora文件要增加如下内容:
ORCL =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = llj)(PORT = 1521))
)
(CONNECT_DATA =
(SID = orcl)
(SERVER = DEDICATED)
)
)
CATALOG =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = llj)(PORT = 1522))
)
(CONNECT_DATA =
(SID = catalog)
(SERVER = DEDICATED)
)
)