首页 > 数据库 >Oracle中查看日志的产生情况

Oracle中查看日志的产生情况

时间:2024-07-26 18:08:39浏览次数:15  
标签:decode 查看 sum char HH24 time Oracle 日志 first

脚本

select trunc(t.first_time) "Date",
to_char(t.first_time, 'DY') "Day",
count(1),
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"
from v$log_history t
group by trunc(t.first_time),to_char(t.first_time, 'DY');

标签:decode,查看,sum,char,HH24,time,Oracle,日志,first
From: https://www.cnblogs.com/dber-ablewang/p/18325970

相关文章

  • 【工具】SpringBoot项目如何查看某个maven依赖是否存在以及依赖链路
    当我在SpringBoot项目中想加个依赖,但是不确定现有依赖的依赖的依赖.....有没有添加过这个依赖,怎么办呢?如果添加过了但是不知道我需要的这个依赖属于哪个依赖的下面,怎么查呢?IDEA中提供了很方便的视图可以满足我们的需求第一步点击项目右侧的maven第二步选中Dependencies第三......
  • 在.net 8中使用HttpClientFactory时日志记录请求body和响应body
     1、定义DelegatingHandlerpublicclassLoggingHandler:DelegatingHandler{privatereadonlyILogger<LoggingHandler>_logger;publicLoggingHandler(ILogger<LoggingHandler>logger){_logger=logger;}protectedov......
  • ubuntu下查看apt安装的软件包具体安装了哪些文件
    如果软件包是dpkg安装了,可以通过dpkg-L来查看已安装的软件包具体安装了哪些文件到哪些目录下。但是如果软件还未安装时,dpkg-L就无能为力了。这时就需要用apt-file命令来实现了。首先ubuntu默认不安装apt-file,先安装它sudoaptinstallapt-file-y然后更新源里面的信息,其实就......
  • 新电脑如何设置 npm 源及查看源、安装 cnpm、pnpm 和 yarn 的详细教程
    当你获得一台新电脑,或需要在现有电脑上优化JavaScript和Node.js的开发环境时,正确配置npm是一步不可少的过程。本教程将详细指导你如何设置npm源,查看当前源,以及如何安装cnpm、pnpm和yarn。1.设置npm源npm(NodePackageManager)是Node.js的包管理器,通过......
  • 自定义Linux操作日志配置
    方案一:使用acct工具记录步骤1   通过设置日志文件可以对每个用户的每一条命令进行纪录,这一功能默认是不开放的,为了打开它,我们要确认已经安装了acct工具:#Debian、Ubuntu、SUSE下叫acctapt-getinstallacctzypperinstallacct#CentOS、RHEL、Fedora上叫psacctyu......
  • 用Python解析邮件日志
    我的任务有点困难。我有一个邮件日志,如:Oct315:30:18mail1postfix/lmtp[5369]:DB10242054:to=<XXXXX>,orig_to=<XXXXXX>,relay=ip[ip]:port,delay=1.4,delays=0.04/0/0.01/1.4,dsn=2.0.0,status=sent(2502.0.0fromMTA(smtp:[iP]:port):2502.0.0Ok:queueda......
  • 记一种Oracle中行转列PIVOT函数的替换方案
    在实际工作中,开发可能会碰到数据需要进行行转列的查询,第一个想到的就是用Oracle的内置函数PIVOT,但PL可能会说,这种查询的性能可能会不太好,项目上要求不使用这个函数,那么有什么方法实现这种查询呢?方案:使用同一张表的row_id来进行关联查询,因为Oracle中表数据的row_id是唯......
  • Oracle数据库状态信息自动化收集脚本
    #!/bin/bash#配置变量ORACLE_SID=CDBORACLE_HOME=/u01/app/oracle/product/19c/dbhome_1PATH=$ORACLE_HOME/bin:$PATHexportORACLE_SIDORACLE_HOMEPATH#数据库登录信息DB_USER=lcsdbDB_PASS=123456PDB_NAME=FS3_LCS#输出文件OUTPUT_DIR=/path/to/output/dire......
  • 日志备份管理
    日志备份管理作为历史数据的最终保存地,备份系统自身的可用性及数据存储策略显得格外重要。如果实现本地数据双备份和重要数据跨机房复制后,那么在任何情况下均能保留一份可用副本。关键要素备份策略过期时间离线归档恢复验证数据分类生产环境中备份数据可以归类为日志文......
  • Oracle数据库监控和运维关注哪些方面
    全面的数据库监控和运维涉及多个方面。以下是一些关键的数据库状态信息,你应该关注这些方面,以确保数据库的健康和性能:1.数据库运行状态数据库状态:检查数据库是否运行正常,了解是否处于OPEN、MOUNT或NOMOUNT状态。实例状态:确保所有实例都正常运行,没有宕机或异常。2.内存使用......