12 Replies Latest reply: Jan 7, 2011 1:33 AM by 799923 RSS

    RMAN COMMANDS

    821674
      Hi hussein,

      I got these RMAN backup commands from someone's scripts (previous dba).
      rman1.exe
      ========
      #!/bin/sh
      export ORACLE_SID=PROD
      export ORACLE_HOME=/u02/oracle/PROD/db/tech_st/10.2.0
      export PATH=$PATH:$ORACLE_HOME/bin
      rman target /  @/u05/RMAN/backup.cmd log=/u05/RMAN/backup.log
      
       
      backup.cmd
      =========
      run {
           CONFIGURE CONTROLFILE AUTOBACKUP ON;
           CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u05/RMAN/%F';
           backup format '/u05/RMAN/%d_LVL0_%T_%u_s%s_p%p' database;
           delete obsolete;
           }
      I think this is for RMAN 10g.

      Will this script good for 9i and 11g?

      What else is lacking in this script ? specifically in the "configure backup pamaters"?



      Thanks a lot,

      Ms Inday G
        • 1. Re: RMAN COMMANDS
          799923
          backup format '/u05/RMAN/%d_LVL0_%T_%u_s%s_p%p' database; should be
          backup database format '/u05/RMAN/%d_LVL0_%T_%u_s%s_p%p'
          • 2. Re: RMAN COMMANDS
            Hussein Sawwan-Oracle
            Will this script good for 9i and 11g?
            It should work. However, it is better you test it on a 9i/11g database to verify.
            What else is lacking in this script ? specifically in the "configure backup pamaters"?
            Please see RMAN manuals.

            Backup and Recovery
            http://www.oracle.com/pls/db112/portal.portal_db?selected=14&frame=#backup_and_recovery

            Thanks,
            Hussein
            • 3. Re: RMAN COMMANDS
              799923
              one more way is :


              You can set one time should be fine in RMAN:

              CONFIGURE CONTROLFILE AUTOBACKUP ON;
              CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/u05/RMAN/%F';
              Configure DEFAULT DEVICE TYPE DISK format '/u05/RMAN/%d_LVL0_%T_%u_s%s_p%p';
              • 4. Re: RMAN COMMANDS
                821674
                Thanks :)

                Can you share me what did you put on your PROD rman backup? The configure parameters part "thing". Just to compare
                what I lack ;)
                • 5. Re: RMAN COMMANDS
                  799923
                  This is modified your version, i will update you.

                  run {

                  backup database plus archivelog all delete input format;
                  corsscheck archivelog all;
                  delete obsolete noprompt;
                  }
                  • 6. Re: RMAN COMMANDS
                    821674
                    hi auto...that format also works :P you can ramble it also

                    backup format '/u05/RMAN/%d_LVL0_%T_%u_s%s_p%p' database; should be

                    backup database format '/u05/RMAN/%d_LVL0_%T_%u_s%s_p%p'
                    • 7. Re: RMAN COMMANDS
                      799923
                      Here is my RMAN script:
                      -----------------------------------
                      DB0DB_RMAN_BKP.sh
                      #!/bin/ksh
                      ###########################################################################
                      #
                      # Name: DW0DB_RMAN_BKP.ksh
                      #
                      # Purpose : Full database RMAN backup of DW0DB Database
                      #
                      # Author  : xxxxxxxxxxxxxxxxxxxx(its you)
                      #
                      # Created : SEP 02 2009
                      #
                      ##########################################################################
                      #
                      #Set the Environment


                      #Define Variables for the script
                      SCRIPT_TOP=<full path to scripts dir>
                      LOGDIR=<full path to log dir>
                      BKPDIR=<full path to backup dir>
                      LOGFILE=<logfilename>

                      # list the backups
                      echo ''
                      echo "List the existing backups in Backup directory" >> $LOGFILE
                      ls -ltr $BKPDIR >>$LOGFILE



                      # Now run the RMAN backup
                      echo ''
                      echo "Starting full backup of $ORACLE_SID at $RUNDATE " >> $LOGFILE

                      $RMAN target / no catalog @/home/oracle/DBA/JOBS/FULL_DW0DB_DISK_BKP.rman >> $LOGFILE


                      # Show size of the backup directory area after backup
                      echo ''
                      echo "Available space in Backup directory after backup" >> $LOGFILE
                      df -h $BKPDIR >> $LOGFILE


                      # list the backups there
                      echo ''
                      echo "List the backups in Backup directory" >> $LOGFILE
                      ls -ltr $BKPDIR >>$LOGFILE

                      ## send an email

                      mail -s "RMAN backup completed" <mailid> < /fullpathtologfile/filename.log


                      ##### end of script###############################################



                      cat FULL_DW0DB_DISK_BKP.rman

                      run {
                      allocate channel c1 type disk;
                      allocate channel c2 type disk;

                      backup database
                      tag DW0DB_FULLBKP
                      format '/bkp/RMAN/DW0DB_BKP/DW0DB_set%s_piece%p_%T_%U'
                      filesperset 10;

                      CROSSCHECK BACKUP OF DATABASE;

                      sql 'alter system switch logfile';
                      sql 'alter system switch logfile';
                      sql 'alter system switch logfile';

                      crosscheck archivelog all;

                      backup archivelog all
                      tag DW0DB_ARCHBKP
                      format '/bkp/RMAN/DW0DB_BKP/ARCH_DW0DB_set%s_piece%p_%T_%U'
                      filesperset 20;

                      backup
                      format '/bkp/RMAN/DW0DB_BKP/DW0DB_ctl_%U'
                      current controlfile;

                      release channel c1;
                      release channel c2;
                      }


                      cat DB0DB_RMAN_ARCH_BKP.sh
                      #!/bin/ksh
                      ###########################################################################
                      #
                      # Name: DW0DB_RMAN_ARCH_BKP.ksh
                      #
                      # Purpose : Archivelog backup of DW0DB Database
                      #
                      # Author  : its you
                      #
                      # Created : SEP 02 2009
                      #
                      ##########################################################################
                      #
                      #Set the Environment



                      #Define Variables for the script
                      SCRIPT_TOP=<full path to scripts dir>
                      LOGDIR=<full path to log dir>
                      BKPDIR=<full path to backup dir>
                      LOGFILE=<logfilename>

                      # list the backups
                      echo ''
                      echo "List the existing backups in Backup directory" >> $LOGFILE
                      ls -ltr $BKPDIR >>$LOGFILE

                      # Now run the RMAN backup
                      echo ''
                      echo "Starting archivelog backup of $ORACLE_SID at $RUNDATE " >> $LOGFILE

                      $RMAN target / no catalog @/home/oracle/DBA/JOBS/DW0DB_RMAN_ARCH.rman >> $LOGFILE


                      # Show size of the backup directory area after backup
                      echo ''
                      echo "Available space in Backup directory after backup" >> $LOGFILE
                      df -h $BKPDIR >> $LOGFILE

                      # list the backups there
                      echo ''
                      echo "List the backups in Backup directory" >> $LOGFILE
                      ls -ltr $BKPDIR >>$LOGFILE

                      ## send an email

                      mail -s "RMAN backup completed" <mailid> < /fullpathtologfile/filename.log

                      ##### end of script###############################################






                      cat DW0DB_RMAN_ARCH.rman

                      run {
                      allocate channel c1 type disk;
                      allocate channel c2 type disk;

                      sql 'alter system switch logfile';
                      sql 'alter system switch logfile';
                      sql 'alter system switch logfile';
                      crosscheck archivelog all;

                      backup archivelog all
                      tag DW0DB_FULLBKP
                      format '/bkp/RMAN/DW0DB_BKP/ARCH_DW0DB_set%s_piece%p_%T_%U'
                      filesperset 20;

                      release channel c1;
                      release channel c2;
                      }
                      • 8. Re: RMAN COMMANDS
                        799923
                        backup format '/u05/RMAN/%d_LVL0_%T_%u_s%s_p%p' database; should be
                        backup database format '/u05/RMAN/%d_LVL0_%T_%u_s%s_p%p'
                        it will works,this is one time RMAN configuration, you don't need to include in RMAN script.
                        • 9. Re: RMAN COMMANDS
                          821674
                          im using linux RHEL4.6, is this for linux?
                          • 10. Re: RMAN COMMANDS
                            799923
                            it will works,this is one time RMAN configuration, you don't need to include in RMAN script.

                            Yes.
                            • 11. Re: RMAN COMMANDS
                              Helios-GunesEROL
                              Hi crystal;

                              Firstly you can not use one script to directly on your system. Let us talk about autoconfig script. I am sure its work on his system but u can not use this script on your server directly. Why? Do you have rman catalog on your system?

                              You need to create your own, and dont thing about to parameter coz i never see 2 person use same parameter in Rman backup. For instance i am using;

                              backup archivelog all delete input FORMAT= 'My_arch_%d_%t_%s_%p';
                              backup database plus archivelog delete input format= 'My_DB_%d_%t_%s_%p';

                              Mainly those parameter define to how RMAN will store your backup. You can use many different parameter, so check Hussein Sawwan's post and try to understand concept first!. Those parameter is neccessarty to make understand how RMAN should store those info and how it will use when u are need to make restore.

                              I also suggest use below syntax on your backup sh before you start your backup and end of backup
                              corsscheck archivelog all;
                              CROSSCHECK backup;

                              Regard
                              Helios
                              • 12. Re: RMAN COMMANDS
                                799923
                                Mainly those parameter define to how RMAN will store your backup. You can use many different parameter, so check Hussein Sawwan's post and try to understand concept first!. Those parameter is neccessarty to make understand how RMAN should store those info and how it will use when u are need to make restore.
                                Helios, your absolutely right :) .