python - RUnning shell script through sqlplus -
i logged in oracle in prod env , have requirement run shell scripts on remote hosts while in sqlplus. trying via python. there way it?
i able run sql scripts or sql commands sqlplus following :-
session = popen(['sqlplus','-s','abc/abc@'+str(hostname)+':1000/'+str(dbname)+''], stdin=pipe, stdout=pipe, stderr=pipe) session.stdin.write('spool '+str(op_file)+' \n' ' '+str(data)+ '\n'); session.stdin.write(' ; \n') session.stdin.write('exit \n') session.stdin.flush() stdout, stderr = session.communicate()
but when want run shell script there way of doing through sqlplus itself, coz other way of logging in via ssh , sudoing in oracle not possible
i think 1 of ways of doing using plsql:-
http://www.dba-oracle.com/t_execute_shell_script_plsql_procedure.htm
but not sure.
sql*plus client application. can spawn processes on client machine run shell scripts on client. cannot spawn processes on database server.
as you've linked to, can use dbms_scheduler
package on database server spawn processes on server run batch files. can similar java stored procedure since runs on server. dbms_scheduler
has ability run jobs on remote servers if appropriate scheduler agents installed seems unlikely particularly helpful in vast majority of situations.
Comments
Post a Comment