Tuesday 22 March 2011

Backup and Restoring Oracle VM Manager on a different server

In today’s topic, I’d like to discuss the process of backing up and restoring your Oracle VM Manager. Since the Oracle VM Manager is used to manage all your virtual machines and virtual machine resources, I thought it would be a good exercise to discuss the step-by-step process on backing up and restoring the OVM Manager environment. It is crucial to make backups of your Oracle VM Manager to ensure that you don’t lose any data from the Oracle VM Manager repository database that could cause you a headache in having to actively restore each virtual machine to a new Oracle VM Manager, one by one (not a fun exercise). The good news is Oracle has made the backup-restore process quite easy. In the example below, I will be backing up my original Oracle VM Manager, and restoring the content from my old server it into a new server all that has a fresh install of Oracle VM Manager.

Prerequisites:

1) Ensure all your Oracle VM Servers are actively running.

2) Install a fresh copy Oracle VM Manager on your new server

Steps to backup your Oracle VM Manager environment:

1) Login to the Oracle VM Manager as a user with root privileges i.e. root.

2) As root user, backup the existing Oracle VM Manager using the command:

# sh /opt/ovs-manager-2.2/bin/backup.sh

3) The script will prompt you with two options: backup the OVM Manager or restore the OVM Manager. Please ensure to select backup.

4) Once you have selected to backup your Oracle VM Manager, you will be promoted few more questions to save your dump and log files to a destination of your choice. The screen will look as follows:

Back up data now ...

Please enter the password for database account 'OVS':

Please specify the path for dump file?

Please specify the path for log file?

5) Congratulations! Oracle VM Manager was successfully backed up.

Restoring Oracle VM Manager to the existing host:

The process of restoring your Oracle VM Manager is as simple as backing up your Oracle VM Manager. In this example, I’ll show how to restore your backup copy from your old Oracle VM Manager to your new Oracle VM Manager.

1) Copy the dump files and log files from your existing Oracle VM Manager to your new Oracle VM Manager. This can be easily done using the scp command. Example:

scp ovs.dmp host_ip_of_new_OVM_Manager:/tmp/

2) Stop the oc4j service on the old Oracle VM Manager using the command:

service oc4j stop

3) Shutdown the old Oracle VM Manager repository database as oracle user. (NOTE: While this step is not necessary, however I felt it was a good precautionary measure to take and decided shutdown my database).

export ORACLE_HOME='/usr/lib/oracle/xe/app/oracle/product/10.2.0/server'

export ORACLE_SID=XE

$ORACLE_HOME/bin/sqlplus / as sysdba;

SQL> shutdown immediate;

SQL> quit

4) On the new freshly installed Oracle VM Manager server, stop the oc4j service via command:

service oc4j stop

5) Now we will restore the data from our existing Oracle VM Manager to our new Oracle VM Manager using the same backup.sh script. As the root user, type the following command:

# sh /opt/ovs-manager-2.2/bin/backup.sh

6) The script will prompt you with two options: backup the OVM Manager or restore the OVM Manager. Please ensure to select restore.

7) Once you have selected to restore your Oracle VM Manager, you will be promoted few more questions to restore your data using the dump and log files you copied from your existing Oracle VM Manager. The screen will look as follows:

Restore data now ...

Please enter the password for database account 'SYS':

Please enter the path and filename for the dump file (eg /tmp/ovs.dmp):

Please enter the path and filename for the log file (eg /tmp/ovs.log):

Import: Release 10.2.0.1.0 - Production on Fri Jul 2 16:31:03 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

Connected to: Oracle Database 10g Express Edition Release 10.2.0.1.0 – Production

Export file created by EXPORT:V10.02.01 via conventional path

Warning: the objects were exported by OVS, not by you

import done in US7ASCII character set and AL16UTF16 NCHAR character set

import server uses AL32UTF8 character set (possible charset conversion)

. . importing table “OVS_AGENT” 22 rows imported

. . importing table “OVS_ALERT” 0 rows imported

. . importing table “OVS_CATEGORY” 1 rows imported

. . importing table “OVS_CDROM” 5 rows imported

. . importing table “OVS_CDROM_RESOURCE” 0 rows imported

. . importing table “OVS_GROUP” 4 rows imported

. . importing table “OVS_IMG_OS” 0 rows imported

. . importing table “OVS_LOCK” 166 rows imported

. . importing table “OVS_LOG” 6582 rows imported

. . importing table “OVS_MAP” 35 rows imported

. . importing table “OVS_OS_RESOURCE” 18 rows imported

. . importing table “OVS_PARTNER” 0 rows imported

. . importing table “OVS_PREFERRED_SERVER” 0 rows imported

. . importing table “OVS_PRIVILEGE” 4 rows imported

. . importing table “OVS_PRIVILEGE_ROLE” 5 rows imported

. . importing table “OVS_RESOURCE” 0 rows imported

. . importing table “OVS_ROLE” 3 rows imported

. . importing table “OVS_SERVER” 22 rows imported

. . importing table “OVS_SITE” 7 rows imported

. . importing table “OVS_STATISTIC” 22465 rows imported

. . importing table “OVS_SYS_VALUE” 8 rows imported

. . importing table “OVS_TASK” 19 rows imported

. . importing table “OVS_USER” 14 rows imported

. . importing table “OVS_USER_GROUP” 39 rows imported

. . importing table “OVS_USER_ROLE” 14 rows imported

. . importing table “OVS_USER_SITE” 93 rows imported

. . importing table “OVS_VD_IMG” 256 rows imported

. . importing table “OVS_VIRTUAL_DISK” 428 rows imported

. . importing table “OVS_VM_GEN_INFO” 124 rows imported

. . importing table “OVS_VM_IMG” 124 rows imported

. . importing table “OVS_VM_NETWORK” 125 rows imported

. . importing table “OVS_VM_SNAPSHOT” 0 rows imported

Import terminated successfully without warnings.

Done

8 ) Once the import has completed successfully, start the oc4j service on your new Oracle VM Manager using the command:

service oc4j start

9) Congratulations! Oracle VM Manager has been successfully restored on your new Oracle VM Manager.

NOTE: User passwords (including admin) will have the same passwords from your existing Oracle VM Manager. If you installed your fresh Oracle VM Manager and used a different password, once you do the restore it will override your existing password and use the passwords found within the existing Oracle VM manager repository you imported.


1 comment:

NCR said...

What about backup and restore virtual machines, is there a procedure to follow, because I have not success doing it.