您好,登錄后才能下訂單哦!
本篇文章為大家展示了windows2008 Oracle如何通過rman進(jìn)行增量遷移,內(nèi)容簡明扼要并且容易理解,絕對(duì)能使你眼前一亮,通過這篇文章的詳細(xì)介紹希望你能有所收獲。
環(huán)境介紹: windows2008R2 Oracle11.2.0.1 非歸檔模式
遷移過程:
修改歸檔:
點(diǎn)擊(此處)折疊或打開
alter system set log_archive_dest_1='location=d:\archivelog' scope=spfile;
shutdown immediate;
startup mount;
alter database archivelog;
alter database open
通過rman進(jìn)行全備,當(dāng)然也可以進(jìn)行0級(jí)備份,后續(xù)增量備份,這里使用歸檔日志方式進(jìn)行追加數(shù)據(jù)。
點(diǎn)擊(此處)折疊或打開
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文件
點(diǎn)擊(此處)折疊或打開
create pfile='d:\pfile20170721.ora' from spfile
目標(biāo)端創(chuàng)建實(shí)例:
點(diǎn)擊(此處)折疊或打開
oradim -new -sid orcl
將備份文件、參數(shù)文件、密碼文件拷貝至目標(biāo)端
編輯pfile文件,創(chuàng)建相關(guān)目錄,修改相關(guān)參數(shù)(如sga、pga等)
點(diǎn)擊(此處)折疊或打開
md D:\app\Administrator\admin\orcl\adump
md D:\app\Administrator\admin\orcl\dpdump
md D:\app\Administrator\oradata\orcl
啟動(dòng)nomount階段
點(diǎn)擊(此處)折疊或打開
create spfile from pfile='d:\pfile20170721.ora';
startup nomount
恢復(fù)控制文件:
點(diǎn)擊(此處)折疊或打開
--恢復(fù)控制文件 ,注意修改備份的控制文件名
restore controlfile from 'D:\rmanbackup\ORCL_CONTROLFILE_20170731_74_1';
--啟動(dòng)到mount階段
sql 'alter database mount'
恢復(fù)數(shù)據(jù)文件:
點(diǎn)擊(此處)折疊或打開
catalog start with 'D:\rmanbackup';
--查看對(duì)應(yīng)數(shù)據(jù)文件
--查看對(duì)應(yīng)的表空間、數(shù)據(jù)文件信息
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#;
--對(duì)數(shù)據(jù)文件重命名查詢語句
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';
--更改目標(biāo)盤符,這里是d: 原來為E
------------------------------
--恢復(fù)數(shù)據(jù)文件 跟客戶通過,數(shù)據(jù)文件目錄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 位置
點(diǎn)擊(此處)折疊或打開
--查看redo路徑
select * from v$logfile;
--修改redo路徑,查看路徑后,如路徑不對(duì),修改為目標(biāo)路徑
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'
==================================================================================
開始切換數(shù)據(jù)庫:
點(diǎn)擊(此處)折疊或打開
--停止原庫監(jiān)聽,手動(dòng)切換幾次歸檔
alter system archive log current;
--確保數(shù)據(jù)庫數(shù)據(jù)一致,重啟數(shù)據(jù)庫實(shí)例,再次切換幾次歸檔
alter system archive log current;
--備份歸檔
backup format 'E:\rmanbackup\orcl_arch_%T_%s_%p' archivelog all
附:使用增量
點(diǎn)擊(此處)折疊或打開
--也可以使用增量的方式(主要相關(guān)語句,具體參考其他文件 )
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
拷貝文件到目標(biāo)服務(wù)器:
開始恢復(fù):
點(diǎn)擊(此處)折疊或打開
catalog start with 'D:\rmanbackup\ORCL_ARCH_20170721_61_1';
list backup of archivelog all;
--歸檔日志備份最早序號(hào)開始
restore archivelog from sequence 57;
--將數(shù)據(jù)庫實(shí)例恢復(fù)至最后一個(gè)歸檔文件序號(hào)
recover database until sequence 63;
--open
alter database open resetlogs;
--修改臨時(shí)表空間
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 命令創(chuàng)建實(shí)例,開機(jī)無法自動(dòng)啟動(dòng)實(shí)例,可修改注冊表修改。ORA_CTY1_AUTOSTART 默認(rèn)為false,修改為true。也可以執(zhí)行下面命令:
點(diǎn)擊(此處)折疊或打開
oradim.exe -NEW -SID orcl -INTPWD oracle -STARTMODE auto -PFILE "D:\Agilent\Oracle\Admin\..\initorcl.ora"
恢復(fù)后,建議進(jìn)行數(shù)據(jù)庫、系統(tǒng)相關(guān)檢查。
上述內(nèi)容就是windows2008 Oracle如何通過rman進(jìn)行增量遷移,你們學(xué)到知識(shí)或技能了嗎?如果還想學(xué)到更多技能或者豐富自己的知識(shí)儲(chǔ)備,歡迎關(guān)注億速云行業(yè)資訊頻道。
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場,如果涉及侵權(quán)請(qǐng)聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。