DBAsupport.com Forums - Powered by vBulletin
Results 1 to 3 of 3

Thread: RMAN advice

  1. #1
    Join Date
    Jun 2001
    Posts
    40
    Dear All

    I'm looking to move towards using RMAN rather than complex shell scripts for backing up databases and have been reading and experimenting for a few days now. Follows is the backup script I've written (I've validated that I can do datafile, point in time, control file, and disaster recovery with my backups on a test box). I was wondering if any experienced RMAN users out there might spot some short comings in my use of RMAN that I haven't foreseen. Any advice would be much appreciated.

    Thanks

    Austin

    =======================================
    #!/bin/sh

    THIS_DAY="`date '+%a'`"
    TODAY="`date '+%d%m%y'`"

    if [ "$THIS_DAY" = "Mon" ]
    then
    BACKUP_TYPE="BACKUP INCREMENTAL LEVEL 0 DATABASE PLUS ARCHIVELOG \
    FILESPERSET 4 TAG weekly_$TODAY;"
    else
    BACKUP_TYPE="BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE \
    PLUS ARCHIVELOG FILESPERSET 4 TAG daily_$TODAY;"
    fi

    rman << EOF
    CONNECT TARGET / ;
    CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT
    '/home/oracle/backup/mand/dat/ora_df%t_s%s_s%p';
    CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO
    '/home/oracle/backup/mand/dat/%F';
    CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
    CONFIGURE CONTROLFILE AUTOBACKUP ON;
    CONFIGURE BACKUP OPTIMIZATION ON;

    DELETE BACKUP COMPLETED BEFORE 'SYSDATE-7';
    $BACKUP_TYPE
    DELETE ARCHIVELOG UNTIL TIME 'SYSDATE-7';

    RESTORE DATABASE VALIDATE;
    RESTORE CONTROLFILE VALIDATE;
    RESTORE ARCHIVELOG FROM TIME 'SYSDATE-7' VALIDATE;

    CROSSCHECK BACKUP;
    REPORT NEED BACKUP;
    LIST BACKUP SUMMARY;
    EOF

  2. #2
    Join Date
    May 2002
    Posts
    42
    The three sections backup, restore and crosscheck,report,list are in three different scripts right?

    script 1 to do backup
    DELETE BACKUP COMPLETED BEFORE 'SYSDATE-7';
    $BACKUP_TYPE
    DELETE ARCHIVELOG UNTIL TIME 'SYSDATE-7';

    script 2 to do recovery
    RESTORE DATABASE VALIDATE;
    RESTORE CONTROLFILE VALIDATE;
    RESTORE ARCHIVELOG FROM TIME 'SYSDATE-7' VALIDATE;

    script 3,4,5 to do reporting/checking
    CROSSCHECK BACKUP;
    REPORT NEED BACKUP;
    LIST BACKUP SUMMARY;

    for a restore you may want the shell script to put the database in a nomount state (startup nomount) so rman will have the db in the correct state. Also, after a RESTORE you should do a RECOVER. You may want to have another script to just restore and recover one tablespace or one datafile (not the entire db).


    Andrew

  3. #3
    Join Date
    Apr 2002
    Posts
    28
    You might want to add backing up the init.ora, orapwd files and creating what I call a disaster recovery text file - so you have some info about database tablespace sizes if you have to restore to another server. I also like to backup the controlfile to trace as well. I do all of these tasks in the following script (tested on 9i):

    http://www.dotcomsolutionsinc.net/pr...ol901_29_.html

    (In general, you have made a good start with your RMAN script.) It is Ok to do the crosscheck and validate within the same script too. The above script makes use of the controlfile for storage of backup info, you can also store the info into an RMAN catalog as well (which is optimal). There are some recovery scenarios which are unworkable if you don't use an RMAN catalog. Here is a list of some recovery scenarios I use:

    http://www.dotcomsolutionsinc.net/pr...very_scenarios
    David Simpson
    www.dotcomsolutionsinc.net

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Click Here to Expand Forum to Full Width