ORACLE 資料庫RMAN備份恢複

來源:互聯網
上載者:User

機器A:
select instance_name from v$instance;
select name from v$database;
select name from v$datafile;
查詢記錄模式:
archive log list;
shutdown immediate;
startup mount;
把日誌改為歸檔模式:
alter database archivelog;
alter database open;
alter system archive log current;
select name from v$archived_log;
開啟控制檔案跟蹤:
alter database backup controlfile to trace;
查看追蹤檔案位置:
show parameter user_dump_dest
cmd:
set oracle_sid=orcl
rman target sys/abc
host "md c:\back";
run
{
backup database;
format 'c:\back\%d_%s_%T_full.bak';
}
select file#,name from v$datafile;
傳送以下檔案到機器B:
c:\back
d:\oracle\product\10.2.0\admin\orcl
CREATE CONTROLFILE SET DATABASE "ORCL" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO01.LOG' SIZE 50M,
GROUP 2 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO02.LOG' SIZE 50M,
GROUP 3 'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\REDO03.LOG' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSTEM01.DBF',
'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\UNDOTBS01.DBF',
'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\SYSAUX01.DBF',
'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\USERS01.DBF',
'E:\ORACLE\PRODUCT\10.2.0\ORADATA\ORCL\XM'
CHARACTER SET ZHS16GBK

機器B:
建立要恢複oracle的目錄
e:\oracle\product\10.2.0\oradata\orcl
e:\oracle\product\10.2.0\admin
e:\oracle\product\10.2.0\falsh_recovery_area
把收到的檔案夾orcl放到e:\oracle\product\10.2.0\admin
拷貝
e:\oracle\product\10.2.0\admin\orcl\pfile中的參數檔案到自己真實資料庫db_1\database檔案夾中,並改名為initorcl.ora
開啟initorcl.ora
把裡面的路徑改為真實oracle資料庫的位置
d:\替換為e:\
cmd1:
set oracle_sid=orcl
oracle orcl
等到提示ctrl+c
cmd2:
set oracle_sid=orcl
sqlplus / as sysdba
startup nomount;
cmd3:
set oracle_sid=orcl
rman target sys/abc
restore controlfile from 'C:\back\ORCL_2_20090414_FULL.BAK';
cmd2:
alter database mount;
cmd3:
run{
set newname for datafile 1 to 'E:\oracle\product\10.2.0\oradata\orcl\SYSTEM01.DBF';
set newname for datafile 2 to 'E:\oracle\product\10.2.0\oradata\orcl\UNDOTBS01.DBF';
set newname for datafile 3 to 'E:\oracle\product\10.2.0\oradata\orcl\SYSAUX01.DBF';
set newname for datafile 4 to 'E:\oracle\product\10.2.0\oradata\orcl\USERS01.DBF';
set newname for datafile 5 to 'E:\oracle\product\10.2.0\oradata\orcl\XM';
restore database;
switch datafile all;
}
cmd2:
select name from v$database;
shutdown immediate;
startup mount;
alter database backup controlfile to trace;
找到追蹤檔案:
重做控制檔案:把裡面的路徑改為正確路徑:
d:\改為 e:\
shutdown immediate;
startup nomount;
執行產生控制檔案的語句;執行錢必須先刪除.ctl的檔案
alter database open resetlogs;
select name from v$database;
select member from v$logfile;

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.