Friday, August 9, 2013

0 Oracle Backup/Restore (2) RMAN - Backup

RMAN – Recovery Manager

  • Backup is happen on the data block level. It can save time and space. Would detect the HWM on the file and do not backup data block higher the HWM.
  • Compression
  • Can detect the bad data block
  • Backup Level 0-5. 0 is Full backup.  1-5 can be differential or incremental .

 

RMAN Catalog

-- Create tablepsace to hold repository
CREATE TABLESPACE RMAN
DATAFILE '/u01/app/oracle/oradata/oracledb1/RMAN01.DBF' SIZE 50M REUSE
AUTOEXTEND ON NEXT 64K MAXSIZE 32767M
EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO;
 
-- Create rman schema owner
CREATE USER rman IDENTIFIED BY rman
TEMPORARY TABLESPACE temp 
DEFAULT TABLESPACE rman 
QUOTA UNLIMITED ON rman;
 
GRANT connect, resource, recovery_catalog_owner TO rman;

image

rman catalog username/passowrd@SID target username/password@SID

  • If SID is not provided, it use the current $ORACLE_SID
  • Catalog’s username name and password is the one we create in the above.
  • In below screenshot, we only connect to the catalog

image

In below screenshot,  we connect to the $ORACLE_SID database and catalog and then register database.

image

Backup database

backup database; 
backup database plus archivelog;

image

Here is the screenshot of the backup database plus archivelog

image

Backup tablespace

backup tablespace <TABLESPACE NAME>
backup tablepsace exmple;

image

Backup data file

backup datafile [datafile path] 
backup datafile '/u01/app/oracle/oradata/oracledb1/example01.dbf';

image

 

Backup control file

 backup current controlfile;

image

 

Differential Incremental backup

  • Incremental backup would only backup the changed block since the last level 0 incremental backup.
  • If there is no level 0 incremental backup. RMAN will first create level 0 and then create the level 1 backup.
  • Oracle would not use the FULL backup as base (parent ) for increment backup ( level 1).
  • The level 1 backup would only backup the changes since last level 0 or level 1 backup.
 backup incremental level 1 database;

image

Cumulative Incremental backup

RMAN can also backup Cumulative backup base on the last level 0 backup.

 

BACKUP INCREMENTAL LEVEL 1 CUMULATIVE database

image

List backup

# Show all backup 
list backup;
 
# Show/Delete items not needed for recovery
report obsolete;
delete obsolete;
image

 

image

0 comments:

Post a Comment

 

SQL Panda Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates