Monday, 11 May 2015

Change Oracle Flash Recovery Area Location

Oracle’s default Flash Recovery Area (FRA) location default location is at ORACLE_BASE/flash_recovery_area. Most of the times you want to take it from the default storage where you install oracle software to another storage device.

Flash Recovery Area feature allows you to set up a location on disk where your database can create/manage different kinds of backup and recovery files for you. Using a FRA eases the database administration by automatically naming recovery-related files, retaining them as long as they are needed for restore and recovery, and erase them when they are no longer needed to restore your database and/or space is needed for some backup and recovery purpose.
To move yours database FRA to a new location,  start SQLPlus to modify the DB_RECOVERY_FILE_DEST initialization parameter.

SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='/u01/flash_recovery_area' SCOPE=BOTH SID='*';

-- or if you use ASM:
SQL> ALTER SYSTEM SET DB_RECOVERY_FILE_DEST='+disk1' SCOPE=BOTH SID='*';

After you change this parameter, all new FRA files will be created in the new location.
The permanent files (control files and online redolog files), flashback logs and transient files can be left in the old FRA location. The database will delete the transient files from the old FRA location as they become eligible for deletion.
For FLASHBACK logfiles to be able to to pick up the new DB_RECOVERY_FILE_DEST location, the flashback option needs to be restarted like this:

SQL> shutdown immediate;
SQL> startup mount;
SQL> ALTER DATABASE FLASHBACK OFF;
SQL> ALTER DATABASE FLASHBACK ON;
SQL> ALTER DATABASE OPEN;

What is Ora-1555 Snapshot too Old error?

Oracle Rollback Segments (Undo more recently) hold a copy of data before it was modified and they work in a round-robin fashion. Writing and then eventually overwriting the entries as soon as the changes are committed.
They are needed to provide read consistency (a consistent set of data at a point in time) or to allow a process to abandon or rollback the changes or for database recovery.

Here’s a typical scenario:-
User A opens a query to fetch every row from a billion row table. If User B updates and commits the last row of the billion row table a Rollback entry will be created so User A can see the data as it was before the update.
Other users are busily updating rows in the database and this in turn generates rollback – which may eventually cause the entry needed for User A to be overwritten (after all User B did commit the change – so it’s OK to overwrite the rollback segment). Maybe 15 minutes later the query is still running and User A finally fetches the last row of the billion row table – but the rollback entry is gone. He gets ORA-01555: Snapshot too old rollback segment too small