From eafa43ee8903961289f5f7415322d38ba4fa9b0b Mon Sep 17 00:00:00 2001 From: Yacine31 Date: Thu, 7 Dec 2023 18:43:30 +0100 Subject: [PATCH] update rman backup --- sql/26_last_rman_backup.sql | 34 ---------------------------------- sql/27_last_rman_backup.sql | 29 ++++++++++++++++------------- 2 files changed, 16 insertions(+), 47 deletions(-) delete mode 100644 sql/26_last_rman_backup.sql diff --git a/sql/26_last_rman_backup.sql b/sql/26_last_rman_backup.sql deleted file mode 100644 index 874b60a..0000000 --- a/sql/26_last_rman_backup.sql +++ /dev/null @@ -1,34 +0,0 @@ -prompt

Les dernières sauvegardes RMAN (10 derniers jours)

-alter session set nls_date_format='DD/MM/YYYY HH24:MI:SS' ; -set pages 25 lines 250; -col HEURE_DEBUT for a20; -col HEURE_FIN for a20; -col LAST_BKP for a10; -col status for a25; -col IN_BYTES for a15; -col OUT_BYTES for a15; -col DBNAME for a10; -set head off; - -select '---------------------------------- ' -|| 'Database name : ' || name || ', Instance name = ' || instance_name -|| ' ----------------------------------' -from v$database, v$instance; - -set head on - -select - d.NAME "DBNAME" - ,SESSION_KEY "KEY" - ,INPUT_TYPE "BKP_TYPE" - ,to_char(START_TIME,'DD-MM-YYYY HH24:MI:SS') "HEURE_DEBUT" - ,to_char(END_TIME,'DD-MM-YYYY HH24:MI:SS') "HEURE_FIN" - ,to_char(trunc(sysdate) + numtodsinterval(ELAPSED_SECONDS, 'second'),'hh24:mi:ss') "DUREE" - ,cast((floor(sysdate-start_time)) as int) || 'd ' || round((round(sysdate-start_time, 2) - cast(floor(sysdate-start_time) as int))*24,0) || 'h' as "LAST_BKP" - ,INPUT_BYTES_DISPLAY "IN_BYTES" - ,OUTPUT_BYTES_DISPLAY "OUT_BYTES" - ,r.STATUS -from V$RMAN_BACKUP_JOB_DETAILS r, v$database d, v$instance i -where start_time > (SYSDATE - 10) -order by SESSION_KEY -; diff --git a/sql/27_last_rman_backup.sql b/sql/27_last_rman_backup.sql index 7597f66..ff1f5a0 100644 --- a/sql/27_last_rman_backup.sql +++ b/sql/27_last_rman_backup.sql @@ -1,30 +1,33 @@ prompt

Les dernières sauvegardes RMAN (30 derniers jours/50 dernières lignes)

alter session set nls_date_format='DD/MM/YYYY HH24:MI:SS' ; -set linesize 250 heading off; -set heading on pagesize 999; -column status format a25; -column input_bytes_display format a12; -column output_bytes_display format a12; -column device_type format a10; +-- set linesize 250 heading off; +-- set heading on pagesize 999; +-- column status format a25; +-- column input_bytes_display format a12; +-- column output_bytes_display format a12; +-- column device_type format a10; SELECT + b.SESSION_KEY "Session Key", b.input_type "Type", + to_char(b.start_time, 'DD-MM-YYYY HH24:MI') "Start Time", + to_char(b.end_time, 'DD-MM-YYYY HH24:MI') "End Time", + to_char(trunc(sysdate) + numtodsinterval(ELAPSED_SECONDS, 'second'),'hh24:mi:ss') "Duration", + b.output_device_type "Device Type", + b.input_bytes_display "Input Bytes", + b.output_bytes_display "Output Bytes", CASE WHEN b.status = 'FAILED' THEN '' || b.status || '' ELSE b.status - END "Status", - to_char(b.start_time, 'DD-MM-YYYY HH24:MI') "Start Time", - to_char(b.end_time, 'DD-MM-YYYY HH24:MI') "End Time", - b.output_device_type "Device Type", - b.input_bytes_display "Input Bytes", - b.output_bytes_display "Output Bytes" + END "Status" FROM v$rman_backup_job_details b WHERE b.start_time > ( sysdate - 30 ) AND ROWNUM <= 50 ORDER BY - b.start_time DESC; + b.SESSION_KEY desc; +-- b.start_time DESC;