windows环境
oracle 10.2.0.1
源库:192.168.1.81
目标库:192.168.1.2
主要流程:
停止源库->备份->恢复->改数据文件位置->resetlogs打开
迁移数据库81 到192.168.1.2上
停81库,设置归档路径,将其启动到归档模式,
以administrator身份启动数据库服务oracleserviceorcl
备份测试
C:\>set oracle_sid=orcl
C:\>rman target /
RMAN> backup current controlfile format '\\192.168.1.2\oradata\81\cf_%U';
全备
run {
backup as compressed backupset database
format '\\192.168.1.2\oradata\81\dbfull_%d_%T_%s';
sql 'alter system archive log current';
}
搜集信息
sqlplus "/as sysdba"
set linesize 130 pagesize 2000
set trimspool on
set echo off
set verify off
set timing off
set feedback off
set head off
set echo off
spool renfile.sql
select 'set newname for datafile '''||name||''' to ''d:\oradata\81\'|| substr(name, instr(name, '\', -1) + 1)||'''; ' cmd from v$datafile
union all
select 'set newname for tempfile '''||name||''' to ''d:\oradata\81\'|| substr(name, instr(name, '\', -1) + 1)||'''; ' cmd from v$tempfile;
spool off
创建pfile文件,拷贝到目标位置
create pfile from spfile;
修改pfile文件中的路径,注意dump目录、控制文件目录、归档位置目录(最好将需要恢复的归档日志拷贝到此目录 以便恢复)
启动实例到nomount状态,恢复控制文件
set oracle_sid=orcl
rman target /
startup nomount
restore controlfile from 'd:\oradata\81\DBFULL_ORCL_20110111_21'; #控制文件得提前知道放哪了
段句柄=\\192.168.1.2\ORADATA\81\DBFULL_ORCL_20110111_21
alter database mount;
catalog start with 'e:\oradata\bak' noprompt; #备份集的位置指定一下
run{
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF' to 'd:\oradata\81\SYSTEM01.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF' to 'd:\oradata\81\UNDOTBS01.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF' to 'd:\oradata\81\SYSAUX01.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF' to 'd:\oradata\81\USERS01.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\EXAMPLE01.DBF' to 'd:\oradata\81\EXAMPLE01.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_01.DBF' to 'd:\oradata\81\test_01.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_02.DBF' to 'd:\oradata\81\test_02.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_0423_01.DBF' to 'd:\oradata\81\test_0423_01.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_0423_02.DBF' to 'd:\oradata\81\test_0423_02.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_0423_03.DBF' to 'd:\oradata\81\test_0423_03.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_0423_04.DBF' to 'd:\oradata\81\test_0423_04.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_03.DBF' to 'd:\oradata\81\test_03.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_04.DBF' to 'd:\oradata\81\test_04.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_05.DBF' to 'd:\oradata\81\test_05.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_06.DBF' to 'd:\oradata\81\test_06.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\test_07.DBF' to 'd:\oradata\81\test_07.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\AAA.DBF' to 'd:\oradata\81\AAA.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TS_EV_01.DBF' to 'd:\oradata\81\TS_EV_01.DBF';
set newname for datafile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TS_EV_02.DBF' to 'd:\oradata\81\TS_EV_02.DBF';
set newname for tempfile 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\TEMP01.DBF' to 'd:\oradata\81\TEMP01.DBF';
restore database;
switch datafile all;
switch tempfile all;
recover database;
#alter database open resetlogs;
}
如果缺少归档日志
run {
set ARCHIVELOG DESTINATION to 'd:\oradata\81\arch';
recover database;
}
sqlplus "/as sysdba"
alter database rename file 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG' to 'd:\oradata\81\redo01.dbf';
alter database rename file 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG' to 'd:\oradata\81\redo02.dbf';
alter database rename file 'D:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG' to 'd:\oradata\81\redo03.dbf';
检查控制文件、数据文件、日志文件、临时文件位置是否正确。
参考:
run {
ALLOCATE CHANNEL dev1 DEVICE TYPE DISK;
ALLOCATE CHANNEL dev2 DEVICE TYPE DISK;
backup full tag 'dbfullbak' database maxsetsize 30g
include current controlfile format '\\192.168.1.2\oradata\81\dbfull_%U'
plus archivelog format '\\192.168.1.2\oradata\81\arch_%U' delete all input;
}
相关视频
相关阅读 Oracle PRKC-1002错误原因和解决方案oracle10g安装图解(win7)Oracle错误代码大全oracle查看实例名方法Oracle表空间恢复方案微软亚太研发集团总部大楼 扎根中国"硅谷"亚马逊网络服务推出Oracle RDS如何关闭oracle rac选项 make rac_off
热门文章 oracle10g安装图解(wi
最新文章
数据库流行度排行2019oracle10g安装图解(wi
SQL2008全部数据导出导入两种方法SQL2005新建复制“找不到存储过程 错误:28Dos远程登录mysql数据库详细图文教程mysql怎么开启远程登录功能
人气排行 mysql自动定时备份数据库的最佳方法-支持wiVisual Foxpro 6.0安装向导图文教程SQL Server 2008 安装图文教程SQL2008全部数据导出导入两种方法SQL 2000/2005/2008 的收缩日志方法,和清理mysql出 Can't connect to MySQL server onoracle10g安装图解(win7)sql2005安装图解_(sql server2005)安装教程
查看所有0条评论>>