Oracle EMCLI-II
In this short post, I am going to show you how to submit your Oracle jobs from the library and how to monitor your Oracle jobs from the command line. By doing that you can create your automation instead of using Oracle Enterprise Manager web interface. Before issuing any command below, first you need to authorize Oracle OMS and sync your environment.
Submitting Oracle Jobs from the library.
[email protected]:~$ emcli create_job_from_library -owner=SYSMAN -lib_job_name=T24_EXA03_BACKUP -name=T24_EXA03_BACKUP_TEST
After submit the job you should get similar output if everything is OK.
Creation of job "T24_EXA03_BACKUP_TEST" was successful.
Monitor job status: You can monitor submitted job status.
[email protected]:~$ emcli get_jobs -noheader -name=T24_EXA03_BACKUP_TEST
Getting Execution ID: Sometimes even your Oracle job finished successfully, Your job may not be finished as an expected. In order to overcome this situation, we can also get the execution detail for the finished job. First thing is the getting the execution id for the submitted job. (T24_EXA03_BACKUP_TEST in our case)
emcli get_jobs -noheader -name=T24_EXA03_BACKUP_TEST | awk '{print $4}')
Getting Execution detail: After possession of execution id. we can get the execution detail.
[email protected]:~$ emcli get_job_execution_detail -execution=6E6A0527A3AA7B89E0532812200A13E8 -showOutput -xml
It prints out all the job logs in xml format. As my sample job is RMAN backup, it gives me similar output such this. “Recovery Manager complete” Executing a Job on the specific target: In order to submit job on a specific target we need to create oracle property file. Creating a property file. Create a file sample.job and add the line below.
target_list=t2401int:rac_database
Submitting the job specific target:
[email protected]:~$ emcli create_job_from_library -owner=SYSMAN -lib_job_name=T24_EXA03_BACKUP -name=T24_EXA_BACKUP_TEST -appendtargets -input_file=property_file:sample.job