Difference between revisions of "RMAN Catalog Configuration"

From Ittichai Chammavanijakul's Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
== RMAN Catalog Configuration ==
 
== RMAN Catalog Configuration ==
  
1) Create tablespace for RMAN repository
+
1) Create tablespace for RMAN catalog.
 
<pre>
 
<pre>
 
create tablespace rman_tbs
 
create tablespace rman_tbs
Line 15: Line 15:
 
</pre>
 
</pre>
  
3) Grant privileges to the RMAN Repository owner.
+
3) Grant privileges to the RMAN catalog owner.
 
<pre>
 
<pre>
 
grant connect, resource, recovery_catalog_owner to rman_user;
 
grant connect, resource, recovery_catalog_owner to rman_user;
 
</pre>
 
</pre>
  
4) Create catalog.
+
4) Create a RMAN catalog.
 
<pre>
 
<pre>
 
rman catalog rman_user/rman_user
 
rman catalog rman_user/rman_user
create catalog;
+
create catalog tablespace rman_tbs;
 
</pre>
 
</pre>
  
 
5) Now you Register the database with RMAN catalog.
 
5) Now you Register the database with RMAN catalog.
 +
<pre>
 +
$ rman
 +
 +
Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 9 11:32:04 2012
 +
 +
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
 +
 +
RMAN> connect target /
 +
 +
connected to target database: ORA11GR2 (DBID=99935947)
 +
 +
RMAN> connect catalog rman_user/rman_user@RMANDB
 +
 +
connected to recovery catalog database
 +
 +
RMAN> register database;
 +
 +
database registered in recovery catalog
 +
starting full resync of recovery catalog
 +
full resync complete
 +
 +
RMAN> show all;
 +
 +
RMAN configuration parameters for database with db_unique_name ORA11GR2 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 COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
 +
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
 +
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_ORA11GR2.f'; # default
 +
 +
<pre>
 +
 +
* Verification
 +
RMAN_USERSQL> select * from rc_database;
 +
 +
    DB_KEY  DBINC_KEY     DBID NAME   RESETLOGS_CHANGE# RESETLOGS
 +
---------- ---------- ---------- -------- ----------------- ---------
 +
1     2 99935947 ORA11GR2   1 15-MAY-12
  
[[Category: Oracle_Database]]
+
* Test backup
 +
<pre>
 +
RMAN> configure channel device type disk format '/u01/ORA11GR2/backup/ORA11GR2_%U.dbf';
 +
 
 +
new RMAN configuration parameters:
 +
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT  '/u01/ORA11GR2/backup/ORA11GR2_%U.dbf';
 +
new RMAN configuration parameters are successfully stored
 +
starting full resync of recovery catalog
 +
full resync complete
 +
 
 +
RMAN> show all;
 +
RMAN configuration parameters for database with db_unique_name ORA11GR2 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 CHANNEL DEVICE TYPE DISK FORMAT  '/home/oracle/Downloads/ORA11GR2_%U.dbf';
 +
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
 +
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
 +
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
 +
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
 +
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
 +
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_ORA11GR2.f'; # default
 +
</pre>
 +
 
 +
* Others
 +
<pre>
 +
RMAN> configure default device type to disk;
 +
RMAN> configure device type disk parallelism 2 backup type to copy;
 +
RMAN> configure retention policy to recovery window of 7 days;
 +
RMAN> configure backup optimization on;
 +
 
 +
RMAN> report schema;
 +
</pre>
 +
 
 +
* Convert database to archive log mode if not already done so.
 +
<pre>
 +
 
 +
SQL> archive log list;
 +
Database log mode       No Archive Mode
 +
Automatic archival       Disabled
 +
Archive destination       /u01/app/oracle/product/11.2.0/db_1/dbs/arch
 +
Oldest online log sequence    69
 +
Current log sequence       71
 +
 
 +
SQL> shutdown immediate
 +
Database closed.
 +
Database dismounted.
 +
ORACLE instance shut down.
 +
 
 +
