ORA-12547: TNS:lost contact+oracle 开启监听失败

时间:2024-11-12 07:49:04

1、ORA-12547: TNS:lost contact

[root@dbserver /]# sqlplus sys/xiniu123 as sysdba                        

SQL*Plus: Release 12.2.0.1.0 Production on Sat Aug 26 12:55:34 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

ERROR:
ORA-12547: TNS:lost contact


Enter user-name: 
ERROR:
ORA-12547: TNS:lost contact


Enter user-name: 
ERROR:
ORA-12547: TNS:lost contact

原因权限不够
确认$ORACLE_HOME/bin/oracle文件权限是否有问题

最初的权限
[root@dbserver /]#  ll $ORACLE_HOME/bin/oracle  
-rwxr-x--x. 1 oracle dba 407988851 Aug  1 12:50 /usr/oracle/product/bin/oracle

修改后正确的权限
[root@dbserver /]# chmod 6751 $ORACLE_HOME/bin/oracle  
[root@dbserver /]# ll $ORACLE_HOME/bin/oracle  
-rwsr-s--x. 1 oracle dba 407988851 Aug  1 12:50 /usr/oracle/product/bin/oracle

以上就可以解决了ORA-12547: TNS:lost contact问题了

2、oracle 开启监听失败

[root@dbserver bin]# lsnrctl start 

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 26-AUG-2017 10:49:54

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Starting /usr/oracle/product/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
NL-00280: error creating log stream /usr/oracle/product/network/log/listener.log
 NL-00278: cannot open log file
  SNL-00016: snlfohd: error opening file
   Linux Error: 13: Permission denied

Listener failed to start. See the error message(s) above...

做了1上面的授权操作这个问题没了,但是有引入新的问题

[oracle@dbserver trace]$ lsnrctl start

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 26-AUG-2017 13:28:31

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Starting /usr/oracle/product/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /usr/oracle/product/network/admin/
Log messages written to /usr/oracle/product/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=196.160.1.211)(PORT=1521)))
TNS-01155: Incorrectly specified SID_LIST_LISTENER parameter in 
 NL-00303: syntax error in NV string

Listener failed to start. See the error message(s) above...

我做了如下操作,没有找到为什么监听失败的原因,但是已经可以连接了
步骤1

将**xxx**的内容删除

            **SID_LIST_LISTENER =  
               (SID_LIST =  
                    (SID_DESC =  
                      (SID_NAME = CLRExtProc)  
                      (ORACLE_HOME = /usr/oracle/product)  
                       (PROGRAM = extproc)  
                       (ENVS = "EXTPROC_DLLS=ONLY:/usr/oracle/product")  
                    )  
                )  
            (SID_DESC =
                (GLOBAL_DBNAME = ORCL)
                (ORACLE_HOME = /usr/oracle/product)
                (SID_NAME = ORCL)
            )**
LISTENER =
  (DESCRIPTION_LIST =
        (DESCRIPTION =
          (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
          (ADDRESS = (PROTOCOL = TCP)(HOST = 196.160.1.211)(PORT = 1521))
        )
    )

ADR_BASE_LISTENER = /usr/oracle/product

步骤2 启动监听

[oracle@dbserver trace]$ lsnrctl start

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 26-AUG-2017 13:28:31

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Starting /usr/oracle/product/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /usr/oracle/product/network/admin/
Log messages written to /usr/oracle/product/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=196.160.1.211)(PORT=1521)))
TNS-01155: Incorrectly specified SID_LIST_LISTENER parameter in 
 NL-00303: syntax error in NV string

Listener failed to start. See the error message(s) above...

[oracle@dbserver trace]$ lsnrctl start

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 26-AUG-2017 14:00:19

Copyright (c) 1991, 2016, Oracle.  All rights reserved.

Starting /usr/oracle/product/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 12.2.0.1.0 - Production
System parameter file is /usr/oracle/product/network/admin/
Log messages written to /usr/oracle/product/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=196.160.1.211)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date                26-AUG-2017 14:00:19
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /usr/oracle/product/network/admin/
Listener Log File         /usr/oracle/product/diag/tnslsnr/dbserver/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=196.160.1.211)(PORT=1521)))
The listener supports no services
The command completed successfully

步骤3 将步骤1删除的内容重新添加上

**SID_LIST_LISTENER =  
               (SID_LIST =  
                    (SID_DESC =  
                      (SID_NAME = CLRExtProc)  
                      (ORACLE_HOME = /usr/oracle/product)  
                       (PROGRAM = extproc)  
                       (ENVS = "EXTPROC_DLLS=ONLY:/usr/oracle/product")  
                    )  
                )  
            (SID_DESC =
                (GLOBAL_DBNAME = ORCL)
                (ORACLE_HOME = /usr/oracle/product)
                (SID_NAME = ORCL)
            )**

步骤4 关闭数据库shutdown abort
步骤5打开数据库startup
以上就解决问题了