diff --git a/sql/12_instance_status.sql b/sql/12_instance_status.sql deleted file mode 100644 index 432d4e4..0000000 --- a/sql/12_instance_status.sql +++ /dev/null @@ -1,29 +0,0 @@ -prompt

Database/Instance Status

-alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS'; -select - inst_id, - instance_name, - host_name, -to_char(startup_time ,'DD/MM/YYYY HH24:MI:SS') startup_time, - status, --- VERSION_FULL, --- EDITION, - ARCHIVER, - INSTANCE_ROLE, - database_status, -logins -FROM gv$instance; - -SELECT - inst_id, - name, - to_char(CREATED ,'DD/MM/YYYY HH24:MI:SS') CREATED , - open_mode, - DATABASE_ROLE, - log_mode, - FORCE_LOGGING, - CURRENT_SCN FROM gv$database; - -select * from v$version; - - diff --git a/sql/12a_instance_status.sql b/sql/12a_instance_status.sql new file mode 100644 index 0000000..91f8217 --- /dev/null +++ b/sql/12a_instance_status.sql @@ -0,0 +1,30 @@ +prompt

Database/Instance Status

+alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS'; + +SELECT 'DATABASE_NAME' AS property, name AS value FROM gv$database +UNION ALL +SELECT 'DATABASE_ROLE' AS property, DATABASE_ROLE AS value FROM gv$database +UNION ALL +SELECT 'OPEN_MODE' AS property, open_mode AS value FROM gv$database +UNION ALL +select 'INSTANCE_NAME' as property, INSTANCE_NAME as value from v$instance +union all +select 'INSTANCE_ROLE' as property, INSTANCE_ROLE as value from v$instance +union all +select 'LOGINS' as property, LOGINS as value from v$instance +union all +SELECT 'LOG_MODE' AS property, log_mode AS value FROM gv$database +UNION ALL +SELECT 'FORCE_LOGGING' AS property, FORCE_LOGGING AS value FROM gv$database +UNION ALL +select 'VERSION' as property, VERSION as value from v$instance +union all +SELECT 'CREATED' AS property, to_char(CREATED ,'DD/MM/YYYY HH24:MI:SS') AS value FROM gv$database +UNION ALL +select 'STARTUP_TIME' as property, to_char(STARTUP_TIME,'DD/MM/YYYY HH24:MI:SS') as value from v$instance +UNION ALL +SELECT 'CURRENT_SCN' AS property, to_char(CURRENT_SCN) AS value FROM gv$database; + + + + diff --git a/sql/12b_instance_version.sql b/sql/12b_instance_version.sql new file mode 100644 index 0000000..1ede0ea --- /dev/null +++ b/sql/12b_instance_version.sql @@ -0,0 +1,2 @@ +prompt

Database/Version

+select * from v$version; \ No newline at end of file diff --git a/sql/15_check_supplemntal_logging.sql b/sql/15_check_supplemntal_logging.sql index 76c1ab1..19283ba 100644 --- a/sql/15_check_supplemntal_logging.sql +++ b/sql/15_check_supplemntal_logging.sql @@ -1,19 +1,16 @@ prompt

Database supplemental logging :

-col data_mining for a15 -col data_pkey for a15 -col data_uniq_key for a15 -col data_fk for a15 -col data_all for a15 -col data_pl for a15 -col force_logging for a15 -SELECT - force_logging, - supplemental_log_data_min data_mining, - supplemental_log_data_pk data_pkey, - supplemental_log_data_ui data_uniq_key, - supplemental_log_data_fk data_fk, - supplemental_log_data_all data_all, - supplemental_log_data_pl data_pl -FROM v$database; +select 'force_logging' as property, force_logging as value from v$database +union all +select 'supplemental_log_data_min' as property, supplemental_log_data_min as value from v$database +union all +select 'supplemental_log_data_pk' as property, supplemental_log_data_pk as value from v$database +union all +select 'supplemental_log_data_ui' as property, supplemental_log_data_ui as value from v$database +union all +select 'supplemental_log_data_fk' as property, supplemental_log_data_fk as value from v$database +union all +select 'supplemental_log_data_all' as property, supplemental_log_data_all as value from v$database +union all +select 'supplemental_log_data_pl' as property, supplemental_log_data_pl as value from v$database diff --git a/sql/16_dba_registry.sql b/sql/16_dba_registry.sql index 6a558d6..1b86b81 100644 --- a/sql/16_dba_registry.sql +++ b/sql/16_dba_registry.sql @@ -1,14 +1,6 @@ prompt

