使用RMAN进行数据迁移1.查看SCN,然后备份数据库run{allocate channel c1 type disk;allocate channel c2 type disk;allocate channel c3 type disk;allocate channel c4 type disk;allocate channel c5 type disk;sql 'alter system archive log current';backup database tag 'db0' include current controlfile plus archivelog;release channel c1;release channel c2;release channel c3;release channel c4;release channel c5;}备份的文件249G,备份用时20分钟2.将备份传输至目标服务器 (53分钟)3.在目标服务器还原先在$ORACLE_HOME/dbs下创建文件 initmvbox.ora里面只有一行db_name=mvbox 将数据库启动至nomountrestore spfile to '/xxxx/spfilemvbox.ora' from '/xxxx/2015_06_11/o1_mf_nnsnf_DB0_bqky8s7r_.bkp'; 还原控制文件shutdown abort;startup mount;restore controlfile from '/xxxx/2015_06_11/o1_mf_ncnnf_DB0_bqky8pq9_.bkp';sql 'alter database mount';挂载备份catalog start with '/xxxx/2015_06_11';还原数据库run{allocate channel c1 type disk;allocate channel c2 type disk;allocate channel c3 type disk;allocate channel c4 type disk;allocate channel c5 type disk;restore database;release channel c1;release channel c2;release channel c3;release channel c4;release channel c5;}还原数据库用时 30分钟4.在目标服务器进行数据库恢复(业务实际停机时间)首先,业务停机然后查看当前的SCNselect to_char(CURRENT_SCN) from v$database; 备份归档日志sql 'alter system archive log current';run{allocate channel c1 type disk;allocate channel c2 type disk;allocate channel c3 type disk;allocate channel c4 type disk;allocate channel c5 type disk;backup archivelog all tag 'arch0';release channel c1;release channel c2;release channel c3;release channel c4;release channel c5;}因为在迁移之前,清空过归档日志,所以归档日志只是从备份开始到现在的这段时间日志量不大,10分钟以内就可以完成 备份和传输清空归档日志的命令(delete noprompt archivelog all;)挂载归档日志catalog start with '/xxxx/2015_06_11';进行不完全恢复,set until scn xxx这个数字就是备份归档日志之前查看的SCNrun{shutdown immediate; startup mount; set until scn 79377202898; allocate channel c1 type disk;allocate channel c2 type disk;allocate channel c3 type disk;allocate channel c4 type disk;allocate channel c5 type disk;recover database;release channel c1;release channel c2;release channel c3;release channel c4;release channel c5;}恢复用时11分钟(应用归档日志从10:40至14:39,4个小时)alter database open resetlogs;迁移完成.比对MySQL的不完全恢复可以发现MySQL先恢复,再应用binlog,最后还原他恢复的时间比较短,主要的时间是应用binlog(每恢复一小时的binlog需要15分钟),最后的还原不需要时间(直接改datadir..)而Oracle,先还原再恢复还原的时间比较长(30分钟),而恢复的时间比较短(每推进一小时的数据需要2到3分钟)所以,在备份的服务器,保持一个最近还原的备份很重要..最起码会节省30分钟的还原时间
如果觉得我的文章对您有用,请点赞。您的支持将鼓励我继续创作!
关于TWT使用指南社区专家合作厂商入驻社区企业招聘投诉建议版权与免责声明联系我们 © 2024talkwithtrend — talk with trend,talk with technologist京ICP备09031017号-30
添加新评论0 条评论