WARNING: This web is not used anymore. Please use PDBService.HandsOnExercises instead!
 
The goal of this exercise is to practice backup and recovery of Tier 1 databases. Due to very limited time only 1 recovery scenario (i.e. full database point in time recovery) will be exercised. This scenario has been chosen as the most useful and most probable to happen in reality in the database environment with SAME implementation.

Backup procedure

1. Perform a full backup of your database. If you have any backup infrastructure in place use it to perform the backup. If you perform backups by hand do the follwing:

  • login to one node of the cluster. Make sure that ORACLE_SID and ORACLE_HOME environment variables are set correctly
  • start RMAN, connect to the target database and to the catalog (if you use one):
          export NLS_DATE_FORMAT='YYYY-MON-DD HH24:MI:SS'
          rman target / [catalog usrname@TNS_descriptor]
       
  • Configure controlfile autobackup:
          configure controlfile autobackup on;
       
  • Performa a full database backup, use tape system if you have one in place:
          run
          {
             allocate channel c1 device type disk|sbt;
             allocate channel c2 device type disk|sbt;
             backup as backupset database plus archivelog;
           }
           exit
       
2. Write down the dbid of the database:
      sqlplus "/ as sysdba"
      select dbid from v$database;
      exit
   
3. Find and write down your spfile location and Flash Recovery Area settings (if you use one):
      sqlplus "/ as sydba"
      show parameter spfile;
      show parameter db_recovery_file_dest;
      exit
   
4. Just before failure simulation connect to RMAN and backup archivelogs:
     run
      {
         allocate channel c1 device type disk|sbt;
         allocate channel c2 device type disk|sbt;
         backup archivelog all;
      }
  
5. As a safety net make an additional manual backup of your controlfile and the parameter files:
      mkdir $HOME/backup_dir
      cd $HOME/backup_dir
      pwd
      sqlplus "/ as sysdba"
      create pfile='path_to_your_backup_directory/initDB.ora' from spfile;
      alter database backup controlfile to 'path_to_your_backup_directory/controlfile.ctl';
      exit;
   

Checks

1. Make sure that you still have pfile and control file backups in '$HOME/backup_dir' directory

2. Make sure that ORACLE_SID and ORACLE_HOME environment variables are set correctly, connect to RMAN and check whether your DB is recoverable:

      rman target / [catalog usrname@TNS_descriptor]
      run
      {
         allocate channel c1 device type disk|sbt;
         allocate channel c2 device type disk|sbt;
         set until time 'sysdate-1/240';
         restore database check readonly preview;
       }
       list archivelog all completed after 'sysdate-1';
   
Note: Make sure that you have used the same backup device as during the backup.

Failure simulation

1. Stop all cluster nodes.

2. Remove all datafiles, controlfiles, and the spfile. Do not touch archived redo logs or backup sets if there are any. For ASM use the 'asmcmd' tool.

Recovery procedure

0. Usually in case of disaster recovery you have to repeat all the hardware and OS configuration steps and then to install the Oracle clusterware and RDBMS sofwater. Finally ASM (if it is in use) instances and diskgroups has to be created. In our case all those steps are not required as all the hardware and software components stayed intact.

1. SPFILE restore.

  • login as oracle user to the first node of the cluster
  • check whether ORACLE_SID and ORACLE_HOME variables are set properly
  • start RMAN do not connect to the recovery catalog even if you use one (we will not use recovery catalog during recovery to avoid introducing there changes related to the database recovery):
          rman target sys/xxxxxxx nocatalog
       
  • If you did backups to a flush recovery area prepare a dummy initDB.ora file with following parameters and use it to startup the instance:
          initDB.ora:
          db_recovery_file_dest_size=...
          db_recovery_file_dest="..."
          db_name=...
          sga_target=300M
    
          sqlplus "/ as sysdba"
          startup pfile='initDB.ora' nomount;
          exit;
       
  • if you don't use a flash recovery area, connect to RMAN, set dbid and startup an Oracle instance
          rman target sys/xxxxxxx nocatalog
          set dbid=xxxxxxxxxxxxx;
          startup nomount;
       
  • Restore the spfile (from RMAN client)
          run 
          {
            allocate channel c1 device type disk|sbt;
            restore spfile to 'your_spfile_location_path' from autobackup;
          }
       
  • Restart the Oracle instance:
          shutdown
          startup nomount
          exit
       

2. Controlfile restore.

  • connect to RMAN set DBID and restore the controlfile
          rman target / nocatalog
          set dbid=xxxxxxxxxxxxx;
          run{
            allocate channel c1 device type disk|sbt;
            restore controlfile from autobackup;
         }
         exit;
       
  • mount the database and disable block change tracking (if you use this feature)
          sqlplus "/ as sysdba"
          alter database mount;
          alter database disable block change tracking;
          select file#,name from v$datafile;
          -- check if you have non oracle managed files (you MUST RENAME them, see syntax below)
          exit
       
3. Data file restore
   rman target / nocatalog
   run 
   {
      set until time = "to_date('24-AUG-2006 00:00:00','dd-mon-yyyy hh24:mi:ss')";
      allocate channel c1 type disk|sbt;
      allocate channel c2 type disk|sbt;
      # set newname for datafile 57 to new;  -> use only if you have non OMF files, for example cms
      restore check readonly database;
      recover database;
   }

NOTE: explicitly allocate disk and tape channels for parallel recovery, AND in the order listed here above, otherwise you will get a serial recovery (to be further investigated)

   sqlplus "/ as sysdba"
   select name,status from v$datafile; (check if restore is ok)

   alter database open read only; 
   (do NOT reset logs at this stage, first check if the restored db is ok)

   shutdown immediate
   startup mount
   alter database open resetlogs;

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | WYSIWYG | More topic actions
Topic revision: r5 - 2007-06-12 - JacekWojcieszuk
 
    • Cern Search Icon Cern Search
    • TWiki Search Icon TWiki Search
    • Google Search Icon Google Search

    PSSGroup All webs login

This site is powered by the TWiki collaboration platform Powered by PerlCopyright & 2008-2020 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
or Ideas, requests, problems regarding TWiki? use Discourse or Send feedback