查询归档量

select logtime,  
       count(*),  
       round(sum(blocks * block_size) / 1024 / 1024) mbsize  
  from (select trunc(first_time, 'hh') as logtime, a.BLOCKS, a.BLOCK_SIZE  
          from v$archived_log a  
         where a.DEST_ID = 1  
           and a.FIRST_TIME > trunc(sysdate))  
 group by logtime  
 order by logtime desc;  
 
 

 

查最近一周每天的归档日志生成量

 

Sql代码  收藏代码
select logtime,  
       count(*),  
       round(sum(blocks * block_size) / 1024 / 1024) mbsize  
  from (select trunc(first_time, 'dd') as logtime, a.BLOCKS, a.BLOCK_SIZE  
          from v$archived_log a  
         where a.DEST_ID = 1  
           and a.FIRST_TIME > trunc(sysdate - 7))  
 group by logtime  
 order by logtime desc;  
 

 

如果你需要知道RAC下各个节点的归档日志情况,我将上面脚本略作修改,增加thread#列。

 

查当天每小时的各个实例的归档日志生成量

 

Sql代码  收藏代码
select THREAD#,  
       logtime,  
       count(*),  
       round(sum(blocks * block_size) / 1024 / 1024) mbsize  
  from (select a.THREAD#,  
               trunc(first_time, 'hh') as logtime,  
               a.BLOCKS,  
               a.BLOCK_SIZE  
          from v$archived_log a  
         where a.DEST_ID = 1  
           and a.FIRST_TIME > trunc(sysdate))  
 group by THREAD#, logtime  
 order by THREAD#, logtime desc;  
 
查最近一周每天的各个实例的归档日志生成量 

Sql代码  收藏代码
select THREAD#,  
       logtime,  
       count(*),  
       round(sum(blocks * block_size) / 1024 / 1024) mbsize  
  from (select THREAD#,  
               trunc(first_time, 'dd') as logtime,  
               a.BLOCKS,  
               a.BLOCK_SIZE  
          from v$archived_log a  
         where a.DEST_ID = 1  
           and a.FIRST_TIME > trunc(sysdate - 7))  
 group by THREAD#, logtime  
 order by THREAD#, logtime desc;  

 

转载于:https://www.cnblogs.com/dayu-liu/p/10232772.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值