ORA-12547: TNS:lost contact

[oracle@racnode1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Mon Jan 13 16:31:25 2020

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

ERROR:
ORA-12547: TNS:lost contact


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

Subscribe to get access

Read more of this content when you subscribe today.

ORA-29283: invalid file operation ORA-06512: at “SYS.UTL_FILE”, line 536 ORA-29283: invalid file operation

Connected to Oracle database through service name, then get  errors by running the below sample code.  There is no problem to run the sample code while connecting to database through IPC.

$sqlplus testuser/****@DBTEST

SQL>DECLARE
    l_output utl_file.file_type;
BEGIN
    l_output := utl_file.fopen( 'MY_DIR', 'test.txt', 'w' );
    utl_file.fclose( l_output ); 
END;
/

*
ERROR at line 1:
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 536
ORA-29283: invalid file operation
ORA-06512: at line 4
$sqlplus  / as sysdba
SQL> DECLARE
     l_output utl_file.file_type;
BEGIN
     l_output := utl_file.fopen( 'MY_DIR', 'test.txt', 'w' );
     utl_file.fclose( l_output );
END;

 /

PL/SQL procedure successfully completed.

CAUSES

Subscribe to get access

Read more of this content when you subscribe today.

RMAN-03002 RMAN-05501 RMAN-03015 RMAN-03009 ORA-17629 ORA-17627 ORA-27101 ORA-17629 duplicate target database for standby from active database

In 12c , try to duplicate a standby database with below errors:

channel ORA_DISK_1: SID=158 device type=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 01/15/2019 18:35:32
RMAN-05501: aborting duplication of target database
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 01/15/2019 18:35:32
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3651
Additional information: -603812709
ORA-17629: Cannot connect to the remote database server

WORKAROUND

In tnsnames.ora of both primary and standby database server, add  “(UR = A)” for the standby database entry :

TESTDBSTY =
(DESCRIPTION =
   (ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
   (CONNECT_DATA = (SERVICE_NAME = TESTDBSTY)(UR=A))
)

ORA-01017: invalid username/password; logon denied

Try to connect to 12c standby database , then get “ORA-01017” error.

$ sqlplus sys/password@TESTDBSTY as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Tue Jan 15 18:07:54 2019

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

ERROR:
ORA-01017: invalid username/password; logon denied

After investigation, found the listener is running by 11R2 binary, instead of 12cR1 binary.

Restart the listener in 12cR1 ORACLE_HOME, then everything is fine.

Always run listener by using the highest version of all ORACLE_HOME.

ORA-12514: TNS:listener does not currently know of service requested in connect descriptor

Before start to create standby database by using DUPLICATE command, try to connect to  auxiliary instance:

RMAN>  connect auxiliary  sys/password@testdbsty

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-04006: error from auxiliary database: 
ORA-12514: TNS:listener does not currently know of service requested in connect descriptor
$ sqlplus sys/password@testdbsty as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Tue Jan 15 15:18:35 2019

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

ERROR:
ORA-12154: TNS:could not resolve the connect identifier specified

Workaround:

Add an entry in listener.ora, and then reload listener to make it effective:

SID_LIST_LISTENER =
(SID_LIST =
   (SID_DESC =
      (GLOBAL_DBNAME = TESTDBSTY)
      (SID_NAME = TESTDBSTY)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
  )
..
.
}

$lsnrctl status
Services Summary...
Service "TESTDBSTY" has 2 instance(s).
  Instance "TESTDBSTY", status UNKNOWN, has 1 handler(s) for this service...
  Instance "TESTDBSTY", status BLOCKED, has 1 handler(s) for this service...
...
.
.