rman Basic Commands

Those are very basic rman Commands. For local Database, you can connect this way and for other Databases, provide proper connection credentials.



C:\>rman target /

Recovery Manager: Release 10.2.0.1.0 - Production on Mon Apr 2 09:01:28 2012

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

connected to target database: ORCL1 (DBID=1163774759)

RMAN>

To list rman parameters, use this following command .


RMAN> show all;

using target database control file instead of recovery catalog
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'G:\ORACLE\PRODUCT\10.2.0\DB_2\DATABASE\SNCFORCL1.ORA'; # default


You can alter rman parameters this way.



RMAN> configure retention policy to redundancy 2;

new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
new RMAN configuration parameters are successfully stored



RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO 'G:\ORACLE\PRODUCT\10.2.0\DB_2\DATABASE\SNCFORCL1.ORA'; # default


RMAN> configure retention policy clear;

old RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
RMAN configuration parameters are successfully reset to default value


For plain backup


RMAN> backup database;

Starting backup at 02-APR-12
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=141 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\SYSTEM01.DBF
input datafile fno=00003 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\SYSAUX01.DBF
input datafile fno=00005 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\EXAMPLE01.DBF
input datafile fno=00002 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\UNDOTBS01.DBF
input datafile fno=00004 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 02-APR-12
channel ORA_DISK_1: finished piece 1 at 02-APR-12
piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NNNDF_TAG20120402T091646_7QMN7HBQ_.BKP tag=TAG20120402T091646 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 02-APR-12
channel ORA_DISK_1: finished piece 1 at 02-APR-12
piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NCSNF_TAG20120402T091646_7QMN98F5_.BKP tag=TAG20120402T091646 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05
Finished backup at 02-APR-12



For listing backups



RMAN> list backup;

using target database control file instead of recovery catalog

List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
1       Full    6.80M      DISK        00:00:03     02-APR-12
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20120402T091013
        Piece Name: G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NCSNF_TAG20120402T091013_7QMMV898_.BKP
  Control File Included: Ckp SCN: 669123       Ckp time: 02-APR-12
  SPFILE Included: Modification time: 02-APR-12

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
2       Full    595.50M    DISK        00:00:51     02-APR-12
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20120402T091646
        Piece Name: G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NNNDF_TAG20120402T091646_7QMN7HBQ_.BKP
  List of Datafiles in backup set 2
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 669473     02-APR-12 G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\SYSTEM01.DBF
  2       Full 669473     02-APR-12 G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\UNDOTBS01.DBF
  3       Full 669473     02-APR-12 G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\SYSAUX01.DBF
  4       Full 669473     02-APR-12 G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\USERS01.DBF
  5       Full 669473     02-APR-12 G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\EXAMPLE01.DBF

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3       Full    6.80M      DISK        00:00:03     02-APR-12
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20120402T091646
        Piece Name: G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NCSNF_TAG20120402T091646_7QMN98F5_.BKP
  Control File Included: Ckp SCN: 669498       Ckp time: 02-APR-12
  SPFILE Included: Modification time: 02-APR-12

For incremental backups



RMAN> backup incremental level 0 database;

Starting backup at 03-APR-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=143 devtype=DISK
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\SYSTEM01.DBF
input datafile fno=00003 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\SYSAUX01.DBF
input datafile fno=00005 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\EXAMPLE01.DBF
input datafile fno=00002 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\UNDOTBS01.DBF
input datafile fno=00004 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 03-APR-12
channel ORA_DISK_1: finished piece 1 at 03-APR-12
piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NNND0_TAG20120403T032620_7QON2G7T_.BKP tag=TAG20120403T032620 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
channel ORA_DISK_1: starting incremental level 0 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 03-APR-12
channel ORA_DISK_1: finished piece 1 at 03-APR-12
piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NCSN0_TAG20120403T032620_7QON46OH_.BKP tag=TAG20120403T032620 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 03-APR-12

RMAN> backup incremental level 1 database;

