前几天刚重装了Oracle,当时只是用SQL plus连接了一下
今天用plsql测试的时候突然发现报错了,用了Navicat Premium测试也是一样
报错如下

ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务解决

百度很多方法,大多是需要往E:\app\26227\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
放入一段代码,有的没告诉放在哪里有的是确实放错了地方导致我的OracleOraDb11g_home1TNSListener无法启动了
对于我这种小白来说只能无脑尝试,当然最后还是成功了,记录一下方法。
找到E:\app\26227\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora文件打开编辑(主要是找自己的安装目录)
原文件是这样的

# listener.ora Network Configuration File: 
E:\app\26227\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.

 SID_LIST_LISTENER =
 (SID_LIST =
   (SID_DESC =
    (SID_NAME = CLRExtProc)
    (ORACLE_HOME = E:\app\26227\product\11.2.0\dbhome_1)
    (PROGRAM = extproc)
    (ENVS = "EXTPROC_DLLS=ONLY:E:\app\26227\product\11.2.0\dbhome_1\bin\oraclr11.dll")
  )
 )

LISTENER =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
 )
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-TR0P8T6)(PORT = 1521))
 )
)

 ADR_BASE_LISTENER = E:\app\26227

改了之后是这样的

# listener.ora Network Configuration File: 
E:\app\26227\product\11.2.0\dbhome_1\NETWORK\ADMIN\listener.ora
# Generated by Oracle configuration tools.

 SID_LIST_LISTENER =
  (SID_LIST =
     (SID_DESC =
      (SID_NAME = CLRExtProc)
      (ORACLE_HOME = E:\app\26227\product\11.2.0\dbhome_1)
      (PROGRAM = extproc)
      (ENVS = "EXTPROC_DLLS=ONLY:E:\app\26227\product\11.2.0\dbhome_1\bin\oraclr11.dll")
     ) 
     //这一段是加的,根据本机的配置一下九想
 (SID_DESC =
      (SID_NAME = ORCL)
      (ORACLE_HOME = E:\app\26227\product\11.2.0\dbhome_1)
      (ENVS = "EXTPROC_DLLS=ONLY:E:\app\26227\product\11.2.0\dbhome_1\bin\oraclr11.dll")
    )
    //到这里为止,记得删除注释
 )

LISTENER =
 (DESCRIPTION_LIST =
   (DESCRIPTION =
     (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
 )
 (DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = DESKTOP-TR0P8T6)(PORT = 1521))
 )
)

 ADR_BASE_LISTENER = E:\app\26227