RMAN实战6:RMAN输出信息的收集

记录RMAN的输出结果很重要,有下面几种收集RMAN输出结果的方法:1.重定向 2.tee或script命令 3.spool 4.用sql查数据字典

将输出重定向到文件

这个是老生常谈了,1代表正常输出,2代表错误输出,统统定向到同一个文件。

rmanback.bsh 1>/home/oracle/bin/log/rmanback.log 2>&1

Linux/UNIX自带命令输出

tee 命令

$ rman | tee /tmp/rman.log
#加入参数-a是追加的意思
$ rman | tee -a /tmp/rman.log

script 命令

这个命令不怎么常用


#开始记录,指定记录文件,如果不指定默认记录到当前文件夹的typescript文件
-bash-3.00# script /tmp/scritpt.log
Script command is started. The file is /tmp/scritpt.log.
#注意这儿变化,bash变成了sh
sh-3.00# id
uid=0(root) gid=0(system) groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp)
sh-3.00# pwd
/
#用exit结束退出,sh重新变成了bash
sh-3.00# exit
exit
Script command is complete. The file is /tmp/scritpt.log.
#看下记录的内容
-bash-3.00# cat /tmp/scritpt.log 
Script command is started on Wed Dec 16 19:35:26 BEIST 2015.
sh-3.00# id
uid=0(root) gid=0(system) groups=2(bin),3(sys),7(security),8(cron),10(audit),11(lp)
sh-3.00# pwd
/
sh-3.00# exit
exit

Script command is complete on Wed Dec 16 19:35:31 BEIST 2015.

数据库的spool log 命令

--开始记录
RMAN> spool log to '/tmp/rman.log'
RMAN> set echo on
--这时候是没有交互的
RMAN> show all;
RMAN> show all;
RMAN> set echo on;
RMAN> show all;
--结束记录
RMAN> spool log off;

Spooling for log turned off

Recovery Manager10.2.0.4.0

--结束后就有记录了
RMAN> show all;
show all;
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/almtest/oracle/oracle/product/10.2.0/db_1/dbs/snapcf_almtest.f'; # default


RMAN> exit
exit


Recovery Manager complete.
--加入append 代表追加
bash-3.00$ rman target / log /tmp/rman.log append
RMAN> set echo on
RMAN> show all;
RMAN> exit

通过数据字典查信息

可以通过动态视图来查,最多包含32768行信息,库重启后会被清空

select sid, recid, output
from v$rman_output
order by recid;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

贤时间

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值