Oracle 10g備份與恢復高階使用者指南--第九章 RMAN備份資訊維護

panpong發表於2017-01-07

第九章        RMAN備份資訊維護

1.                  RMAN報告

透過RMAN命令list,report,show三個命令訪問相關資訊;除了這幾個常用的命令,還可以透過restore…preview命令檢視備份檔案資訊;

LIST命令:檢視備份相關資訊,DB Incarnation等;list backupsetV$BACKUP_FILES\RC_BACKUP_FILESS

REPORT命令:報告需要備份的,OBSOLETE備份,unrecoverable資料檔案,

REPORT OBSOLETE REDUNDANCY 2;

REPORT OBSOLETE RECOVERY WINDOW OF 5 DAYS;

 

2.                  Crosscheck RMAN的備份

RMAN資料庫中的備份記錄可能與磁帶或磁碟上的實際備份檔案不一致。Crosscheck就是檢查這種不一致的命令;執行crosscheck命令後,不一致的記錄會被標示為EXPIRED,透過delete expired命令可以刪除被標示expired的備份集記錄;

 

3.                  刪除RMAN的備份

DELETE

DELETE... FORCE

BACKUP ... DELETE [ALL] INPUT

CHANGE ... UNCATALOG

DELETE OBSOLETE

DELETE EXPIRED

DELETE ARCHIVELOG ALL BACKED UP 2 TIMES TO DEVICE TYPE sbt;

BACKUP ARCHIVELOG ALL DELETE INPUT;

BACKUP ARCHIVELOG ALL FROM SEQUENCE 1200 DELETE ALL INPUT;

BACKUP ARCHIVELOG FROM SEQUENCE 123 DELETE ALL INPUT;

 

4.                  Change…availableunavailableRMAN備份

RMAN可以透過以下命令修改資料庫中備份記錄為AVAILABLE 或UNAVAILABLE;

CHANGE ... UNAVAILABLE

CHANGE ... AVAILABLE

 

5.                  改變RMAN備份的保留策略狀態

RMAN> CHANGE BACKUPSET TAG year_end_2002 KEEP FOREVER NOLOGS;

RMAN> CHANGE BACKUPSET TAG year_end_2002 NOKEEP;

 

6.                  透過V$檢視監控RMAN

V$PROCESS:當前活動程式

V$SESSION :當前活動會話

V$SESSION_LONGOPS :提供備份與還原job的程式報告

V$SESSION_WAIT :列出會話等待的事件或資源

 

查詢服務會話與通道對應關係:

COLUMN CLIENT_INFO FORMAT a30

COLUMN SID FORMAT 999

COLUMN SPID FORMAT 9999

 

SELECT s.SID, p.SPID, s.CLIENT_INFO

FROM V$PROCESS p, V$SESSION s

WHERE p.ADDR = s.PADDR

AND CLIENT_INFO LIKE 'rman%'

;

 

查詢程式與通道對應關係:

RUN

{

  ALLOCATE CHANNEL c1 TYPE disk;

  SET COMMAND ID TO 'sess1';

  BACKUP DATABASE;

}

 

RUN

{

  ALLOCATE CHANNEL c1 TYPE sbt;

  SET COMMAND ID TO 'sess2';

  BACKUP DATABASE;

}

SELECT SID, SPID, CLIENT_INFO

  FROM V$PROCESS p, V$SESSION s

  WHERE p.ADDR = s.PADDR

  AND CLIENT_INFO LIKE '%id=sess%';

 

監控JOB過程:

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

;

監控RMAN與介質管理器的互動:

select name from v$event_name where name like '%sbt%';

COLUMN EVENT FORMAT a10

COLUMN SECONDS_IN_WAIT FORMAT 999

COLUMN STATE FORMAT a20

COLUMN CLIENT_INFO FORMAT a30

 

SELECT p.SPID, EVENT, SECONDS_IN_WAIT AS SEC_WAIT,

       sw.STATE, CLIENT_INFO

FROM V$SESSION_WAIT sw, V$SESSION s, V$PROCESS p

WHERE sw.EVENT LIKE 's%bt%'

       AND s.SID=sw.SID

       AND s.PADDR=p.ADDR

;

 

監控備份和還原的執行情況:

V$BACKUP_SYNC_IO: Displays rows when the I/O is synchronous to the process (or thread on some platforms) performing the backup.

V$BACKUP_ASYNC_IO: Displays rows when the I/O is asynchronous to the process (or thread on some platforms) performing the backup.

Note: Where asynchronous I/O is not supported by the host operating system, it may be implemented using slave I/O processes.

 

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/16976507/viewspace-2132057/,如需轉載,請註明出處,否則將追究法律責任。

相關文章