Fonctionnalités installées dans la base de données (DBA_REGISTRY) :

SELECT * --- COMP_ID, --- COMP_NAME, --- VERSION, --- VERSION_FULL, --- STATUS, --- MODIFIED, --- SCHEMA, --- PROCEDURE - FROM dba_registry x + FROM dba_registry ORDER BY comp_id; diff --git a/sql/22a_online_log.sql b/sql/22a_online_log.sql new file mode 100644 index 0000000..d988104 --- /dev/null +++ b/sql/22a_online_log.sql @@ -0,0 +1,13 @@ +prompt

Fichiers de journalisation (Redolog) :

+alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS'; + +SELECT + * +FROM + v$log +ORDER BY + group#, + thread#, + sequence#; + + diff --git a/sql/22_online_log.sql b/sql/22b_online_log.sql similarity index 86% rename from sql/22_online_log.sql rename to sql/22b_online_log.sql index 5de12f3..8eecf57 100644 --- a/sql/22_online_log.sql +++ b/sql/22b_online_log.sql @@ -1,16 +1,5 @@ -prompt

Fichiers de journalisation (Redolog) :

-alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS'; - -SELECT - * -FROM - v$log -ORDER BY - group#, - thread#, - sequence#; - prompt

Multiplexage des fichiers de journalisation (Redolog et standbylog)

+alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS'; COL MEMBER FORMAT A90 WRAPPED BREAK ON GROUP# SKIP 1 ON THREAD# ON SEQUENCE# ON TAILLE_MIB ON "STATUS(ARCHIVED)" diff --git a/sql/23_archive_log_per_day.sql b/sql/23a_archive_log_per_day.sql similarity index 85% rename from sql/23_archive_log_per_day.sql rename to sql/23a_archive_log_per_day.sql index f2cdd32..ded55b4 100644 --- a/sql/23_archive_log_per_day.sql +++ b/sql/23a_archive_log_per_day.sql @@ -64,15 +64,3 @@ 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 -where first_time > systimestamp - 30 -group by to_char(first_time, 'YYYY/MM/dd') -order by to_char(first_time, 'YYYY/MM/dd') -; - -exit diff --git a/sql/23b_archive_log_per_day.sql b/sql/23b_archive_log_per_day.sql new file mode 100644 index 0000000..7cb26cb --- /dev/null +++ b/sql/23b_archive_log_per_day.sql @@ -0,0 +1,10 @@ +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 +where first_time > systimestamp - 30 +group by to_char(first_time, 'YYYY/MM/dd') +order by to_char(first_time, 'YYYY/MM/dd') +; diff --git a/sql/24_fra_usage.sql b/sql/24_fra_usage.sql deleted file mode 100644 index 65a4468..0000000 --- a/sql/24_fra_usage.sql +++ /dev/null @@ -1,9 +0,0 @@ -prompt

Fast Recovery Area Usage

-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'; -prompt -SELECT * FROM V$FLASH_RECOVERY_AREA_USAGE; diff --git a/sql/24a_fra_usage.sql b/sql/24a_fra_usage.sql new file mode 100644 index 0000000..dad14df --- /dev/null +++ b/sql/24a_fra_usage.sql @@ -0,0 +1,11 @@ +prompt

Fast Recovery Area Usage

+select 'Taille FRA MiB' as property, p.value / 1024 / 1024 as value from +v$parameter p WHERE name = 'db_recovery_file_dest_size' +union all +select 'Espace utilise MiB' as property, round((p.value * tot_pct / 100) / 1024 / 1024, 0) as value from +( SELECT SUM(percent_space_used) tot_pct FROM v$flash_recovery_area_usage ) , V$PARAMETER P +WHERE name = 'db_recovery_file_dest_size' +union all +select 'Pourcentage utilise' as property, tot_pct as value from +( SELECT SUM(percent_space_used) tot_pct FROM v$flash_recovery_area_usage ) +; diff --git a/sql/24b_fra_usage.sql b/sql/24b_fra_usage.sql new file mode 100644 index 0000000..bb8f77f --- /dev/null +++ b/sql/24b_fra_usage.sql @@ -0,0 +1,2 @@ +prompt

