Monday, May 24, 2010

Rename file and BAAG

There are two reasons why I'm posting this. First I have read a interview
with Alex Gorbachev
about BAAG and second I run into BAAG related problem myself.
This was not pure BAAG problem as I used my knowledge but I forgot about one very important step - VERIFY old knowledge (based on Oracle 8i) with current release. What I did ?

A scenario was very simple - I have a "production" database (thanks God it was only my VM) running on ASM with all files in group called DATA. I cloned that database using a storage snapshot functionality and then I have renamed ASM group to different name and mounted it. So far so good. Next step was to mount a cloned database and rename a files in control file using old fashion command
ALTER DATABASE RENAME FILE '+DATA\xxxx\redo01.log' to '+DATACLONE\xxxx\redo02.log';
Command was successfully finished and control file has been updated. I have checked a alert log and what was my surprise when I saw warning that file source can't be deleted.
WARNING: Cannot delete Oracle managed file 
I didn't want to delete a source file - this file is a part of source database. It was very interested and I did another test - I have stopped a source database and run rename command for other file.
And ? Yes a source file has been deleted. What if you do it on production environment without test ?
The most worry thing is that latest SQL reference there is no information about that behavior.
This clause renames only files in the control file. It does not actually rename them on your operating system. The operating system files continue to exist, but Oracle Database no longer uses them.
This is not about ASM but if there is a different behavior for ASM it should be mentioned as well.
So there are three important things to remember:
- always check what you are going to do and not guess a results
- check relevant of vendor docs, White papers and other well know stuff with current release of software.



Don Seiler said...

Marcin, I just discovered this myself, doing the same type of cloning that you describe. Very scary stuff. Did you find any way to prevent it?

Marcin Przepiorowski said...


No - I didn't find any way but to be honest didn't search too much as well.