You are on page 1of 19

RMAN DEMO

4iApps DBA Team


02-June-11

Demo Setup
CATALOG

DATABASE
L

TARGET DATABASE

RMAN

Target TNS Name

Catalog TNS Name

L Listener

IN CATALOG DATABASE
Create a catalog user(cat)
Before creating a catalog user we have to create a catalog tablespace
to hold the catalog.
steps to create catalog tablespace(cat_tbs) and catalog user(cat)
step1:sql> Create tablespace cat_tbs
Datafile /home/oracle/product/10.2.0/oradata/cat_tbs.dbf
size 100m
step2: sql> Create user cat identified by cat
Default tablespace cat_tbs
Temporary tablespace temp
Quota unlimited on cat_tbs
step3: sql> Grant connect,resource to cat
step4: sql> Grant recovery_catalog_owner to cat

CONTINUED
Create a listener(catalog2) in catalog
database.
step1: Go to netmgr, create a
listener(catalog2).
step2: save and exit
step3: start the listener(catalog2)

IN TARGET DATABASE
CREATING PASSWORD FILE FOR TARGET DATABASE
> Startup
> Show parameter spfile
> Alter system set remote_login_passwordfile=exclusive
scope=spfile
> shut immediate
cd $ ORACLE_HOME / dbs
$ orapwd file = orapwtarget password = sys
$ cd network/admin
$ vi sqlnet.ora
sqlnet.authentication_services = none
names.directory_path = (tnsnames)

CONTINUED
Creating listener and connect descriptor
Step1: Go to netmgr create a listener
(target1) and create a connect
descriptor(con_tar) for this listener and one
more connect descriptor(con_cat) for
catalog listener(catalog2).
Step2: save and exit.
Step3: Start the listener

STEPS TO BE FOLLOWED BEFORE


CONNECTING
Database should be in archive log
mode
Listeners should be started in both the
target and catalog database
Recovery catalog database should be
always up and running
tnsping should be ping from Catalog to
Target Database(Target to Catalog is
not necessary).

Connecting to RMAN
$ RMAN
RMAN > Connect target
sys/sys@con_tar

RMAN > Connect catalog


cat/cat@con_cat
RMAN > create catalog

RMAN > Register database

RMAN > show all;

Continued

RMAN> show all;


RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK;
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR
DEVICE TYPE DISK TO '/%F;# default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1; # 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/bkp/rman/backup %d_S_%s_P_%p_T_%t';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/u01/app/oracle/product/9.2.0/dbs/snapcf_ORA920.f'; # default

Various backup demos using


RMAN
Backing up Entire Database
rman target sys/sys@con_tar catalog
cat/cat@con_cat
RMAN>backup database;
(will backup data file , control file)

Backing up the archived logs


RMAN>backup archivelog delete input :
(will backup all archivelog which havent backed up
before)
RMAN>backup database plus archivelog ;
(Will backup data file+Archived log)

Backing up control file :


RMAN>backup current controlfile; ( will backup current
contolfile).

Continued
Backing up tablespace
RMAN>backup tablespace <tbsname>;
(will backup tablespace DB should be in
archivelog mode)
Backing up datafile:
RMAN>backup datafile <pathname>/<datafile
name>;
It will backup datafile in Flash Recovery
Area/we can specify a path

Incremental Backup
Level 0 backup
RMAN > backup incremental level 0
database;

Level 1 cumulative backup


RMAN > backup incremental level 1
cumulative database;

Level 1 differential backup


RMAN > backup incremental level 1
database;

Demo Scenarios
Scenario 1 - Recover full database
Need to recover full database including controlfile, If we have
backup then we can start recovery.

RMAN > Connect target sys/sys@con_tar


RMAN > connect catalog cat/cat@con_cat
RMAN > startup nomount
RMAN > run
{
restore database;
alter database mount;
recover database;
}

Scenario
Scenario 2 - Recover lost datafile
RMAN> RUN
{
sql alter tablespace sysaux offline;
restore datafile;
/home/oracle10g/data/sysaux1.dbf';
recover datafile;
/home/oracle10g/data/sysaux1.dbf';
sql alter tablespace sysaux online;
}

Scenario
Scenario 3 - Recover lost tablespace

RMAN> run
{
sql alter tablespace sysaux offline;
restore tablespace sysaux;
recover tablespace sysaux;
sql alter tablespace sysaux online;
}

Scenario
Scenario 4 - Recover Lost controlfile
Target database
Shut abort
Startup nomount
Connect to rman catalog and target database

RMAN > run


{
Restore controlfile;
alter database mount;
recover database;
alter database open resetlogs;
}

RUN
{
ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT
c:/oracle/product/10.2.0/dbbackup/%U;
BACKUP DATABASE plus archivelog;
}

THANK YOU

You might also like