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

Thread: RMAN Scripts

  1. #1
    Join Date
    Apr 2001
    Posts
    142

    Talking

    Can anyone tell me how to create RMAN backup/Restore scripts for Oracle 8.1.7 on WinNT and how to run them.

    Thanks


  2. #2
    Join Date
    Aug 2000
    Posts
    52
    Please refer orant\rdbms80\demo\rman

    You will get all the script.

    sanjay

  3. #3
    Join Date
    Feb 2001
    Location
    Bombay,India
    Posts
    530
    Hi,
    I will give u all the steps inorder to use RMAN for ur backups and recovery of database.As u will be knowing that RMAN is a new concept implemented in Oracle 8 to backup and restore ur database.The main advantage of RMAN comes only if u have 2 databases.One database will contain
    RMAN catlog(tables and views used by RMAN to backup and recover ur database) and second database ur target database(of which backup will take place).In my scenario at my place there are 2 databases bscs and test.BSCS database is my primary database and test database is my test database,so
    I will create recovery catalog in test database in order to backup my bscs(primary)database.U dont have to do anything on the primary database,everything has to be done
    on your test database


    1. Create a tablespace for recovery catalog
    create tablespace RMAN_DATA
    datafile 'disk1\data\rmandata01.dbf'
    size 50M;

    2.Create a user for administering recovery cat.
    create user RMAN identified by RMAN
    default tablespace RMAN_DATA
    temporary tablespace TEMP
    quota unlimited on RMAN_DATA;

    3.Grant the RMAN user SYSDBA,SYSOPER roles
    grant sysdba,sysoper to rman;

    4.Grant connect,resource roles to RMAN
    grant connect,resource to RMAN;

    5.Grant recovery_catalog_owner to RMAN
    grant recovery_catalog_owner to RMAN;

    6. Run catrman.sql script as user RMAN


    After completing the above steps run the following command to start RMAN

    RMAN target="sys/sys@bscs521"
    rcvcat="rman/rman@test521"

    U will be getting the RMAN prompt if u have configured correctly.The next step is to register ur target database with RMAN,At this stage all the database schema of the target database gets stored in ur recovery catalog.
    RMAN > register database;

    Now u can take backups of database,tablespace,redo log files,controlfiles including RMAN.I will give u some examples for each one of it using RMAN

    1.To take backup of ur entire database
    RMAN > run
    {
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    backup
    filesperset 5 format 'disk1\backup\fullbackup.bus'
    (database include current controlfile);
    release channel c1;
    release channel c2;
    }

    2. To take backup of tablespace(In RMAN u dont have to put ur tablespace in hot backup mode)

    RMAN > run
    {
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    backup tablespace USERS_DATA;
    filesperset 5 format 'disk1\backup\USERSbackup.bus';
    release channel c1;
    release channel c2;
    }


    3. To take backup of ur controlfile(In RMAN u have to create image copy of ur controlfile and then copy to tape as image copies cannot be directly copied to TAPE)

    RMAN > run
    {
    allocate channel c1 type disk;
    copy
    current controlfile to '/disk2/rman/currentcontrol1204200.ctl';
    release channel c1;
    }

    4. To take backup of ur datafile
    RMAN > run
    {
    allocate channel c1 type disk;
    copy
    datafile 5 to '/disk2/rman/usersdata02.dbf';
    release channel c1;
    }

    5. To take backup of ur redo log files
    RMAN > run
    {
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    backup
    filesperset 5 format 'disk1\backup\archbackup_%d_%s_%p.bus'
    (archivelog);
    release channel c1;
    release channel c2;
    }



    6. TO restore ur database using RMAN
    RMAN > run
    {
    allocate channel c1 type disk;
    allocate channel c2 type disk;
    sql "alter tablespace USERS_DATA offline";
    restore tablespace USERS_DATA;
    recover tablespace USERS_DATA;
    sql "alter tablespace USERS_DATA online";
    release channel c1;
    release channel c2;
    }


    Apart from this u can create scripts and execute them instead of running commands given above.Also u can do incremental and cumulative backups using RMAN.The main advantage of RMAN comes only if u have two databases to manage,U can create on 1 database also but if ur primary database crashes then Recovery Catalog cannot be used to recover the database.If u have any doubts regarding creation and maintaneance of RMAN,please be free to write to me at rohitsn@altavista.com

    Regards,
    Rohit Nirkhe,Oracle DBA,OCP 8i
    rohitsn@altavista.com

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