Configuring Recovery Manager(RMAN)


HOW TO CONNECT RMAN:-
 
[oracle@sujeet ~]$ rman target orcl
 
RMAN> exit
Recovery Manager complete.
 
[oracle@sujeet ~]$ rman target /
 
RMAN> list backup;
 
Using target database control file instead of recovery catalog
 
RMAN> sho all;
RMAN> report need backup;
 
RMAN retention policy will be applied to the command
RMAN retention policy is set to redundancy 1
Report of files with less than 1 redundant backups
File #bkps Name
---- ----- -----------------------------------------------------
1    0     /10g/app/oracle/product/10.2.0/oradata/orcl/system01.dbf
2    0     /10g/app/oracle/product/10.2.0/oradata/orcl/undotbs01.dbf
3    0     /10g/app/oracle/product/10.2.0/oradata/orcl/sysaux01.dbf
4    0     /10g/app/oracle/product/10.2.0/oradata/orcl/users01.dbf
5    0     /10g/app/oracle/product/10.2.0/oradata/orcl/example01.dbf
6    0     /10g/app/oracle/product/10.2.0/oradata/orcl/rman.dbf
 
SQL> startup mount
ORACLE instance started.
 
Total System Global Area  595591168 bytes
Fixed Size                  1220748 bytes
Variable Size             171970420 bytes
Database Buffers          415236096 bytes
Redo Buffers                7163904 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
 
SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     2
Next log sequence to archive   4
Current log sequence           4
 
[oracle@sujeet ~]$ rman target /
 
 
RMAN> backup full database plus archivelog;
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
Finished backup at 29-NOV-11
 
RMAN> backup full database;
 
CHECK BACKUP LOCATION WHERE IT’S STORED FULL PATH:-
 
[oracle@sujeet ~]$ cd /10g/app/oracle/product/10.2.0/db_1/
flash_recovery_area/ORCL/backupset/2011_11_29/
 
[oracle@sujeet 2011_11_29]$ ll
total 1256612
-rw-r----- 1 oracle dba  19016704 Nov 29 10:58 o1_mf_annnn_TAG20111129T105813_7f8vch0t_.bkp
-rw-r----- 1 oracle dba    219648 Nov 29 10:58 o1_mf_annnn_TAG20111129T105853_7f8vdq21_.bkp
-rw-r----- 1 oracle dba   7143424 Nov 29 10:49 o1_mf_ncsnf_TAG20111129T104956_7f8tvx9r_.bkp
-rw-r----- 1 oracle dba   7143424 Nov 29 10:58 o1_mf_ncsnf_TAG20111129T105816_7f8vdnss_.bkp
-rw-r----- 1 oracle dba   7143424 Nov 29 11:02 o1_mf_ncsnf_TAG20111129T110221_7f8vnb5h_.bkp
-rw-r----- 1 oracle dba 622370816 Nov 29 10:58 o1_mf_nnndf_TAG20111129T105816_7f8vcjfn_.bkp
-rw-r----- 1 oracle dba 622436352 Nov 29 11:02 o1_mf_nnndf_TAG20111129T110221_7f8vm65p_.bkp
 
 
 ***How to Set Up a Recovery Catalog*****
 
SQL> create user sujeet identified by sujeet ;
 
User created.
 
SQL> grant connect ,resource,recovery_catalog_owner to sujeet;
Grant succeeded.
 
SQL> create tablespace rtbs datafile'/10g/oracle/product/10.2.0/
oradata/idea/rtbs.dbf' size 10M;
 
Tablespace created.
 
SQL> conn sujeet/sujeet
Connected.
SQL> conn sys / as sysdba
Enter password: 
Connected.
 
[oracle@sujeet db_1]$ rman catalog sujeet/sujeet@idea
 
Recovery Manager: Release 10.2.0.1.0 - Production on Tue Dec 13 08:58:24 2011
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
connected to recovery catalog database
 
RMAN> create catalog;
 
recovery catalog created
 
RMAN> register database;
 
RMAN> BACKUP RECOVERY AREA;
 
RMAN> BACKUP RECOVERY FILES;
 
*****Connection Types with RMAN*****
 
1. Target database
2. Recovery catalog DB
3. Auxiliary database
 
[oracle@sujeet db_1]$ rman target sys/oracle@idea
 
RMAN> exit
 
Recovery Manager complete.
 
[oracle@sujeet db_1]$ rman target / nocatalog
 
Remote Connection:-
To connect from another server, use the Oracle Net service name for the 
target database:
 
[oracle@sujeet]$ rman target sys/target_pwd@idea
 
************Configuring RMAN**********
 
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
 
using target database control file instead of recovery catalog
new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
 
RMAN> CONFIGURE RETENTION POLICY
2> TO RECOVERY WINDOW OF 7 DAYS;
 
