ORA-12154:TNS:监听程序无法识别连接描述符中请求的服务--用plsql和sqlplus都连接不上数据库了

时间:2021-03-08 19:26:51

 

问题:用plsql和sqlplus都连接不上数据库了

描述:
1.oracle服务都已经启动了
2.用plsql连接数据库提示:ORA-12154:TNS:监听程序无法识别连接描述符中请求的服务
3.cmd--》sqlplus---》输入用户名和密码能登陆
4.cmd--》可以用命令导出数据库
5.在log中显示:
2010-12-08 08:32:09.921: [  OCROSD][1672]utgdv:1:could not open registry key SOFTWARE\Oracle\ocr os error 操作系统找不到已输入的环境选项。

2010-12-08 08:32:10.046: [  OCRRAW][1672]proprinit: Could not open raw device
2010-12-08 08:32:10.046: [ default][1672]a_init:7!: Backend init unsuccessful : [33]
2010-12-08 08:32:10.046: [ CSSCLNT][1672]clsssinit: error(33 ) in OCR initialization


解决办法:

将文件emoms.properties

 

 

#Tue Nov 02 22:52:27 CST 2010

oracle.sysman.emSDK.svlt.ConsoleServerName=localhost_Management_Service

oracle.sysman.eml.mntr.emdRepPwd=f19268fb7db265af

emdrep.ping.pingCommand=ping <hostname>

oracle.sysman.eml.mntr.emdRepPort=1521

oracle.sysman.eml.mntr.emdRepDBName=orcl

oracle.sysman.eml.mntr.emdRepPwdSeed=1192292953497935708

oracle.sysman.emSDK.svlt.ConsoleMode=standalone

oracle.sysman.emRep.dbConn.statementCacheSize=30

oracle.sysman.db.isqlplusUrl=http\://localhost\:5560/isqlplus/dynamic

oracle.sysman.emSDK.svlt.ConsoleServerPort=1158

oracle.sysman.eml.mntr.emdRepRAC=FALSE

oracle.sysman.emSDK.emd.rt.useMonitoringCred=true

oracle.sysman.eml.mntr.emdRepPwdEncrypted=TRUE

oracle.sysman.db.isqlplusWebDBAUrl=http\://localhost\:5560/isqlplus/dba/dynamic

oracle.sysman.emSDK.svlt.ConsoleServerHost=zhouyao

oracle.sysman.eml.mntr.emdRepDBID=1261830988

oracle.sysman.emSDK.svlt.ConsoleServerHTTPSPort=1158

oracle.sysman.eml.mntr.emdRepServer=zhouyao

oracle.sysman.eml.mntr.emdRepSID=orcl

oracle.sysman.eml.mntr.emdRepConnectDescriptor=(DESCRIPTION\=(ADDRESS_LIST\=(ADDRESS\=(PROTOCOL\=TCP)(HOST\=zhouyao)(PORT\=1521)))(CONNECT_DATA\=

(SERVICE_NAME\=orcl)))

oracle.sysman.emSDK.sec.ReuseLogonPassword=true

oracle.sysman.eml.mntr.emdRepUser=SYSMAN

oracle.sysman.db.adm.conn.statementCacheSize=2

oracle.sysman.db.perf.conn.statementCacheSize=30

 

 

改成和tnsnames.ora以及listener.ora中的一样

# listener.ora Network Configuration File: E:\oracle\product\10.2.0\db_1\network\admin\listener.ora
# Generated by Oracle configuration tools.

SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = E:\oracle\product\10.2.0\db_1)
      (PROGRAM = extproc)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = zhouyao)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )

 

ok 打完收工!