Rman Document

July 11, 2017 | Author: santababu | Category: Backup, Databases, Computer File, Information Retrieval, Information Technology Management
Share Embed Donate


Short Description

Details about RMAN configuration and backup senario....

Description

RMAN KEY FEATURES  RMAN, Recovery Manager, is a tool to backup, restore and recover Oracle databases  Can store frequently executed commands as scripts, independent of OS  Empty blocks are not copied  Provides incremental backup feature to copy only changed blocks  Can deduct block corruption while taking backup  Parallelize operation to reduce backup time  Can reduce reads per file, thus minimizing impact to database performance CONFIGURING TARGET DATABASE  CONNECTING TO THE TARGET DATABASE  SSh –X oracle10g @ 10.1.15.91  CREATING LISTENER  Go to netmgr and add a listener  CREATING CONNECTION DESCRIPTOR  Add a connection descriptor in netmgr(con_tar)  STARTING LISTENER  Start listener using lsnrctl

CONFIGURING CATALOG DATABASE  CREATE LISTENER o Go to netmgr and add a listener  CREATING CONNECTION DESCRIPTOR o Add a connection descriptor in netmgr(con_cat)  STARTING LISTENER o Start listener using lsnrctl

CREATING CATALOG USER BEFORE CREATING THE CATALOG USER WE WANT TO CREATE A CATALOG TABLESPACE TO HOLD THE CATALOG Create tablespace cat_tbs Datafile ‘/home/oracle/product/10.2.0/oradata/cat_tbs.dbf’ size 100m Create user cat identified by cat Default tablespace cat_tbs Temporary tablespace temp Quota unlimited on cat_tbs Grant connect,resource to cat Grant recovery_catalog_owner to cat

STEPS TO BE FOLLOWED BEFORE CONNECTING  Database should be in archive log mode  Listeners should be started in both the target and catalog database  Recovery catalog database should be always up and running  Target database should be in the mount phase (to read control files)

CONNECTING THROUGH RMAN  $ RMAN  RMAN > Connect target sys/[email protected]_tar  RMAN > Connect catalog cat/[email protected]_cat  RMAN > Create catalog tablespace cat_tbs  RMAN > Register database

CONFIGURING RMAN FOR BACKUP

RMAN> show all; RMAN configuration parameters are: CONFIGURE RETENTION POLICY TO REDUNDANCY 2; CONFIGURE BACKUP OPTIMIZATION OFF; # default CONFIGURE DEFAULT DEVICE TYPE TO DISK; CONFIGURE CONTROLFILE AUTOBACKUP ON; CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/%F;# default CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # default CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/bkp/rman/backup %d_S_%s_P_%p_T_%t'; CONFIGURE MAXSETSIZE TO UNLIMITED; # default

CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/9.2.0/dbs/snapcf_ORA920.f'; # default

RMAN Backup Types  Full backup of a data file that includes every allocated block in the file being backed up  Incremental level 0 –Backup of every block except blocks compressed out Level 1- includes blocks that have been changed since the parent backup was taken.  Open A backup of online, read/write datafiles when the database is open.  Closed A backup of any part of the target database when it is mounted but not open. Closed backups can be consistent or inconsistent.  Consistent Backup taken when the database is mounted (but not in open),after proper shutdown.checkpoint SCNs in the datafile headers match the header information in the control file.  Inconsistent A backup of any part of the target database when it is open or when a crash occurred or SHUTDOWN ABORT was run prior to mounting.An inconsistent backup requires recovery to become consistent.

Various backup using RMAN Backing up Entire Database rman target sys/[email protected]_tar catalog cat/[email protected]_cat RMAN>backup database; ( will backup data file , control file) Backing up the archived logs RMAN>backup archivedlog : (will backup all archivedlog which haven’t backedup before) RMAN>backup database plus archivedlog ; (Will backup data file+Archived log) Backing up control file : RMAN>backup current controlfile; ( will backup current contolfile). Backingup tablespace : RMAN>backup tablespace ; (will backup tablespace DB should be in archivelogmode) Backing datafile: RMAN>backup datafile ‘/’; It will backup datafile in Flash Recovery Area/we can specify a path

INCREMENTAL BACKUPS • • • • •

• •

• •

An incremental backup at level n, n > 0, copies only changed blocks since previous incremental backup whose level 0, copies all changed blocks since previous incremental backup whose level < n Incremental backup is useful when the database is very large Cumulative incremental is useful to reduce database down time during recovery

Example of cumulative incremental backup

In a cumulative level 1 backup, RMAN backs up all the blocks used since the most recent level 0 incremental backup. Cumulative incremental backups reduce the work needed for a restore by ensuring that you only need one incremental backup from any particular level. Cumulative backups require more space and time than differential backups, however, because they duplicate the work done by previous backups at the same level. The following command performs a cumulative level 1 incremental backup of the database: RMAN>BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;

Example of differential incremental backup

In a differential level 1 backup, RMAN backs up all blocks that have changed since the most recent cumulative or differental incremental backup, whether at level 1 or level 0. RMAN determines which level 1 backup occurred most recently and backs up all blocks modified after that backup. If no level 1 is available, RMAN copies all blocks changed since the level 0 backup. The following command performs a level 1 differential incremental backup of the database:

RMAN> BACKUP INCREMENTAL LEVEL 1 differential DATABASE;

Recovery Decide your scenario  Lost controlfile  Lost datafile  Lost entire database

Restore • • • • •

Restore database - Restores entire database including controlfile Restore datafile - Restores specific datafiles Restore tablespace - Restores all datafiles belongs to tablespace. Restore controlfile - Restores only controlfile Restore archivelog all - Restores all archivelog files.

RECOVER If restore completed successfully then following command can be executed based on the recovery scenario. – – – – – – –

Recover database - Recovering entire database Recover datafile - Recovering specific datafiles recover tablespace - Recovering all datafiles belongs to the tablespace recover database until cancel - Recovering database until canel recover database until time = - Until time recover database until SCN = - Until Specific SCN recover database until SEQUENCE = - Until specific sequence

SQL> select file#, error, online_status, change#, time from v$recover_file; Will give details details about the files you need to restore and recover

SCENARIOS Scenario 1 Recover full database Need to recover full database including controlfile, If we have backup then we can start recovery. Rman RMAN RMAN RMAN RMAN

> Connect target sys/[email protected]_tar > connect catalog cat/[email protected]_cat > startup nomount > run { restore database; alter database mount; recover database; }

Scenario 2 Recover Lost controlfile •



Target database Shut abort Startup nomount Connect to rman catalog and target database

RMAN > run { Restore controlfile; alter database mount; recover database; alter database open resetlogs; }

Scenario 3 Recover lost datafile RMAN> RUN { alter tablespace sysaux offline; restore datafile ‘/home/oracle10g/data/sysaux1.dbf'; recover datafile ‘/home/oracle10g/data/sysaux1.dbf'; alter tablespace sysaux online }

Scenario 4 Recover lost tablespace RMAN>run { alter tablespace sysaux offline restore tablespace sysaux recover tablespace sysaux alter tablespace sysaux online }

Sandeep kumar Sinha Sembiyan.v Email-- [email protected] [email protected]

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF