Get the App
SLTechnology News&Howtos  ›  Database  › 

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

Shulou Source: shulou.com Published: 2022-05-31 20:04:36 10月04日 Update

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!

Tags: Articles hours quantity logs queries value interests at the same time days more friends knowledge results editing scripts industry information information channels channels references Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux OPPO Reno Redmi vpn