1. 程式人生 > >oracle 11g RMAN 的配置

oracle 11g RMAN 的配置

登入rman,以控制檔案為資料庫

$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on FRI May 25 10:43:14 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: MAMS (DBID=591992015)

顯示rman預設設定

RMAN>show all;

using target database control file instead of recovery catalog

RMAN configuration parameters for database with db_unique_name JUAN are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/ANNI/db_%U.rmn';

CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_Riven.f'; # default

1、更改rman磁碟備份預設目錄

RMAN> configure channel device type disk format '/home/oracle/RMAN';

old RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/ANNI/db_%U.rmn';
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/RMAN';
new RMAN configuration parameters are successfully stored

RMAN> show all;

RMAN configuration parameters for database with db_unique_name MAMS are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/home/oracle/RMAN';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_Riven.f'; # default

2、更改儲存策略

(1)所有的備份保留時間為10天

RMAN>configure retention policy to recovery window  of 10 days;

(2)最新的5份備份標記為redundancy

RMAN>configure retention policy to redundanct = 5;

(3)備份儲存策略失效

RMAN>configure retention policy to none;

(4)將恢復預設的儲存策略

RMAN>configure retention policy clear;

3、備份優化

backup optimization:預設值為off,啟用優化後,會按照優化演算法進行備份,比如只讀表空間不備份等

RMAN>configure backup optimization on;

RMAN>configure backup optimization off;

RMAN>configure backup optimization clear;

4、預設裝置

default device type:預設值為disk,指定備份到磁碟或者是磁帶

RMAN>configure default device type to disk;   

RMAN>configure default device type to stb;       (磁帶)

RMAN>configure default device type clear;         (恢復預設)

5、控制檔案

開啟自動備份及指定路徑及名稱,當控制檔案變化時,控制檔案自動備份

RMAN>configure controlfile autobackup on;

RMAN>configure controlfile autobackup format for device type '/home/oracle/backup/control/conf_%F';

RMAN>configure controlfile autobackup clear;

RMAN>configure controlfile autobackup format for device type disk clear;

6、配置控制檔案的快照檔案的存放路徑和檔名,這個快照檔案是在備份期間產生的

RMAN>configure snapshot controlfile name to '/home/oracle/base/product/11.2.0/dbs/snapcf_mams.f';

RMAN>configure snapshot controlfile name clear;

7、排除選項

(1)exclude:排除‘SUMDATA’表空間

RMAN>configure exclude for tablespace 'SUMDATA';

(2)重置排除選項為預設值

RMAN>configure exclude for tablespace 'SUMDATA' clear;

8、備份集大小

(1)設定備份集大小

RMAN>configure maxsetsize to nG|nM|nK|unlimited

(2)重置備份集大小為預設值

RMAN>configure maxsetsize clear

9、壓縮備份

(1)預設值壓縮

RMAN> show compression algorithm;

RMAN configuration parameters for database with db_unique_name MAMS are:
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default

(2)設定為高壓縮比

RMAN> configure compression algorithm 'HIGH';

new RMAN configuration parameters:
CONFIGURE COMPRESSION ALGORITHM 'HIGH' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE;
new RMAN configuration parameters are successfully stored

(3)設定為其他壓縮比

RMAN> configure compression algorithm 'MEDIUM';

RMAN> configure compression algorithm 'LOW';

RMAN> configure compression algorithm 'BASIC';