Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does Oracle query the number of archived logs generated per hour in recent days

2025-04-01 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces how Oracle queries the number of archived logs generated per hour in recent days, which has a certain reference value. Interested friends can refer to it. I hope you will learn a lot after reading this article.

The script is as follows:

SELECT SUBSTR (TO_CHAR (first_time, 'MM/DD/RR HH:MI:SS'), 1) Day, SUM (SUBSTR (TO_CHAR (first_time,' MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),'00 (DECODE (SUBSTR (TO_CHAR (first_time, 'MM/DD/RR HH24:MI:SS'), 10)) H01, SUM (SUBSTR (TO_CHAR (first_time (first_time) ) H02, SUM (SUBSTR (TO_CHAR (first_time, 'MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'), SUM (SUBSTR (TO_CHAR (first_time,' MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H04, SUM (SUBSTR (TO_CHAR (first_time (first_time) ) H05, SUM (SUBSTR (SUBSTR (TO_CHAR (first_time, 'MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H06), SUM (SUBSTR (TO_CHAR (first_time,' MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H07, SUM (SUBSTR (TO_CHAR (first_time (first_time) ) H08, SUM (SUBSTR (SUBSTR (TO_CHAR (first_time, 'MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H09, SUM (SUBSTR (TO_CHAR (first_time,' MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H10, SUM (SUBSTR (TO_CHAR (first_time (first_time) ) H11 (DECODE (SUBSTR (TO_CHAR (first_time, 'MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H12), SUM (DECODE (SUBSTR (TO_CHAR (first_time,' MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H13, SUM (SUBSTR (TO_CHAR (first_time) ) H14, SUM (SUBSTR (SUBSTR (TO_CHAR (first_time, 'MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS' 2),) H15, SUM (SUBSTR (TO_CHAR (first_time,' MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS' 0),) H16, SUM (SUBSTR (TO_CHAR (first_time) ) H17 (DECODE (SUBSTR (TO_CHAR (first_time, 'MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H18, SUM (SUBSTR (TO_CHAR (first_time,' MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H19, SUM (SUBSTR (TO_CHAR (first_time) ) H20, SUM (SUBSTR (SUBSTR (TO_CHAR (first_time, 'MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H21, SUM (SUBSTR (TO_CHAR (first_time,' MM/DD/RR HH24:MI:SS'), 10 MM/DD/RR HH24:MI:SS'),) H22, SUM (SUBSTR (TO_CHAR (first_time) ) H23, COUNT (*) TOTALFROM v$log_history aWHERE first_time > = to_char (sysdate-10) GROUP BY SUBSTR (TO_CHAR (first_time, 'MM/DD/RR HH:MI:SS'), 1) ORDER BY SUBSTR (first_time,' MM/DD/RR HH:MI:SS'), 1) DESC

To modify the number of days, you can modify WHERE first_time > = to_char (sysdate-11)

Execution result

Thank you for reading this article carefully. I hope the article "Oracle how to query the number of archived logs generated per hour in recent days" shared by the editor will be helpful to you. At the same time, I also hope that you will support us and follow the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report