如何快速的克隆oracle数据库到另外的机器

最快的方法1:(无法跨平台,例如linux to windows?)冷备份需要停机?

http://stackoverflow.com/questions/3111349/what-is-the-easiest-way-to-transfer-oracle-database-from-one-pc-to-another

APC's answer is the way to go for a logical transfer. If you're asking because you just want a one-time transfer to another PC then:

  • install the same version of Oracle on the second PC
  • create the same directory structure for the database files on the second PC

  • copy the database files (tablespace files, control files, redo logs) to the second PC (with the database shut down on PC #1!)

Some other advice:
Better to use RMAN to clone DB.
Without RMAN, old-school way is(老派做法):
1. Delete windows service for prod03 instance using oradim.
2. Delete prod03 datafiles, controlfiles, redolog files and init/config files. 
3. copy prod01 datafiles, controlfiles, redolog files and init/config files to new server, in proper places.
4. Optionally modify instance name in init/config files and in listener.ora to prod03
5. create windows service using oradim accordingly to name (prod01 or prod03) depending on step 4.



稍慢的方法2:(可否跨平台呢?)冷备份需要停机!
http://www.dba-oracle.com/oracle_tips_db_copy.htm

A database cloning procedure is especially useful for the DBA who wants to give his developers a full-sized TEST and DEV instance by cloning the PROD instance into the development server areas.

This Oracle clone procedure can be use to quickly migrate a system from one UNIX server to another.  It clones the Oracle database and this Oracle cloning procedures is often the fastest way to copy a Oracle database.

STEP 1: On the old system, go into SQL*Plus, sign on as SYSDBA and issue: “alter database backup controlfile to trace”. This will put the create database syntax in the trace file directory. The trace keyword tells oracle to generate a script containing a create controlfile command and store it in the trace directory identified in the user_dump_dest parameter of the init.ora file. It will look something like this:

STARTUP NOMOUNT
CREATE CONTROLFILE REUSE DATABASE "OLDLSQ" NORESETLOGS 
NOARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 2
MAXDATAFILES 240
MAXINSTANCES 1
MAXLOGHISTORY 113
LOGFILE
GROUP 1 ('/u03/oradata/oldlsq/log1a.dbf',
'/u03/oradata/olslsq/log1b.dbf') SIZE 30M,
GROUP 2 ('/u04/oradata/oldlsq/log2a.dbf',
'/u04/oradata/oldlsq/log2b.dbf') SIZE 30M
DATAFILE
'/u01/oradata/oldlsq/system01.dbf',
'/u01/oradata/oldlsq/mydatabase.dbf'
;
# Recovery is required if any of the datafiles are restored
# backups, or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# Database can now be opened normally.
ALTER DATABASE OPEN;

 

STEP 2: Shutdown the old database

STEP 3: Copy all data files into the new directories on the new server. You may change the file names if you want, but you must edit the controlfile to reflect the new data files names on the new server.

rcp /u01/oradata/oldlsq/* newhost:/u01/oradata/newlsq
rcp /u01/oradata/oldlsq/* newhost:/u01/oradata/newlsq
rcp /u03/oradata/oldlsq/* newhost:/u03/oradata/newlsq
rcp /u04/oradata/oldlsq/* newhost:/u04/oradata/newlsq

 

STEP 4: Copy and Edit the Control file – Using the output syntax from STEP 1, modify the controlfile creation script by changing the following:

Old:

CREATE CONTROLFILE REUSE DATABASE "OLDLSQ" NORESETLOGS

New:

CREATE CONTROLFILE SET DATABASE "NEWLSQ" RESETLOGS

STEP 5: Remove the “recover database” and “alter database open” syntax

# Recovery is required if any of the datafiles are restored
# backups, or if the last shutdown was not normal or immediate.
RECOVER DATABASE
# Database can now be opened normally.
ALTER DATABASE OPEN;

 

STEP 6: Re-names of the data files names that have changed.

Save as db_create_controlfile.sql.

Old:

DATAFILE
'/u01/oradata/oldlsq/system01.dbf',
'/u01/oradata/oldlsq/mydatabase.dbf'

New:

DATAFILE
'/u01/oradata/newlsq/system01.dbf',
'/u01/oradata/newlsq/mydatabase.dbf'

STEP 7: Create the bdump, udump and cdump directories

cd $DBA/admin
mkdir newlsq
cd newlsq
mkdir bdump
mkdir udump
mkdir cdump
mkdir pfile


STEP 8: Copy-over the old init.ora file

rcp $DBA/admin/olslsq/pfile/*.ora newhost:/u01/oracle/admin/newlsq/pfile

STEP 9: Start the new database

@db_create_controlfile.sql

STEP 10: Place the new database in archivelog mode



使用RMAN clone:
http://docs.oracle.com/cd/E11882_01/backup.112/e10642/rcmdupdb.htm#BRADV420

如何安装进入使用RMAN (recovery manager):
http://blog.itpub.net/7607759/viewspace-624511/

从windows到linux:http://blog.csdn.net/waterxcfg304/article/details/11160093
下面是我做的实验:
source platform:
os: Windows
oracle version: 10.2.0.1.0
 
Target platform:
os:Linux
oracle version:10.2.0.1.0


检查oracle所在的系统平台名称:
select a.PLATFORM_NAME,b.ENDIAN_FORMAT
from v$database a,v$transportable_platform b 
where a.PLATFORM_ID=b.PLATFORM_ID;


使用RMAN 跨平台clone:
http://www.dba-oracle.com/art_dbazine_ault_cross_plat.htm
检查平台OS的兼容列表:注意 位数 和 字节序
select b.PLATFORM_NAME,b.ENDIAN_FORMAT
from  v$transportable_platform b ;
检查你要转换的数据库文件大小:
SELECT TABLESPACE_NAME,FILE_NAME,AUTOEXTENSIBLE,
INCREMENT_BY,MAXBYTES/1024/1024 "MAX IN MB",
BYTES/1024/1024 "SIZE_IN_MB"
FROM DBA_DATA_FILES ORDER BY TABLESPACE_NAME;


RMAN> CONVERT TABLESPACE ‘USERS’
      TO PLATFORM = ‘Linux IA (32-bit)’
      DB_FILE_NAME_CONVERT = ‘/u02/oradata/grid/users01.dbf’, ‘/dba/recovery_area/transport_linux’





  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值