暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

How do I clone a database from one machine to another - when the filesystems are different ?

2011-01-01
828

The Oracle (tm) Users' Co-Operative FAQ

How do I clone a database from one machine to another - when the filesystems are different ?


Author's name: Connor McDonald

Author's Email: connor_mcdonald@yahoo.com

Date written: 28 November 2002

Oracle version(s): 7+

How do I clone a database from one machine to another - when the filesystems are different ?


(I'm assuming you're using a hot backup of the source database to do your clone - after all, no-one should be using cold backups!)

Cloning a database is normally done with the following sequence:

  1. Copy the datafiles to the target node
  2. Produce a CREATE CONTROLFILE command for the cloned database
  3. Start the target database in NOMOUNT mode
  4. Run the create controlfile command created in (2)
  5. Issue "recover database using backup controlfile until cancel"
  6. Provide the recovery processe with archived redo logs until you are happy
  7. Cancel the recovery and issue "alter database open resetlogs"
  8. Re-create or re-add any TEMPFILES used for temporary tablespaces

This is all quite straightforward even if you have to rename the database, and any of the files in the database. The secret is in step (2). On the source database, you can run

SQL> alter database backup controlfile to trace

at which point you will get a full "create controlfile" command dumped out to the user_dump_dest directory. It will look something like

CREATE CONTROLFILE REUSE DATABASE "SOURCEDB" NORESETLOGS ARCHIVELOG
  ...
LOGFILE
  GROUP 1 '/disk1/log1.dbf'  SIZE 50M,
  ...
DATAFILE
  '/disk2/system01.dbf',
  '/disk3/rbs01.dbf',
  ...
  '/diskN/last_file01.dbf'
CHARACTER SET WE8ISO8859P1;

For cloning this database, you will alter

  • The REUSE to SET
  • The SOURCEDB to NEWDB (that is, the new name of the target database)
  • The NORESETLOGS to RESETLOGS

For each file listed under the DATAFILE clause, if you will be renaming the file as part of the cloning process, then you simply update the file name to the new name in the CREATE CONTROLFILE command.


Further reading: You can also clone a database using the RMAN duplicate command (see the RMAN documentation for instructions)



最后修改时间:2020-04-16 15:11:51
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论