1.1   确实 源数据库与目标库版本一致

语句:select * from v$version;

源库:

1292898163287465984.htm

1.2   确认源数据库名与目标库数据库名一致

查询数据库名语句:select name fromv$database;

如果不一致通过恢复spfile文件再把spfile文件转为为pfile文件修改数据库名;

恢复spfile:

restore spfile from '/home/oracle/backup/spfile_20171103_0hsijpo8_1_1.bak';

根据spfile创建pfile:

createpfile from spfile;

1.3   查询源库dbid

语句:select dbid fromv$database;

1292898163287465984.htm

1.4   登录sqlplus 创建pfile

1292898163287465984.htm

1.5   关闭数据库

1292898163287465984.htm

1.6   进入rman

1292898163287465984.htm

1.7   由pfile启动数据库到nomount状态

语句:startup pfile ='$ORACLE_HOME/dbs/initauth.ora' nomount;

1292898163287465984.htm

1.8   恢复控制文件

命令:restorecontrolfile from '/home/oracle/backup/ctl_20171109_1usj3jvs_1_1.ctl'

1292898163287465984.htm

1.9    mount数据库

命令: alterdatabase mount;

1292898163287465984.htm

1.10     重新注册备份集

命令:catalogstart with '/home/oracle/backup/';

1292898163287465984.htm

1.11      恢复数据文件

脚本如下:

run{

allocate channel t1 type DISK FORMAT'/home/oracle/backup/%U';

allocate channel t2 type DISK FORMAT'/home/oracle/backup/%U';

allocate channel t3 type DISK FORMAT'/home/oracle/backup/%U';

set newname for datafile 1 to'/u01/app/oracle/oradata/AUTH/system.259.856237927';

set newname for datafile 2 to'/u01/app/oracle/oradata/AUTH/sysaux.260.856237941';

set newname for datafile 3 to'/u01/app/oracle/oradata/AUTH/undotbs1.261.856237955';

set newname for datafile 4 to'/u01/app/oracle/oradata/AUTH/undotbs2.263.856237975';

set newname for datafile 5 to'/u01/app/oracle/oradata/AUTH/users.264.856237981';

set newname for datafile 6 to'/u01/app/oracle/oradata/AUTH/auth.268.856243549';

set newname for datafile 7 to'/u01/app/oracle/oradata/AUTH/auth.269.856243795';

set newname for datafile 8 to'/u01/app/oracle/oradata/AUTH/sysaux02.dbf';

set newname for datafile 9 to'/u01/app/oracle/oradata/AUTH/system02.dbf';

restore database;

switch datafile all;

release channel t1;

release channel t2;

release channel t3;

}

1292898163287465984.htm

等待。。。。

1.12     recover 数据库

脚本如下:

run {

allocate channel t1 type DISK FORMAT'/home/oracle/backup/%U';

allocate channel t2 type DISK FORMAT'/home/oracle/backup/%U';

allocate channel t3 type DISK FORMAT'/home/oracle/backup/%U';

recover database;

release channel t1;

release channel t2;

release channel t3;

}

1292898163287465984.htm

1.12.1           更改数据库,归档日志的存档终点。

1292898163287465984.htm

删除选中两行

alter system setlog_archive_dest='/u01/app/oracle/oradata/arch_log';

1292898163287465984.htm

1292898163287465984.htm

1292898163287465984.htm

1.13     用resetlogs方式打开数据库

命令: alterdatabase open resetlogs;

1292898163287465984.htm

1292898163287465984.htm

1.14     修改redo 日志文件位置:

在sqlplusz中

通过 select memberfrom V$logfile; 查询

通过 alterdatabase rename file ‘原路径’ to ‘新路径’  全部修改完毕

1292898163287465984.htm

1292898163287465984.htm

再次尝试resetlog方式打开数据库

1292898163287465984.htm

删除 log 10;

1292898163287465984.htm

再次尝试resetlog方式打开数据库

1.15     重建临时表空间

由于rman备份的时候并不备temporarytablespaces,所以恢复完毕后,要重新创建它们。如:

$sqlplus /nolog

SQL>conn /as sysdba

SQL> altertablespace temp add tempfile '/u01/app/oracle/oradata/AUTH/temp01.dbf' size1024m;

1292898163287465984.htm

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