Friday, March 27, 2015

Moving Control File into ASM



Steps to move your db controlfile into ASM:-

1. Check the parameter on control_files to see current path.

2. Set control_files parameter in db to new path.

    alter system set control_files='/DEV/+VMU01','/DEV/+PSO01' scope=spfile;

3. Now -
     shutdown immediate;
     startup nomount;

4. Using RMAN, restore controlfile from old control_file.
 RMAN> restore controlfile from '+VMU01/vinaydev_streams/controlfile/current.2648.134262629';

5. Now Mount and open the instance.
 alter database mount;
     alter database open;
 

Database Flashback and Backup

Database Flashback and backup:
------------------------------------------------
If you to flashback a database to Guaranteed Restore Point(GRP) that has already been set in the database. Now the backups that were taken after the Guaranteed Restore Point(GRP) was created can no longer be used.  But, you can restore the database to a point in time before to the GRP creation.

Here are the steps:
SQL> shutdown immediate
startup mount
flashback database to restore point VINAYDEV;

Total System Global Area  424647870 bytes
 Fixed Size                  5514791 bytes
 Variable Size             328358173 bytes
 Database Buffers           45679529 bytes
 Redo Buffers                5892829 bytes

Database mounted.
 SQL>
Flashback complete.

SQL> alter database open resetlogs;
Database altered.

Now we can recover and restore the database from backup that was taken prior to the GRP was created-
Recovery Manager: Release 11.1.0.7.0 - Production on Thu Nov 8 09:16:45 2014
Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: VINAYORD (DBID=251753272, not open)

RMAN> run {
2> restore database;
3> recover database;
4> }

Starting restore at 08-NOV-2014
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=252 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/oradata/VINAYORD/vinaydev_streams01.dbf
channel ORA_DISK_1: restoring datafile 00002 to /u01/oradata/VINAYORD/express01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/oradata/VINAYORD/apexdb_01.dbf
channel ORA_DISK_1: reading from backup piece /VINAY/DEVBKP/VINAYORD/rman/datafile_09/df_VINAYORD_08Nov14_0959_321_2_dbf.rmn
channel ORA_DISK_1: piece handle=/VINAY/DEVBKP/VINAYORD/rman/datafile_09/df_VINAYORD_08Nov14_0959_321_2_dbf.rmn tag=VINAYORD_INCR. LEV 0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:15
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
.....
.....
.....
channel ORA_DISK_1: piece handle=/VINAY/DEVBKP/VINAYORD/rman/datafile_09/df_VINAYORD_08Nov08_0958_320_2_dbf.rmn tag=VINAYORD_INCR. LEV 0
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:01:55
Finished restore at 08-NOV-2014

Starting recover at 08-NOV-2014
using channel ORA_DISK_1


starting media recovery


archived log file name=/VINAY/DEVBKP/DEV/ARCH/1_1_736684842.dbf thread=1 sequence=1
archived log file name=/VINAY/DEVBKP/DEV/ARCH/1_2_736684842.dbf thread=1 sequence=2
archived log file name=/VINAY/DEVBKP/DEV/ARCH/1_3_736684842.dbf thread=1 sequence=3
media recovery complete, elapsed time: 00:00:02
Finished recover at 08-NOV-2014

RMAN> sql 'alter database open';
now,alter database open.

Note - Always try your work in lower environments first. Never try this or any work in Production/higher environments.

This is just for knowledge sharing.