Starting backup at 03-APR-12
using channel ORA_DISK_1
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00001 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\SYSTEM01.DBF
input datafile fno=00003 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\SYSAUX01.DBF
input datafile fno=00005 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\EXAMPLE01.DBF
input datafile fno=00002 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\UNDOTBS01.DBF
input datafile fno=00004 name=G:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL1\USERS01.DBF
channel ORA_DISK_1: starting piece 1 at 03-APR-12
channel ORA_DISK_1: finished piece 1 at 03-APR-12
piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NNND1_TAG20120403T034948_7QOOGFSD_.BKP tag=TAG20120403T034948 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting incremental level 1 datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current control file in backupset
including current SPFILE in backupset
channel ORA_DISK_1: starting piece 1 at 03-APR-12
channel ORA_DISK_1: finished piece 1 at 03-APR-12
piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NCSN1_TAG20120403T034948_7QOOH8WB_.BKP tag=TAG20120403T034948 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 03-APR-12

To retrieve and delete obsolete backups.



RMAN> report obsolete;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of obsolete backups and copies
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           1      02-APR-12
  Backup Piece       1      02-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NCSNF_TAG20120402T091013_7QMMV898_.BKP
Backup Set           2      02-APR-12
  Backup Piece       2      02-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NNNDF_TAG20120402T091646_7QMN7HBQ_.BKP
Backup Set           3      02-APR-12
  Backup Piece       3      02-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NCSNF_TAG20120402T091646_7QMN98F5_.BKP
Backup Set           5      03-APR-12
  Backup Piece       5      03-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NCSN0_TAG20120403T032620_7QON46OH_.BKP




RMAN> delete obsolete;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           1      02-APR-12
  Backup Piece       1      02-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NCSNF_TAG20120402T091013_7QMMV898_.BKP
Backup Set           2      02-APR-12
  Backup Piece       2      02-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NNNDF_TAG20120402T091646_7QMN7HBQ_.BKP
Backup Set           3      02-APR-12
  Backup Piece       3      02-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NCSNF_TAG20120402T091646_7QMN98F5_.BKP
Backup Set           5      03-APR-12
  Backup Piece       5      03-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NCSN0_TAG20120403T032620_7QON46OH_.BKP

Do you really want to delete the above objects (enter YES or NO)? yes
deleted backup piece
backup piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NCSNF_TAG20120402T091013_7QMMV898_.BKP recid=1 stamp=779533816
deleted backup piece
backup piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NNNDF_TAG20120402T091646_7QMN7HBQ_.BKP recid=2 stamp=779534207
deleted backup piece
backup piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_02\O1_MF_NCSNF_TAG20120402T091646_7QMN98F5_.BKP recid=3 stamp=779534264
deleted backup piece
backup piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NCSN0_TAG20120403T032620_7QON46OH_.BKP recid=5 stamp=779599638
Deleted 4 objects



RMAN> delete noprompt obsolete;

RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
using channel ORA_DISK_1
Deleting the following obsolete backups and copies:
Type                 Key    Completion Time    Filename/Handle
-------------------- ------ ------------------ --------------------
Backup Set           4      03-APR-12
  Backup Piece       4      03-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NNND0_TAG20120403T032620_7QON2G7T_.BKP
Backup Set           6      03-APR-12
  Backup Piece       6      03-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NNND1_TAG20120403T034948_7QOOGFSD_.BKP
Backup Set           7      03-APR-12
  Backup Piece       7      03-APR-12          G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NCSN1_TAG20120403T034948_7QOOH8WB_.BKP
deleted backup piece
backup piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NNND0_TAG20120403T032620_7QON2G7T_.BKP recid=4 stamp=779599582
deleted backup piece
backup piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NNND1_TAG20120403T034948_7QOOGFSD_.BKP recid=6 stamp=779600989
deleted backup piece
backup piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NCSN1_TAG20120403T034948_7QOOH8WB_.BKP recid=7 stamp=779601016
Deleted 3 objects




RMAN> crosscheck backupset;

using channel ORA_DISK_1
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NNND0_TAG20120403T035827_7QOOYMSD_.BKP recid=8 stamp=779601507
crosschecked backup piece: found to be 'EXPIRED'
backup piece handle=G:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\ORCL1\BACKUPSET\2012_04_03\O1_MF_NCSN0_TAG20120403T035827_7QOP0DWB_.BKP recid=9 stamp=779601564
Crosschecked 2 objects


Thanks
A Rahim Khan

Advertisements
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: