ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 【迁移】使用rman迁移数据库

【迁移】使用rman迁移数据库

原创 Linux操作系统 作者:yellowlee 时间:2011-05-24 22:13:42 0 删除 编辑
使用rman迁移数据库

1源库全备,然后备份控制文件

backup format '/xxxx/xxxt/full_%s_%p_%t' database;

backup current controlfile format '/xxxx/xxx/control_%s_%p_%t';

 

2安装目标库软件,且升级到版本与源库一致

3源库生成pfile,拷贝到目标库,并修改控制文件和dump文件路径

Create pfile from spfile;

 

Pfile内容:

test1.__db_cache_size=377487360

test1.__java_pool_size=4194304

TEST1.__large_pool_size=4194304

test1.__large_pool_size=4194304

test1.__shared_pool_size=209715200

test1.__streams_pool_size=0

*.audit_file_dest='/tpsys/oracle/admin/test1/adump'

*.background_dump_dest='/tpsys/oracle/admin/test1/bdump'

*.compatible='10.2.0.1.0'

*.control_files='/tpdata/oradata/test1/control01.ctl','/tpdata/oradata/test1/control02.ctl','/tpdata/oradata/test1/control03.ctl'

*.core_dump_dest='/tpsys/oracle/admin/test1/cdump'

*.db_block_size=8192

*.db_domain=''

*.db_file_multiblock_read_count=16

*.db_name='test1'

*.db_recovery_file_dest='/tpsys/oracle/flash_recovery_area'

*.db_recovery_file_dest_size=5368709120

*.dispatchers='(PROTOCOL=TCP) (SERVICE=test1XDB)'

*.job_queue_processes=10

*.log_archive_start=TRUE

*.open_cursors=300

*.pga_aggregate_target=199229440

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

*.sga_target=598736896

*.undo_management='AUTO'

*.undo_tablespace='UNDOTBS1'

*.user_dump_dest='/tpsys/oracle/admin/test1/udump'

 

4在目标库用rman restore控制文件

startup nomount pfile=’xxxxx’;

restore controlfile from '/tpdata/oradata/test1/control_11_1_748094979';

 

5创建密码文件

$ORACLE_HOME/bin/orapwd file=$ORACLE_HOME/dbs/orapwtest1 password=sys

 

 

6,mount数据库

Rman restore数据库

run{

allocate channel t1 type disk;

allocate channel t2 type disk;

set newname for datafile '/tpsys/oracle/oradata/test1/system01.dbf'  to  '/tpdata/oradata/test1/system01.dbf'    ;

set newname for datafile '/tpsys/oracle/oradata/test1/undotbs01.dbf' to  '/tpdata/oradata/test1/undotbs01.dbf'   ;

set newname for datafile '/tpsys/oracle/oradata/test1/sysaux01.dbf'  to  '/tpdata/oradata/test1/sysaux01.dbf'    ;

set newname for datafile '/tpsys/oracle/oradata/test1/users01.dbf'   to  '/tpdata/oradata/test1/users01.dbf'     ;

set newname for datafile '/tpsys/oracle/oradata/test1/iasys.dbf'     to  '/tpdata/oradata/test1/iasys.dbf'       ;

restore database;

switch datafile all;

release channel t1;

release channel t2;

}

 

allocated channel: t1

channel t1: sid=155 devtype=DISK

 

allocated channel: t2

channel t2: sid=154 devtype=DISK

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

executing command: SET NEWNAME

 

Starting restore at 10-APR-11

 

channel t1: starting datafile backupset restore

channel t1: specifying datafile(s) to restore from backup set

restoring datafile 00001 to /tpdata/oradata/test1/system01.dbf

restoring datafile 00002 to /tpdata/oradata/test1/undotbs01.dbf

restoring datafile 00003 to /tpdata/oradata/test1/sysaux01.dbf

restoring datafile 00004 to /tpdata/oradata/test1/users01.dbf

restoring datafile 00005 to /tpdata/oradata/test1/iasys.dbf

channel t1: reading from backup piece /tpsys/oracle/flash_recovery_area/TEST1/backupset/2011_04_08/o1_mf_nnndf_TAG20110408T174321_6sxp5sm7_.bkp

channel t1: restored backup piece 1

piece handle=/tpsys/oracle/flash_recovery_area/TEST1/backupset/2011_04_08/o1_mf_nnndf_TAG20110408T174321_6sxp5sm7_.bkp tag=TAG20110408T174321

channel t1: restore complete, elapsed time: 00:03:24

Finished restore at 10-APR-11

 

datafile 1 switched to datafile copy

input datafile copy recid=6 stamp=748129430 filename=/tpdata/oradata/test1/system01.dbf

datafile 2 switched to datafile copy

input datafile copy recid=7 stamp=748129430 filename=/tpdata/oradata/test1/undotbs01.dbf

datafile 3 switched to datafile copy

input datafile copy recid=8 stamp=748129430 filename=/tpdata/oradata/test1/sysaux01.dbf

datafile 4 switched to datafile copy

input datafile copy recid=9 stamp=748129430 filename=/tpdata/oradata/test1/users01.dbf

datafile 5 switched to datafile copy

input datafile copy recid=10 stamp=748129430 filename=/tpdata/oradata/test1/iasys.dbf

 

released channel: t1

 

released channel: t2

 

RMAN>

7 恢复数据库

recover database using BACKUP CONTROLFILE

从源库拷贝必要的归档文件,这里按照rman的提示输入归档名称

如果缺少了归档:

recover database using BACKUP CONTROLFILE until cancel;

shutdown immediate

startup mount;

 

8 alter database open resetlogs

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/16179598/viewspace-696185/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2008-12-27

  • 博文量
    316
  • 访问量
    664990