new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
new RMAN configuration parameters are successfully stored
 
*********Managing Persistent Settings**********
 
***Use the SHOW command to list current settings:-
 
RMAN> SHOW CONTROLFILE AUTOBACKUP FORMAT;
 
RMAN configuration parameters are:
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
 
RMAN> SHOW EXCLUDE;
 
RMAN configuration parameters are:
RMAN configuration has no stored or default parameters
 
RMAN> SHOW ALL;
 
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
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 '/10g/oracle/product/10.2.0/db_1/
dbs/snapcf_idea.f'; # default
 
 
 
****Use the CLEAR command to reset any persistent**
 
#.setting to its default value:-
 
RMAN> CONFIGURE BACKUP OPTIMIZATION CLEAR;
 
RMAN configuration parameters are successfully reset to default value
 
RMAN> CONFIGURE MAXSETSIZE CLEAR;
 
RMAN configuration parameters are successfully reset to default value
 
RMAN> CONFIGURE DEFAULT DEVICE TYPE CLEAR;
 
RMAN configuration parameters are successfully reset to default value
 
 
****Automatic and Manual Channel Allocation****
 
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO sbt;
 
new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO 'SBT_TAPE';
new RMAN configuration parameters are successfully stored
 
 
RMAN> RUN { 
2> ALLOCATE CHANNEL c1 DEVICE TYPE disk;
3> BACKUP DATAFILE '/10g/oracle/product/10.2.0/oradata/idea
4> /users01.dbf';
5> }
 
allocated channel: c1
channel c1: sid=149 devtype=DISK
 
Starting backup at 13-DEC-11
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00004 name=/10g/oracle/product/10.2.0/oradata/idea/users01.dbf
channel c1: starting piece 1 at 13-DEC-11
channel c1: finished piece 1 at 13-DEC-11
piece handle=/10g/oracle/product/10.2.0/db_1/flash_recovery_area/IDEA/backupset/2011_12_13/o1_mf_nnndf_TAG20111213T093731_7gfmw3l3_.bkp tag=TAG20111213T093731 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-DEC-11
 
Starting Control File and SPFILE Autobackup at 13-DEC-11
piece handle=/10g/oracle/product/10.2.0/db_1/flash_recovery_area/IDEA/autobackup/2011_12_13/o1_mf_s_769772252_7gfmw54c_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 13-DEC-11
released channel: c1
 
 
****Channel Control Options*****
 
• Configure parallelism:-
 
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
 
• Specify the maximum backup piece size:-
 
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK
2> MAXPIECESIZE 2G;
 
 
 
 
• Format the name of generated backup files:-
 
RMAN> RUN {
2> ALLOCATE CHANNEL d1 DEVICE TYPE DISK
3> FORMAT '/10g/backups/%U';
4> BACKUP DATABASE PLUS ARCHIVELOG;}
 
 
RMAN: - Recovery Manager
EM: - Enterprise Manager
 
 
***********************************************************************
             Using Recovery Manager
***********************************************************************
 
 
Types of RMAN Commands:-

You can issue two basic types of RMAN commands: 
 
1. Stand-alone:-
Some of the stand-alone commands are:
CHANGE
CONNECT
CREATE CATALOG, RESYNC CATALOG
CREATE SCRIPT, DELETE SCRIPT, REPLACE SCRIPT
 
2. Job commands:-
 
Job commands appear inside a RUN command block:-

RMAN> RUN {
BACKUP AS BACKUPSET
FORMAT '/u01/db01/backup/%d_%s_%p'
DURATION 10:00 MINIMIZE LOAD
(DATABASE);
SQL 'alter system archive log current';
}
BACKUP Command:-
 
RMAN> BACKUP AS BACKUPSET
FORMAT '/BACKUP/df_%d_%s_%p.bus'
TABLESPACE hr_data;

Parallelization of Backup Sets:-
You can configure parallel backups by setting the PARALLELISM option of the CONFIGURE command to greater than 1 or by manually allocating multiple channels. RMAN parallelizes its operation and writes multiple backup sets in parallel. The server sessions divide the work of backing up the specified files.




Example
RMAN> RUN {
ALLOCATE CHANNEL c1 DEVICE TYPE sbt;
ALLOCATE CHANNEL c2 DEVICE TYPE sbt;
ALLOCATE CHANNEL c3 DEVICE TYPE sbt;
BACKUP
INCREMENTAL LEVEL = 0
FORMAT '/disk1/backup/df_%d_%s_%p.bak'
 (DATAFILE 1,4,5 CHANNEL c1)
 (DATAFILE 2,3,9 CHANNEL c2)
 (DATAFILE 6,7,8 CHANNEL c3);
ALTER SYSTEM ARCHIVE LOG CURRENT;
}
 
 
When backing up data files, you can specify the files to be backed up by either their path nameor their file number. For example, the following two commands perform the same action:-

