首页 > 其他分享 >How to Calculate the size of archive log files each day

How to Calculate the size of archive log files each day

时间:2023-04-13 17:13:30浏览次数:26  
标签:files DECODE log format SUM CHAR time day first

Calculate the size of archive log files each day 


SQL> SELECT TRUNC(COMPLETION_TIME) ARCHIVED_DATE,
           SUM(BLOCKS * BLOCK_SIZE) / 1024 / 1024 SIZE_IN_MB
      FROM V$ARCHIVED_LOG
     GROUP BY TRUNC(COMPLETION_TIME)
     ORDER BY 1;

ARCHIVED_DATE SIZE_IN_MB
------------- ----------
2020-02-14 00:00:00 2406.45117
2020-02-15 00:00:00 3491.56445
2020-02-16 00:00:00 3196.87354
2020-02-17 00:00:00 2917.70605
2020-02-18 00:00:00 2798.62158

2020-02-19 00:00:00 2650.23242

Size of the archive log files each hour. 



SQL> alter session set nls_date_format = 'YYYY-MM-DD HH24';

Session altered.

SQL> SELECT TRUNC(COMPLETION_TIME, 'HH') ARCHIVED_DATE_HOUR,
            SUM(BLOCKS * BLOCK_SIZE) / 1024 / 1024 SIZE_IN_MB
       FROM V$ARCHIVED_LOG
      GROUP BY TRUNC(COMPLETION_TIME, 'HH')
      ORDER BY 1;

ARCHIVED_DATE SIZE_IN_MB
------------- ----------

2020-01-21 02 13304.7856
 

Size of the archive log files each day per instance



SQL> SELECT
            TRUNC(COMPLETION_TIME) ARCHIVED_DATE,
            THREAD#,
            SUM(BLOCKS * BLOCK_SIZE) / 1024 / 1024 SIZE_IN_MB
       FROM V$ARCHIVED_LOG
      GROUP BY TRUNC(COMPLETION_TIME), THREAD#
      ORDER BY 1, 2;

ARCHIVED_    THREAD# SIZE_IN_MB
--------- ---------- ----------

26-JAN-20          1 148411.591  

Online Redo Log Switch Frequency Map Query



set pages 999 lines 400
col h0 format 999
col h1 format 999
col h2 format 999
col h3 format 999
col h4 format 999
col h5 format 999
col h6 format 999
col h7 format 999
col h8 format 999
col h9 format 999
col h10 format 999
col h11 format 999
col h12 format 999
col h13 format 999
col h14 format 999
col h15 format 999
col h16 format 999
col h17 format 999
col h18 format 999
col h19 format 999
col h20 format 999
col h21 format 999
col h22 format 999
col h23 format 999
SELECT TRUNC (first_time) "Date", inst_id, TO_CHAR (first_time, 'Dy') "Day",
 COUNT (1) "Total",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '00', 1, 0)) "h0",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '01', 1, 0)) "h1",  SUM (DECODE (TO_CHAR (first_time, 'hh24'), '02', 1, 0)) "h2",  SUM (DECODE (TO_CHAR (first_time, 'hh24'), '03', 1, 0)) "h3",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '04', 1, 0)) "h4",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '05', 1, 0)) "h5",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '06', 1, 0)) "h6",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '07', 1, 0)) "h7",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '08', 1, 0)) "h8",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '09', 1, 0)) "h9",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '10', 1, 0)) "h10",  SUM (DECODE (TO_CHAR (first_time, 'hh24'), '11', 1, 0)) "h11",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '12', 1, 0)) "h12",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '13', 1, 0)) "h13",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '14', 1, 0)) "h14",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '15', 1, 0)) "h15",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '16', 1, 0)) "h16",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '17', 1, 0)) "h17",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '18', 1, 0)) "h18",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '19', 1, 0)) "h19",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '20', 1, 0)) "h20",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '21', 1, 0)) "h21",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '22', 1, 0)) "h22",
 SUM (DECODE (TO_CHAR (first_time, 'hh24'), '23', 1, 0)) "h23",
 ROUND (COUNT (1) / 24, 2) "Avg"
