diff --git a/Daily/rapport_mensuel.sh b/Daily/rapport_mensuel.sh index fcc117a..19ec2bd 100644 --- a/Daily/rapport_mensuel.sh +++ b/Daily/rapport_mensuel.sh @@ -21,9 +21,13 @@ do " > ${HTML_FILE} - sqlplus -s "/ as sysdba" @rapport_html.sql >> ${HTML_FILE} - sed -i 's/$//g' ${HTML_FILE} + # sqlplus -s "/ as sysdba" @rapport_html.sql >> ${HTML_FILE} + for f in sql/*.sql + do + sqlplus -s "/ as sysdba" @f >> ${HTML_FILE} + done + sed -i 's/$/
/g' ${HTML_FILE} echo Rapport dans le fichier html : ${HTML_FILE} done diff --git a/Daily/sql/check_db_restart.sql b/Daily/sql/check_db_restart.sql new file mode 100644 index 0000000..1e9fdb6 --- /dev/null +++ b/Daily/sql/check_db_restart.sql @@ -0,0 +1,4 @@ +alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS'; +col host_name format a15 +SELECT instance_name, host_name, startup_time, status, logins FROM gv$instance ORDER BY 1; + diff --git a/Daily/sql/check_failed_cheduler_jobs.sql b/Daily/sql/check_failed_cheduler_jobs.sql new file mode 100644 index 0000000..fe4ee38 --- /dev/null +++ b/Daily/sql/check_failed_cheduler_jobs.sql @@ -0,0 +1,4 @@ +SELECT owner, job_name, job_type, state, TRUNC(start_date) SDATE, TRUNC(next_run_date) NXTRUN, failure_count +FROM dba_scheduler_jobs +WHERE failure_count <> 0; + diff --git a/Daily/sql/check_pga_use.sql b/Daily/sql/check_pga_use.sql new file mode 100644 index 0000000..19400ff --- /dev/null +++ b/Daily/sql/check_pga_use.sql @@ -0,0 +1,13 @@ +col osuser format a15 +col pid format 9999 +col program format a20 +col sid format 99999 +col spid format a6 +col username format a12 + +SELECT p.spid,p.pid,s.sid,s.serial#,s.status,p.pga_alloc_mem,p.PGA_USED_MEM,s.username,s.osuser,s.program +FROM v$process p,v$session s +WHERE s.paddr ( + ) = p.addr +-- AND p.background IS NULL -- comment if need to monitor background processes +ORDER BY p.pga_alloc_mem DESC; + diff --git a/Daily/sql/check_sort_area.sql b/Daily/sql/check_sort_area.sql new file mode 100644 index 0000000..c7c309d --- /dev/null +++ b/Daily/sql/check_sort_area.sql @@ -0,0 +1,6 @@ +SELECT a.value "Disk Sorts", b.value "Memory Sorts", +ROUND((100*b.value)/DECODE((a.value+b.value), 0,1,(a.value+b.value)),2) "Pct Memory Sorts" +FROM v$sysstat a, v$sysstat b +WHERE a.name = 'sorts (disk)' +AND b.name = 'sorts (memory)'; + diff --git a/Daily/sql/check_supplemntal_logging.sql b/Daily/sql/check_supplemntal_logging.sql new file mode 100644 index 0000000..8b7889a --- /dev/null +++ b/Daily/sql/check_supplemntal_logging.sql @@ -0,0 +1,3 @@ +SELECT supplemental_log_data_min, supplemental_log_data_pk, supplemental_log_data_ui, supplemental_log_data_fk, supplemental_log_data_all, supplemental_log_data_pl +FROM v$database; + diff --git a/Daily/sql/redolog_freq_switch.sql b/Daily/sql/redolog_freq_switch.sql new file mode 100644 index 0000000..c77080b --- /dev/null +++ b/Daily/sql/redolog_freq_switch.sql @@ -0,0 +1,71 @@ +-- +-- affichage de la rotation des redelog par jour et par heure +-- + +set head off +select max('Taille des fichiers redolog (Mo) : ' || bytes/1024/1024) from v$log; + +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 + + +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') +; + +exit diff --git a/Daily/sql/redolog_size_per_days.sql b/Daily/sql/redolog_size_per_days.sql new file mode 100644 index 0000000..65159fe --- /dev/null +++ b/Daily/sql/redolog_size_per_days.sql @@ -0,0 +1,12 @@ +REM +REM Tailes des redoslog par jour +REM + +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') +; diff --git a/Daily/sql/who_is_connected.sql b/Daily/sql/who_is_connected.sql new file mode 100644 index 0000000..dcc7854 --- /dev/null +++ b/Daily/sql/who_is_connected.sql @@ -0,0 +1,8 @@ +-- Qui est connecté à la base : + +set pages 999 lines 200 +col PROGRAM for a35 +col MACHINE for a20 +col OSUSER for a10 +alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS'; +select OSUSER, MACHINE, PROGRAM, STATE, LOGON_TIME from v$session order by LOGON_TIME asc;