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.
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.