Home » Server Options » Replication » dbms_scheduler ORA-12560: TNS:protocol adapter error (Oracle 12.1.0.2 Windows 64bit)
dbms_scheduler ORA-12560: TNS:protocol adapter error [message #666070] Wed, 11 October 2017 08:56 Go to next message
philipebe
Messages: 5
Registered: September 2017
Junior Member
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.
Re: dbms_scheduler ORA-12560: TNS:protocol adapter error [message #666071 is a reply to message #666070] Wed, 11 October 2017 14:44 Go to previous message
John Watson
Messages: 7148
Registered: January 2010
Location: Global Village
Senior Member
There is no reason why a shell launched for the OS user in your credential would know the ORACLE_SID to which you wish to connect. I'm not very good with Windows, but I have found inconsistencies with setting environment variables: the priority of settings in the registry and in the shell is not always clear to me. To be certain, I would use a job of type EXECUTABLE and have it run cmd.exe passing it a batch file name as an argument. Have the batch file do everything, setting all your variables before running rman.exe
Previous Topic: refresh data on target database...everytime there is data change at the source database
Goto Forum:
  


Current Time: Mon Nov 20 09:11:19 CST 2017

Total time taken to generate the page: 0.06499 seconds