RMAN备份相关的动态性能视图及监控

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

2where client_infoisnotnull;

SID USERNAMECLIENT_INFO

---------- ------------------------------ ------------------------------

146 SYSrman channel=ORA_DISK_1

148 SYSrman channel=ORA_DISK_2

150 SYSrman 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

2where client_infoisnotnull;

SID USERNAMECLIENT_INFO

---------- ------------------------------ ------------------------------

140 SYSid=rman

SQL> select sid,spid,client_info

2from v$process p ,v$session s

3where p.addr = s.paddr

4and client_infolike'%id=%';

SID SPIDCLIENT_INFO

---------- ------------ ------------------------------

140 5002id=rman

--查看rman完整的进度

SQL> select sid,serial#,context,sofar,totalwork,

2round(sofar/totalwork*100,2)"% Complete"

3from v$session_longops

4where opnamelike'RMAN:%'

5andopnamenotlike'RMAN:aggregate%'

6andtotalwork!=0;

--通过如下SQL获得rman用来完成备份操作的服务进程的SID与SPID信息:

select sid, spid, client_info

from v$process p, v$session s

where p.addr = s.paddr

andclient_infolike'%id=rman%'

3.Linux下的rman自动备份

备份脚本+crontab

bak_inc0:级增量备份,每周日使用级增量进行备份

bak_inc1:级增量备份,每周三使用级增量备份,备份从周日以来到周三所发生的数据变化

bak_inc2:级增量备份,备份每天发生的差异增量。如从周日到周一的差异,从周一到周二的差异

--下面是级增量的脚本,其余级与级依法炮制,所不同的是备份级别以及tag标记

[oracle@oradb scripts]$ cat bak_inc0

run {

allocate channel ch1 type disk;

backup as compressed backupsetincremental level 0

format '/u01/oracle/bk/rmbk/incr0_%d_%U'

tag 'day_incr0'

database plus archivelog delete input;

release channel ch1;

}

逐个测试脚本

[oracle@oradb bk]$ rman target/log=/u01/oracle/bk/log/bak_inc0.log/

>cmdfile=/u01/oracle/bk/scripts/bak_inc0.rcv

RMAN>2>3>4>5>6>7>8>9>

[oracle@oradb bk]$

编辑crontab

[root@oradb ~]# whoami

root

[root@oradb ~]# crontab-e-u oracle

45 23**0 rman target/log=/u01/oracle/bk/log/bak_inc0.logappend cmdfile=/u01/oracle/bk/scripts/bak_inc0.rcv

45 23**1 rman target/log=/u01/oracle/bk/log/bak_inc2.logappend cmdfile=/u01/oracle/bk/scripts/bak_inc2.rcv

45 23**2 rman target/log=/u01/oracle/bk/log/bak_inc2.logappend cmdfile=/u01/oracle/bk/scripts/bak_inc2.rcv

45 23**3 rman target/log=/u01/oracle/bk/log/bak_inc1.logappend cmdfile=/u01/oracle/bk/scripts/bak_inc1.rcv

45 23**4 rman target/log=/u01/oracle/bk/log/bak_inc2.logappend cmdfile=/u01/oracle/bk/scripts/bak_inc2.rcv

45 23**5 rman target/log=/u01/oracle/bk/log/bak_inc2.logappend cmdfile=/u01/oracle/bk/scripts/bak_inc2.rcv

45 23**6 rman target/log=/u01/oracle/bk/log/bak_inc2.logappend cmdfile=/u01/oracle/bk/scripts/bak_inc2.rcv

"/tmp/crontab.XXXXInBzgR" 7L,791C written

crontab:installing new crontab

保存之后重启crontab

[root@oradb ~]# service crond restart

Stopping crond:[OK]

Starting crond:[OK]

检查自动备份是否成功执行

你可能感兴趣的:(动态性能视图)