11G OCM Cold Backup and Restore of REPOS


Back to the plan outlined in OCM 11G Planning (1). I plan to do a cold backup and restoration from that cold backup (step #7).

Preparation

Stop OEM

I need to stop the only application that is using the repos database: oem

/opt/oracle/app/OracleHomes/oms10g/bin/emctl stop oms

Create the Backup Directory

The backups will be to the /opt/oracle/backup/repos directory:

Change RMAN Configuration Parameters

I need to have autobackup on for the controlfile.

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP on;

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored

RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/opt/oracle/backup/repos/%F';

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/opt/oracle/backup/repos/%F';
new RMAN configuration parameters are successfully stored

Put the Database Instance into MOUNT Mode

I used RMAN to put the database instance into the correct mode for a cold backup by RMAN.

rman target / nocatalog
shutdown immediate;
startup mount;
exit;

Get the DBID

I need the Database ID in case I lose the control files. Since the instance is mounted, this information is available from the control files via the V$DATABASE view

select dbid from v$database;

      DBID
----------
1882277977

Perform Cold Backup

A cold backup is simple.

mkdir -p /opt/oracle/backup/repos
rman target / nocatalog
startup mount
backup database format '/opt/oracle/backup/repos/%U.dbf';
shutdown immediate
exit;

The session log is:

[oracle@gridctrl ~]$ rman target / nocatalog

Recovery Manager: Release 11.1.0.7.0 - Production on Fri Jan 8 09:38:09 2010

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

connected to target database (not started)

RMAN> startup mount

Oracle instance started
database mounted

Total System Global Area     535662592 bytes

Fixed Size                     1314580 bytes
Variable Size                251658476 bytes
Database Buffers             276824064 bytes
Redo Buffers                   5865472 bytes

RMAN> backup database format '/opt/oracle/backup/repos/%U.dbf';

Starting backup at 08-JAN-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=154 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00005 name=/opt/oracle/app/oradata/REPOS/mgmt.dbf
input datafile file number=00001 name=/opt/oracle/app/oradata/REPOS/system01.dbf
input datafile file number=00002 name=/opt/oracle/app/oradata/REPOS/undotbs01.dbf
input datafile file number=00003 name=/opt/oracle/app/oradata/REPOS/sysaux01.dbf
input datafile file number=00006 name=/opt/oracle/app/oradata/REPOS/mgmt_ecm_depot1.dbf
input datafile file number=00007 name=/opt/oracle/app/oradata/REPOS/rman_catalog01.dbf
input datafile file number=00004 name=/opt/oracle/app/oradata/REPOS/users01.dbf
channel ORA_DISK_1: starting piece 1 at 08-JAN-10
channel ORA_DISK_1: finished piece 1 at 08-JAN-10
piece handle=/opt/oracle/backup/repos/06l2ughe_1_1.dbf tag=TAG20100108T103006 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:02:56
Finished backup at 08-JAN-10

Starting Control File and SPFILE Autobackup at 08-JAN-10
piece handle=/opt/oracle/backup/repos/c-1882277977-20100108-00 comment=NONE
Finished Control File and SPFILE Autobackup at 08-JAN-10

RMAN> shutdown immediate

database dismounted
Oracle instance shut down

Everything is backed up.

Performing a Full Recovery

Overview

I am going to wipe away all of the redo logs, control files, and data files. Then I will attempt to restore everything from the RMAN backup.

The basic procedure is in Chapter 19 Performing RMAN Recovery: Advanced Scenarios in the Oracle® Database Backup and Recovery User’s Guide 11g Release 1 (11.1) manual.

Simulating a Crash

To simulate the crash, I merely rename the directories as follows (the existence of two directories seems to be a residue of the uodate process):

cd /opt/oracle/app/oradata
mv repos repos_backup
mv REPOS REPOS_backup
mkdir repos
mkdir REPOS

Note that the spfile still exists in its default location.

Restoring the Control Files

To restore the Control Files, I need the autobackups created above.

The general idea is to use the still-existing spfile, start the instance only, set the DBID, and restore the controlfiles from the autobackup. The procedure is in Performing Recovery with a Backup Control File. The commands used are:

startup nomount
set dbid 1882277977;
run {
  set CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/opt/oracle/backup/repos/%F';
  restore controlfile from autobackup;
}

The log is:

RMAN> startup nomount

connected to target database (not started)
Oracle instance started

Total System Global Area     535662592 bytes

Fixed Size                     1314580 bytes
Variable Size                251658476 bytes
Database Buffers             276824064 bytes
Redo Buffers                   5865472 bytes

RMAN> set dbid 1882277977;

executing command: SET DBID

RMAN> run {
2>  set CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/opt/oracle/backup/repos/%F';
3>  restore controlfile from autobackup;
4> }

executing command: SET CONTROLFILE AUTOBACKUP FORMAT

Starting restore at 08-JAN-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=153 device type=DISK

recovery area destination: /opt/oracle/app/flash_recovery_area
database name (or database unique name) used for search: REPOS
channel ORA_DISK_1: no AUTOBACKUPS found in the recovery area
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20100108
channel ORA_DISK_1: AUTOBACKUP found: /opt/oracle/backup/repos/c-1882277977-20100108-00
channel ORA_DISK_1: restoring control file from AUTOBACKUP /opt/oracle/backup/repos/c-1882277977-20100108-00
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=/opt/oracle/app/oradata/REPOS/control01.ctl
output file name=/opt/oracle/app/oradata/REPOS/control02.ctl
output file name=/opt/oracle/app/oradata/REPOS/control03.ctl
Finished restore at 08-JAN-10

Restore and Recover the Database

I now have a backup controlfile. The next set of commands are:

alter database mount;
restore database;
recover database;
alter database open resetlogs;

The log (modified to remove all of the archived redo log files) is:

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 08-JAN-10
Starting implicit crosscheck backup at 08-JAN-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=153 device type=DISK
Crosschecked 5 objects
Finished implicit crosscheck backup at 08-JAN-10

Starting implicit crosscheck copy at 08-JAN-10
using channel ORA_DISK_1
Finished implicit crosscheck copy at 08-JAN-10

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /opt/oracle/app/flash_recovery_area/REPOS/archivelog/2010_01_03/o1_mf_1_168_5n0qxfpm_.arc
...
File Name: /opt/oracle/app/flash_recovery_area/REPOS/archivelog/2009_11_27/o1_mf_1_13_5jyztn3x_.arc

using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /opt/oracle/app/oradata/REPOS/system01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /opt/oracle/app/oradata/REPOS/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /opt/oracle/app/oradata/REPOS/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /opt/oracle/app/oradata/REPOS/users01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /opt/oracle/app/oradata/REPOS/mgmt.dbf
channel ORA_DISK_1: restoring datafile 00006 to /opt/oracle/app/oradata/REPOS/mgmt_ecm_depot1.dbf
channel ORA_DISK_1: restoring datafile 00007 to /opt/oracle/app/oradata/REPOS/rman_catalog01.dbf
channel ORA_DISK_1: reading from backup piece /opt/oracle/backup/repos/06l2ughe_1_1.dbf
channel ORA_DISK_1: piece handle=/opt/oracle/backup/repos/06l2ughe_1_1.dbf tag=TAG20100108T103006
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:56
Finished restore at 08-JAN-10

RMAN> recover database;

Starting recover at 08-JAN-10
using channel ORA_DISK_1

starting media recovery

RMAN-08187: WARNING: media recovery until SCN 8434724 complete
Finished recover at 08-JAN-10

RMAN> alter database open resetlogs;

database opened

RMAN>

Check the Application

Since the only application is OEM, I just start the application:

/opt/oracle/app/OracleHomes/oms10g/bin/emctl start oms

And the application starts successfully.

Conclusion

Step #7 is now complete.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s