Search This Blog

Thursday, 13 October 2016

Recovery Manager-3


                                                                      Recovery Manager-3

 

 

Restore and Recovery scenarios:

   

    Loss of non system datafile:  ex. User1.dbf / 4 (file id)

         Steps:

             1. Offline the datafile

                  Rman >sql ‘alter database datafile 4 offline’;

             2. Restore and recover the datafile.

                  Rman>restore datafile 4;

             3.  Rman>recover datafile 4;                                 

             4. Online the datafile

                  Rman>sql ‘alter database datafile 4 online’;

     

    Loss of all datafiles:

             1. Shut down and start the database in mount state.

             2. Restore and recover database.

                  Rman>restore database;

                  Rman>recover database;

             3. Open the database.

                  Rman>sql ‘alter database open’;

    Loss of All Controlfiles:

             1. Shut down (shut abort) the database and start in nomount state

             2. Restore the controlfile;

                 Rman>restore controlfile;

             3. Change database state to mount state:

                 Rman> Sql ‘alter database mount’;

             4. Recover the database and open database with resetlogs.

                 Rman>recover database;

                 Rman>sql ‘alter database open resetlogs’;

             5. Take full database backup (recommended)

    Losses of all online redo logfile: Status = current (logseq 6)

             1. Shut down (shut immediate) the database and start in mount state

             2. Check current log sequence

                 Sql>archive log list;

             3. Set the log sequence restore and recover the database and open database with resetlogs.

                 Rman>run {set until logseq 6};  

                 Rman>restore database;

                 Rman>recover database until logseq 6;

                 Rman>sql ‘alter database open resetlogs’;

             4. Take full database backup;

 

 

Disaster recovery

        

     Loss of all files (spfile, datafile, and controlfiles, online redo logs)

    

Steps:

            1. shut down (abort) the database (if running)

            2. Find database id (from catalog) and set that dbid from rman

                Rman>set dbid 1234;

            3. Start database in nomount state

                 Rman>startup nomount à starts with dummy parameter file

                 Rman>restore spfile;

                 Rman>startup force nomount;

           

 

         

           4. Restore controlfile and bring database in mount state

               Rman> restore controlfile;

               Rman> sql ‘alter database mount’;

            5. Recover database until last log sequence

               Rman>run {set until logseq 7};     (suppose the last loqseq# was 7)          

               Rman>restore database;

               Rman>recover database;

               Rman> sql ‘alter database open resetlogs’;

 

 

 

INCREMENTAL and CUMULATIVE backups:

Rman>backup incremental level 0 database format  ’/u01/user2/rmanbkp/full_incre_bkp_%U’;

 

Sql>desc V$BLOCK_CHANGE_TRACKING

$mkdir bktrc

Sql>alter database enable block change tracking using file ‘/u01/user18/bktrc/bktrc.trc’;

 

Note: After enabling block change tracking CTWR process started and starts writing to created file.

Rman>backup incremental level 2 database format ‘/u01/user18/rmanbkp/full_bkp_%U’;

 

Rman> backup cumulative incremental level 0  database format ‘/u01/user18/rmanbkp/full_cumm_bkp_%U’;

 

OS SCRIPTS:

At OS Prompt:

 $vi hotbkp.sh

        #!/bin/bash

        Rman target / catalog rman/rman@toprod

        Backup database;

         Exit

Wq!

 

Run the script:

 $sh hotbkp.sh

 

 

 

 

  

 

 

 

No comments:

Post a Comment