windows2008 Oracle如何通过rman进行增量迁移

网友投稿 388 2023-12-29

windows2008 Oracle如何通过rman进行增量迁移

本篇文章为大家展示了windows2008 Oracle如何通过rman进行增量迁移,内容简明扼要并且容易理解,绝对能使你眼前一亮,通过这篇文章的详细介绍希望你能有所收获。

windows2008 Oracle如何通过rman进行增量迁移

环境介绍: windows2008R2 Oracle11.2.0.1  非归档模式

迁移过程:

修改归档:

点击(此处)折叠或打开

alter system set log_archive_dest_1=location=d:\archivelog scope=spfile;

shutdown immediate;

startup mount;

alter database archivelog;

alter database open

通过rman进行全备,当然也可以进行0级备份,后续增量备份,这里使用归档日志方式进行追加数据。

点击(此处)折叠或打开

run {

allocate channel ch2 type disk;

    allocate channel ch3 type disk;

    allocate channel ch4 type disk;

allocate channel ch5 type disk;

    sql alter system archive log current;

    sql alter system archive log current;

backup format E:\rmanbackup\orcl_full_%T_%s_%p database plus archivelog delete all input;

backup format E:\rmanbackup\orcl_controlfile_%T_%s_%p current controlfile;

    sql alter system archive log current;

backup format E:\rmanbackup\orcl_arch_%Y%M%D_%s_%p archivelog all;

    release channel ch2;

    release channel ch3;

release channel ch4;

    release channel ch5;

}

生成pfile文件

点击(此处)折叠或打开

create pfile=d:\pfile20170721.ora from spfile

目标端创建实例

点击(此处)折叠或打开

oradim -new -sid orcl

将备份文件、参数文件、密码文件拷贝至目标端

编辑pfile文件,创建相关目录,修改相关参数(如sga、pga等)

点击(此处)折叠或打开

md D:\APP\Administrator\admin\orcl\adump

md D:\app\Administrator\admin\orcl\dpdump

md D:\app\Administrator\oradata\orcl

启动nomount阶段

点击(此处)折叠或打开

create spfile from pfile=d:\pfile20170721.ora;

startup nomount

恢复控制文件:

点击(此处)折叠或打开

--恢复控制文件 ,注意修改备份的控制文件名

restore controlfile from D:\rmanbackup\ORCL_CONTROLFILE_20170731_74_1;

--启动到mount阶段

sql alter database mount

恢复数据文件:

点击(此处)折叠或打开

catalog start with D:\rmanbackup;

--查看对应数据文件

--查看对应的表空间、数据文件信息

set lines 150

col tname for a10

col dname for a65

select t.ts#,t.name tname,d.file#,d.name dname,d.status from v$tablespace t,v$datafile d where t.ts#=d.ts#;

--对数据文件重命名查询语句

select set newname for datafile ||d.file#|| to ||d.name||; from v$datafile d,v$tablespace t where d.ts#=t.ts# and t.INCLUDED_IN_DATABASE_BACKUP=YES;

--更改目标盘符,这里是d: 原来为E

------------------------------

--恢复数据文件  跟客户通过,数据文件目录XHLISDB不变

run{

set newname for datafile 1 to D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSTEM01.DBF;

set newname for datafile 2 to D:\APP\ADMINISTRATOR\ORADATA\ORCL\SYSAUX01.DBF;

set newname for datafile 3 to D:\APP\ADMINISTRATOR\ORADATA\ORCL\UNDOTBS01.DBF;

set newname for datafile 4 to D:\APP\ADMINISTRATOR\ORADATA\ORCL\USERS01.DBF;

…………

restore database;

switch datafile all;

}

--修改redo 位置

点击(此处)折叠或打开

--查看redo路径

select * from v$logfile;

--修改redo路径,查看路径后,如路径不对,修改为目标路径

select alter database rename file ||member|| to ||member||; from v$logfile;

alter database rename file E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO002.LOG to D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO002.LOG;

alter database rename file E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO003.LOG to D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO003.LOG;

alter database rename file E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO001.LOG to D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO001.LOG;

alter database rename file E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO004.LOG to D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO004.LOG;

alter database rename file E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO005.LOG to D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO005.LOG;

alter database rename file E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO006.LOG to D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO006.LOG;

alter database rename file E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO007.LOG to D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO007.LOG;

alter database rename file E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO008.LOG to D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO008.LOG;

alter database rename file E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO009.LOG to D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO009.LOG;

alter database rename file E:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO010.LOG to D:\APP\ADMINISTRATOR\ORADATA\ORCL\REDO010.LOG

==================================================================================

开始切换数据库

点击(此处)折叠或打开

--停止原库监听,手动切换几次归档

alter system archive log current;

--确保数据库数据一致,重启数据库实例,再次切换几次归档

alter system archive log current;

--备份归档

backup format E:\rmanbackup\orcl_arch_%T_%s_%p archivelog all

附:使用增量

点击(此处)折叠或打开

--也可以使用增量的方式(主要相关语句,具体参考其他文件 )

select current_scn from v$database;

BACKUP INCREMENTAL FROM SCN 1013684 DATABASE FORMAT E:\rmanbackup\orcl_incr_%T_%s_%p;

backup current controlfile format E:\rmanbackup\orcl_arch_%T_%s_%p;

recover database noredo

拷贝文件到目标服务器:

开始恢复:

点击(此处)折叠或打开

catalog start with D:\rmanbackup\ORCL_ARCH_20170721_61_1;

list backup of archivelog all;

--归档日志备份最早序号开始

restore archivelog from sequence 57;

--将数据库实例恢复至最后一个归档文件序号

recover database until sequence 63;

--open

alter database open resetlogs;

--修改临时表空间

alter database tempfile D:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF drop;

ALTER TABLESPACE TEMP ADD TEMPFILE D:\APP\ADMINISTRATOR\ORADATA\ORCL\TEMP01.DBF SIZE 10G autoextend on

注意:通过oradim 命令创建实例,开机无法自动启动实例,可修改注册表修改。ORA_CTY1_AUTOSTART  默认为false,修改为true。也可以执行下面命令:

点击(此处)折叠或打开

oradim.exe -NEW -SID orcl -INTPWD oracle -STARTMODE auto -PFILE "D:\Agilent\Oracle\Admin\..\initorcl.ora"

恢复后,建议进行数据库、系统相关检查。

上述内容就是windows2008 Oracle如何通过rman进行增量迁移,你们学到知识或技能了吗?如果还想学到更多技能或者丰富自己的知识储备,欢迎关注行业资讯频道。

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:怎么使用HotDB SQL语法
下一篇:rman怎么恢复spfile
相关文章

 发表评论

暂时没有评论,来抢沙发吧~