SQL> startup mount
 +
ORACLE instance started.
 +
 
 +
Total System Global Area  601272320 bytes
 +
Fixed Size     2230712 bytes
 +
Variable Size   180356680 bytes
 +
Database Buffers   415236096 bytes
 +
Redo Buffers     3448832 bytes
 +
Database mounted.
 +
 
 +
SQL> alter database archivelog;
 +
Database altered.
 +
 
 +
SQL> alter database open;
 +
Database altered.
 +
 
 +
SQL> archive log list;
 +
Database log mode       Archive Mode
 +
Automatic archival       Enabled
 +
Archive destination       /u01/app/oracle/product/11.2.0/db_1/dbs/arch
 +
Oldest online log sequence    69
 +
Next log sequence to archive  71
 +
Current log sequence       71
 +
 
 +
SQL> alter system set log_archive_dest_1='location=/u01/ORA11GR2/backup/';
 +
 
 +
System altered.
 +
 
 +
** The LOG_ARCHIVE_DEST is for LOCAL destination only. Its duplex is LOG_ARCHIVE_DUPLEX_DEST.
 +
** The LOG_ARCHIVE_DEST_n parameter can be set to LOCAL or REMOTE. This is preferred method.
 +
 
 +
SQL> archive log list
 +
Database log mode       Archive Mode
 +
Automatic archival       Enabled
 +
Archive destination       /u01/ORA11GR2/backup
 +
Oldest online log sequence    69
 +
Next log sequence to archive  71
 +
Current log sequence       71
 +
 
 +
</pre>
 +
 
 +
* Test backup
 +
<pre>
 +
RMAN> backup database;
 +
 
 +
Starting backup at 09-JUN-12
 +
allocated channel: ORA_DISK_1
 +
channel ORA_DISK_1: SID=45 device type=DISK
 +
channel ORA_DISK_1: starting full datafile backup set
 +
channel ORA_DISK_1: specifying datafile(s) in backup set
 +
input datafile file number=00001 name=+DG1/ora11gr2/datafile/system.260.783364449
 +
input datafile file number=00003 name=+DG1/ora11gr2/datafile/undotbs1.262.783364525
 +
input datafile file number=00002 name=+DG1/ora11gr2/datafile/sysaux.261.783364493
 +
input datafile file number=00004 name=+DG1/ora11gr2/datafile/users.264.783364547
 +
input datafile file number=00005 name=+DG1/fda1_01.dbf
 +
channel ORA_DISK_1: starting piece 1 at 09-JUN-12
 +
channel ORA_DISK_1: finished piece 1 at 09-JUN-12
 +
piece handle=/u01/ORA11GR2/backup/ORA11GR2_05nd44p1_1_1.dbf tag=TAG20120609T154953 comment=NONE
 +
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:36
 +
channel ORA_DISK_1: starting full datafile backup set
 +
channel ORA_DISK_1: specifying datafile(s) in backup set
 +
including current control file in backup set
 +
including current SPFILE in backup set
 +
channel ORA_DISK_1: starting piece 1 at 09-JUN-12
 +
channel ORA_DISK_1: finished piece 1 at 09-JUN-12
 +
piece handle=/u01/ORA11GR2/backup/ORA11GR2_06nd44s1_1_1.dbf tag=TAG20120609T154953 comment=NONE
 +
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
 +
Finished backup at 09-JUN-12
 +
 
 +
</pre>

Revision as of 15:58, 9 June 2012

RMAN Catalog Configuration

1) Create tablespace for RMAN catalog.

create tablespace rman_tbs
datafile '+DG1' size 100M autoextend on;

2) Create RMAN owner user.

create user rman_user 
identified by rman_user
default tablespace rman_tbs
temporary tablespace temp;

3) Grant privileges to the RMAN catalog owner.

grant connect, resource, recovery_catalog_owner to rman_user;

4) Create a RMAN catalog.

rman catalog rman_user/rman_user
create catalog tablespace rman_tbs;

5) Now you Register the database with RMAN catalog.

