Tuesday, January 10, 2012

Database Point In Time Recovery

@:oracle:/home/oracle> sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Mon Jan 9 18:09:45 2012

Copyright (c) 1982, 2009, Oracle. All rights reserved.

Enter user-name: / as sysdba

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, Oracle Label Security, OLAP,
Data Mining, Oracle Database Vault and Real Application Testing options

SQL> shu immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

SQL> startup mount
ORACLE instance started.
Total System Global Area 1603411968 bytes
Fixed Size 2207208 bytes
Variable Size 1006633496 bytes
Database Buffers 587202560 bytes
Redo Buffers 7368704 bytes
Database mounted.

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Automatic Storage Management, Oracle Label Security, OLAP,
Data Mining, Oracle Database Vault and Real Application Testing options

@:oracle:/home/oracle> rman

Recovery Manager: Release 11.2.0.1.0 - Production on Mon Jan 9 18:10:38 2012

Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

RMAN> connect target /

connected to target database: TEST (DBID=3150684, not open)

RMAN> connect catalog rman/rman@RMAN

connected to recovery catalog database

RMAN>RUN
{
SET UNTIL SEQUENCE 109; -- V$LOG_HISTORY
#Alternatives:
#SET UNTIL SCN 1000;
#SET UNTIL TIME 'Nov 15 2004 09:00:00';
RESTORE DATABASE;
RECOVER DATABASE;
}

executing command: SET until clause

Starting restore at 09-JAN-12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=66 device type=DISK
flashing back control file to SCN 3267640

Finished restore at 09-JAN-12

Starting recover at 09-JAN-12
using channel ORA_DISK_1

starting media recovery


xxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxxxxxxxxx

media recovery complete, elapsed time: 00:00:47
Finished recover at 09-JAN-12

RMAN> alter database open resetlogs;

database opened
new incarnation of database registered in recovery catalog
starting full resync of recovery catalog
full resync complete

RMAN>