split des requetes 1 par fichier

This commit is contained in:
Yacine31
2023-12-15 18:01:57 +01:00
parent f8b5fa8974
commit b9a21f055c
18 changed files with 153 additions and 158 deletions

View File

@@ -1,29 +0,0 @@
prompt <h2>Database/Instance Status</h2>
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;

View File

@@ -0,0 +1,30 @@
prompt <h2>Database/Instance Status</h2>
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;

View File

@@ -0,0 +1,2 @@
prompt <h2>Database/Version</h2>
select * from v$version;

View File

@@ -1,19 +1,16 @@
prompt <h2>Database supplemental logging :</h2> prompt <h2>Database supplemental logging :</h2>
col data_mining for a15 select 'force_logging' as property, force_logging as value from v$database
col data_pkey for a15 union all
col data_uniq_key for a15 select 'supplemental_log_data_min' as property, supplemental_log_data_min as value from v$database
col data_fk for a15 union all
col data_all for a15 select 'supplemental_log_data_pk' as property, supplemental_log_data_pk as value from v$database
col data_pl for a15 union all
col force_logging for a15 select 'supplemental_log_data_ui' as property, supplemental_log_data_ui as value from v$database
SELECT union all
force_logging, select 'supplemental_log_data_fk' as property, supplemental_log_data_fk as value from v$database
supplemental_log_data_min data_mining, union all
supplemental_log_data_pk data_pkey, select 'supplemental_log_data_all' as property, supplemental_log_data_all as value from v$database
supplemental_log_data_ui data_uniq_key, union all
supplemental_log_data_fk data_fk, select 'supplemental_log_data_pl' as property, supplemental_log_data_pl as value from v$database
supplemental_log_data_all data_all,
supplemental_log_data_pl data_pl
FROM v$database;

View File

@@ -1,14 +1,6 @@
prompt <h2>Fonctionnalités installées dans la base de données (DBA_REGISTRY) :</h2> prompt <h2>Fonctionnalités installées dans la base de données (DBA_REGISTRY) :</h2>
SELECT * SELECT *
-- COMP_ID, FROM dba_registry
-- COMP_NAME,
-- VERSION,
-- VERSION_FULL,
-- STATUS,
-- MODIFIED,
-- SCHEMA,
-- PROCEDURE
FROM dba_registry x
ORDER BY ORDER BY
comp_id; comp_id;

13
sql/22a_online_log.sql Normal file
View File

@@ -0,0 +1,13 @@
prompt <h2>Fichiers de journalisation (Redolog) :</h2>
alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS';
SELECT
*
FROM
v$log
ORDER BY
group#,
thread#,
sequence#;

View File

@@ -1,16 +1,5 @@
prompt <h2>Fichiers de journalisation (Redolog) :</h2>
alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS';
SELECT
*
FROM
v$log
ORDER BY
group#,
thread#,
sequence#;
prompt <h2>Multiplexage des fichiers de journalisation (Redolog et standbylog)</h2> prompt <h2>Multiplexage des fichiers de journalisation (Redolog et standbylog)</h2>
alter session set nls_date_format='YYYY/MM/DD HH24:MI:SS';
COL MEMBER FORMAT A90 WRAPPED COL MEMBER FORMAT A90 WRAPPED
BREAK ON GROUP# SKIP 1 ON THREAD# ON SEQUENCE# ON TAILLE_MIB ON "STATUS(ARCHIVED)" BREAK ON GROUP# SKIP 1 ON THREAD# ON SEQUENCE# ON TAILLE_MIB ON "STATUS(ARCHIVED)"

View File

@@ -64,15 +64,3 @@ group by to_char(first_time, 'YYYY/MM/dd')
order by to_char(first_time, 'YYYY/MM/dd') order by to_char(first_time, 'YYYY/MM/dd')
; ;
prompt <h2>Taille des redolog par jour :</h2>
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

View File

@@ -0,0 +1,10 @@
prompt <h2>Taille des redolog par jour :</h2>
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')
;

View File

@@ -1,9 +0,0 @@
prompt <h2>Fast Recovery Area Usage</h2>
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;

11
sql/24a_fra_usage.sql Normal file
View File

@@ -0,0 +1,11 @@
prompt <h2>Fast Recovery Area Usage</h2>
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 )
;

2
sql/24b_fra_usage.sql Normal file
View File

@@ -0,0 +1,2 @@
prompt <h2>Fast Recovery Area Usage</h2>
SELECT * FROM V$FLASH_RECOVERY_AREA_USAGE;

2
sql/30b_users.sql Normal file
View File

@@ -0,0 +1,2 @@
prompt <h2>DBA_Profiles </h2>
select * from DBA_Profiles order by profile, resource_name;

View File

@@ -1,71 +0,0 @@
-- Qui est connecté à la base :
prompt <h2>Sessions Aggregate per User and Type</h2>
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 <h2>Sessions Aggregate per Module and Action</h2>
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 <h2>Who is connected ? </h2>
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;

View File

@@ -0,0 +1,29 @@
-- Qui est connecté à la base :
prompt <h2>Sessions Aggregate per User and Type</h2>
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;

View File

@@ -0,0 +1,30 @@
prompt <h2>Sessions Aggregate per Module and Action</h2>
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;

View File

@@ -0,0 +1,9 @@
prompt <h2>Who is connected ? </h2>
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;