Monday, December 8, 2014

Clearing Flash area logs in DR environment

We need to follow following procedure to clean flash area logs ,It is applicable only when we donot have flash back restore points :
==================================================================Step 1 : Cancel the mrp process :
=======================================
alter database recover managed standby database cancel;

Step 2 : shutdown the database using shutdown immediate
========================================================
shutdown immediate;

Step3 : SQL > Start no mount

Step 4 :SQL > alter database mount standby database

Step 5 :SQL > alter database flashback off; /#this command will clear flash back logfiles #/

Step 6 :SQL > alter database flashback on ;/#Re enabling flash recover /

Step 7 : If possible restart db again not mandatory.










Example :
==========
We don't have flash back restore points here :
===============================================

INSTANCE_NAME STARTUp Time STATUS
---------------- ---------------- ------------
hytprod91 2010.10.27:03:52 MOUNTED

SQL> SELECT NAME, SCN, TIME, DATABASE_INCARNATION#, GUARANTEE_FLASHBACK_DATABASE,STORAGE_SIZE FROM V$RESTORE_POINT;

no rows selected


FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
------------ ------------------ ------------------------- ---------------
CONTROLFILE .08 0 1
ONLINELOG 0 0 0
ARCHIVELOG 0 0 0
BACKUPPIECE 0 0 0
IMAGECOPY 0 0 0
FLASHBACKLOG 99.91 76.65 1236

6 rows selected.

SQL> alter database recover managed standby database cancel;


Database altered.

SQL> SQL> shutdown immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1610612736 bytes
Fixed Size 2182600 bytes
Variable Size 379367992 bytes
Database Buffers 1224736768 bytes
Redo Buffers 4325376 bytes
SQL> alter database mount standby database;

Database altered.

SQL> select flashback_on from v$database;
select * from V$FLASH_RECOVERY_AREA_USAGE;
FLASHBACK_ON
------------------
YES

SQL>

FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
------------ ------------------ ------------------------- ---------------
CONTROLFILE .08 0 1
ONLINELOG 0 0 0
ARCHIVELOG 0 0 0
BACKUPPIECE 0 0 0
IMAGECOPY 0 0 0
FLASHBACKLOG 99.91 76.61 1236

6 rows selected.

SQL> alter database flashback off;

Database altered.

SQL> SQL> SQL> SQL> SQL> select * from V$FLASH_RECOVERY_AREA_USAGE;

FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
------------ ------------------ ------------------------- ---------------
CONTROLFILE .08 0 1
ONLINELOG 0 0 0
ARCHIVELOG 0 0 0
BACKUPPIECE 0 0 0
IMAGECOPY 0 0 0
FLASHBACKLOG 0 0 0

6 rows selected.

SQL> alter database flashback on;
alter database flashback on
*
ERROR at line 1:
ORA-01153: an incompatible media recovery is active


SQL> alter database recover managed standby database cancel;


Database altered.

SQL> SQL> SQL> SQL> alter database flashback on;

Database altered.

SQL> select * from V$FLASH_RECOVERY_AREA_USAGE;

FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
------------ ------------------ ------------------------- ---------------
CONTROLFILE .08 0 1
ONLINELOG 0 0 0
ARCHIVELOG 0 0 0
BACKUPPIECE 0 0 0
IMAGECOPY 0 0 0
FLASHBACKLOG .05 0 1

6 rows selected.

SQL> select flashback_on from v$database;

FLASHBACK_ON
------------------
YES

SQL> shut immediate;
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1610612736 bytes
Fixed Size 2182600 bytes
Variable Size 379367992 bytes
Database Buffers 1224736768 bytes
Redo Buffers 4325376 bytes
SQL> alter database mount standby database;

Database altered.

SQL> select flashback_on from v$database;
select * from V$FLASH_RECOVERY_AREA_USAGE;

FLASHBACK_ON
------------------
YES

SQL>
FILE_TYPE PERCENT_SPACE_USED PERCENT_SPACE_RECLAIMABLE NUMBER_OF_FILES
------------ ------------------ ------------------------- ---------------
CONTROLFILE .08 0 1
ONLINELOG 0 0 0
ARCHIVELOG 0 0 0
BACKUPPIECE 0 0 0
IMAGECOPY 0 0 0
FLASHBACKLOG .05 0 1

6 rows selected.

No comments:

Post a Comment

Followers