There are many ways to setup the RMAN. Here i am using the separete database to store backup catalog information with windows Server 2008 (OS). Please remember, the directories and folder might change based on the OS and environment.
Here i am using UMIS as primary database and CATDB as catalog database.
Step1. Enable the archive log in UMIS database
1 2 | SQL> archive log list Database log mode No Archive Mode |
Shutdown database:
1 2 3 4 | SQL> shutdown immediate; Database closed. Database dismounted. ORACLE instance shut down. |
Startup your database in mount state:
1 2 3 4 5 6 7 8 9 | SQL> startup mount; ORACLE instance started. Total System Global Area 1503199232 bytes Fixed Size 2288584 bytes Variable Size 905970744 bytes Database Buffers 587202560 bytes Redo Buffers 7737344 bytes Database mounted. |
Configure your database in archivelog mode by issue the following:
1 2 | SQL> alter database archivelog; Database altered. |
Step2. Install the CATDB and Create the tablespace and user in catalog database to hold backup information.
1 2 | SQL> CONNECT sys/password@catdb AS SYSDBA Connected. |
1 2 3 4 5 6 7 8 9 | SQL> CREATE TABLESPACE RMAN DATAFILE ‘F:\CATDB\RMAN01.DBF' SIZE 480M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED LOGGING ONLINE EXTENT MANAGEMENT LOCAL AUTOALLOCATE BLOCKSIZE 8K SEGMENT SPACE MANAGEMENT AUTO FLASHBACK ON; <strong>Tablespace created.</strong> |
1 2 3 4 5 6 | SQL> CREATE USER rman IDENTIFIED BY rman TEMPORARY TABLESPACE temp DEFAULT TABLESPACE rman QUOTA UNLIMITED ON rman; <strong>User created. </strong> |
1 2 | SQL> GRANT connect, resource, recovery_catalog_owner TO rman; <strong>Grant succeeded.</strong> |
Step3. Create the recovery catalog in catalog database.
1 2 3 4 | C:\>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 |
1 2 | RMAN> create catalog tablespace "RMAN"; -- This is a logically tablespace. <strong>Recovery catalog created</strong> |
1 2 | RMAN> exit <strong>Recovery Manager complete.</strong> |
Step4. Register the database with Catalog database. Each database should be registered to catalog database to run RMAN backup.
1 2 3 4 | C:\>rman catalog=rman/rman@catdb target=sys/password@UMIS 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 |
1 2 3 4 5 | RMAN> Register Database; <strong>Database registered in Recovery catalog </strong>Starting full resync of recovery catalog full resync complete<strong> </strong> |
1 2 | RMAN> exit <strong>Recovery Manager complete.</strong> |
Step5. Configure the persistent parameters.
1 2 3 4 | C:\>rman catalog=rman/rman@catdb target=sys/password@UMIS 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 |
1 | RMAN> configure retention policy to recovery window of 2 days; |
New RMAN configuration parameters:
1 2 3 4 | 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 |
1 | RMAN> configure default device type to disk; |
New RMAN configuration parameters:
1 2 3 4 | CONFIGURE DEFAULT DEVICE TYPE TO DISK; new RMAN configuration parameters are successfully stored starting full resync of recovery catalog full resync complete |
1 | RMAN> configure controlfile autobackup on; |
New RMAN configuration parameters:
1 2 3 4 | CONFIGURE CONTROLFILE AUTOBACKUP ON; new RMAN configuration parameters are successfully stored starting full resync of recovery catalog full resync complete |
1 | RMAN> Configure channel device type disk format 'F:\rmanbackup\Backup%d_DB_%U_%S_%P'; |
New RMAN configuration parameters:
1 2 3 4 | CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT 'F:\rmanbackup\Backup%d_DB_%U_%S_%P'; new RMAN configuration parameters are successfully stored starting full resync of recovery catalog full resync complete |
Step 6. Take database full backup. The full database backup should be taken first time. Afterwards, archivelog backup will be taken.
1 2 3 4 5 | C:\>rman catalog=rman/rman@catdb target=sys/password@orcl 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 |
1 2 3 | RMAN> run{backup database plus archivelog; delete noprompt obsolete;} <strong>Starting full resync of recovery catalog </strong>full resync complete |
1 2 | RMAN> exit Recovery Manager complete |
Now the RMAN setup is completed successfully. Here is the info about RMAN.
1 2 3 4 5 6 7 8 9 | Primary DB = UMIS Catalog DB = CATDB RMAN Backup location = F:\rmanbackup. Now the full backup is taken. Every day, the below script should run and backup the new archive log files. C:\>rman catalog=rman/rman@catdb target=sys/oracle@UMIS 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 |
1 2 3 | RMAN> run{delete noprompt obsolete; backup archivelog all;} RMAN> exit Recovery Manager complete. |
Note: We can run the below script daily at specific time by setting up the scheduler. Please follow the steps:
1 | C:\>rman catalog=rman/rman@catdb target=sys/oracle@UMIS |
Wrtie one sql file named daily_backup.sql which should contain the following code.
1 2 3 4 5 | run { backup archivelog all; delete noprompt obsolete; } |
Other file is bat file named daily_backup.bat (This file will call by scheduler) which should contain the following command.
1 | rman catalog=rman/rman@catdb target=sys/password@orcl cmdfile daily_backup.sql |
Good Day