分享
 
 
 

记录一次现场“数据库迁移”的笔记

王朝other·作者佚名  2008-05-19
窄屏简体版  字體: |||超大  

刚开始出现了些问题,搞得我既郁闷又着急。都不知道我在记什么了,大家将就着看吧!

一个10G数据库的真实迁移过程(也可以说是一个数据库系统崩溃下的恢复过程),要求停机的时间最短

前提:拥有完整的数据库备份和归档日志,迁移的主机所有的目录结构和原主机一样。

Oracle版本: 10.1.0.3.0

操作系统: linux2.6.11

备份程序:rman,没用恢复目录

把所有rman的备份(包括控制文件的自动备份)拷贝到新的服务器上,路径要和原来的一模一样。

迁移过程如下:

1、把参数文件,tns等文件拷贝到新服务器上,原数据库停机,开始把数据库迁移到新的服务器上。

$set oracle_sid=service

SQL conn / as sysdba

Connected.

SQLstartup nomount;

2、--恢复控制文件

SQL declare

devtype varchar2(256);

done boolean;

begin

devtype :=dbms_backup_restore.deviceallocate(NULL);

dbms_backup_restore.restoresetdatafile;

dbms_backup_restore.restorecontrolfileto('/opt/data/SERVICE/control01.ctl'); dbms_backup_restore.restorebackuppiece('/opt/backup/control_c-4194659530-20050805-01',DONE = done);

end;

/

PL/SQL procedure successfully completed.

--这个过程我到现在还解,应该是只要控制文件自动备份,通过restore controlfile from autobackup就能恢复过来,但我在现场怎么实现不了。没办法,只要用dbms_backup_restore包了。

3、--把控制文件复制成三个文件

$ cp control01.ctl control02.ctl

$ cp control01.ctl control03.ctl

SQLalter database mount --数据库启动到mount状态准备进行数据文件的恢复

4、--启动rman

Recovery Manager: Release 10.1.0.3.0 - Production

Copyright (c) 1995, 2004, Oracle. All rights reserved.

RMAN connect target /

connected to target database: SERVICE (DBID=667643333)

RMAN restore database ;

Starting restore at 05-AUG-05

using target database controlfile instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: sid=159 devtype=DISK

channel ORA_DISK_1: starting datafile backupset restore

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

restoring datafile 00001 to /opt/data/SERVICE/system01.dbf

restoring datafile 00002 to /opt/data/SERVICE/undotbs01.dbf

restoring datafile 00003 to /opt/data/SERVICE/sysaux01.dbf

restoring datafile 00004 to /opt/data/SERVICE/users01.dbf

restoring datafile 00005 to /opt/data/SERVICE/business01.dbf

restoring datafile 00006 to /opt/data/SERVICE/advertise.dbf

restoring datafile 00007 to /opt/data/SERVICE/backup.dbf

channel ORA_DISK_1: restored backup piece 1

piece handle=/opt/backup/service_mpgr881f_1_1_565452847 tag=TAG20050804T141407

channel ORA_DISK_1: restore complete

Finished restore at 05-AUG-05

5、--查看归档日志

RMAN list backup archivelog all;

6、进行数据库的恢复

RMAN recover database;

Starting recover at 05-AUG-05

using channel ORA_DISK_1

starting media recovery

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15553

channel ORA_DISK_1: restored backup piece 1

piece handle=/opt/backup/service_mqgr88jj_1_1_565453427 tag=TAG20050804T142347

channel ORA_DISK_1: restore complete

archive log filename=/opt/archive/SERVICE1_15553_552391870.dbf thread=1 sequence=15553

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15554

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15555

channel ORA_DISK_1: restored backup piece 1

piece handle=/opt/backup/service_msgr88om_1_1_565453590 tag=TAG20050804T142629

channel ORA_DISK_1: restore complete

archive log filename=/opt/archive/SERVICE1_15554_552391870.dbf thread=1 sequence=15554

archive log filename=/opt/archive/SERVICE1_15555_552391870.dbf thread=1 sequence=15555

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15556

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15557

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15558

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15559

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15560

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15561

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15562

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15563

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15564

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15565

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15566

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15567

channel ORA_DISK_1: restored backup piece 1

piece handle=/opt/backup/service_mvgraf8g_1_1_565525776 tag=TAG20050805T102935

channel ORA_DISK_1: restore complete

archive log filename=/opt/archive/SERVICE1_15556_552391870.dbf thread=1 sequence=15556

archive log filename=/opt/archive/SERVICE1_15557_552391870.dbf thread=1 sequence=15557

archive log filename=/opt/archive/SERVICE1_15558_552391870.dbf thread=1 sequence=15558

archive log filename=/opt/archive/SERVICE1_15559_552391870.dbf thread=1 sequence=15559

archive log filename=/opt/archive/SERVICE1_15560_552391870.dbf thread=1 sequence=15560

archive log filename=/opt/archive/SERVICE1_15561_552391870.dbf thread=1 sequence=15561

archive log filename=/opt/archive/SERVICE1_15562_552391870.dbf thread=1 sequence=15562

archive log filename=/opt/archive/SERVICE1_15563_552391870.dbf thread=1 sequence=15563

archive log filename=/opt/archive/SERVICE1_15564_552391870.dbf thread=1 sequence=15564

archive log filename=/opt/archive/SERVICE1_15565_552391870.dbf thread=1 sequence=15565

archive log filename=/opt/archive/SERVICE1_15566_552391870.dbf thread=1 sequence=15566

archive log filename=/opt/archive/SERVICE1_15567_552391870.dbf thread=1 sequence=15567

channel ORA_DISK_1: starting archive log restore to default destination

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15568

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15569

channel ORA_DISK_1: restoring archive log

archive log thread=1 sequence=15570

channel ORA_DISK_1: restoring archive log

archive log

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有