Home » RDBMS Server » Backup & Recovery » Answer to Question --Practically How to work with RMAN?
Answer to Question --Practically How to work with RMAN? [message #135192] Tue, 30 August 2005 07:06 Go to next message
sunil_v_mishra
Messages: 506
Registered: March 2005
Senior Member
hi,

Friends i had seen many people are asking how to use RMAN and they just need Step to do backup and recovery by using RMAN Uitility...frankly saying ....Its...Spoon feeding ...Very Happy

But below are the requirement of many people which shows how to do Backup , restore and recovery of database by using RMAN

Note :- There is much more in RMAN ...as Backup of RMAN is stored on another Server here in this example i showed how to store backup on same server on which our database reside. You can know how to store RMAN backup on another server if you go through the documentation .

Exmanple

BACKUP and RECOVERY with RMAN

--->Create directory rman were we can store our backup

D:/orahome1>md rman
---------------------------------------------------------------------------------------------------------------------------------
===>Connecting to the RMAN with nocatalog

C:\Documents and Settings\sadmin>rman target / nocatalog

Recovery Manager: Release 9.0.1.5.1 - Production

(c) Copyright 2001 Oracle Corporation. All rights reserved.

connected to target database: ASDB (DBID=2169591373)
using target database controlfile instead of recovery catalog

===> Taking Backup

RMAN> backup database format 'D:/orahome1/rman/ora_df%t_s%s_s%p';
Starting backup at 19-AUG-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including current controlfile in backupset
input datafile fno=00001 name=D:\ORAHOME1\ORADATA\ASDB\SYSTEM01.DBF
input datafile fno=00009 name=D:\ORAHOME1\ORADATA\ASDB\IAS_META01.DBF
input datafile fno=00005 name=D:\ORAHOME1\ORADATA\ASDB\PORTAL.DBF
input datafile fno=00002 name=D:\ORAHOME1\ORADATA\ASDB\UNDOTBS01.DBF
input datafile fno=00016 name=D:\ORAHOME1\ORADATA\ASDB\IP_DT.DBF
input datafile fno=00015 name=D:\ORAHOME1\ORADATA\ASDB\IP_RT.DBF
input datafile fno=00012 name=D:\ORAHOME1\ORADATA\ASDB\DCM.DBF
input datafile fno=00023 name=D:\ORAHOME1\ORADATA\ASDB\GCATS1_OID.DBF
input datafile fno=00020 name=D:\ORAHOME1\ORADATA\ASDB\UDDISYS01.DBF
input datafile fno=00007 name=D:\ORAHOME1\ORADATA\ASDB\PTLIDX.DBF
input datafile fno=00017 name=D:\ORAHOME1\ORADATA\ASDB\IP_IDX.DBF
input datafile fno=00018 name=D:\ORAHOME1\ORADATA\ASDB\IP_LOB.DBF
input datafile fno=00013 name=D:\ORAHOME1\ORADATA\ASDB\OSS_SYS01.DBF
input datafile fno=00003 name=D:\ORAHOME1\ORADATA\ASDB\DRSYS01.DBF
input datafile fno=00024 name=D:\ORAHOME1\ORADATA\ASDB\GDEFAULT1_OID.DBF
input datafile fno=00021 name=D:\ORAHOME1\ORADATA\ASDB\ATTRS1_OID.DBF
input datafile fno=00025 name=D:\ORAHOME1\ORADATA\ASDB\SVRMG1_OID.DBF
input datafile fno=00006 name=D:\ORAHOME1\ORADATA\ASDB\PTLDOC.DBF
input datafile fno=00010 name=D:\ORAHOME1\ORADATA\ASDB\DISCOPLTM1.DBF
input datafile fno=00011 name=D:\ORAHOME1\ORADATA\ASDB\DISCOPLTC1.DBF
input datafile fno=00014 name=D:\ORAHOME1\ORADATA\ASDB\WCRSYS01.DBF
input datafile fno=00019 name=D:\ORAHOME1\ORADATA\ASDB\OCA.DBF
input datafile fno=00008 name=D:\ORAHOME1\ORADATA\ASDB\PTLLOG.DBF
input datafile fno=00022 name=D:\ORAHOME1\ORADATA\ASDB\BATTRS1_OID.DBF
channel ORA_DISK_1: starting piece 1 at 19-AUG-05
channel ORA_DISK_1: finished piece 1 at 19-AUG-05
piece handle=D:\ORAHOME1\RMAN\ORA_DF566751828_S3_S1 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:56
Finished backup at 19-AUG-05

RMAN> EXIT

Recovery Manager complete.
---------------------------------------------------------------------------------------------------------------------------------

===>To Crash our database

Now shutdown your database from SQL prompt

SQL> shutdown

----> And Rename your system01.dbf file so that there can be crash in your database
---------------------------------------------------------------------------------------------------------------------------------

===>Now Again try to startup the database but first connect to sqlpls by sysdba

SQL*Plus: Release 9.0.1.4.0 - Production on Fri Aug 19 14:59:26 2005

(c) Copyright 2001 Oracle Corporation. All rights reserved.

Enter user-name: SYS AS SYSDBA
Enter password:
Connected to an idle instance.

SQL> STARTUP

ORACLE instance started.
Total System Global Area 151810128 bytes
Fixed Size 282704 bytes
Variable Size 100663296 bytes
Database Buffers 50331648 bytes
Redo Buffers 532480 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: 'D:\ORAHOME1\ORADATA\ASDB\SYSTEM01.DBF'

===>Now above you can see Error occoured because SYSTEM01.DBF is missing.

--------------------------------------------------------------------------------------------------------------------------------

Now Again connect to RMAN

C:\Documents and Settings\sadmin>rman target / nocatalogRecovery Manager: Release 9.0.1.5.1 - Production

(c) Copyright 2001 Oracle Corporation. All rights reserved.

connected to target database: ASDB (DBID=2169591373)
using target database controlfile instead of recovery catalog

RMAN>


RMAN> RESTORE DATABASE;

Starting restore at 19-AUG-05

allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=8 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to D:\ORAHOME1\ORADATA\ASDB\SYSTEM01.DBF
restoring datafile 00002 to D:\ORAHOME1\ORADATA\ASDB\UNDOTBS01.DBF
restoring datafile 00003 to D:\ORAHOME1\ORADATA\ASDB\DRSYS01.DBF
restoring datafile 00005 to D:\ORAHOME1\ORADATA\ASDB\PORTAL.DBF
restoring datafile 00006 to D:\ORAHOME1\ORADATA\ASDB\PTLDOC.DBF
restoring datafile 00007 to D:\ORAHOME1\ORADATA\ASDB\PTLIDX.DBF
restoring datafile 00008 to D:\ORAHOME1\ORADATA\ASDB\PTLLOG.DBF
restoring datafile 00009 to D:\ORAHOME1\ORADATA\ASDB\IAS_META01.DBF
restoring datafile 00010 to D:\ORAHOME1\ORADATA\ASDB\DISCOPLTM1.DBF
restoring datafile 00011 to D:\ORAHOME1\ORADATA\ASDB\DISCOPLTC1.DBF
restoring datafile 00012 to D:\ORAHOME1\ORADATA\ASDB\DCM.DBF
restoring datafile 00013 to D:\ORAHOME1\ORADATA\ASDB\OSS_SYS01.DBF
restoring datafile 00014 to D:\ORAHOME1\ORADATA\ASDB\WCRSYS01.DBF
restoring datafile 00015 to D:\ORAHOME1\ORADATA\ASDB\IP_RT.DBF
restoring datafile 00016 to D:\ORAHOME1\ORADATA\ASDB\IP_DT.DBF
restoring datafile 00017 to D:\ORAHOME1\ORADATA\ASDB\IP_IDX.DBF
restoring datafile 00018 to D:\ORAHOME1\ORADATA\ASDB\IP_LOB.DBF
restoring datafile 00019 to D:\ORAHOME1\ORADATA\ASDB\OCA.DBF
restoring datafile 00020 to D:\ORAHOME1\ORADATA\ASDB\UDDISYS01.DBF
restoring datafile 00021 to D:\ORAHOME1\ORADATA\ASDB\ATTRS1_OID.DBF
restoring datafile 00022 to D:\ORAHOME1\ORADATA\ASDB\BATTRS1_OID.DBF
restoring datafile 00023 to D:\ORAHOME1\ORADATA\ASDB\GCATS1_OID.DBF
restoring datafile 00024 to D:\ORAHOME1\ORADATA\ASDB\GDEFAULT1_OID.DBF
restoring datafile 00025 to D:\ORAHOME1\ORADATA\ASDB\SVRMG1_OID.DBF
channel ORA_DISK_1: restored backup piece 1
piece handle=D:\ORAHOME1\RMAN\ORA_DF566751828_S3_S1 tag=null params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 19-AUG-05

RMAN> RECOVER DATABASE;

Starting recover at 19-AUG-05
using channel ORA_DISK_1

starting media recovery
media recovery complete

Finished recover at 19-AUG-05

RMAN>
---------------------------------------------------------------------------------------------------------------------------------

==>Now at SQL prompt open the database as database is recovered so that user can connect to the database.

SQL> ALTER DATABASE OPEN;

Database altered.

SQL> show parameter instance_name;

NAME TYPE VALUE
--------------------------------------- --------------- ---------------
instance_name string asdb

---------------------------------------------------------------------------------------------------------------------------------
Note:- Controlfile , Archive logs, redolog files, init.ora & Passwordfile do its backup manually as above senario is for Only datafile.

From:-
Always your Friend
Sunil

[Updated on: Tue, 30 August 2005 07:10]

Report message to a moderator

Re: Answer to Question --Practically How to work with RMAN? [message #135286 is a reply to message #135192] Tue, 30 August 2005 15:28 Go to previous message
Mahesh Rajendran
Messages: 10707
Registered: March 2002
Location: oracleDocoVille
Senior Member
Account Moderator
Quote:

Note:- Controlfile , Archive logs, redolog files, init.ora & Passwordfile do its backup manually as above senario is for Only datafile.


Why a seperate manual backup?

RMAN> Backup database plus archivelog;

will backup archived logs.

From your own logfile
Quote:

channel ORA_DISK_1: specifying datafile(s) in backupset
including current controlfile in backupset


So control file is backed up.
a better practise is to set controlfile autobackup so that with every RMAN backup command, control file and SPFILE are auotmatically backed up.

And your NEVER EVER backup online redolog files on any hot backup mode.

[Updated on: Tue, 30 August 2005 15:32]

Report message to a moderator

Previous Topic: Media Recovery (ORA-01113)
Next Topic: RECOVERY USING ARCHIVED FILES
Goto Forum:
  


Current Time: Fri Apr 19 18:58:06 CDT 2024