$ rman

Recovery Manager: Release 11.2.0.3.0 - Production on Sat Jun 9 11:32:04 2012

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

RMAN> connect target /

connected to target database: ORA11GR2 (DBID=99935947)

RMAN> connect catalog rman_user/rman_user@RMANDB

connected to recovery catalog database

RMAN> register database;

database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN> show all;

RMAN configuration parameters for database with db_unique_name ORA11GR2 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 COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_ORA11GR2.f'; # default

<pre>

* Verification
RMAN_USERSQL> select * from rc_database;

    DB_KEY  DBINC_KEY	    DBID NAME	  RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
	 1	    2	99935947 ORA11GR2		  1 15-MAY-12

* Test backup
<pre>
RMAN> configure channel device type disk format '/u01/ORA11GR2/backup/ORA11GR2_%U.dbf';

new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT   '/u01/ORA11GR2/backup/ORA11GR2_%U.dbf';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN> show all;
RMAN configuration parameters for database with db_unique_name ORA11GR2 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 CHANNEL DEVICE TYPE DISK FORMAT   '/home/oracle/Downloads/ORA11GR2_%U.dbf';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_ORA11GR2.f'; # default
  • Others
RMAN> configure default device type to disk;
RMAN> configure device type disk parallelism 2 backup type to copy;
RMAN> configure retention policy to recovery window of 7 days;
RMAN> configure backup optimization on;

RMAN> report schema;
  • Convert database to archive log mode if not already done so.

SQL> archive log list;
Database log mode	       No Archive Mode
Automatic archival	       Disabled
Archive destination	       /u01/app/oracle/product/11.2.0/db_1/dbs/arch
Oldest online log sequence     69
Current log sequence	       71

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.

Total System Global Area  601272320 bytes
Fixed Size		    2230712 bytes
Variable Size		  180356680 bytes
Database Buffers	  415236096 bytes
Redo Buffers		    3448832 bytes
Database mounted.

SQL> alter database archivelog;
Database altered.

SQL> alter database open;
Database altered.

SQL> archive log list;
Database log mode	       Archive Mode
Automatic archival	       Enabled
Archive destination	       /u01/app/oracle/product/11.2.0/db_1/dbs/arch
Oldest online log sequence     69
Next log sequence to archive   71
Current log sequence	       71

SQL> alter system set log_archive_dest_1='location=/u01/ORA11GR2/backup/';

System altered.

** The LOG_ARCHIVE_DEST is for LOCAL destination only. Its duplex is LOG_ARCHIVE_DUPLEX_DEST.
** The LOG_ARCHIVE_DEST_n parameter can be set to LOCAL or REMOTE. This is preferred method.

SQL> archive log list
Database log mode	       Archive Mode
Automatic archival	       Enabled
Archive destination	       /u01/ORA11GR2/backup
Oldest online log sequence     69
Next log sequence to archive   71
Current log sequence	       71

  • Test backup
RMAN> backup database;

Starting backup at 09-JUN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=45 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=+DG1/ora11gr2/datafile/system.260.783364449
input datafile file number=00003 name=+DG1/ora11gr2/datafile/undotbs1.262.783364525
input datafile file number=00002 name=+DG1/ora11gr2/datafile/sysaux.261.783364493
input datafile file number=00004 name=+DG1/ora11gr2/datafile/users.264.783364547
input datafile file number=00005 name=+DG1/fda1_01.dbf
channel ORA_DISK_1: starting piece 1 at 09-JUN-12
channel ORA_DISK_1: finished piece 1 at 09-JUN-12
piece handle=/u01/ORA11GR2/backup/ORA11GR2_05nd44p1_1_1.dbf tag=TAG20120609T154953 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:36
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 09-JUN-12
channel ORA_DISK_1: finished piece 1 at 09-JUN-12
piece handle=/u01/ORA11GR2/backup/ORA11GR2_06nd44s1_1_1.dbf tag=TAG20120609T154953 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:03
Finished backup at 09-JUN-12