RMAN备份之四

一  设置备份集无效

  RMAN> change backupset 82 unavailable;

changed backup piece unavailable
backup piece handle=/u01/app/oracle/dbbackup/backupset/df_20111106_84_1_2kmqvfg9_1_1.bak recid=106 stamp=766492169
Changed 1 objects to UNAVAILABLE status


RMAN> list backupset of datafile 8 summary;


List of Backups
===============
Key     TY LV S Device Type Completion Time #Pieces #Copies Compressed Tag
------- -- -- - ----------- --------------- ------- ------- ---------- ---
48      B  F  A DISK        06-NOV-11       1       1       NO         TAG20111106T093146
50      B  F  A DISK        06-NOV-11       1       1       NO         TAG20111106T093158
52      B  F  A DISK        06-NOV-11       1       1       NO         TAG20111106T093205
54      B  F  A DISK        06-NOV-11       1       2       NO         TAG20111106T094028
56      B  F  A DISK        06-NOV-11       1       2       NO         TAG20111106T094243
58      B  F  A DISK        06-NOV-11       1       1       NO         TAG20111106T094316
60      B  F  A DISK        06-NOV-11       1       1       NO         TAG20111106T094719
65      B  F  A DISK        06-NOV-11       1       1       NO         TAG20111106T100539
67      B  F  A DISK        06-NOV-11       1       1       NO         TAG20111106T100816
70      B  F  A DISK        06-NOV-11       1       1       NO         TAG20111106T100913
76      B  F  A DISK        06-NOV-11       1       1       NO         TAG20111106T102902
82      B  F  U DISK        06-NOV-11       1       1       NO         TAG20111106T102928

RMAN>

 

二  压缩备份集

  RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO compressed backupset;

RMAN> list backupset;


List of Backup Sets
===================

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
91      Full    345.27M    DISK        00:03:23     06-NOV-11     
  List of Datafiles in backup set 91
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 2411983    06-NOV-11 /u01/app/oracle/oradata/orcl/undotbs01.dbf
  7       Full 2411983    06-NOV-11 /u01/app/oracle/oradata/orcl/resum.dbf
  8       Full 2411983    06-NOV-11 /u01/app/oracle/oradata/orcl/tbs_usr_bak.dbf

  Backup Set Copy #1 of backup set 91
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:03:23     06-NOV-11       NO         TAG20111106T120247


BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
92      Full    553.52M    DISK        00:04:03     06-NOV-11     
  List of Datafiles in backup set 92
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 2411984    06-NOV-11 /u01/app/oracle/oradata/orcl/system01.dbf
  3       Full 2411984    06-NOV-11 /u01/app/oracle/oradata/orcl/sysaux01.dbf
  6       Full 2411984    06-NOV-11 /u01/app/oracle/oradata/orcl/undotbs2.dbf

  Backup Set Copy #1 of backup set 92
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:04:03     06-NOV-11       NO         TAG20111106T120247




BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
94      Full    30.02M     DISK        00:02:14     06-NOV-11     
  List of Datafiles in backup set 94
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  2       Full 2412171    06-NOV-11 /u01/app/oracle/oradata/orcl/undotbs01.dbf
  7       Full 2412171    06-NOV-11 /u01/app/oracle/oradata/orcl/resum.dbf
  8       Full 2412171    06-NOV-11 /u01/app/oracle/oradata/orcl/tbs_usr_bak.dbf

  Backup Set Copy #1 of backup set 94
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:02:14     06-NOV-11       YES        TAG20111106T120750

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
95      Full    102.05M    DISK        00:03:47     06-NOV-11     
  List of Datafiles in backup set 95
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 2412172    06-NOV-11 /u01/app/oracle/oradata/orcl/system01.dbf
  3       Full 2412172    06-NOV-11 /u01/app/oracle/oradata/orcl/sysaux01.dbf
  6       Full 2412172    06-NOV-11 /u01/app/oracle/oradata/orcl/undotbs2.dbf

  Backup Set Copy #1 of backup set 95
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:03:47     06-NOV-11       YES        TAG20111106T120750
 

三   坏块检测和跳过

  SQL> create tablespace tbs_corrupt datafile '/u01/app/oracle/oradata/orcl/tbscorrupt.dbf' size 1m;

Tablespace created.

SQL> create table tb_corrupt tablespace tbs_corrupt
  2  as
  3  select * from sys.dba_objects where rownum<3000;

Table created.

SQL> shutdown abort;    
ORACLE instance shut down.
SQL>
SQL>
SQL> startup
ORACLE instance started.

Total System Global Area  167772160 bytes
Fixed Size                  1260696 bytes
Variable Size             150995816 bytes
Database Buffers           12582912 bytes
Redo Buffers                2932736 bytes
Database mounted.
Database opened.
SQL> select count(*) from tb_corrupt;
select count(*) from tb_corrupt
                     *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 9, block # 35)
ORA-01110: data file 9: '/u01/app/oracle/oradata/orcl/tbscorrupt.dbf'


SQL>
、RMAN> backup datafile 9;

Starting backup at 06-NOV-11
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=145 devtype=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: sid=144 devtype=DISK
channel ORA_DISK_1: starting compressed full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
input datafile fno=00009 name=/u01/app/oracle/oradata/orcl/tbscorrupt.dbf
channel ORA_DISK_1: starting piece 1 at 06-NOV-11
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 11/06/2011 12:23:59
ORA-19566: exceeded limit of 0 corrupt blocks for file /u01/app/oracle/oradata/orcl/tbscorrupt.dbf

RMAN>


Run
{
Set MAXCORRUPT FOR DATAFILE 9 to 2;
Backup datafile 9;
}
 

四  增量备份

0级别的增量备份等同于数据块的全备份
累积型1的备份
差异性1的备份

BACKUP INCREMENTAL LEVEL 0 DATABASE
BACKUP INCREMENTAL LEVEL 1   DATABASE;    �D�Ddifferential database;
BACKUP INCREMENTAL LEVEL 1 CUMULATIVE DATABASE;

增量备份新特性:block change tracking

 
SQL> alter database enable block change tracking using file '/u01/app/oracle/dbbackup/rman_bct.f';

Database altered.

SQL> BACKUP INCREMENTAL LEVEL 0 DATABASE

RUN {
RECOVER COPY OF DATABASE WITH TAG 'dbiub';
BACKUP  INCREMENTAL LEVEL 1  FOR RECOVER OF COPY WITH TAG 'dbiub'  DATABASE;
}

五 监控备份进度

  SELECT SID, SERIAL#, CONTEXT, SOFAR, TOTALWORK,
ROUND(SOFAR/TOTALWORK*100,2) "%_COMPLETE"
FROM V$SESSION_LONGOPS
WHERE OPNAME LIKE 'RMAN%'
AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK != 0
AND SOFAR <> TOTALWORK;

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

你可能感兴趣的:(oracle,职场,休闲,RMAN备份与恢复)