simplification et bouclage sur toutes les bases
This commit is contained in:
@@ -1,47 +1,9 @@
|
||||
. /home/oracle/.bash_profile
|
||||
SCRIPTDIR=/home/oracle/Daily
|
||||
LOGDIR=${SCRIPTDIR}/logs
|
||||
DATETIME=`date +%Y%m%d%H%M`
|
||||
mv $LOGDIR/DailyCheck.html $LOGDIR/DailyCheck_${DATETIME}.html
|
||||
rm $LOGDIR/diskspacereport.html
|
||||
rm $LOGDIR/diskspacereport.txt
|
||||
rm $LOGDIR/dbnodecpudetails.lst
|
||||
rm $LOGDIR/diskspacereport1.html
|
||||
sqlplus -s "/ as sysdba" @$SCRIPTDIR/DailyCheck_html.sql
|
||||
HOST=$(hostname)
|
||||
IPADDR=$(hostname -i)
|
||||
>$LOGDIR/diskspacereport.txt
|
||||
string1="CPU, Memory and Space Usage Report for DB Server ($HOST | $IPADDR) : \n"
|
||||
echo -e $string1>> $LOGDIR/diskspacereport.txt
|
||||
printf "\n"
|
||||
for i in `seq 1 5` ; do
|
||||
>$LOGDIR/dbnodecpudetails.lst
|
||||
top -bn 1 | head -n 3 >> $LOGDIR/dbnodecpudetails.lst
|
||||
sleep 3
|
||||
|
||||
for r in $(ps -eaf | grep pmon | egrep -v 'grep|ASM1|APX1' | cut -d '_' -f3)
|
||||
do
|
||||
export ORACLE_SID=$r
|
||||
. oraenv -s
|
||||
echo $ORACLE_SID $ORACLE_HOME
|
||||
sqlplus -s "/ as sysdba" @DailyCheck_html.sql > DailyCheck_${DATETIME}.html
|
||||
done
|
||||
cat $LOGDIR/dbnodecpudetails.lst >> $LOGDIR/diskspacereport.txt
|
||||
echo "<br />" >> $LOGDIR/diskspacereport.txt
|
||||
free | grep Mem | awk '{ printf("Free Memory: %.2f %\n", ($4+$7)/$2 * 100.0) }' >> $LOGDIR/diskspacereport.txt
|
||||
echo "<br />" >> $LOGDIR/diskspacereport.txt
|
||||
df -h >> $LOGDIR/diskspacereport.txt
|
||||
echo "<br />" >> $LOGDIR/diskspacereport.txt
|
||||
|
||||
|
||||
echo "*******************************************END OF REPORT****************************************************">> $LOGDIR/diskspacereport.txt
|
||||
cat $LOGDIR/diskspacereport.txt > $LOGDIR/diskspacereport.html
|
||||
sed 's/$/<br>/g' $LOGDIR/diskspacereport.html>$LOGDIR/diskspacereport1.html
|
||||
cat $LOGDIR/diskspacereport1.html >> $LOGDIR/DailyCheck.html
|
||||
EMAIL_LIST=daily_report@gmail.com
|
||||
SEND_MAIL()
|
||||
{
|
||||
{
|
||||
echo "To: $EMAIL_LIST"
|
||||
echo "Subject:Health Check : $ORACLE_SID@`hostname`"
|
||||
echo "MIME-Version: 1.0"
|
||||
echo "Content-Type: text/html"
|
||||
echo "Content-Disposition: inline"
|
||||
cat $LOGDIR/DailyCheck.html
|
||||
} | /usr/sbin/sendmail $EMAIL_LIST
|
||||
}
|
||||
SEND_MAIL
|
||||
[oracle@dbnode1 Daily]$
|
||||
@@ -2,149 +2,149 @@ SET TERMOUT OFF
|
||||
SET ECHO OFF
|
||||
SET SERVEROUTPUT OFF
|
||||
set feedback off
|
||||
set echo off pagesize 1000 markup html on ENTMAP OFF spool on -
|
||||
TABLE BORDER='1'
|
||||
spool /home/oracle/Daily/logs/DailyCheck.html
|
||||
prompt 1)
|
||||
prompt********************************Current DATE********************************************************
|
||||
select to_char(sysdate,'DD-MON-YYYY:HH24:MI:SS') "CURRENT DATE" from dual;
|
||||
set echo off pagesize 1000 markup html on ENTMAP OFF spool on TABLE BORDER='1'
|
||||
-- spool ./DailyCheck.html
|
||||
|
||||
-- ---------------------------------------------------
|
||||
prompt 1 - Current DATE
|
||||
-- ---------------------------------------------------
|
||||
select to_char(sysdate,'DD/MM/YYYY HH24:MI:SS') "CURRENT DATE" from dual;
|
||||
|
||||
prompt 2)
|
||||
prompt********************************DB SIZE********************************************************
|
||||
-- ---------------------------------------------------
|
||||
prompt 2 - DB SIZE
|
||||
-- ---------------------------------------------------
|
||||
col TOTAL_SIZE_GB format 99,999.99
|
||||
select sum(bytes)/1024/1024/1024 TOTAL_SIZE_GB from dba_data_files;
|
||||
|
||||
-- ---------------------------------------------------
|
||||
prompt 3 - INSTANCE STATUS
|
||||
-- ---------------------------------------------------
|
||||
select inst_id,
|
||||
instance_name,
|
||||
status,
|
||||
VERSION_FULL,
|
||||
EDITION,
|
||||
ARCHIVER,
|
||||
INSTANCE_ROLE,
|
||||
database_status,
|
||||
active_state,
|
||||
to_char(startup_time,'DD/MM/YYYY HH24:MI:SS') startup_time
|
||||
FROM gv$instance;
|
||||
|
||||
prompt 3)
|
||||
prompt********************************INSTANCE STATUS********************************************************
|
||||
select inst_id,instance_name, status, database_status, active_state, startup_time FROM gv$instance;
|
||||
-- ---------------------------------------------------
|
||||
prompt 4 - Database Status
|
||||
-- ---------------------------------------------------
|
||||
SELECT inst_id, name, to_char(CREATED ,'DD/MM/YYYY') CREATED , open_mode, DATABASE_ROLE, log_mode, FORCE_LOGGING, CURRENT_SCN FROM gv$database;
|
||||
|
||||
-- ---------------------------------------------------
|
||||
prompt 5 - Database non default parameters
|
||||
-- ---------------------------------------------------
|
||||
set pages 999 lines 150
|
||||
col name for a50
|
||||
col value for a90
|
||||
col display_value for a90
|
||||
select NAME, DISPLAY_VALUE from v$parameter where ISDEFAULT='FALSE' order by name;
|
||||
|
||||
prompt 4)
|
||||
prompt**************************ARCHIVE LOG MODE****************************************************************************
|
||||
|
||||
SELECT inst_id,name, open_mode, log_mode FROM gv$database;
|
||||
prompt Archive Log Sequence :
|
||||
archive log list;
|
||||
prompt 5)
|
||||
|
||||
prompt**************************Number of tablespaces************************************************************************
|
||||
|
||||
SELECT COUNT (0) "No. of tablespaces" FROM v$tablespace;
|
||||
|
||||
|
||||
prompt 6)
|
||||
prompt**************************Number of Datafiles********************************************************************
|
||||
SELECT COUNT (0) "No. of Data Files" FROM dba_data_files;
|
||||
|
||||
|
||||
prompt 7)
|
||||
prompt**************************ASM Disk, space and Archive Log Details********************************************************************
|
||||
|
||||
select GROUP_NUMBER,NAME,STATE,OFFLINE_DISKS from v$asm_diskgroup;
|
||||
-- ---------------------------------------------------
|
||||
prompt 6 - Users
|
||||
-- ---------------------------------------------------
|
||||
set pages 999 lines 150
|
||||
ALTER SESSION SET NLS_DATE_FORMAT ='YYYY/MM/DD HH24:MI';
|
||||
col USERNAME for a25
|
||||
col DEF_TBS for a15
|
||||
col TMP_TBS for a10
|
||||
col PROFILE for a10
|
||||
col ACCOUNT_STATUS for a20
|
||||
select USERNAME, ACCOUNT_STATUS, PROFILE, DEFAULT_TABLESPACE DEF_TBS, TEMPORARY_TABLESPACE TMP_TBS, CREATED, PASSWORD_VERSIONS from dba_users order by created;
|
||||
|
||||
-- ---------------------------------------------------
|
||||
prompt 6 - NLS Database parameters
|
||||
-- ---------------------------------------------------
|
||||
col parameter for a30
|
||||
col value for a30
|
||||
select * from nls_database_parameters ;
|
||||
|
||||
-- ---------------------------------------------------
|
||||
prompt 8 - FRA
|
||||
-- ---------------------------------------------------
|
||||
set lines 300
|
||||
select name, state, type, total_mb/1024/1024 "Total Space in TB", free_mb/1024/1024 "Free space in TB", Usable_file_mb/1024/1024 "Useable Space in TB" from v$asm_diskgroup ;
|
||||
SELECT VALUE/1024/1024 TAILLE_FRA_MiB, ROUND((VALUE*TOT_PCT/100)/1024/1024,0) ESPACE_UTILISE_MiB,
|
||||
TOT_PCT POURCENTAGE_UTILISE
|
||||
FROM
|
||||
V$PARAMETER P,
|
||||
(SELECT SUM(PERCENT_SPACE_USED) TOT_PCT FROM V$FLASH_RECOVERY_AREA_USAGE) PCT_U
|
||||
WHERE NAME='db_recovery_file_dest_size';
|
||||
|
||||
set lines 300
|
||||
select * from v$flash_recovery_area_usage;
|
||||
SELECT * FROM V$FLASH_RECOVERY_AREA_USAGE;
|
||||
|
||||
prompt 8)
|
||||
prompt********************************INVALID OBJECTS DETAILS************************************************************
|
||||
-- ---------------------------------------------------
|
||||
prompt 8 - INVALID OBJECTS DETAILS
|
||||
-- ---------------------------------------------------
|
||||
col owner format a20
|
||||
col object_name format a50
|
||||
col status format a10
|
||||
select owner,OBJECT_NAME, status FROM dba_objects WHERE status = 'INVALID';
|
||||
|
||||
prompt 9)
|
||||
prompt********************************Locked Sessions**************************************************************
|
||||
set feedback off;
|
||||
alter session set nls_date_format='DD-MON-YY hh24:MI:SS';
|
||||
set feedback on;
|
||||
select 'SID '||a.sid||' is blocking the sessions '||b.sid from gv$lock a, gv$lock b where a.block=1 and b.request >0;
|
||||
prompt Lock Holder and Waiter details :
|
||||
col "Lock Type" for a10;
|
||||
SELECT DECODE(request,0,'Holder: ','Waiter: '), sid, lmode "Lock Mode", type "Lock Type", block FROM V$LOCK WHERE (id1, id2, type) IN
|
||||
(SELECT id1, id2, type FROM GV$LOCK WHERE request>0) ORDER BY id1, request;
|
||||
prompt Session locking time in minutes :
|
||||
select sid,serial#,status,logon_time,sysdate,round( (sysdate-logon_time)*24*60 ) "Locking Minutes"
|
||||
from gv$session where sid IN (select a.sid from v$lock a, v$lock b where a.block=1 and b.request >0);
|
||||
|
||||
prompt 10)
|
||||
prompt****************************** Active Session Details running more than 60 minutes **********************************************************
|
||||
select p.spid spid,s.sid sid, s.serial# "serial", s.status "status", s.username "oracle username", s.action,
|
||||
to_char(s.logon_time, 'DD-MON-YY, HH24:MI') "logon time",
|
||||
s.module "MODULE",s.program "PROGRAM",round(s.last_call_et/60,0) "Running since Minutes" ,s.process "client process",s.machine "client machine",s.osuser "osuser"
|
||||
from gv$session s, gv$process p
|
||||
where p.addr=s.paddr
|
||||
and s.type!='BACKGROUND'
|
||||
and s.status='ACTIVE'
|
||||
and last_call_et/60 > 60
|
||||
and rownum < 150
|
||||
order by 10 desc;
|
||||
-- ---------------------------------------------------
|
||||
prompt 11 - TABLE SPACE Details and DB Size
|
||||
-- ---------------------------------------------------
|
||||
|
||||
prompt 11)
|
||||
prompt******************************* TABLE SPACE Details and DB Size ****************************************************************
|
||||
SELECT ROUND(SUM(TAILLE_BYTES)/1024/1024/1024,2) TAILLE_GIB FROM
|
||||
(
|
||||
SELECT SUM(FILE_SIZE_BLKS*BLOCK_SIZE) TAILLE_BYTES FROM V$CONTROLFILE
|
||||
UNION ALL
|
||||
SELECT SUM(BYTES) FROM V$TEMPFILE
|
||||
UNION ALL
|
||||
SELECT SUM(BYTES) FROM V$DATAFILE
|
||||
UNION ALL
|
||||
SELECT SUM(MEMBERS*BYTES) FROM V$LOG
|
||||
UNION ALL
|
||||
SELECT BYTES FROM V$STANDBY_LOG SL, V$LOGFILE LF WHERE SL.GROUP# = LF.GROUP#
|
||||
);
|
||||
|
||||
set linesize 132 tab off trimspool on
|
||||
set pagesize 105
|
||||
set pause off
|
||||
set echo off
|
||||
set feedb on
|
||||
|
||||
column TABLESPACE_NAME format a30
|
||||
select TABLESPACE_NAME,USED_PERCENT from DBA_TABLESPACE_USAGE_METRICS order by USED_PERCENT;
|
||||
|
||||
set linesize 110
|
||||
COLUMN dummy NOPRINT
|
||||
COLUMN pct_used FORMAT 99.9 HEADING "% Used"
|
||||
COLUMN name FORMAT a30 HEADING "Tablespace"
|
||||
COLUMN Kbytes FORMAT 99,999,999,999 HEADING "KBytes"
|
||||
COLUMN used FORMAT 99,999,999,999 HEADING "Used"
|
||||
COLUMN free FORMAT 99,999,999,999 HEADING "Free"
|
||||
COLUMN largest FORMAT 9,999,999,999 HEADING "Largest"
|
||||
COLUMN largest_rq FORMAT 99,999,999 HEADING "Largest_rq"
|
||||
BREAK ON report
|
||||
COMPUTE SUM OF kbytes ON REPORT
|
||||
COMPUTE SUM OF free ON REPORT
|
||||
COMPUTE SUM OF used ON REPORT
|
||||
col tablespace format a60
|
||||
set lines 200 pages 50
|
||||
SELECT SYSDATE FROM DUAL
|
||||
/
|
||||
SELECT NVL(b.tablespace_name,NVL(a.tablespace_name,'UNKOWN')) name,
|
||||
kbytes_alloc kbytes,
|
||||
kbytes_alloc-nvl(kbytes_free,0) used,
|
||||
NVL(kbytes_free,0) free,
|
||||
((kbytes_alloc-nvl(kbytes_free,0))/kbytes_alloc)*100 pct_used,
|
||||
NVL(largest,0) largest, NVL (c.largest_req,0) largest_rq,
|
||||
decode(substr(((nvl(largest,0) - nvl (c.largest_req,0) * 5)),1,1),'-','FAILED')
|
||||
FROM ( SELECT SUM(bytes)/1024 Kbytes_free,
|
||||
max(bytes)/1024 largest,
|
||||
tablespace_name
|
||||
FROM sys.dba_free_space
|
||||
GROUP BY tablespace_name ) a,
|
||||
( SELECT SUM(bytes)/1024 Kbytes_alloc,
|
||||
tablespace_name
|
||||
FROM sys.dba_data_files
|
||||
GROUP BY tablespace_name ) b,
|
||||
(select max(next_extent)/1024 largest_req,tablespace_name from dba_segments
|
||||
group by tablespace_name ) c
|
||||
WHERE a.tablespace_name (+) = b.tablespace_name
|
||||
and a.tablespace_name = c.tablespace_name
|
||||
order by pct_used desc
|
||||
/
|
||||
select tablespace_name,sum(bytes)/(1024*1024*1024) "Size Gig"
|
||||
from dba_temp_files
|
||||
group by tablespace_name
|
||||
/
|
||||
select 2 * (sum(bytes)/(1024*1024*1024)) "Redo size Gig"
|
||||
from v$log
|
||||
COL TABLESPACE_NAME FORMAT A20 HEAD "Nom espace|disque logique"
|
||||
COL PCT_OCCUPATION_THEORIQUE FORMAT 990.00 HEAD "%occ|Theo"
|
||||
COL TAILLE_MIB FORMAT 99999990.00 HEAD "Taille|MiB"
|
||||
COL TAILLE_MAX_MIB FORMAT 99999990.00 HEAD "Taille max|MiB"
|
||||
COL TAILLE_OCCUPEE_MIB FORMAT 99999990.00 HEAD "Espace occupé|MiB"
|
||||
WITH TS_FREE_SPACE AS
|
||||
(select tablespace_name, file_id, sum(bytes) FREE_O from dba_free_space group by tablespace_name, file_id
|
||||
), TEMP_ALLOC AS
|
||||
(select tablespace_name, file_id, sum(bytes) USED_O from v$temp_extent_map group by tablespace_name, file_id
|
||||
)
|
||||
SELECT
|
||||
TABLESPACE_NAME,
|
||||
SUM(TAILLE_MIB) TAILLE_MIB,
|
||||
SUM(TAILLE_MAX_MIB) TAILLE_MAX_MIB,
|
||||
SUM(TAILLE_OCCUPEE_MIB) TAILLE_OCCUPEE_MIB,
|
||||
ROUND(SUM(TAILLE_OCCUPEE_MIB)*100/SUM(GREATEST(TAILLE_MAX_MIB,TAILLE_MIB)),2) PCT_OCCUPATION_THEORIQUE
|
||||
FROM
|
||||
(
|
||||
SELECT D.FILE_NAME, D.TABLESPACE_NAME, D.BYTES/1024/1024 TAILLE_MIB, DECODE(D.AUTOEXTENSIBLE,'NO',D.BYTES,D.MAXBYTES)/1024/1024 TAILLE_MAX_MIB,
|
||||
(D.BYTES-FO.FREE_O)/1024/1024 TAILLE_OCCUPEE_MIB
|
||||
FROM
|
||||
DBA_DATA_FILES D, TS_FREE_SPACE FO
|
||||
WHERE
|
||||
D.TABLESPACE_NAME=FO.TABLESPACE_NAME
|
||||
AND D.FILE_ID=FO.FILE_ID
|
||||
UNION ALL
|
||||
SELECT T.FILE_NAME, T.TABLESPACE_NAME, T.BYTES/1024/1024 TAILLE_MIB, DECODE(T.AUTOEXTENSIBLE,'NO',T.BYTES,T.MAXBYTES)/1024/1024 TAILLE_MAX_MIB,
|
||||
(TA.USED_O)/1024/1024 TAILLE_OCCUPEE_MIB
|
||||
FROM
|
||||
DBA_TEMP_FILES T, TEMP_ALLOC TA
|
||||
WHERE
|
||||
T.TABLESPACE_NAME=TA.TABLESPACE_NAME
|
||||
AND T.FILE_ID=TA.FILE_ID
|
||||
)
|
||||
GROUP BY TABLESPACE_NAME
|
||||
ORDER BY TABLESPACE_NAME;
|
||||
CLEAR COL
|
||||
/
|
||||
|
||||
prompt 12)
|
||||
prompt***************************TEMP TABLESPACE UTILIZATION****************************************************************
|
||||
-- ---------------------------------------------------
|
||||
prompt 12 - TEMP TABLESPACE UTILIZATION
|
||||
-- ---------------------------------------------------
|
||||
SELECT A.tablespace_name tablespace, D.mb_total,SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_used,
|
||||
D.mb_total - SUM (A.used_blocks * D.block_size) / 1024 / 1024 mb_free
|
||||
FROM v$sort_segment A,
|
||||
@@ -155,132 +155,142 @@ WHERE B.ts#= C.ts# GROUP BY B.name, C.block_size
|
||||
) D
|
||||
WHERE A.tablespace_name = D.name GROUP by A.tablespace_name, D.mb_total;
|
||||
|
||||
prompt 12A)
|
||||
prompt****************************** Details of XX_LOGON_RECORDS Table **********************************************************
|
||||
-- ---------------------------------------------------
|
||||
prompt 13 - LAST RMAN BACKUP STATUS
|
||||
-- ---------------------------------------------------
|
||||
alter session set nls_date_format='DD/MM/YYYY HH24:MI:SS' ;
|
||||
set serveroutput on
|
||||
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;
|
||||
declare
|
||||
base varchar2(40) ;
|
||||
serv varchar2(40) ;
|
||||
begin
|
||||
select instance_name into base from v$instance ;
|
||||
select host_name into serv from v$instance ;
|
||||
dbms_output.put_line (' Rapport pour la base de donnee :' || base || ' sur le serveur : '|| serv );
|
||||
end ;
|
||||
/
|
||||
select
|
||||
b.input_type,
|
||||
b.status,
|
||||
to_char(b.start_time,'DD-MM-YY HH24:MI') "Start Time",
|
||||
to_char(b.end_time,'DD-MM-YY HH24:MI') "End Time",
|
||||
b.output_device_type device_type,
|
||||
b.input_bytes_display,
|
||||
b.output_bytes_display
|
||||
FROM v$rman_backup_job_details b
|
||||
WHERE b.start_time > (SYSDATE - 30)
|
||||
ORDER BY b.start_time asc;
|
||||
|
||||
select count(*) number_of_records from xlcaudit.XX_LOGON_RECORDS having count(*) > 110000;
|
||||
|
||||
col segment_name format a20
|
||||
col owner format a15
|
||||
select OWNER,segment_name, sum(bytes)/1024/1024 "Size in MB" from dba_segments where segment_name = 'XX_LOGON_RECORDS' and owner='XLCAUDIT' group by segment_name,owner;
|
||||
|
||||
prompt****************************** Count for the past 24 Hours from XX_LOGON_RECORDS Table **********************************************************
|
||||
|
||||
select count (*) from xlcaudit.XX_LOGON_RECORDS where sample_time > sysdate -1 order by sample_time;
|
||||
|
||||
prompt 13)
|
||||
prompt****************************LAST 90 RMAN BACKUP STATUS****************************************************************
|
||||
set linesize 150
|
||||
set pages 300
|
||||
column "SIZE" format a10
|
||||
select to_char(start_time,'yyyy-mm-dd hh24:mi') start_time,TO_CHAR(end_time, 'yyyy-mm-dd hh24:mi') End_Time, input_type,
|
||||
output_bytes_display "SIZE",round(sum(elapsed_seconds)/60) "Time taken in Min", status
|
||||
from v$rman_backup_job_details where end_time>trunc(sysdate)-90
|
||||
group by to_char(start_time,'yyyy-mm-dd hh24:mi'),TO_CHAR(end_time, 'yyyy-mm-dd hh24:mi'),output_bytes_display, input_type,status
|
||||
order by 2 desc;
|
||||
|
||||
|
||||
prompt 14)
|
||||
prompt******************************** Production Alert Log Error ********************************************************
|
||||
select to_char(ORIGINATING_TIMESTAMP, 'DD-MON-YYYY HH-MM-SS') "ORIGINATING_TIMESTAMP", message_text
|
||||
-- ---------------------------------------------------
|
||||
prompt 14 - Production Alert Log Error
|
||||
-- ---------------------------------------------------
|
||||
set pages 999 lines 150
|
||||
select to_char(ORIGINATING_TIMESTAMP, 'DD-MM-YYYY HH-MM-SS') || ' : ' || message_text "Last alertlog (30 days)"
|
||||
FROM X$DBGALERTEXT
|
||||
WHERE originating_timestamp > systimestamp - 1 AND regexp_like(message_text, '(ORA-)');
|
||||
WHERE originating_timestamp > systimestamp - 30 AND regexp_like(message_text, '(ORA-)');
|
||||
|
||||
prompt 15)
|
||||
prompt******************************** Current sequence no in Production ********************************************************
|
||||
-- ---------------------------------------------------
|
||||
prompt 15 - Current sequence no in Production
|
||||
-- ---------------------------------------------------
|
||||
|
||||
select thread#, max(sequence#) from gv$archived_log group by thread#;
|
||||
COL MEMBER FORMAT A90 WRAPPED
|
||||
BREAK ON GROUP# SKIP 1 ON THREAD# ON SEQUENCE# ON TAILLE_MIB ON "STATUS(ARCHIVED)"
|
||||
SELECT 'OnlineLog' T, G.GROUP#, G.THREAD#, G.SEQUENCE#, G.BYTES/1024/1024 TAILLE_MIB, G.STATUS||'('||G.ARCHIVED||')' "STATUS(ARCHIVED)", F.MEMBER
|
||||
FROM V$LOG G, V$LOGFILE F
|
||||
WHERE G.GROUP#=F.GROUP#
|
||||
UNION ALL
|
||||
SELECT 'StandbyLog',G.GROUP#, G.THREAD#, G.SEQUENCE#, G.BYTES/1024/1024 TAILLE_MIB, G.STATUS||'('||G.ARCHIVED||')' "STATUS(ARCHIVED)", F.MEMBER
|
||||
FROM V$STANDBY_LOG G, V$LOGFILE F
|
||||
WHERE G.GROUP#=F.GROUP#
|
||||
ORDER BY 1,3,4,2;
|
||||
|
||||
prompt 16)
|
||||
prompt********************************Archive Gaps between Production and DROBIXP ********************************************************
|
||||
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
|
||||
-- ---------------------------------------------------
|
||||
prompt 18 - Archive generated for the past 30 days
|
||||
-- ---------------------------------------------------
|
||||
set head off
|
||||
select max('Taille des fichiers redolog (Mo) : ' || bytes/1024/1024) from v$log;
|
||||
|
||||
SELECT a.thread#, b. last_seq, a.applied_seq, a.last_app_timestamp, b.last_seq-a.applied_seq ARCHIVE_GAP
|
||||
FROM (SELECT thread#, MAX(sequence#) applied_seq, MAX(next_time) last_app_timestamp
|
||||
FROM gv$archived_log WHERE applied = 'YES' and name='DROBIXP' GROUP BY thread#) a,
|
||||
(SELECT thread#, MAX (sequence#) last_seq FROM gv$archived_log where name='DROBIXP' GROUP BY thread#) b WHERE a.thread# = b.thread#;
|
||||
set head on
|
||||
set pages 999 lines 200
|
||||
col Date for a12
|
||||
col Total for 9999
|
||||
col 00 for 999
|
||||
col 01 for 999
|
||||
col 02 for 999
|
||||
col 03 for 999
|
||||
col 04 for 999
|
||||
col 05 for 999
|
||||
col 06 for 999
|
||||
col 07 for 999
|
||||
col 08 for 999
|
||||
col 09 for 999
|
||||
col 10 for 999
|
||||
col 11 for 999
|
||||
col 12 for 999
|
||||
col 13 for 999
|
||||
col 14 for 999
|
||||
col 15 for 999
|
||||
col 16 for 999
|
||||
col 17 for 999
|
||||
col 18 for 999
|
||||
col 19 for 999
|
||||
col 20 for 999
|
||||
col 21 for 999
|
||||
col 22 for 999
|
||||
col 23 for 999
|
||||
col 24 for 999
|
||||
|
||||
|
||||
prompt 17)
|
||||
prompt********************************Archive Gaps between Production and DROBXPRD ********************************************************
|
||||
ALTER SESSION SET NLS_DATE_FORMAT = 'DD-MON-YYYY HH24:MI:SS';
|
||||
select to_char(first_time, 'YYYY/MM/dd') "Date",
|
||||
count(1) "Total",
|
||||
sum(decode(to_char(first_time, 'hh24'),'00',1,0)) "00",
|
||||
sum(decode(to_char(first_time, 'hh24'),'01',1,0)) "01",
|
||||
sum(decode(to_char(first_time, 'hh24'),'02',1,0)) "02",
|
||||
sum(decode(to_char(first_time, 'hh24'),'03',1,0)) "03",
|
||||
sum(decode(to_char(first_time, 'hh24'),'04',1,0)) "04",
|
||||
sum(decode(to_char(first_time, 'hh24'),'05',1,0)) "05",
|
||||
sum(decode(to_char(first_time, 'hh24'),'06',1,0)) "06",
|
||||
sum(decode(to_char(first_time, 'hh24'),'07',1,0)) "07",
|
||||
sum(decode(to_char(first_time, 'hh24'),'08',1,0)) "08",
|
||||
sum(decode(to_char(first_time, 'hh24'),'09',1,0)) "09",
|
||||
sum(decode(to_char(first_time, 'hh24'),'10',1,0)) "10",
|
||||
sum(decode(to_char(first_time, 'hh24'),'11',1,0)) "11",
|
||||
sum(decode(to_char(first_time, 'hh24'),'12',1,0)) "12",
|
||||
sum(decode(to_char(first_time, 'hh24'),'13',1,0)) "13",
|
||||
sum(decode(to_char(first_time, 'hh24'),'14',1,0)) "14",
|
||||
sum(decode(to_char(first_time, 'hh24'),'15',1,0)) "15",
|
||||
sum(decode(to_char(first_time, 'hh24'),'16',1,0)) "16",
|
||||
sum(decode(to_char(first_time, 'hh24'),'17',1,0)) "17",
|
||||
sum(decode(to_char(first_time, 'hh24'),'18',1,0)) "18",
|
||||
sum(decode(to_char(first_time, 'hh24'),'19',1,0)) "19",
|
||||
sum(decode(to_char(first_time, 'hh24'),'20',1,0)) "20",
|
||||
sum(decode(to_char(first_time, 'hh24'),'21',1,0)) "21",
|
||||
sum(decode(to_char(first_time, 'hh24'),'22',1,0)) "22",
|
||||
sum(decode(to_char(first_time, 'hh24'),'23',1,0)) "23",
|
||||
sum(decode(to_char(first_time, 'hh24'),'24',1,0)) "24"
|
||||
from v$log_history
|
||||
group by to_char(first_time, 'YYYY/MM/dd')
|
||||
order by to_char(first_time, 'YYYY/MM/dd')
|
||||
;
|
||||
|
||||
prompt Taille des redolog par jour
|
||||
select
|
||||
to_char(first_time, 'YYYY/MM/dd') "Jour",
|
||||
count(*) "Nbr de fichiers",
|
||||
ROUND(sum(BLOCKS*BLOCK_SIZE)/1024/1024, 0) "Taille_Mo"
|
||||
from v$archived_log
|
||||
group by to_char(first_time, 'YYYY/MM/dd')
|
||||
order by to_char(first_time, 'YYYY/MM/dd')
|
||||
;
|
||||
|
||||
SELECT a.thread#, b. last_seq, a.applied_seq, a.last_app_timestamp, b.last_seq-a.applied_seq ARCHIVE_GAP
|
||||
FROM (SELECT thread#, MAX(sequence#) applied_seq, MAX(next_time) last_app_timestamp
|
||||
FROM gv$archived_log WHERE applied = 'YES' and name='DROBXPRD' GROUP BY thread#) a,
|
||||
(SELECT thread#, MAX (sequence#) last_seq FROM gv$archived_log where name='DROBXPRD' GROUP BY thread#) b WHERE a.thread# = b.thread#;
|
||||
|
||||
|
||||
prompt 18)
|
||||
prompt********************************Archive generated for the past 7 days ********************************************************
|
||||
set echo off;
|
||||
set pages 10000
|
||||
set sqlbl on;
|
||||
col day for a12
|
||||
set lines 1000
|
||||
set pages 999
|
||||
col "00" for a3
|
||||
col "01" for a3
|
||||
col "02" for a3
|
||||
col "03" for a3
|
||||
col "04" for a3
|
||||
col "05" for a3
|
||||
col "06" for a3
|
||||
col "07" for a3
|
||||
col "08" for a3
|
||||
col "09" for a3
|
||||
col "10" for a3
|
||||
col "11" for a3
|
||||
col "12" for a3
|
||||
col "13" for a3
|
||||
col "14" for a3
|
||||
col "15" for a3
|
||||
col "16" for a4
|
||||
col "17" for a3
|
||||
col "18" for a4
|
||||
col "19" for a3
|
||||
col "20" for a3
|
||||
col "21" for a3
|
||||
col "22" for a3
|
||||
col "23" for a3
|
||||
|
||||
SELECT
|
||||
to_char(first_time,'DD-MON-YYYY') day,
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'00',1,0)),'9999') "00",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'01',1,0)),'9999') "01",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'02',1,0)),'9999') "02",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'03',1,0)),'9999') "03",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'04',1,0)),'9999') "04",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'05',1,0)),'9999') "05",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'06',1,0)),'9999') "06",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'07',1,0)),'9999') "07",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'08',1,0)),'9999') "08",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'09',1,0)),'9999') "09",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'10',1,0)),'9999') "10",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'11',1,0)),'9999') "11",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'12',1,0)),'9999') "12",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'13',1,0)),'9999') "13",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'14',1,0)),'9999') "14",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'15',1,0)),'9999') "15",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'16',1,0)),'9999') "16",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'17',1,0)),'9999') "17",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'18',1,0)),'9999') "18",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'19',1,0)),'9999') "19",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'20',1,0)),'9999') "20",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'21',1,0)),'9999') "21",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'22',1,0)),'9999') "22",
|
||||
to_char(sum(decode(to_char(first_time,'HH24'),'23',1,0)),'9999') "23",
|
||||
count(*) Total
|
||||
from
|
||||
gv$log_history
|
||||
WHERE first_time > sysdate -7
|
||||
GROUP by
|
||||
to_char(first_time,'DD-MON-YYYY'),trunc(first_time) order by trunc(first_time);
|
||||
|
||||
prompt*******************************************************************************************************************
|
||||
prompt
|
||||
spool off
|
||||
-- spool off
|
||||
set markup html off spool off
|
||||
exit
|
||||
|
||||
Reference in New Issue
Block a user