from:http://blog.chinaunix.net/u/10516/showart_1762303.html
OS:xp DB:10g
用DBCA新建了一个库(原来有一个库),新建的库能正常启动关闭。但无法用OEM连接,TNSPING也不行,报的都是同样的错:“TNS-12541: TNS: 无监听程序”。
监听的配置如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = c:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = sjhorac)
(ORACLE_HOME = c:\oracle\product\10.2.0\db_1)
(SID_NAME = sjhorac)
)
(SID_DESC =
(GLOBAL_DBNAME = sjhrman)
(ORACLE_HOME = c:\oracle\product\10.2.0\db_1)
(SID_NAME = sjhrman)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
TNSNAMES的配置如下:
10GRMAN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.76)(PORT = 1521))
)
(CONNECT_DATA =
(SID = sjhrman)
)
)
SJHORAC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SID = sjhorac)
)
)
经实验发现:将10grman的host改为localhost后,一切正常。将监听器的host改为具体的IP地址(192.168.10.76)后,重启监听。这时发现原来正常的SJHORAC不能tnsping,报的错跟上面一样。原来不正常的10grman现在是OK的。看来连接字符中的HOST需要跟监听器中的HOST保持一致。
其实也可以不用这么麻烦。删除监听器的配置文件,让数据库去动态注册。但有个前提:必须用1521的监听端口。整个动态注册的过程由PMON进程来完成。我们可以通过以下步骤来验证:
启动本地数据库-》启动监听器-》过一段时间,用OEM连接数据库-》lsnrctl status
如果过一段时间还无法用OEM或TNSPING,那么可以用以下命令强制注册:
SQL> alter system register;
System altered.
如果先启动监听器,再启动数据库就无需上面的命令了。
OS:xp DB:10g
用DBCA新建了一个库(原来有一个库),新建的库能正常启动关闭。但无法用OEM连接,TNSPING也不行,报的都是同样的错:“TNS-12541: TNS: 无监听程序”。
监听的配置如下:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = c:\oracle\product\10.2.0\db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = sjhorac)
(ORACLE_HOME = c:\oracle\product\10.2.0\db_1)
(SID_NAME = sjhorac)
)
(SID_DESC =
(GLOBAL_DBNAME = sjhrman)
(ORACLE_HOME = c:\oracle\product\10.2.0\db_1)
(SID_NAME = sjhrman)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
TNSNAMES的配置如下:
10GRMAN =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.10.76)(PORT = 1521))
)
(CONNECT_DATA =
(SID = sjhrman)
)
)
SJHORAC =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
)
(CONNECT_DATA =
(SID = sjhorac)
)
)
经实验发现:将10grman的host改为localhost后,一切正常。将监听器的host改为具体的IP地址(192.168.10.76)后,重启监听。这时发现原来正常的SJHORAC不能tnsping,报的错跟上面一样。原来不正常的10grman现在是OK的。看来连接字符中的HOST需要跟监听器中的HOST保持一致。
其实也可以不用这么麻烦。删除监听器的配置文件,让数据库去动态注册。但有个前提:必须用1521的监听端口。整个动态注册的过程由PMON进程来完成。我们可以通过以下步骤来验证:
启动本地数据库-》启动监听器-》过一段时间,用OEM连接数据库-》lsnrctl status
如果过一段时间还无法用OEM或TNSPING,那么可以用以下命令强制注册:
SQL> alter system register;
System altered.
如果先启动监听器,再启动数据库就无需上面的命令了。