When Rman Recovers Data, it can restore the control file and spfile with the help of catalog. Today, we have specially configured the catalog Database:
1> Create a tablespace in the catalog Database for catalog
Create tablespace rman_ts datafile '/u02/ezhou/rman01.dbf' size 50 m extent management local uniform size 126 k;
2> create a user on the catalog Database and grant permissions to the user
Create user rman_user identified by rman_user default tablespace rman_ts quota unlimited on rman_ts;
Grant recovery_catalog_owner to rman_user;
Grant connect, resource to rman_user;
3: connect to the catalog Database and create tablespace:
Rman catalog rman_user/rman_user
RMAN> create catalog tablespace rman_ts;
Recovery catalog created
4: Configure and start the listener on catalog and configure the local naming service on the target database.
Cd/$ Oracle_HOME/network/admin
[Oracle @ aoracle admin] $ vi tnsnames. ora
PRD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.190.140) (PORT = 1521 ))
)
(CONNECT_DATA =
(SID = EZHOU)
)
)
Okay. start the listener: lsnrctl start
Then, run lsnrctl status to view the status is ready.
5> connect to the catalog database through the local naming service on the target database Machine
[Oracle @ aoracle ~] $ Rman target/catalog rman_user/rman_user @ prd;
Recovery Manager: Release 10.2.0.1.0-Production on Thu Dec 8 15:14:46 2011
Copyright (c) 1982,200 5, Oracle. All rights reserved.
Connected to target database: EZHOU (DBID = 4046377924)
Connected to recovery catalog database
Well, register the target database on the catalog Database.
RMAN> register database;
Database registered in recovery catalog
Starting full resync of recovery catalog
Full resync complete
RMAN>
Now, the configuration of catalog is complete.
Of course, you can refer to the following article:
1. Create a tablespace in the directory database to restore the Directory
Create tablespace rman_ts DATAFILE '/oradata/RCAT/data/rman. dbf'size 200 m;
PS: Delete the tablespace drop tablespace rman_ts including contents;
2. Create an RMAN user in the directory database
Create user rman identified by rman default tablespace rman_ts temporary tablespace temp quota unlimited on rman_ts;
PS: delete user drop user rman CASCADE;
3. Authorize the rman user
GRANT recovery_catalog_owner, connect, resource TO rman;
4. enable a new CMD
Rman catalog rman/rman
Or-C: \> rman
-RMAN> connect catalog rman/rman @ idba;
-RMAN> create catalog tablespace rman_ts // create a catalog in rman_ts tablespace
5. Create a file in D: \ oracle \ ora92 \ network \ admin \ tnsnames. ora.
PROD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.123.127) (PORT = 1521 ))
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = IDBA)
)
)
6. log on to the production database as a sys user to create a backup user.
-SQL> CREATE USER rman IDENTIFIED BY rman
-SQL> GRANT sysdba TO rman;
7. register the production database on the connection
-RMAN> connect target rman/rman @ prod
-RMAN> REGISTER DATABASE
######################################## ##########
#################### Crontab-e ################# ###
######################################## ##########
0 2 28 1 */oraapp/oracle/dba/full_bkup.sh
10 0 ** 0/oraapp/oracle/dba/lev0_bkup.sh
10 0 ** 1-2/oraapp/oracle/dba/lev2_bkup.sh
10 0 ** 3/oraapp/oracle/dba/lev1_bkup.sh
10 0 ** 4-6/oraapp/oracle/dba/lev2_bkup.sh
10 3 ** 0/oraapp/oracle/dba/ora_wk.sh
######################################## ##########
########/Oraapp/oracle/dba/DBA_rename. SQL #########
######################################## ##########
Connect RMAN/RMAN @ RCAT;
Set echo off
Set feedback off
Set linesize 1000
Set pagesize 0
Set verify off
Spool/oraapp/oracle/dba/log/rename.txt
Select 'dd bs = 1024 if = & 1 of =/oraapp/oracle/dba/log/RLog _ '| to_char (sysdate, 'D ') | '.txt 'from dual;
Spool off
Host chmod 755/oraapp/oracle/dba/log/rename.txt
Host/oraapp/oracle/dba/log/rename.txt
Host rm-rf/oraapp/oracle/dba/log/rename.txt
Exit;
######################################## ##########
##########/Oraapp/oracle/dba/ora_ OS .sh ###########
######################################## ##########
#! /Bin/sh
#
# Copy all backup files from the db server72
#
Cp/hotbkup/data/orabk/*/hotbkup/data/tmp/>/oraapp/oracle/dba/log/bkup. log
#
# Move the daily backup to current week directory
#
Cp/hotbkup/data/tmp/*/offbkup/data/cweek/>/oraapp/oracle/dba/log/bkup. log
#
# Remove the yestoday's backup files
#
Rm-rf/hotbkup/data/day/*>/oraapp/oracle/dba/log/bkup. log
#
# Copy all the backup file to day directory
#
Mv/hotbkup/data/tmp/*/hotbkup/data/day/>/oraapp/oracle/dba/log/bkup. log
#
# Delete all the db server72's backup files to free diskspace
# Must delete at last for security
#
Rm-rf/hotbkup/data/orabk/*>/oraapp/oracle/dba/log/bkup. log
#
# List all the backup file
#
Ls-l/hotbkup/data/orabk/>/oraapp/oracle/dba/log/bkup. log
Ls-l/hotbkup/data/tmp/>/oraapp/oracle/dba/log/bkup. log
Ls-l/hotbkup/data/day/>/oraapp/oracle/dba/log/bkup. log
Ls-l/offbkup/data/cweek/>/oraapp/oracle/dba/log/bkup. log
#
# Send email to dba
#
Mail-s "BK _ 'date" + % Y-% m-% d "'_ log" westzq@hotmail.com </oraapp/oracle/dba/log/bkup. log
######################################## ##########
##########/Oraapp/oracle/dba/ora_wk.sh ###########
######################################## ##########
#! /Bin/sh
#
# Remove all the last week backup files
#
Rm-rf/offbkup/data/pweek /*
#
# Move current week backup file to preview week folder
#
Mv/offbkup/data/cweek/*/offbkup/data/pweek/
######################################## ##########
########/Oraapp/oracle/dba/full_bkup.sh ##########
######################################## ##########
#! /Bin/sh
Export ORACLE_HOME =/oraapp/oracle/92
Export DBA_HOME =/oraapp/oracle/dba
Export ORACLE_SID = RCAT
Export NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
Export NLS_DATE_FORMAT = 'yyyy-MM-DD_HH24: MI: ss'
$ ORACLE_HOME/bin/rman partition File $ DBA_HOME/full_bk.rcv msglog $ DBA_HOME/log/bkup. log
$ ORACLE_HOME/bin/sqlplus/nolog @ $ DBA_HOME/DBA_rename. SQL $ DBA_HOME/log/bkup. log
/Oraapp/oracle/dba/ora_ OS .sh &
######################################## ##########
#########/Oraapp/oracle/dba/full_bkup.rcv #########
######################################## ##########
Connect catalog RMAN/RMAN @ RCAT;
Connect target RMAN/RMAN @ PROD;
Run {
Allocate channel specified device type disk;
Allocate channel ch2 device type disk;
Backup full filesperset = 2 tag = 'full _ % d' format = '/oradata/orabk/% T_full _ % d _ % s _ % P' database include current controlfile;
SQL 'alter system archive log current ';
Backup filesperset = 4 format = '/oradata/orabk/arch _ % T _ % d _ % s _ % P' archivelog all delete input;
Release channel identifier;
Release channel ch2;
}
Quit;
######################################## ##########
########/Oraapp/oracle/dba/lev0_bkup.sh ##########
######################################## ##########
#! /Bin/sh
Export ORACLE_HOME =/oraapp/oracle/92
Export DBA_HOME =/oraapp/oracle/dba
Export ORACLE_SID = RCVCAT
Export NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
Export NLS_DATE_FORMAT = 'yyyy-MM-DD_HH24: MI: ss'
$ ORACLE_HOME/bin/rman partition File $ DBA_HOME/lev0_bkup.rcv log $ DBA_HOME/log/bkup. log
$ ORACLE_HOME/bin/sqlplus/nolog @ $ DBA_HOME/DBA_rename. SQL $ DBA_HOME/log/bkup. log
/Oraapp/oracle/dba/ora_ OS .sh &
######################################## ##########
#########/Oraapp/oracle/dba/lev0_bkup.rcv #########
######################################## ##########
Connect catalog RMAN/RMAN @ RCAT;
Connect target RMAN/RMAN @ PROD;
Run {
Allocate channel specified device type disk;
Allocate channel ch2 device type disk;
Backup incremental level = 0 filesperset = 2 tag = 'lev0 _ % d' format = '/oradata/orabk/% T_lev0 _ % d _ % s _ % P' database include current controlfile;
SQL 'alter system archive log current ';
Backup filesperset = 4 format = '/oradata/orabk/arch _ % T _ % d _ % s _ % P'
Archivelog all delete input;
Release channel identifier;
Release channel ch2;
}
Quit;
######################################## ##########
#########/Oraapp/oracle/dba/lev1_bkup.sh ##########
######################################## ##########
#! /Bin/sh
Export ORACLE_HOME =/oraapp/oracle/92
Export DBA_HOME =/oraapp/oracle/dba
Export ORACLE_SID = RCAT
Export NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
Export NLS_DATE_FORMAT = 'yyyy-MM-DD_HH24: MI: ss'
$ ORACLE_HOME/bin/rman partition File $ DBA_HOME/lev1_bkup.rcv log $ DBA_HOME/log/bkup. log
$ ORACLE_HOME/bin/sqlplus/nolog @ $ DBA_HOME/DBA_rename. SQL $ DBA_HOME/log/bkup. log
/Oraapp/oracle/dba/ora_ OS .sh &
######################################## ##########
#########/Oraapp/oracle/dba/lev?bkup.rcv #########
######################################## ##########
Connect catalog RMAN/RMAN @ RCAT;
Connect target RMAN/RMAN @ PROD;
Run {
Allocate channel specified device type disk;
Allocate channel ch2 device type disk;
Backup incremental
Level = 1
Filesperset = 2
Tag = 'lev1 _ % d'
Format = '/oradata/orabk/% T_lev1 _ % d _ % s _ % P'
Database include current controlfile;
SQL 'alter system archive log current ';
Backup filesperset = 4
Format = '/oradata/orabk/arch _ % T _ % d _ % s _ % P'
Archivelog all delete input;
Release channel identifier;
Release channel ch2;
}
Quit;
######################################## ##########
########/Oraapp/oracle/dba/lev2_bkup.sh ##########
######################################## ##########
#! /Bin/sh
Export ORACLE_HOME =/oraapp/oracle/92
Export DBA_HOME =/oraapp/oracle/dba
Export ORACLE_SID = RCVCAT
Export NLS_LANG = AMERICAN_AMERICA.ZHS16GBK
Export NLS_DATE_FORMAT = 'yyyy-MM-DD_HH24: MI: ss'
$ ORACLE_HOME/bin/rman partition File $ DBA_HOME/lev2_bkup.rcv log $ DBA_HOME/log/bkup. log
$ ORACLE_HOME/bin/sqlplus/nolog @ $ DBA_HOME/DBA_rename. SQL $ DBA_HOME/log/bkup. log
/Oraapp/oracle/dba/ora_ OS .sh &
######################################## ##########
#########/Oraapp/oracle/dba/lev2_bkup.rcv #########
######################################## ##########
Connect catalog RMAN/RMAN @ RCAT;
Connect target RMAN/RMAN @ PROD;
Run {
Allocate channel specified device type disk;
Allocate channel ch2 device type disk;
Backup incremental
Level = 2
Filesperset = 2
Tag = 'lev2 _ % d'
Format = '/oradata/orabk/% T_lev2 _ % d _ % s _ % P'
Database include current controlfile;
SQL 'alter system archive log current ';
Backup filesperset = 4
Format = '/oradata/orabk/arch _ % T _ % d _ % s _ % P'
Archivelog all delete input;
Release channel identifier;
Release channel ch2;
}
Quit;