dataguard 中log_file_name_convert、db_file_name_convert的作用

在搭建dataguard时,如果主备的环境目录不一致会用到log_file_name_convert,和db_file_name_convert,12c以后还有pdb_file_name_convert。

这些convert参数的具体作用是当主备数据文件目录和日志目录不一致时要指定的转换对应关系,用于使用rman异机或rman的active duplicate。有时候有以下错误的理解。参考mos((Doc ID 272896.1))

1、认为db_file_name_convert参数可以实现rename

2、认为log_file_name_convert参数可以实现rename

3、认为log_file_name_convert参数可以实现主库日志调整时备库可以同步调整

这些在mos上找到了相关解答,尤其第三个,db_file_name_convert参数在主库添加数据文件的时候自动在备库创建相应文件,log_file_name_convert参数却无效。(以下摘自mos)

1. Can the parameter DB_FILE_NAME_CONVERT be used to rename the files as 
part of restore of the target backups?

Answer
------
It is a common mis-conception regarding the usage of DB_FILE_NAME_CONVERT.

The parameter DB_FILE_NAME_CONVERT is used to rename the datafiles being 
restored from the target backups into an "auxiliary" instance.
But it cannot be used to rename the files in the target instance itself.

This parameter is usually used in the following 3 cases:
++ Creation of a standby from the target using:
"DUPLICATE TARGET DATABASE FOR STANDBY ...;"
++ Creation of a duplicate database from the target using:
"DUPLICATE TARGET DATABASE TO 'xxx'...;"
++ RMAN Tablespace point in time recovery using:
"RECOVER TABLESPACE 'xxx' UNTIL 'xxx'...;"

In all the above cases the datafiles are restored to the location mentioned in
the parameter DB_FILE_NAME_CONVERT or as specified by "SET NEWNAME FOR ....." 
command. Once the files are restored then the "auxiliary"(/duplicate/clone/..)
controlfile is created and the files are renamed to the location specified by 
the parameter. All this happens as part of memory scripts.

This is not the case with a manual restore of the target to a new location.
In that case the the files are restored to location contained in the controlfile
and the parameter DB_FILE_NAME_CONVERT is not used at all.

In case of creating standby database manually DB_FILE_NAME_CONVERT and 
LOG_FILE_NAME_CONVERT parameter can be used if db/log file location is 
different in primary and standby.

Please note that setting DB_FILE_NAME_CONVERT would not change file location in 
controlfile but memory only for the instance. The standby control file will 
keep original location information until you change them using 
'ALTER DATABASE RENAME FILE .. ' command. If restarting standby after 
removing (commenting out) DB_FILE_NAME_CONVERT, the standby will be started with 
same location for db/log files and may errors output when opening read only 
or applying archive logs.

In short, the parameter cannot be used to rename and restore files into the 
target database itself.


2. Can the parameter LOG_FILE_NAME_CONVERT be used to rename the the logfiles
as part of a manual restore of target to a different location?

Answer
------
The answer again is NO.
The explanation of the first question holds good for the online redologs as well.
Though the logfiles are not restored but are created as part of an "open resetlogs".
In that case again the controlfile would not be renamed using the parameter and 
would still be pointing to the original location.

3. Does parameter LOG_FILE_NAME_CONVERT enable to add logfile to standby when 
adding ones into primary?

Answer
------
The answer again is No. 
Redo, standby redo and temp files are managed separately in primary and standby 
environment. Adding redo into primary would not add same to standby automatically 
even with LOG_FILE_NAME_CONVERT.

针对1、2这个问题理解了就可以,convert只是转换路径,不改名;第三个问题,如果主库要添加redo,要如何操作

1)备库关闭应用

ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;

2)备库设置standby_file_management为mannual 

alter system set standby_file_management=mannual;

3)备库添加redo、standby redo

4)主库设置standby_file_management为mannual 

5)主库添加redo、standby redo

6)将主库备库都standby_file_management设置为auto

alter system set standby_file_management=auto;

7)备库开启应用

 

 

 

 

你可能感兴趣的:(dg,oracle)