Monday, September 1, 2014

Steps to setup RMAN


This article is tested in oracle11gR2. How do we setup the RMAN in oracle? There are couple of ways, we can setup the RMAN. We can use control file to store backup catalog info or we can have separate database to store catalog info. Here I am using separate database to store backup catalog
information.

I am using Linux OS. Please remember, the directories and folder might change based on the operating system and environment. But the below steps are pretty much same for any environment.

Here i am using ORCL as primary database and CATDB as catalog database.

 Step1 Enabling Archive log. See the following link for the First step


Step2 Create the tablespace and user in catalog database to hold backup information.

SQL> CONNECT sys/password@catdb AS SYSDBA
Connected.

SQL> CREATE TABLESPACE RMAN
2 DATAFILE '/DBA_Test/d02/app/oracat/oradata/catdb/rman01.dbf' SIZE 6208K REUSE
3 AUTOEXTEND ON NEXT 64K MAXSIZE 32767M
4 EXTENT MANAGEMENT LOCAL
5 SEGMENT SPACE MANAGEMENT AUTO;

Tablespace created.

SQL> CREATE USER rman IDENTIFIED BY rman
2 TEMPORARY TABLESPACE temp
3 DEFAULT TABLESPACE rman
4 QUOTA UNLIMITED ON rman;

User created.

SQL> GRANT connect, resource, recovery_catalog_owner TO rman;

Grant succeeded.

SQL>

Step3 Create the recovery catalog in catalog database.

SQL>rman catalog=rman/rman@catdb

Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 21 09:59:26 2009

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

connected to recovery catalog database


Sometimes you'll face the issue while trying to connect RMAN using the above mentioned command, probably the error would be 


SP2-0734: unknown command beginning "rman catal..." - rest of line ignored.

Follow the below given steps to overcome this issue.

[oracat@localhost ~]$ rman

Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 21 15:59:12 2009

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

RMAN> connect catalog rman@oracat

recovery catalog database Password:

RMAN> create catalog tablespace "RMAN";

recovery catalog created

RMAN> exit

Recovery Manager complete.

[oracat@server1 ~]$

Step4 Register the database with Catalog database. Each database should be registered to catalog database to run RMAN backup.

[oracat@server1 ~]$rman target / catalog rman/rman@catdb

Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 21 10:02:01 2009

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

connected to target database: CATDB (DBID=1215124933)
connected to recovery catalog database

RMAN> register database;

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

RMAN> exit

Recovery Manager complete.

[oracat@server1 ~]$

[oraint@server1 ~]$ rman target / catalog rman/rman@catdb

Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 21 10:02:01 2009

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

connected to target database: ORCL (DBID=1215124933)
connected to recovery catalog database

RMAN> register database;

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

RMAN> exit

Recovery Manager complete.

[oraint@server1 ~]$

Step5 Configure the persistent parameters.
[oraint@server1 ~]$ rman target / catalog rman/rman@catdb

Recovery Manager: Release 10.2.0.1.0 - Production on Tue May 19 18:46:40 2009

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

connected to target database: ORCL (DBID=1215054467)
connected to recovery catalog database

RMAN> configure retention policy to recovery window of 2 days;

new RMAN configuration parameters:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 2 DAYS;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN> configure default device type to disk;

new RMAN configuration parameters:
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN> configure controlfile autobackup on;

new RMAN configuration parameters:
CONFIGURE CONTROLFILE AUTOBACKUP ON;
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN> configure channel device type disk format 'DBA_Test/rmanbackup/Backup%d_DB_%U_%T_%s_%t';
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'DBA_Test/rmanbackup/Backup_DB_%d_DB_%U_%T_%s_%t';
new RMAN configuration parameters are successfully stored
starting full resync of recovery catalog
full resync complete

RMAN>


 Step 6 Take database full backup. The full database backup should be taken        first time. Afterwards, archivelog backup will be taken.
[oraint@server1 ~]$ rman target / catalog rman/rman@catdb

Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 21 10:16:09 2009

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

connected to target database: ORCL (DBID=1215124933)
connected to recovery catalog database

RMAN> run{
2> backup database plus archivelog;
3> delete noprompt obsolete;
4> }

