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

Thread: rman backup script suggestion

  1. #1
    Join Date
    Aug 2008
    Posts
    123

    rman backup script suggestion

    Hi all,

    Bellow i have backup script but i want to know how can i run in one script?

    setenv TNS_ADMIN "/location/network/admin"
    setenv ORACLE_HOME "/location/db1"
    setenv TWO_TASK "DB1"
    setenv ORACLE_SID "DB1"
    rman run {
    # Shutdown database for backups and put into MOUNT mode
    shutdown immediate
    startup mount
    # Allocate channel. Important: This must be done after
    # database has been mounted!!!
    allocate channel t1 DEVICE TYPE DISK FORMAT '/backuplocation/DB1RMAN/%U' ;
    # Perform full database backup
    backup Database format '/backuplocation/DB1RMAN/%d_FULL_%U.bck';
    # Open database after backup complete
    sql 'alter database open';
    backup current controlfile;
    sql 'ALTER DATABASE BACKUP CONTROLFILE TO TRACE';
    release channel t1;
    }

  2. #2
    Join Date
    May 2002
    Posts
    2,645
    You mean like put it in a shell script?

  3. #3
    Join Date
    Aug 2008
    Posts
    123
    yes

  4. #4
    Join Date
    Jul 2006
    Posts
    195
    Here is your script. This backs up the DB GOLD_PRI and I keep the catalog
    in GOLD_CAT. You will need to change to suit your needs.

    Not sure as to why your shutting down and starting up your DB. One of the
    major advantages is that RMAN allows you to back up the DB, while still
    running.

    #!/bin/ksh



    rman < connect target sys/sys@GOLD_PRI
    connect catalog rman/rman@GOLD_CAT

    CROSSCHECK BACKUP DEVICE TYPE DISK;
    CROSSCHECK ARCHIVELOG ALL;
    run {
    SQL 'alter system switch logfile';


    backup tag='FullBkup' FULL DATABASE
    FILESPERSET 2 DATABASE
    INCLUDE CURRENT CONTROLFILE
    PLUS ARCHIVELOG DELETE INPUT;

    }

    DELETE NOPROMPT EXPIRED BACKUP;
    DELETE NOPROMPT OBSOLETE;

    EOF


    Good Luck

  5. #5
    Join Date
    Nov 2000
    Location
    Pittsburgh, PA
    Posts
    4,166
    You should start by not using tcsh for scripting. you should probably use bash instead of korn shell. However, at a glance it seems that your script has all of the minimum requirements of doing a warm backup of a database that is not in archive log mode. You should verify that you have the following parameter set appropriately for you environment.

    "configure retention policy to recovery window of ${RETENTION} days;"

  6. #6
    Join Date
    May 2011
    Posts
    25
    does this script run as oracle or root?
    can it backup oracle 8i database?
    how do you set the SID? i have 4 of them.

    then how do you do a restore to 11gr1?

  7. #7
    Join Date
    Jul 2002
    Location
    Lake Worth, FL
    Posts
    1,492
    Quote Originally Posted by fbifido View Post
    does this script run as oracle or root?
    can it backup oracle 8i database?
    how do you set the SID? i have 4 of them.

    then how do you do a restore to 11gr1?
    You cannot use 8i backup to restore to 11g database.
    "The person who says it cannot be done should not interrupt the person doing it." --Chinese Proverb

  8. #8
    Join Date
    May 2011
    Posts
    25
    i was told that exp is not a backup, but rman can be use to do a backup.

    so how about this, from example above:

    export ORACLE_HOME=/u01/app/oracle/product/8.1.7/db_1
    export TNS_ADMIN=$ORACLE_HOME/network/admin
    export TWO_TASK=DCTEST # <- i don't know this one
    export ORACLE_SID=DCTEST
    export BACKUP_DEST=/u02/oradata/backup/$ORACLE_SID

    rman run {
    allocate channel t1 DEVICE TYPE DISK FORMAT '$BACKUP_DEST/%U' ;
    # Perform a full backup
    backup [ALL or FULL] format '$BACKUP_DEST/%d_FULL_%U.bck';
    release channel t1;
    }

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