Oracle RMAN backup through emcli

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
description=Test RMAN backup
# Description: (Required) Enter RMAN commands or a fully qualified script name on the remote hosts, for example, "@script.rcv"
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;
# Description: (Optional) Notify the job owner when a selected state occurs

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







[Solved]Connection to the current OMS could not be established

Hello Folks,

The last week one of our customer wanted to automatize their Oracle backup systems. As an Oracle environment, customer has Oracle 12c. Luckily Oracle 12c designed for the Cloud. Oracle Enterprise Manager is the graphical interface for managing all of  Oracle database environment. Oracle Enterprise Manager has also command line interface which we need to automatize their systems. emcli– Enterprise Manager Command line interface is the tool which enables users to access Enterprise Manager functionality through a command-line. It has a two modes of operation. One is interactive mode and other one is Script Mode. In this post, It will be used interactive mode.

Installation of the emcli for interactive mode:

emcli is a jar package that you need to download, install and setup. You can download the jar package from your OMS.

wget --no-check-certificate

Before install it, do not forget to set JAVA_HOME environment variable.

$export JAVA_HOME=/your/Java/path
#for me
$export JAVA_HOME=/app/jdk1.8.0_162


$JAVA_HOME/bin/java -jar emclikit.jar -install_dir=<em_cli_home_dir>
#for me
$JAVA_HOME/bin/java -jar emclikit.jar -install_dir=/app/emcli

Setting up emcli

Normally Setting up emcli is very easy step. But as always Murphy on the scene :). I got an error during the setup process.

gokay@ankara:~$ ./emcli setup -url= -username=auto -password="pass"  -dir=/app/emcli
Oracle Enterprise Manager 12c Release 5.
Copyright (c) 1996, 2015 Oracle Corporation and/or its affiliates. All rights reserved.

Error: Connection to the current OMS could not be established. Check the log files for further details.
Log file location is : /app/emcli/.emcli/.emcli.log

/app/emcli/.emcli/.emcli.log details

Apr 16, 2018 4:31:01 PM oracle.sysman.emCLI.verb.SetupVerb execute
SEVERE: HttpConnectionException
        at oracle.sysman.emCLI.omsbrowser.OMSBrowser.submitCommand(
        at oracle.sysman.emCLI.omsbrowser.OMSBrowser.getPageInternal(
        at oracle.sysman.emCLI.omsbrowser.OMSBrowser.getPage(
        at oracle.sysman.emCLI.verb.LogoutVerb.doLogout(
        at oracle.sysman.emCLI.verb.SetupVerb.execute(
        at oracle.sysman.emSDK.emCLI.CLIController.execute(
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(
        at java.lang.reflect.Method.invoke(
        at oracle.sysman.emCLI.StandAloneLaunchHandler.invoke(
        at oracle.sysman.emCLI.StandAloneLaunchHandler.launch(
        at oracle.sysman.emSDK.emCLI.CLIController.launch(
        at oracle.sysman.emSDK.emCLI.CLIController.main(
Caused by: Received fatal alert: close_notify
        at HTTPClient.HTTPConnection.sendRequest(
        at HTTPClient.HTTPConnection.handleRequest(
        at HTTPClient.HTTPConnection$
        at HTTPClient.HTTPConnection$
        at HTTPClient.HttpClientConfiguration.doAction(
        at HTTPClient.HTTPConnection.doAction(
        at HTTPClient.HTTPConnection.setupRequest(
        at HTTPClient.HTTPConnection.Post(
        at HTTPClient.HTTPConnection.Post(
        at oracle.sysman.emCLI.omsbrowser.OMSBrowser.submitCommand(

        ... 13 more

I suspected  SSL, which may be the SSL version problem. As Java 8 uses TLS1v2 as default. To  confirm that  I checked with openSSL tool.

$ openssl s_client -showcerts -connect -tls1_2 -debug

New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
    Protocol  : TLSv1.2

#I also tried with the tls1v1

openssl s_client -showcerts -connect -tls1_1 -debug

New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
No ALPN negotiated
    Protocol  : TLSv1.1

I checked on Google; Oracle OMS uses TLSv1. To use TLS1v2 you need to patch it. As a workaround, I changed to my Java version from Java 8  to Java 7.

Set your JAVA_HOME for Java 7

$export JAVA_HOME=/app/jdk1.7.0_XXX

Installation of emcli with Java 7

/home/appadmin/jdk1.7.0_80/bin/java -jar emclikit.jar client -install_dir=/app/emcli
Oracle Enterprise Manager 12c Release 5.
Copyright (c) 2012, 2015 Oracle Corporation.  All rights reserved.

EM CLI client-side install completed successfully.
Execute "emcli help setup" from the EM CLI home (the directory where you have installed EM CLI) for further instructions.

Setting of emcli with Java 7.

Do not forget to add -novalidate option.

[appadmin@sr02lautomic01 emcli]$ ./emcli setup -url= -username=auto -password="pass"  -dir=/app/emcli  -novalidate
Oracle Enterprise Manager 12c Release 5.
Copyright (c) 1996, 2015 Oracle Corporation and/or its affiliates. All rights reserved.

After changed the Java version, It worked. You can ask Oracle for the patch number to use more secure version of the SSL version. Next post will be about taking a backup of the Oracle by using RMAN script with emcli tool.














Cheksum On Linux and Windows

Hello Folks,

When you transfer files from Windows to Linux or vice versa, checksum of these files will be changed unless you transfer it in binary mode(in FTP terminology). It is normal because representation of  new line in Linux differ from the Windows system. In Unix systems new line represented by \n [line feed] whereas, DOS uses \r\n [carriage return + line feed]. In this blog post, we will overcome this situation with sed while checking the checksum of the files in two different systems.


Finding Checksum of a files in Unix(AIX)

#Default is MD5
AIX# csum mytest.txt

#csum with stdin
AIX# echo "Hello World!" | csum -

#Cleaning the hypen
AIX# echo "Hello" | csum - | awk '{print $1}'

Finding Checksum of a file in Linux

gokay@ankara:~$ md5sum avr.c
59035261ec34eea166fcc65e06966128  avr.c

gokay@ankara:~$ echo hello | md5sum -

Finding Checksum of a file in Windows:

It is very useful script in terms of DOS  systems. You can also run it from the command line by removing the statement powershell -command

C:\Users\ankara>powershell -command "Write-Host -NoNewline CKSUM_OF_BALANCE_EXT
RACT_FROM_DST:";"$(CertUtil -hashfile C:\SIL MD5)[1] -replace ' ',''"

How can we check checksum of the files after transferring it from Linux to Windows ?

One of the very easy way to do it is, installing unix2dos utility. But you can not always find this  utility in a system as it is not base system package. Workaround is the sed.

unix2dos with sed.

#Thanks to nixCraft author. I take it  from the nixCraft.
gokay@ankara:~$ sed 's/$'"/`echo \\\r`/" mytest.txt  | md5sum| awk '{print $1}'


Windows Server 2012 R2 hangs on the KVM hypervisor

Windows Server 2012 R2 hangs during the installation on KVM hypervisor on Ubuntu . Windows Server 2012 R2 hangs in the installation step.

Version of the Virtual Host:

gokay@ankara:~$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 16.04.3 LTS
Release:	16.04
Codename:	xenial


      Check your Virtual Disk Bus. And change it to SATA.







I finally installed Windows Server 2012 R2 successfully. But  Virtual NIC was not detected.


    Check your Virtual Network Interface Device model. It should be rtl8139. Virtio did not work for me.