Google it ....

Showing posts with label ORA-12547: TNS:lost contact. Show all posts
Showing posts with label ORA-12547: TNS:lost contact. Show all posts

Tuesday, November 16, 2021

After startup database with srvctl, sqlplus as sysdba results in ORA-12547: TNS:lost contact

We had a very strange situation on one of our test environment: 
1. If use sqlplus to start instance, then use srvctl to stop it will failed with ORA-12547
[oracle@test_host:/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Fri Nov 15 12:57:46 2021
Version 19.3.0.0.0

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

Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@test_host:/home/oracle]$srvctl stop database -d testdb
PRCD-1334 : failed to stop database testdb
PRCD-1124 : Failed to stop database testdb and its services
PRCD-1131 : Failed to stop database testdb and its services on nodes
PRCR-1133 : Failed to stop database testdb and its running services
PRCR-1132 : Failed to stop resources using a filter
ORA-12547: TNS:lost contact
CRS-2675: Stop of 'ora.testdb.db' on 'test_host' failed
2 . If use srvctl to start instance, sqlplus / as sysdba will get ORA-12547
[oracle@test_host:/home/oracle]$sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Thu Nov 15 12:59:21 2021
Version 19.3.0.0.0

Copyright (c) 1982, 2019, 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

SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*Plus
3. Checked the permission for oracle binary and library and orabasetab, no problem found:
$ls -l $ORACLE_HOME/bin/oracle
-rwsr-s--x 1 oracle asmadmin 441253072 Nov 15 12:29 /u01/app/oracle/product/19.0.0/db_1/bin/oracle
( No change after we start instance by using srvctl or sqlplus )
$ls -l $ORACLE_HOME|grep lib
drwxr-xr-x 2 oracle oinstall 4096 Apr 17 2019 jlib
drwxr-xr-x 4 oracle oinstall 12288 Nov 13 12:29 lib

$more orabasetab
#orabasetab file is used to track Oracle Home associated with Oracle Base
/u01/app/oracle/product/19.0.0/db_1:/u01/app/oracle:OraDB19Home1:N:
Solution: The issue is due to incorrect configuration for Oracle home in OCR:
[grid@test_host:/home/grid]$srvctl config database -db testdb
Database unique name: testdb
Database name:
Oracle home: /u01/app/oracle/product/19.0.0/db_1/
So problem is / symbol at the end of oracle_home and we can change it
srvctl stop database -d testdb
srvctl modify database -d testdb -o /u01/app/oracle/product/19.0.0/db_1
srvctl start database -d testdb
This is corresponding oracle support doc: DB started by sqlplus cannot be stopped by srvctl( ORA-12547 ), and vice versa (Doc ID 2612663.1)