FROM gv$log_history
WHERE thread# = inst_id
AND first_time > sysdate -7
GROUP BY TRUNC (first_time), inst_id, TO_CHAR (first_time, 'Dy')
ORDER BY 1,2;

标签:files,DECODE,log,format,SUM,CHAR,time,day,first
From: https://www.cnblogs.com/lkj371/p/17315492.html

相关文章

  • 负荷需求响应模型 基于Logistic函数 采用matlab编程,考虑电价激励下的乐观响应和悲观响
    负荷需求响应模型基于Logistic函数采用matlab编程,考虑电价激励下的乐观响应和悲观响应,利用负荷需求响应模型得到峰转平、平转谷的实际负荷转移率,从而得到基于Logistic函数的负荷转移对比,程序运行稳定ID:6450676853349722......
  • 跟着查老四学Python Day 8:面向对象编程
    面向对象编程基本概念日常寒暄之后,查老四开始讲课了查老四:好的,我会尽量满足你的要求。现在我们开始第一节:面向对象编程。面向对象编程(Object-OrientedProgramming,简称OOP)是一种编程范式,它提倡将现实世界中的事物抽象为程序中的类(Class)和对象(Object),通过封装(Encapsulation)、继承(Inhe......
  • 跟着查老四学Python Day 9:继承和多态
    继承例行寒暄之后,课程正式开始查老四:继承是面向对象编程中的一个重要概念。它允许我们创建一个新类,继承一个现有类的属性和方法,从而实现代码的重用。新类被称为子类,现有类被称为父类。在Python中,通过在子类名后的括号中写入父类名来实现继承。下面是一个简单的示例#父类classAni......
  • docker----day04()
    面试如何自定制上下文管理器#一个对象如果实现了__enter__和___exit__方法,那么这个对象就支持上下文管理协议,即with语句##上节回顾```python#1docker启动,停止,查看状态命令 systemctlstartdockersystemctlstopdockersystemctlstatusdockerd......
  • 跟着查老四学Python Day 11:类的高级特性
    学习类的特殊方法例行寒暄之后,查老四开始了几天的课程查老师:1.学习类的特殊方法,例如__init__、__str__、__repr__等Python中的类可以具有一些特殊方法,这些方法具有双下划线前缀和后缀,例如__init__、__str__和__repr__等。它们在特定情况下被自动调用。__init__:当创建类的实例时,会......
  • 跟着查老四学Python Day 11:常用 Python 库
    Python库概览例行寒暄之后,查老四就开始授课了老猫:请大致介绍一下Python库查老四:Python库是一组预先编写好的模块或函数,它们可以实现特定功能或解决特定问题。Python有许多库,它们覆盖了各种不同的领域和应用。以下是一些常用Python库的简要介绍:NumPy:一个用于处理数组和矩阵运算的......
  • 在Django+Vue3+GraphQL的Blog例子代码中引入Element-Plus UI Framework
    Vue3的UIFramework中有Element-Plus、BalmUI、Quasar、PrimeVue、AntDesignVue等UIFramework.Element-Plus是Element-UI的Vue3版,Element-UI的使用人数的基数较大,Github上的Star数也较多,就选择了Element-Plus作为这个Blog项目的UIFramework.UIFramework的好处就是提供了......
  • day 3 *打鱼与晒网
      设计思路:1.给出一个天数。2.判断距离目标的天数。3.用距离天数%5,进行判断。  #include<iostream>usingnamespacestd;intsum=0;intstatemonth[13]={0,31,28,31,30,31,30,31,31,30,31,30,31};intLday(intyear,intmonth,intday){sum+=365*year;for(in......
  • day27| 39+40+131
    39.组合总和 题目简述:给你一个无重复元素的整数数组 candidates和一个目标整数 target ,找出 candidates 中可以使数字和为目标数 target的所有 不同组合,并以列表形式返回。你可以按任意顺序返回这些组合。candidates中的同一个数字可以无限制重复被选取......
  • git 更新代码错误 Your local changes to the following files would be overwritten
    当gitpull时提示 Yourlocalchangestothefollowingfileswouldbeoverwrittenbymerge idea中撤销当前本地本次提交 ......