01 March 2017

Export the jobs from Cloud Control

In case you need to backup your jobs from Cloud Control, you can use emcli for that. This will give you a quick way to backup or export the job for use elsewhere.

You can setup a script like:

EXPJOB=/home/oracle/export_jobs.sh
echo repdir=/backup/jobs > $EXPJOB

$OMSHOME/bin/emcli login -username=sysman -password=PassWord01

# One command to create the job
$OMSHOME/bin/emcli export_jobs -preview | awk '{ print "./emcli 
export_jobs -file=$repdir/" $1 ".zip -name=\x27" $1 "\x27" }' | sort >> $EXPJOB

#make it executable
chmod 740 $EXPJOB


# run the export
$EXPJOB


The EXPJOB that you create, will look like:

export repdir=/backup/jobs
./emcli export_jobs -file=$repdir/MYJOB01.zip -name='MYJOB01'
./emcli export_jobs -file=$repdir/MYJOB02.zip -name='MYJOB02'
./emcli export_jobs -file=$repdir/MYJOB03.zip -name='MYJOB03'
./emcli export_jobs -file=$repdir/MYJOB04.zip -name='MYJOB04'

If you run it, (from $OMSHOME/bin), it wil generate a seperate zip file for every job.
The zip file contains a single xml file for that job.

If you decide to import it, it will become available in the Job Library.

The import is easily done on the zip file, like:

 ./emcli import_jobs -file=$repdir/MYJOB01.zip

Hope this helps.