ORACLE_基础二十一(Oracle Revover Manager Overview)

RMAN  Components



Repository1: Control File

1.RAMN repository is metadata about targe database and backup and recovery operations

2.RMAN repository is always stored in the control file of the target database

3.CONTROL_FILE_RECORD_KEEP_TIME datermines the minimum age  in days of a record before it can be overwriteen

4.The Control file can grow in size.


Channel Allocation


Auto Channel Allocation

1.Change the default dvice type

    CONFIGUR DEFAULT DEVICE TYPE TO sbt;

2.Configur parallelism for automatic channls

   CONFIGURE DEVICE TYPE DISK PARALLELISM 3

3. Configure automatic channel options

   CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT='/BACKUP/RMAN/%U'

   CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 2G;


Manual Channel Allocation

1.BACKUP, COPY RESTORE and RECOVER commands require at least one channel

2.Allocating a channel starts a server process on the target database.

3.Channels affect the degree of parallelism

4.Channels write to differnet media types

5.Channels can be used to impose limits

RUN{
ALLOCATE CHANNEL c1 TYPE disk
FORMAT='/db01/BACKUP/usr0520.bak';
BACKUP DATAFILE '/db01/ORADATA/users01.dbf';}


Media Management

Recovry Manager-Oracle server session ||Media management library - Media management server software-Tape library of single tape


Types of Connection

1.Target database

2.Recovery catalog database

3.Auxiliary database

   a.Standby database

   b.Duplicate database

   c.TSPITR instance

rman target / as sysdba
rman target <a target=_blank href="mailto:sys/target_pwd@DB01">sys/target_pwd@DB01</a>


Additional Line Arguments

rman target sys/oracle log $HOM/ORADATA/u03/rman.log append

rman target sys/oracle log $HOM/ORADATA/u03/rman.log append  @ '$HOME/STUDENT?LABS/my_rmam_script.rcv'


Recovery Manager Modes
 1.Interactive mode

     a.Use it when doing analysis

     b.Minimiz regular useage

     c.Avoid using with log option

  2.Batch mode

     a.Meant for automated jobs

     b.Minimize operator erros

     c.Set the log file to obtain information


RMAN Backup Concepts

1.Recovery Manager backup is a server -managed backup

2.Recovery  Manager uses Oracle server sessions for backup operations

3.Can back  up entire database, all datafiles in a tablespace, selected datafiles, control files, archived redo log files

4.Closed database backup

  a.Target database must b mounted(not open)

  b.Includes datafiles ,control files, archived redo log files

5.Open database backup

   a.Tablespaces should not be put in backup mode

   b.Includes datafiles,control files, archived redo log files


RMAN Backup Modes


RMAN Backup Destinations


Backup Constraints

1.The database must be mounted or open

2.Online redo backups ar not supported

3.Only "clean" backups are useable in NOARCHIVELOG mode

4.Only "current" datafile backups are usable in ARCIVELOG mode


Recovery Manager Backups

Backup Sets



1.The BACKUP command creats backup sets

2.Backup sets usually contain more than one file.

3.Backup sets can be written to a disk or tape.

4.A restore operation is required to extract files from a backup set

5.Datafile backup sets can be incremental or full.

6.Backup sets do not include never-used blocks.


Backup Piece

1.backup piece is a file in a backup set

2. A backup piece an contain blocks from more than one datafile



Backup Piece Size



备份DATAFILE

<span style="font-size:18px;">backup datafile '/u01/app/oracle/oradata/king/undotbs01.dbf' format '/u01/app/oracle/oradata/king/backup/md_%U'; </span>


Backup tablespaces

SQL> select tablespace_name, contents from dba_tablespaces;                     

TABLESPACE_NAME                CONTENTS
------------------------------ ---------
SYSTEM                         PERMANENT
UNDOTBS1                       UNDO
SYSAUX                         PERMANENT
TEMP                           TEMPORARY
USERS                          PERMANENT

