備份相關的動態效能檢視及監控
1.相關視圖
v$backup_files
v$backup_set
v$backup_piece
v$backup_redolog
v$backup_spfile
v$backup_device
v$rman_configuration
v$archived_log
v$backup_corruption
v$copy_corruption
v$database_block_corruption
v$backup_datafile
2.查看channel對應的server sessions
使用set command id命令
查詢v$process和v$session判斷哪一個會話與之對應的RMAN通道
SQL> select sid,username,client_info from v$session
2 where client_info is not null;
SID USERNAME CLIENT_INFO
---------- ------------------------------ ------------------------------
146 SYS rman channel=ORA_DISK_1
148 SYS rman channel=ORA_DISK_2
150 SYS rman channel=ORA_DISK_3
--下面使用了set command id命令
RMAN> run{
2> allocate channel ch1 type disk;
3> set command id to 'rman';
4> backup as copy datafile 4
5> format '/u01/app/oracle/rmanbak/dd_%U';
6> }
SQL> select sid,username,client_info from v$session
2 where client_info is not null;
更多精彩內容:http://www.bianceng.cn/database/Oracle/
SID USERNAME CLIENT_INFO
---------- ------------------------------ ------------------------------
140 SYS id=rman
SQL> select sid,spid,client_info
2 from v$process p ,v$session s
3 where p.addr = s.paddr
4 and client_info like '%id=%';
SID SPID CLIENT_INFO
---------- ------------ ------------------------------
140 5002 id=rman
--查看rman完整的進度
SQL> select sid,serial#,context,sofar,totalwork,
2 round(sofar/totalwork*100,2) "% Complete"
3 from v$session_longops
4 where opname like 'RMAN:%'
5 and opname not like 'RMAN:aggregate%'
6 and totalwork!=0;
--通過如下SQL獲得rman用來完成備份操作的服務進程的SID與SPID資訊:
select sid, spid, client_info
from v$process p, v$session s
where p.addr = s.paddr
and client_info like '%id=rman%'
3.Linux下的rman自動備份
備份指令碼+crontab
bak_inc0 :0級增量備份,每周日使用級增量進行備份
bak_inc1 :1級增量備份,每周三使用級增量備份,備份從周日以來到周三所發生的資料變化
bak_inc2 :2級增量備份,備份每天發生的差異增量。如從周日到周一的差異,從周一到周二的差異
--下面是級增量的指令碼,其餘級與級依法炮製,所不同的是備份層級以及tag標記
[oracle@oradb scripts]$ cat bak_inc0
run {
allocate channel ch1 type disk;
backup as compressed backupset incremental level 0
format '/u01/oracle/bk/rmbk/incr0_%d_%U'