Skip to Main Content
  • Questions
  • ORA-12560: TNS:protocol adapter error (when running rman backup from scheduler on windows Oracle database)

Breadcrumb

May 4th

Question and Answer

Chris Saxon

Thanks for the question, Philip.

Asked: October 11, 2017 - 1:51 pm UTC

Last updated: October 11, 2017 - 2:36 pm UTC

Version: 12.1.0.2.0

Viewed 1000+ times

You Asked

Hi,
I trying to setup a scheduler job on my windows 64bit Oracle database version 12C
Below is the script i used where i created OS authentication and create a scheduler to run the backup_script.

-- Create a credential so script is run as the correct OS user on the windows database server.
--And the below credentials worked when i used this
BEGIN
  DBMS_CREDENTIAL.create_credential(
    credential_name => 'oracle_OS',
    username        => '<username>',
    password        => '<pwd>'
  );
END;
/

-- Create a job with an RMAN script defined in-line, including an explicit connect.
SET SERVEROUTPUT ON
DECLARE
  l_job_name VARCHAR2(30);
  l_script   VARCHAR2(32767);
BEGIN
  l_job_name := DBMS_SCHEDULER.generate_job_name;
  DBMS_OUTPUT.put_line('JOB_NAME=' || l_job_name);

  -- Define the backup script.
  l_script := 'connect target /
run { 
  backup archivelog all delete all input;
}';

  DBMS_SCHEDULER.create_job(
    job_name        => l_job_name,
    job_type        => 'BACKUP_SCRIPT',
    job_action      => l_script,
    credential_name => 'oracle_OS',
    enabled         => TRUE
  );
END;
/


But when i run the above plsql with the scheduler job, i am getting "ORA-12560: TNS:protocol adapter error".
I do have environment variable set at the OS with the correct SID.
But i am not able to figure out where this error is coming from.
My guess the OS authentication is not working right....but i was able to test the OS credential scheduler job to run a simple dir listing and it worked fine...but the same OS credential is not working for the rman backup script.
Would appreciate your help.

Thanks.
Philip.

and Chris said...

It's possible you're hitting Bug 21525337 - Windows: RMAN backup fails with DBMS_SCHEDULER execution of job due to wrong OS PATH:

After upgrading to 12c DBMS_SCHEDULER jobs that execute RMAN backup scripts
may fail due to an incorrect path on Windows platforms.
eg:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00601: fatal error in recovery manager
RMAN-03004: fatal error during execution of command
ORA-12560: TNS:protocol adapter error
RMAN-03009: failure of allocate command on t1 channel at 08/12/2015 15:39:10
ORA-03113: end-of-file on communication channel
ORACLE error from target database:
ORA-03114: not connected to ORACLE

Rediscovery Notes
In 12.1.0.1 and 12.1.0.2 if DBMS_SCHEDULER jobs are used to execute RMAN
backup scripts, and those scripts fail due to an incorrect path on Windows,
then it could be this bug.

Workaround
None


It's fixed in 12.2 and the Jan 2016 bundle patch for 12.1.0.2.

See MOS note 21525337.8 for more details.

Rating

  (1 rating)

Is this answer out of date? If it is, please let us know via a Comment

Comments

Philip Ebenezer, October 11, 2017 - 4:47 pm UTC

appreciate your response. definitely helpful.

More to Explore

Backup/Recovery

Check out the complete guide to all of the Backup & Recovery techniques in the Oracle Database.