RMAN> backup tablespace SYSAUX,UNDOTBS1 format '/u01/app/oracle/oradata/king/backup/ts_%U';


Contaol File and SP File

1.Use the CONFIGURE CONTROLFILE AUTBACKUP commond to enable

2.When enbled , RMAN automatically performs a back up of the control file and current server parameter file after BACKUP or COPY commands;

3.Back ups also ocur after structural changes to the database

4.Backup is given a default name;

1.RMAN> configure controlfile autobackup on;   

2.RMAN> backup current controlfile;   单独备份 SPFILE 和CONTROL FILE

3.RMAN>backup datafile 4 include current controlfile;   
4.RMAN>sql "alter database backup controlfile to ''/tmp/wilson.bin''"   
  RMAN 如果要执行SQL语句,则用单引号括起来,如果SQL语句会出现单引号 则, 如此句所示


单独备份SPFILE

RMAN>backup spfile format '/u01/sp_%U';


Backup the archived log files

Online redo log file switch is automatic

Archived log failover is performed.  //自动在不同目录 下 找完整的数据

Bask up archived logs that need backing up.


1.Run the alter system archive log current command.

2.Run the backup arcivelog all command

3.Back up the rest of the datafiles specified by the backup database command.

4.Run the alter system archive log current command

5.Back up the new archive logs generated during the backup operation.

SQL> alter system archive log current; 
RMAN> backup archivelog all format '/tmp/ac_%U' delete all input;  
RMAN> backup archivelog sequence between 99 and 199 thread 1 delete input;
RMAN> backup archivelog from time "sysdate-15" until time "sysdate-7";
RMAN>backup database plus archivelog format '/u01/backup/db_%U';


Multiplexed Backup Sets

Multiplex two or more datafiles into a backup set for tape streaming


Prarllelization of Bs


configure device type disk parallelism 3 backup type to backupset; 这里设了以后,备份的时候 就自动提高并发度


Duplexed Backup Sets

backup copies  datafiles 5 format 'u01/xxx/xxx','u01/xxx/xxx
还可以直接改相关的参数

Image Copies

1.can be written only to disk

2.Can be used for recovery immediately; does not need to be restored

3. Is a physical copy of a single datafile,archived log, or control file

4. Is most like an operating system backup (contains all blocks)

5. Can be part of an incremental strategy




Copying the Whole Database


Making Incremental Backups

Differential Incremental Backup


Cumulative Incremental Backup


RMAN> run {                                                                     
2> allocate channel d1 type disk;                                               
3> backup incremental level 0 database format '/tmp/L0_%u';                     
4> } 


RMAN> run {                                                                     
2> allocate channel d1 type disk;                                               
3> backup incremental level 1 database format '/tmp/L1_%u';                     
4> } 



RMAN> run {                                                                     
2> allocate channel d1 type disk;                                               
3> backup incremental level 1 cumulative database format '/tmp/L1c_%u';                     
4> } 


select sid,sofar,totalwork from v$session_longops; 

SQL> alter database enable block change tracking using file '/u01/tack.bin'; //会把oracle平时操作的数据记录到这个文件里边 ,在rman
差异性备份的时候 就可以用这个文件找 变化的块 ,而不用比较整个数据文件,所以快 。建议在物理备库上用

SQL> alter database disable block change tracking;   

Tags for Backups

backup incremental level 2 datafile 4 tag='wilsonrman';
list backup tag='wilsonrman';


RMAN Dynamic Views



Monitoring RMAN Backups

1.Correlate server sessions with channels using the set COMMAND ID command

2.Query V$PROCESS and V$SESSION to determine which sessions correspond to whic RMAN channels.

3.Query V$SESSION_LONGOPS to monitor the progress of backups and copies

4.Use an operating system utility to monitor the process or threads.


Miscellaneous RMAN Issues

1.Abnormal termination of a Recovery Manager job

2.Detecting physical and logical block corruption

3.Detecting a fractured block during open backups



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值