Starting backup at 22-SEP-05
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=21 RECID=2 STAMP=569633386
input archived log thread=1 sequence=22 RECID=3 STAMP=569642984
input archived log thread=1 sequence=23 RECID=4 STAMP=569643339
input archived log thread=1 sequence=24 RECID=5 STAMP=569643519
channel ORA_DISK_1: starting piece 1 at 22-SEP-05
channel ORA_DISK_1: finished piece 1 at 22-SEP-05
piece handle=/DBA_Test/rmanbackup/BackupORCL_DB03gv84g2_1_1_%S_%P tag=TAG20050922T021841 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 22-SEP-05
Starting backup at 22-SEP-05
using channel ORA_DISK_1
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=/Integration/app/oraint/oradata/orcl/system01.dbf
input datafile file number=00002 name=/Integration/app/oraint/oradata/orcl/sysaux01.dbf
input datafile file number=00008 name=/Integration/app/oraint/oradata/orcl/TEST_iasactivities.dbf
input datafile file number=00009 name=/Integration/app/oraint/oradata/orcl/TEST_urmserver.dbf
input datafile file number=00015 name=/Integration/app/oraint/oradata/orcl/TEST_ocs.dbf
input datafile file number=00005 name=/Integration/app/oraint/oradata/orcl/example01.dbf
input datafile file number=00010 name=/Integration/app/oraint/oradata/orcl/TEST_iaswebcenter.dbf
input datafile file number=00006 name=/Integration/app/oraint/oradata/orcl/TEST_ipm.dbf
input datafile file number=00003 name=/Integration/app/oraint/oradata/orcl/undotbs01.dbf
input datafile file number=00011 name=/Integration/app/oraint/oradata/orcl/TEST_ocssearch.dbf
input datafile file number=00012 name=/Integration/app/oraint/oradata/orcl/TEST_iasjive.dbf
input datafile file number=00013 name=/Integration/app/oraint/oradata/orcl/TEST_orairm.dbf
input datafile file number=00014 name=/Integration/app/oraint/oradata/orcl/TEST_mds.dbf
input datafile file number=00007 name=/Integration/app/oraint/oradata/orcl/TEST_webcenter_portlet.dbf
input datafile file number=00004 name=/Integration/app/oraint/oradata/orcl/users01.dbf
channel ORA_DISK_1: starting piece 1 at 22-SEP-05
channel ORA_DISK_1: finished piece 1 at 22-SEP-05
piece handle=/DBA_Test/rmanbackup/BackupORCL_DB04gv84g6_1_1_%S_%P tag=TAG20050922T021844 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:05
Finished backup at 22-SEP-05

Starting backup at 22-SEP-05
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=25 RECID=6 STAMP=569643592
channel ORA_DISK_1: starting piece 1 at 22-SEP-05
channel ORA_DISK_1: finished piece 1 at 22-SEP-05
piece handle=/DBA_Test/rmanbackup/BackupORCL_DB05gv84ic_1_1_%S_%P tag=TAG20050922T021955 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 22-SEP-05

Starting Control File and SPFILE Autobackup at 22-SEP-05
piece handle=/Integration/app/oraint/product/11.2.0/dbhome_1/dbs/c-1097368849- 20050922-00 comment=NONE
Finished Control File and SPFILE Autobackup at 22-SEP-05

RMAN retention policy will be applied to the command
RMAN retention policy is set to recovery window of 2 days
using channel ORA_DISK_1
no obsolete backups found

RMAN> exit


Recovery Manager complete.
[oraint@server1 ~]$


Now the RMAN setup is completed successfully. Here are the info about RMAN.

Primary DB = ORCL
Catalog DB = CATDB
RMAN Backup location = /DBA_Test/rmanbackup.
Now the full backup is taken. Every day, the below script should run and backup the new archive log files.

[oraint@server1 ~]$rman target / catalog rman/rman@catdb

Recovery Manager: Release 10.2.0.1.0 - Production on Thu May 21 10:25:40 2009

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

connected to target database: ORCL (DBID=1215124933)
connected to recovery catalog database

RMAN> run{
2> delete noprompt obsolete;
3> backup archivelog all;
4> }

No comments:

Post a Comment

IAS Cache initialization failed

 Today I faced an Issue in R12.2 instance. The solution I followed to overcome the issue is very simple, but they are more than one solution...