Oracle文档对于该参数的描述十分容易产生歧义:converts the filename of a new log file on the primary database to the filename of a log file on the standby database,有时被误解为归档日志的文件名转换。
如在某standby备库进行以下测试:
alter system set log_file_name_convert='orcl','ZZZZZZ' scope=spfile; SQL> select fnnam,fnonm from x$kccfn; FNNAM -------------------------------------------------------------------------------- FNONM -------------------------------------------------------------------------------- /u01/oradata/ZZZZZZ/redo03.log /u01/oradata/orcl/redo03.log /u01/oradata/ZZZZZZ/redo02.log /u01/oradata/orcl/redo02.log /u01/oradata/ZZZZZZ/redo01.log /u01/oradata/orcl/redo01.log alter system set log_file_name_convert='orcl','8888888' scope=spfile; SQL> select fnnam,fnonm from x$kccfn; FNNAM -------------------------------------------------------------------------------- FNONM -------------------------------------------------------------------------------- /u01/oradata/8888888/redo03.log /u01/oradata/orcl/redo03.log /u01/oradata/8888888/redo02.log /u01/oradata/orcl/redo02.log /u01/oradata/8888888/redo01.log /u01/oradata/orcl/redo01.log
v$datafile中的大部分信息来源于x$kccfn内部视图,kccfn意为[F]ile [N]ames来源于Controlfile,其中 fnnam为经过对controlfile中文件名记录转制(由db_file_name_convert或 log_file_name_convert等参数convert)后的记录,而fnonm为控制文件中的原始文件名(或曰文件路径)。若在Data Guard配置过程中遭遇到日志文件名或数据文件名的转制问题,可以通过查询该视图进一步分析。
author: maclean
permanent link:https://www.askmac.cn/2010/05/31/%E5%85%B3%E4%BA%8E%E5%8F%82%E6%95%B0log_file_name_convert/
date:2010-05-31
All rights reserved.
Usage of db/log_file_name_convert parameters
***
This article is being delivered in Draft form and may contain
errors. Please use the MetaLink “Feedback” button to advise
Oracle of any issues related to this article.
***
ORACLE
——————————
—————-
FREQUENTLY ASKED QUESTIONS
————————–
17-MON-2004
CONTENTS
——–
1. Can the parameter db_file_name_convert be used to rename the files as
part of restore of the target backups?
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?
3. Does parameter log_file_name_convert enable to add logfile to standby
when adding ones into primary?
QUESTIONS & ANSWERS
——————-
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 ‘xxxx’..;”
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.