Contents

Oracle RMAN backup through emcli

Contents

In previous post, I mentioned setting of the emcli and resolving of SSL problem. In this post, I will show you how we simply backup using RMAN through emcli. It is necessary to loginĀ  successfully to OMS to backup your database. And all necessary privileges should be given to user who logins to OMS. Creating a Property file: First step is creating property file. Property file is a file which stores all necessary configuration information related to your database environment. You can see sample property file which belongsĀ  to my environment. You can also create template file with emcli describe_job command.

gokay@ankara:~$ emcli describe_job -name=myJob

Creating Property file manually:

In this configuration, It is used named credentials for the security reasons, instead using user name and clear text password in the file.

cat << EOF > /tmp/RMAN_BACKUP_JOB_1.prop
name=RMAN_BACKUP_JOB_1
type=RMANScript
description=Test RMAN backup
owner=SYSMAN
#kind=library
kind=active
target_list=T2421DEV:rac_database
cred.defaultDBCred.T2421DEV:rac_database=NAMED:SYSMAN:RMANBKP_TEST_ENV
cred.defaultHostCred.T2421DEV:rac_database=NAMED:SYSMAN:EXA032_T24TST
# Description: (Required) Enter RMAN commands or a fully qualified script name on the remote hosts, for example, "@script.rcv"
variable.rman_perl_script=<<MULTILINEVALUE
run {
allocate channel oem_backup_disk1 type disk format '/zfsdev/Oracle_DBbackup/rman_bkp/ExaData_TST/T2421DEV/%d_%U_%D%M%Y';
backup spfile format '/zfsdev/Oracle_DBbackup/rman_bkp/ExaData_TST/T2421DEV/%d_%U_%D%M%Y_spfile';
release channel oem_backup_disk1;
}
MULTILINEVALUE
# Description: (Optional) Notify the job owner when a selected state occurs
# Allowed Values:  SCHEDULED, RUNNING, ACTION_REQUIRED, SUSPENDED, SUCCEEDED, PROBLEMS
notification=SUCCEEDED,PROBLEMS
EOF

Instead of creating a property file you can also execute existing library job.

gokay@ankara:~$ ./emcli -owner=SYSMAN create_job_from_library -lib_job_name="RMAN_BACKUP_JOB_1" -name="RMAN_BACKUP_JOB_20180425"

Checking Job Status

gokay@ankara:~$ ./emcli get_jobs -noheader -name=RMAN_BACKUP_JOB_20180425 | awk  '{print $1 " "  $5 " "  $6 " " $7 " " $8 " " $10}'

Note: Before executing any emcli commands, do not forget to sync the OMS with emcli. Otherwise, you will get an error. After login successfully sync with below command.

gokay@ankara:~$ /.emcli sync
Synchronized successfully