Saturday, April 23, 2016

RDBMS -- standby controlfile and the db_file_name_convert, log_file_name_convert parameters

db_file_name_convert and log_file_name_convert parameters are widely used in standby environments. Their main usage is to convert the paths of the datafile and redolog files that are created in the primary during the managed recovery and make them be able to created in the standby database. (when standby_file_management is set to auto)

In this post, I will mention about a different thing, that is done using these two parameters.
That is, as you may alredy know, in case we recreate standby controlfile, the paths in the newly created standby control reflects the paths of the database and redolog files of the primary database. If the primary and standby file paths are the same, then no issue, but when they are different that we need to do some extras.
There are 3 things that we can do for this;

1)Set the filename conversion initialization parameters. (db_file_name_convert, log_file_name_convert parameters)
2)Rename the files manually using ALTER DATABASE statements.
3)Use a combination of conversion parameters and manual renames.(rename + db_file_name_convert, log_file_name_convert parameters)

So, In this post, I will mention about the first method.

Here are the quick descriptions;

DB_FILE_NAME_CONVERT:Converts primary database datafile filenames to standby datafile filenames, for example, from tbs_* to standbytbs_*.

LOG_FILE_NAME_CONVERT:Converts primary database redo log filenames to standby database redo log filenames, for example, from log_* to standbylog_*.

STANDBY_FILE_MANAGEMENT:When set to auto, this parameter automates the creation and deletion of datafile filenames on the standby site using the same filenames as the primary site. (if we want different file paths, we use db_file_name_convert and log_file_name_convert parameters) -- this parameter actually is not needed for db_file_name_convert and log_file_name_convert to convert the current filenames of the primary to the standby but it is needed when a file is added or deleted in the future)

Making Oracle to use the correct file paths in the standby environment, can be done using  db_file_name_convert and log_file_name_convert parameters easily.

That is, when db_file_name_convert and log_file_name_convert parameters are in place, oracle updates the paths that are stored in the standby controlfile accordingly and thus there will be no need to rename, or switch to copy-like rman operations. In addition Oracle creates or deletes the files in standby databases that are created or deleted in the primary according to these parameters.

As far as I can see , what happens is, during a startup operation, when Oracle understand the control file is a standby controlfile, it checks to see if the db_file_name_convert and log_file_name_convert  parameters are set and if they are set, oracle updates the paths that it will use for accessing the database files and redologfiles accordingly till the next startup. So as long as the parameters in place, oracle does this in every startup, thus there will be no need for renaming the files or using switch to copy-like rman operations.

This parameters are used when the database is a standby database, so if you start to think like; "okay, then I can do my migrations like this.. I can move the datafiles to different paths and then without the controlfile, I can open my database using db_file_name_convert and log_file_name_convert parameters.. " Well that's not true. These parameters are only honoured when used in standby databases.

Also, with this in mind, as for the switch over operations, it seems; Oracle updates the standby controlfile with the paths that are produced according to the db_file_name_convert and log_file_name_convert parameters, and then makes the standby controlfile to be a normal controlfile and opens the database. (note that, standby controlfile and a controlfile has no big difference, only a flag changes )

Note:
As for the environments where the primary and standby databases reside in ASM (managed with Oracle Managed Files), db_file_name_convert and log_file_name_convert can not be used for these kind operations.  (I mean they can be used for future adding or deleting of files but can not be used for renaming the current filepaths--after recreating the standby controlfiles, in the standby site)
This is because the filenames(not paths only) are different because of the suffixes that are added by Oracle. So, in ASM and Oracle Managed Files, it can be accomplished by using the following document: "Step By Step Guide On How To Recreate Standby Control File When Datafiles Are On ASM And Using Oracle Managed Files (Doc ID 734862.1)"

No comments :

Post a Comment

If you will ask a question, please don't comment here..

For your questions, please create an issue into my forum.

Forum Link: http://ermanarslan.blogspot.com.tr/p/forum.html

Register and create an issue in the related category.
I will support you from there.