Thursday, September 15, 2011

Why do we put the tablespace in backup mode ?


If you don't put the tablespace in backup mode, we can't be sure that the copy is recoverable. It may be fine, but it may have inconsistencies.

We can suppose that the copy is consistent if we make the copy with the following conditions

Header inconsistency: If the file copy is done from beginning to end, then the datafile header should reflect the right SCN

Fractured blocks: If the copy does i/o with a size that is multiple of the Oracle block size, then you should not have fractured blocks

Backup consistency:If you take care to recover later than the point in time of the end of the copy, you should not have inconsistency

But there may be other internal mechanisms that are not documented so that we can't be sure that this list of issues is exhaustive.
And, as it is not supported, we cannot rely on a backup done like that. Note that you will have no message

What if the instance crashes while the tablespaces is in backup mode ?

When you start the database after that, Oracle will say that it requires recovery. This is because the SCN was frozen and it is the expected behaviour because if you restore the copied file, it has to be recovered. (and the only way Oracle has to set its value in the copy is to set it in the current file while it is copied)

In that case you can can issue:

ALTER DATABASE END BACKUP;
ALTER DATABASE OPEN;
to open the database.

But your backup is not usable, you have to do it again.


Enjoy:-)

No comments: