SnapSync Fails With ORA-12547: TNS:lost contact (KBA8873)
KBA
KBA# 8873Applicable Delphix Versions
- Click here to view the versions of the Delphix engine to which this article applies
-
Major Release All Sub Releases 6.0 6.0.0.0, 6.0.1.0, 6.0.1.1, 6.0.2.0, 6.0.2.1, 6.0.3.0, 6.0.3.1, 6.0.4.0, 6.0.4.1, 6.0.4.2, 6.0.5.0, 6.0.6.0, 6.0.6.1, 6.0.7.0, 6.0.8.0, 6.0.8.1, 6.0.9.0, 6.0.10.0, 6.0.10.1, 6.0.11.0, 6.0.12.0, 6.0.12.1 5.3
5.3.0.0, 5.3.0.1, 5.3.0.2, 5.3.0.3, 5.3.1.0, 5.3.1.1, 5.3.1.2, 5.3.2.0, 5.3.3.0, 5.3.3.1, 5.3.4.0, 5.3.5.0, 5.3.6.0, 5.3.7.0, 5.3.7.1, 5.3.8.0, 5.3.8.1, 5.3.9.0 5.2
5.2.2.0, 5.2.2.1, 5.2.3.0, 5.2.4.0, 5.2.5.0, 5.2.5.1, 5.2.6.0, 5.2.6.1
5.1
5.1.0.0, 5.1.1.0, 5.1.2.0, 5.1.3.0, 5.1.4.0, 5.1.5.0, 5.1.5.1, 5.1.6.0, 5.1.7.0, 5.1.8.0, 5.1.8.1, 5.1.9.0, 5.1.10.0
5.0
5.0.1.0, 5.0.1.1, 5.0.2.0, 5.0.2.1, 5.0.2.2, 5.0.2.3, 5.0.3.0, 5.0.3.1, 5.0.4.0, 5.0.4.1, 5.0.5.0, 5.0.5.1, 5.0.5.2, 5.0.5.3, 5.0.5.4
Troubleshooting ORA-12547: TNS:lost contact during an Oracle SnapSync job
SnapSyncs of an Oracle dSource may fail with the following error displayed under the failed Actions tab in the Delphix GUI:
Error: Cannot connect to database due to: Exception occurred while getting connection: oracle.ucp.UniversalConnectionPoolException: Cannot get Connection from Datasource: java.sql.SQLException: ORA-12547: TNS:lost contact Error Code: exception.oracle.accessor.database.failed.connection Suggested Action: Make sure that the username provided has access rights to system views, and that the host server can be reached. Diagnosing Information: Logged in through SSH from the Delphix Engine as "delphix_os" on host "nealrh8.acme.com".
Further review of the Delphix debug log, shows a detailed error like the following:
Recovery Manager: Release 19.0.0.0.0 - Production on Mon Feb 7 10:22:28 2022 Version 19.13.0.0.0 Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved. RMAN> RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== ORA-12547: TNS:lost contact RMAN> Recovery Manager complete.
There are many possible reasons why this error may be raised (please refer to the links at the bottom of the article for additional suggestions). In this particular scenario there was an erroneous forward slash at the end of the ORACLE_HOME environment variable when the Oracle instance was started. If you try to connect to the Oracle instance from a different session without the extra forward slash in the ORACLE_HOME environment variable, the error will be raised.
We can demonstrate this outside of Delphix. In the following example, the Oracle instance was started with the erroneous forward slash appended to the end of the ORACLE_HOME environment variable. We can connect when our environment variable matches the error but not when the environment variable is defined correctly:
$ export ORACLE_HOME=/u01/app/oracle/product/19.7.0.0/dbhome_1/ $ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Tue Feb 8 12:20:58 2022 Version 19.7.0.0.0 Copyright (c) 1982, 2020, Oracle. All rights reserved. Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.7.0.0.0 SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production Version 19.7.0.0.0 $ export ORACLE_HOME=/u01/app/oracle/product/19.7.0.0/dbhome_1 $ sqlplus / as sysdba SQL*Plus: Release 19.0.0.0.0 - Production on Tue Feb 8 12:20:43 2022 Version 19.7.0.0.0 Copyright (c) 1982, 2020, Oracle. All rights reserved. ERROR: ORA-12547: TNS:lost contact Enter user-name: $
Prerequisites
If you have sufficient permission, you can examine the Oracle instance's environment variables to see if there is an erroneous slash. Commands to view a running process's environment variables vary by platform. On Linux, it can be done like this:
$ ps -ef | grep pmon oracle 1515 1 0 2021 ? 00:12:58 ora_pmon_CDOMLOSRE2EC oracle 1884 1 0 2021 ? 00:11:54 ora_pmon_CDOMSHSRB0B0 oracle 3024 2873 0 12:24 pts/1 00:00:00 grep --color=auto pmon oracle 32567 1 0 11:42 ? 00:00:00 ora_pmon_DBOMSRB27546 $ strings -a /proc/32567/environ | grep ORACLE ORACLE_SID=DBOMSRB27546 ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/19.7.0.0/dbhome_1/ ORACLE_SPAWNED_PROCESS=1
Resolution
To resolve the "ORA-12547: TNS:lost contact" error:
- Shutdown the Oracle instance.
- Remove the erroneous forward slash from the environment variable, shell profiles, scripts used to start the database, the listener inside SRVCTL, /etc/oratab, et cetera.
- Restart the Oracle instance.
- Under the Delphix Manage > Environments menu, you may refresh the environment hosting the database.
This step is optional but recommended in case there are changes made to the environment that Delphix should be aware of. - Run the SnapSync again from Delphix.
Related Articles
The following articles may provide more information or related information to this article:
- KBA1259 provides other scenarios that may cause the "ORA-12547: TNS:lost contact" error.
- Troubleshooting ORA-12547 TNS: Lost Contact (Doc ID 555565.1)
- Sqlplus Connection To ASM Fails With: ORA-12547: TNS:lost Contact (Doc ID 2620246.1)