Oracle RMAN的概述和配置

來源:互聯網
上載者:User

restore:還原 recover恢複
先用restore database命令通過備份檔案還原到備份點,然後使用recover database命令通過歸檔記錄檔恢複到介質損壞時的時間點。

RMAN的體繫結構
RMAN串連上後有2個預設串連polling和default。還可以有rcvcat串連用於串連儲存備份資訊的recovery catalog DB,備份資訊還可放在目標資料庫的控制檔案裡,RMAN可分配任意多的channel(一個通道為一個串連)用於讀目標資料庫資料寫到磁碟或磁帶上。

control_file_record_keep_time 控制檔案重用需要的天數

rman串連本機資料庫
rman target / nocatalog

串連遠程目標資料庫
rman target sys/sys@XWX1 nocatalog;

寫RMAN輸出到一個記錄檔
rman target sys/sys log d:/rman.log append

rman啟動執行指令碼
rman target sys/sys log d:/rman.log append
@'d:/my_rman_script.rcv'

最簡單的指令碼(here document技術:Here Documents的用處是將後面的內容作為命令的輸入自動提供給前面的命令)
rman rman target / nocatalog <<!
show all;
exit;
!

RMAN>show all;查看配置資訊

自動channel分配:
1.設定channel的預設裝置類型
RMAN>configure default device type to sbt;指定為磁帶
RMAN>configure default device type clear;清除設定,還原到預設值

2.設定並發度
RMAN>configure device type disk parallelism 3;

3.設定備份目錄
RMAN>configure channel device type disk format='d:/backup/rman/%U';%U檔案名稱自動編號唯一

4.設定最大備份片大小
RMAN>configure channel device type disk maxpiecesize 2G;

5.configure backup potimazation on;   ----設定備份最佳化;
6.configure retention policy to
recovery window of 7 days;          ----設定保留備份策略視窗7天;
7.configure retention policy to
redundancy 4;                       ----設定冗餘度為4,儲存4個備份組;
8.configure datafile backup copies for
device type disk to 2;              ----如果備份到磁碟,則同時作2個拷貝的備份;
9.同時備份控制檔案
configure controlfile autobackup on;

手動channel分配
RMAN>run {
allocate channel c1 type disk
format='d:/backup/rman/user20110627.bak';
backup datafile 'd:/Oracle/oradata/users01.dbf';
sql 'alter database archive log current';
}

串連的類型
與目標資料庫
與recovery catalog database
與auxiliary database:standby database、duplicate database、TSPITR instance。

串連一個機器的不同執行個體需要
UNIX:oracle_sid=orcl;export oracle_sid;
window:set oracle_sid=orcl

backup是RMAN備份特有,copy是普通cp命令拷貝的
list命名
1.列出資料庫所有檔案的備份
RMAN>list backup of database;

2.列出資料庫某檔案的備份
report schema; 資料檔案資訊,複製datafile目錄
RMAN>list backup of datafile "d:/oracle/oradata/users01.dbf";
列出資料表空間的所有copies或backup
RMAN>list copy of tablespace "SYSTEM";
RMAN>list backup of tablespace "SYSTEM";

REPORT命令
1.report need backup需要備份的資料檔案
report need backup incremental 3;需要3個或更多增量備份的檔案
report need backup days 3;3天內沒備份的檔案
report need backup redundancy 2;冗餘小於2的檔案

聯繫我們

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