Fast Recovery Area Usage

+SELECT * FROM V$FLASH_RECOVERY_AREA_USAGE; diff --git a/sql/30b_users.sql b/sql/30b_users.sql new file mode 100644 index 0000000..083f205 --- /dev/null +++ b/sql/30b_users.sql @@ -0,0 +1,2 @@ +prompt

DBA_Profiles

+select * from DBA_Profiles order by profile, resource_name; diff --git a/sql/30b_schema_size.sql b/sql/30c_schema_size.sql similarity index 100% rename from sql/30b_schema_size.sql rename to sql/30c_schema_size.sql diff --git a/sql/31_who_is_connected.sql b/sql/31_who_is_connected.sql deleted file mode 100644 index 4dbe7e5..0000000 --- a/sql/31_who_is_connected.sql +++ /dev/null @@ -1,71 +0,0 @@ --- Qui est connecté à la base : -prompt

Sessions Aggregate per User and Type

-WITH x as ( -SELECT COUNT(*), - --con_id, - username, - inst_id, - type, - server, - status, - state - FROM gv$session - GROUP BY - --con_id, - username, - inst_id, - type, - server, - status, - state -) -SELECT x.* - --,c.name con_name -FROM x - --LEFT OUTER JOIN v$containers c ON c.con_id = x.con_id - ORDER BY - 1 DESC, - --x.con_id, - x.username, x.inst_id, x.type, x.server, x.status, x.state; - - -prompt

Sessions Aggregate per Module and Action

-WITH x AS ( -SELECT COUNT(*), - --con_id, - module, - action, - inst_id, - type, - server, - status, - state - FROM gv$session - GROUP BY - --con_id, - module, - action, - inst_id, - type, - server, - status, - state -) -SELECT x.* - --,c.name con_name -FROM x - --LEFT OUTER JOIN v$containers c ON c.con_id = x.con_id - ORDER BY - 1 DESC, - --x.con_id, - x.module, x.action, x.inst_id, x.type, x.server, x.status, x.state; - -prompt

Who is connected ?

- -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, EVENT from v$session order by LOGON_TIME asc; - diff --git a/sql/31a_who_is_connected.sql b/sql/31a_who_is_connected.sql new file mode 100644 index 0000000..0366d24 --- /dev/null +++ b/sql/31a_who_is_connected.sql @@ -0,0 +1,29 @@ +-- Qui est connecté à la base : +prompt

Sessions Aggregate per User and Type

+WITH x as ( +SELECT COUNT(*), + --con_id, + username, + inst_id, + type, + server, + status, + state + FROM gv$session + GROUP BY + --con_id, + username, + inst_id, + type, + server, + status, + state +) +SELECT x.* + --,c.name con_name +FROM x + --LEFT OUTER JOIN v$containers c ON c.con_id = x.con_id + ORDER BY + 1 DESC, + --x.con_id, + x.username, x.inst_id, x.type, x.server, x.status, x.state; diff --git a/sql/31b_who_is_connected.sql b/sql/31b_who_is_connected.sql new file mode 100644 index 0000000..d7786d3 --- /dev/null +++ b/sql/31b_who_is_connected.sql @@ -0,0 +1,30 @@ +prompt

Sessions Aggregate per Module and Action

+WITH x AS ( +SELECT COUNT(*), + --con_id, + module, + action, + inst_id, + type, + server, + status, + state + FROM gv$session + GROUP BY + --con_id, + module, + action, + inst_id, + type, + server, + status, + state +) +SELECT x.* + --,c.name con_name +FROM x + --LEFT OUTER JOIN v$containers c ON c.con_id = x.con_id + ORDER BY + 1 DESC, + --x.con_id, + x.module, x.action, x.inst_id, x.type, x.server, x.status, x.state; diff --git a/sql/31c_who_is_connected.sql b/sql/31c_who_is_connected.sql new file mode 100644 index 0000000..39b0468 --- /dev/null +++ b/sql/31c_who_is_connected.sql @@ -0,0 +1,9 @@ +prompt

Who is connected ?

+ +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, EVENT from v$session order by LOGON_TIME asc; +