RMAN> BACKUP DEVICE TYPE sbt DATAFILE '/home/oracle/system01.dbf';
 
RMAN> BACKUP DEVICE TYPE sbt DATAFILE 1;
 
Compressed Backups:-
 
RMAN> BACKUP AS
2> COMPRESSED BACKUPSET
3> DATABASE;
 
 
RMAN> CONFIGURE DEVICE TYPE
2> DISK PARALLELISM 2
3> BACKUP TYPE TO
4> COMPRESSED BACKUPSET;
NOTE:-By default, compression is disabled.
 
Image Copy:-
 
RMAN> BACKUP AS COPY
2> DATAFILE '/ORADATA/users_01_db01.dbf'
3> FORMAT '/BACKUP/users01.dbf';


RMAN> BACKUP AS COPY
4> ARCHIVELOG LIKE 'arch_1060.arc'
5> FORMAT 'arch_1060.bak';
 
 
RMAN> RUN {
2> ALLOCATE CHANNEL c1 type disk;
3> COPY
4> DATAFILE '/ORADATA/users_01_db01.dbf' to
5> '/BACKUP/users01.dbf',
6> ARCHIVELOG 'arch_1060.arc' to
7> 'arch_1060.bak';
8> }
Backing Up Archived Redo Logs:-
 
RMAN> BACKUP
2> FORMAT '/disk1/backup/ar_%t_%s_%p'
3> ARCHIVELOG FROM SEQUENCE=234
4> DELETE INPUT;
 
Whole Database Backup:-

RMAN> BACKUP DATABASE
PLUS ARCHIVELOG;
 
• To perform an incremental backup at level 0, use the following command:

RMAN> BACKUP INCREMENTAL LEVEL 0 DATABASE;

• To perform a differential incremental backup, use the following command:

RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE;

• To perform a cumulative incremental backup, use the following command:
 
RMAN> BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;
Enabling Block Change Tracking:-

SQL> ALTER DATABASE ENABLE
2> BLOCK CHANGE TRACKING
3> USING FILE '/mydir/rman_change_track.f'
4> REUSE;
 
 
SQL> ALTER DATABASE ENABLE BLOCK CHANGE TRACKING;
SQL> ALTER DATABASE DISABLE BLOCK CHANGE TRACKING;
 
List backup sets and copies of data files:-

RMAN> LIST BACKUP OF DATAFILE
2> "/db01/ORADATA/u03/users01.dbf";

RMAN> LIST BACKUP OF DATABASE;

• List backup sets and copies of any data file for a specified tablespace:-
RMAN> LIST COPY OF TABLESPACE "SYSTEM";

• List backup sets and copies containing archive logs for a specified range:-
RMAN> LIST COPY OF DATABASE ARCHIVELOG
2> FROM TIME='SYSDATE-7';
 
REPORT Command:-

With this command, you can analyze information in the RMAN repository in more detail.
Reports can be produced for a variety of questions,
RMAN> REPORT SCHEMA;

• Which files need to be backed up?
RMAN> REPORT NEED BACKUP ...;

• Which backups can be deleted (that is, are obsolete)?
RMAN> REPORT OBSOLETE;

• Which files are not recoverable because of unrecoverable operations?
RMAN> REPORT UNRECOVERABLE ...;
 
. To report files that need three or more incremental backups for recovery:-
 
   RMAN > REPORT NEED BACKUP incremental 3 database;
 
. To report what system files have not been backed up for three days:-
 
RMAN > REPORT NEED BACKUP days 3 tablespace system;
 
RMAN> REPORT NEED BACKUP incremental 3;
 
RMAN> REPORT NEED BACKUP redundancy 2;
 
 
RMAN> REPORT NEED BACKUP recovery window of 3 days;
 
RMAN> REPORT NEED BACKUP days 3;
REPORT OBSOLETE and DELETE OBSOLETE:-
 
 
Find all recovery files that are deemed obsolete according to the current retention policy settings:-
 
RMAN> REPORT OBSOLETE;
 
List the obsolete recovery files, if no more than two backup copies are needed:-
 
RMAN> REPORT OBSOLETE REDUNDANCY 2;
 
 
Delete the backup set with a backup set key of 4:-
 
RMAN> DELETE BACKUPSET 4;
 
 
Delete the recovery files considered obsolete, because they have more than two backups:-
 
RMAN> DELETE OBSOLETE REDUNDANCY 2;

No comments:

SHRD0014: GLLEZL - process exiting with failure

  SYMPTOMS Journal Import completes with the following error: Error ------ ORA-01653 : unable to extend table GL.GL_IMPORT_REFERENCES ORA-01...