如何把oracle備份還原到另外一台機器上

來源:互聯網
上載者:User

說明:

(1).RMAN備份到異機恢複的時候,db_name需要相同。

如果說要 想改成其他的執行個體名,可以在恢複成功後,用nid 命令修改。 執行個體名的資訊會記錄到控制文 件裡,所以如果在恢複的時候,如果執行個體名不一致,恢複的時候會報錯。

(2).恢複的 路徑和源庫不一致時,就需要在restore命令中使用set 命令指定新位置,並且使用switch datafile all將變更資訊更新的到控制檔案中。

測試環境:

來源資料庫伺服器 A,安裝在E,備份目錄已在E盤;

來源資料庫伺服器B,安裝在F盤.

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

一、來源資料庫準備工作

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

--1. 查詢DBID

SQL> select name,dbid from v$database;

NAME            DBID

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

ORCL       1320546556

--2. 備份來源資料DB

run {
configure retention policy to recovery window of 14 days;
configure controlfile autobackup on; --自動開啟控制檔案備份
configure controlfile autobackup format for device type disk to 'E:\backup\controlfile\bak_%F';
allocate channel c1 device type disk format 'E:\backup\data\bak_%u';
allocate channel c2 device type disk format 'E:\backup\data\bak_%u';
sql 'alter system archive log current';
backup incremental level=0 database skip inaccessible
plus archivelog filesperset 20
delete all input;
release channel c1;
release channel c2;
}
allocate channel for maintenance device type disk;
crosscheck backupset;
delete noprompt obsolete;

--或

run {
configure retention policy to recovery window of 14 days;
allocate channel c1 device type disk format 'E:\backup\data\bak_%u';
allocate channel c2 device type disk format 'E:\backup\data\bak_%u';
sql 'alter system archive log current';
backup incremental level=0 database skip inaccessible
plus archivelog filesperset 20
delete all input;
--手動直接指明備份檔案名和路徑
backup current controlfile tag='bak_ctrollfile' format='E:\backup\controlfile\bak_ctl_file_%U_%T';
backup spfile tag='bak_spfile' format='E:\backup\controlfile\bak_spfile_%U_% T';
release channel c1;
release channel c2;
}
allocate channel for maintenance device type disk;
crosscheck backupset;
delete noprompt obsolete;

--3.手動備份spfile

create pfile='E:\backup\inittest.ora' from spfile;

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

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.