diff --git a/Daily/sql/1_get_db_size.sql b/Daily/sql/00_get_db_size.sql similarity index 100% rename from Daily/sql/1_get_db_size.sql rename to Daily/sql/00_get_db_size.sql diff --git a/Daily/sql/0_check_db_restart.sql b/Daily/sql/01_check_db_restart.sql similarity index 100% rename from Daily/sql/0_check_db_restart.sql rename to Daily/sql/01_check_db_restart.sql diff --git a/Daily/sql/2_instance_status.sql b/Daily/sql/02_instance_status.sql similarity index 100% rename from Daily/sql/2_instance_status.sql rename to Daily/sql/02_instance_status.sql diff --git a/Daily/sql/3_database_parameters.sql b/Daily/sql/03_database_parameters.sql similarity index 100% rename from Daily/sql/3_database_parameters.sql rename to Daily/sql/03_database_parameters.sql diff --git a/Daily/sql/04_nls_database_parameters.sql b/Daily/sql/04_nls_database_parameters.sql new file mode 100644 index 0000000..6e21c4e --- /dev/null +++ b/Daily/sql/04_nls_database_parameters.sql @@ -0,0 +1,2 @@ +select * from nls_database_parameters ; +exit diff --git a/Daily/sql/check_supplemntal_logging.sql b/Daily/sql/05_check_supplemntal_logging.sql similarity index 100% rename from Daily/sql/check_supplemntal_logging.sql rename to Daily/sql/05_check_supplemntal_logging.sql diff --git a/Daily/sql/10_tbs_details.sql b/Daily/sql/10_tbs_details.sql new file mode 100644 index 0000000..f61de4c --- /dev/null +++ b/Daily/sql/10_tbs_details.sql @@ -0,0 +1,37 @@ +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; +exit diff --git a/Daily/sql/11_temp_tbs_details.sql b/Daily/sql/11_temp_tbs_details.sql new file mode 100644 index 0000000..c34e624 --- /dev/null +++ b/Daily/sql/11_temp_tbs_details.sql @@ -0,0 +1,10 @@ +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, +( +SELECT B.name, C.block_size, SUM (C.bytes) / 1024 / 1024 mb_total +FROM v$tablespace B, v$tempfile C +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; +exit diff --git a/Daily/sql/12_online_log.sql b/Daily/sql/12_online_log.sql new file mode 100644 index 0000000..ac50945 --- /dev/null +++ b/Daily/sql/12_online_log.sql @@ -0,0 +1,12 @@ +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; +exit + diff --git a/Daily/sql/13_archive_log_per_day.sql b/Daily/sql/13_archive_log_per_day.sql new file mode 100644 index 0000000..b72f5cc --- /dev/null +++ b/Daily/sql/13_archive_log_per_day.sql @@ -0,0 +1,77 @@ +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') +; + +prompt