rman clone NID 新创建数据文件从0开始恢复

How to clone/duplicate a database with added datafile with no backup

Oracle Database - Enterprise Edition - Version 9.2.0.1 to 10.2.0.4 Release 9.2 to 10.2

Information in this document applies to any platform.

GOAL

How can I clone/duplicate a database and change it's name if a datafile backup is missing. Archivelog files are available for recreating the datafile using 'alter database create datafile'.

I.e., a datafile was added to the database, but not yet backed up. Archive files are available to recreate this datafile. How can a clone/duplicate database be created in this scenario?

Issues to consider:

  1. The RMAN duplicate command will want to create a new controlfile. However, the new datafile will not be added to the controlfile.

  2. If a new controlfile is created with a database name change, the datafile cannot be added after the fact.

  3. You cannot create a datafile (using alter database) if that datafile is not listed in the controlfile.

SOLUTION

You will not be able to use the RMAN duplicate in this scenario. The RMAN duplicate command would fail with errors on the newly added datafile, like:

ORA-01503: CREATE CONTROLFILE failed

ORA-01565: error in identifying file '/<path>/<filename>'

ORA-27041: unable to open file

OSD-04002: unable to open file

O/S-Error: (OS 2) The system cannot find the file specified.

Another possibility would be errors like:

RMAN-03002: failure of Duplicate Db command at 03/22/2007 10:16:22

RMAN-03015: error occurred in stored script Memory Script

ORA-00283: recovery session canceled due to errors

RMAN-11003: failure during parse/execution of SQL statement: alter database recover logfile '/<path>/<archivelog_name>'

ORA-00283: recovery session canceled due to errors

ORA-01244: unnamed datafile(s) added to controlfile by media recovery

ORA-01110: data file 93: '/<path>/<filename>'

NOTE: In Oracle10g, RMAN will create the datafiles on recovery, so this may not be an issue.

NOTE: The same issue can apply to creating a duplicate database for standby, when datafiles are added to the primary after the backup.

Instead, you MUST use a current controlfile of the target database, to create the clone. Then the database name/DBID can be changed using the NID utility.

STEPS:

NOTE: Target database must be shutdown if the clone is created on the same server.

  1. copy production controlfile in the clone location.

  2. startup mount clone database

  3. select name from v$datafile

-- issue 'alter database rename file .... to .....; /* this renames the datafile location. It is

must be issued for every datafile existing - thus missing datafile will not be included in this

rename.

  1. select name from v$logfile

-- issue ''alter database rename file .... to .....; /* this rename will place the redo log files

in the proper location when clone database is opened.

  1. issue:

alter database create datafile AS;

  1. Restore the database

  2. recover database using backup controlfile until cancel;

-- apply all archives you have

  1. alter database open resetlogs;

  2. shutdown database

  3. startup mount

  4. exit sql and issue at the operating system:

-- nid TARGET=SYS/<PASSWORD> DBNAME SETNAME=YES

/* NOTE: If you plan to register this database in RMAN the dbid must also be changed using the NID utility */

  1. shutdown database

  2. edit init.ora changing db_name parameter

  3. startup cloned database

  4. verify name change:

select name from v$database

show parameter db_name

相关推荐
ECT-OS-JiuHuaShan15 小时前
什么是对和错?——“有针对性定义域的逻辑值的真伪”:认识论终极追问的公理化裁决
数据库·人工智能·算法·机器学习·数学建模
乐维_lwops15 小时前
多类型数据库如何高效监控?
数据库·数据库监控·运维监控
齐潇宇15 小时前
Redis数据库基础
linux·数据库·redis·缓存
三更两点16 小时前
AI拉呱-技术洞察 - 2026-06-01
数据库·人工智能·技术洞察
程序边界16 小时前
KES查询优化与运维实战:从表空间到SQL内核那些让DBA少加班的事
数据库
Lyyaoo.16 小时前
【MySQL】存储引擎
数据库·mysql
huluang16 小时前
密评多选题 — 陷阱名单(费曼自述法版)
网络·数据库·密码学
AOwhisky16 小时前
学习自测与解析:MySQL 系列第三期与第四期
linux·运维·数据库·学习·mysql·云计算
Esaka_Forever16 小时前
PyCharm 社区版无法识别 .db 文件类型
数据库·ide·pycharm
yyuuuzz16 小时前
AI模型部署中的常见稳定性问题
运维·服务器·网络·数据库·人工智能·云计算·github