Monday, February 6, 2012

RMAN Restore using RMAN COLD Backup

I have taken RMAN COLD Backup in my last post, In this post I am going to delete datafile and then I will try to open a database. I will write some steps to recover/restore datafile/database.
---------------------------------------------------------------

Microsoft Windows [Version 5.2.3790](C) Copyright 1985-2003 Microsoft Corp.
C:\Documents and Settings\Administrator>sqlplus
SQL*Plus: Release 10.2.0.1.0 - Production on Mon Feb 6 15:27:19 2012
Copyright (c) 1982, 2005, Oracle. 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 612368384 bytes
Fixed Size 1250428 bytes
Variable Size 226495364 bytes
Database Buffers 377487360 bytes
Redo Buffers 7135232 bytes
Database mounted.

ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\IQRA10G\INDX.DBF'

SQL> shutdown immediate;
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

C:\Documents and Settings\Administrator>rman
Recovery Manager: Release 10.2.0.1.0 - Production on Mon Feb 6 15:28:58 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.

RMAN> connect target
connected to target database (not started)
RMAN> sql 'alter database mount';
using target database control file instead of recovery catalog
RMAN-00571: ================================================
RMAN-00569:
===== ERROR MESSAGE STACK FOLLOWS =====
RMAN-00571: ================================================
RMAN-03002: failure of sql command at 02/06/2012 15:29:12
RMAN-06403: could not obtain a fully authorized session
ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist

RMAN> startup nomount;
Oracle instance started
Total System Global Area 612368384 bytes
Fixed Size 1250428 bytes
Variable Size 226495364 bytes
Database Buffers 377487360 bytes
Redo Buffers 7135232 bytes

RMAN> sql 'alter database mount';
sql statement: alter database mount

RMAN> restore tablespace indx;
Starting restore at 06-FEB-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00007 to D:\ORACLE\PRODUCT\10.2.0\ORADATA\IQRA10G\INDX.DBF

channel ORA_DISK_1: reading from backup piece
D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\IQRA10G\BACKUPSET\2012_02_03\O1
channel ORA_DISK_1: restored backup piece 1
piece
handle=D:\ORACLE\PRODUCT\10.2.0\FLASH_RECOVERY_AREA\IQRA10G\BACKUPSET\2012_02_03\O1_MF_NNNDF_TAG20120203T173426_7LQO

channel ORA_DISK_1: restore complete, elapsed time: 00:00:56
Finished restore at 06-FEB-12

RMAN> alter databse open;
RMAN-00571: ================================================
RMAN-00569:
===== ERROR MESSAGE STACK FOLLOWS =====
RMAN-00571: ================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "clone, database"
RMAN-01008: the bad identifier was: databse
RMAN-01007: at line 1 column 7 file: standard input

RMAN> recover tablespace indx;
Starting recover at 06-FEB-12
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 06-FEB-12

RMAN> alter databse open;
RMAN-00571: ================================================
RMAN-00569:
===== ERROR MESSAGE STACK FOLLOWS =====
RMAN-00571: ================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "clone, database"
RMAN-01008: the bad identifier was: databse
RMAN-01007: at line 1 column 7 file: standard input

RMAN> alter database open resetlogs;
RMAN-00571: ================================================
RMAN-00569:
===== ERROR MESSAGE STACK FOLLOWS =====
RMAN-00571: ================================================
RMAN-03002: failure of alter db command at 02/06/2012 15:37:12
ORA-01139: RESETLOGS option only valid after an incomplete database recovery

RMAN> recover database;
Starting recover at 06-FEB-12
using channel ORA_DISK_1
starting media recoverymedia recovery complete, elapsed time: 00:00:00
Finished recover at 06-FEB-12

RMAN> alter database open;
database opened
RMAN>

1 comment:

irfan said...

Hi Rakesh,

very nice blog I take a full backup of my database using ur blog when i try to restore it I got error "RMAN> restore tablespace indx;

Starting restore at 12-NOV-12
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 11/12/2012 15:54:50
RMAN-20202: Tablespace not found in the recovery catalog
RMAN-06019: could not translate tablespace name "INDX" ". I didn't make any changes in tablespace and Index.

please guide and how to take backup and restore it using rman.


thanks & regards,
Syed irfan