10 Commits
maj_v2 ... main

Author SHA1 Message Date
Yacine31
4a47aa1862 ajout de la colonne : nombre de datafile 2025-11-24 18:11:27 +01:00
Yacine31
0d2cd05d78 adaptation des resultats tablespace et datafile aux bases CDB 2025-11-20 22:53:59 +01:00
Yacine31
d82e092f67 correction export ORACLE_HOME 2025-11-19 17:54:07 +01:00
Yacine31
cea287fb1e déplacement des données base et listener dans 10_oracle_installation.
Les listener en bas de la page, car status trop long
2025-11-19 17:45:07 +01:00
Yacine31
0eb1584e0e os_info : correction pour parcourir tous les listeners 2025-11-19 17:28:55 +01:00
Yacine31
b26f1c679f top sql format date humain 2025-11-19 16:52:32 +01:00
Yacine31
0180e31523 erreur sql corrigée 2025-11-19 16:32:00 +01:00
Yacine31
64c96f39f5 correction elapsed_time 2025-11-19 16:29:18 +01:00
Yacine31
1ab4f35373 correction erreur SQL 2025-11-19 16:25:18 +01:00
Yacine31
8c87dad21d top_sql : round des temps calculés 2025-11-19 16:17:06 +01:00
6 changed files with 106 additions and 85 deletions

View File

@@ -7,25 +7,6 @@ source "$(dirname "$0")/utils.sh"
os_type=$(uname -s) os_type=$(uname -s)
print_h2 "Bases de données en cours d'exécution"
run_and_print "ps -ef | grep pmon | grep -v grep"
print_h2 "Listeners en cours d'exécution"
run_and_print "ps -ef | grep tnslsnr | grep -v grep"
print_h2 "Statut du listener : ${listener_name}"
# Boucle pour le statut du listener, car elle est plus complexe
ps -ef | grep tnslsnr | egrep -i " LISTENER |${ORACLE_SID}" | grep -v grep | while read -r l; do
binary_path=$(echo "$l" | perl -lne 'print $1 if /(\S*tnslsnr\S*)/' | sed 's#/bin/tnslsnr##')
listener_name=$(echo "$l" | perl -lne 'print $1 if /\btnslsnr\s+(\S+)/' | sed 's/tnslsnr //')
if [ -n "$binary_path" ] && [ -n "$listener_name" ]; then
export TNS_ADMIN="$binary_path/network/admin"
lsnrctl_command="$binary_path/bin/lsnrctl status $listener_name"
# echo "<b>Listener: ${listener_name}</b>"
run_and_print "$lsnrctl_command"
fi
done
print_h2 "Uptime" print_h2 "Uptime"
run_and_print "uptime" run_and_print "uptime"

View File

@@ -38,3 +38,24 @@ else
echo "<pre>Fichier ${ORA_INVENTORY}/ContentsXML/inventory.xml non trouvé.</pre>" echo "<pre>Fichier ${ORA_INVENTORY}/ContentsXML/inventory.xml non trouvé.</pre>"
fi fi
print_h2 "Bases de données en cours d'exécution"
run_and_print "ps -ef | grep pmon | grep -v grep"
print_h2 "Listeners en cours d'exécution"
run_and_print "ps -ef | grep tnslsnr | grep -v grep"
# Boucle pour le statut du listener, car elle est plus complexe
# ps -ef | grep tnslsnr | egrep -i " LISTENER |${ORACLE_SID}" | grep -v grep | while read -r l; do
# On parcours tous les listener qui tournent sur le serveur pour afficher leur statut
ps -ef | grep tnslsnr | grep -v grep | while read -r l; do
binary_path=$(echo "$l" | perl -lne 'print $1 if /(\S*tnslsnr\S*)/' | sed 's#/bin/tnslsnr##')
listener_name=$(echo "$l" | perl -lne 'print $1 if /\btnslsnr\s+(\S+)/' | sed 's/tnslsnr //')
if [ -n "$binary_path" ] && [ -n "$listener_name" ]; then
export TNS_ADMIN="$binary_path/network/admin"
export ORACLE_HOME="$binary_path"
print_h2 "Statut du listener : ${listener_name}"
lsnrctl_command="$binary_path/bin/lsnrctl status $listener_name"
run_and_print "$lsnrctl_command"
fi
done

View File

@@ -1,9 +1,4 @@
prompt <h2>Détail des tablespaces : </h2> prompt <h2>Détail des tablespaces : </h2>
-- COL TABLESPACE_NAME FORMAT A20 HEAD "Nom Tablespace"
-- COL PCT_OCCUPATION_THEORIQUE FORMAT 990.00 HEAD "% Occup"
-- COL TAILLE_MIB FORMAT 99999990.00 HEAD "Taille MB"
-- COL TAILLE_MAX_MIB FORMAT 99999990.00 HEAD "Taille max MB"
-- COL TAILLE_OCCUPEE_MIB FORMAT 99999990.00 HEAD "Espace occupé MiB"
COL TABLESPACE_NAME FORMAT A20 HEAD "Tablespace" COL TABLESPACE_NAME FORMAT A20 HEAD "Tablespace"
COL alloc FORMAT 99999999.00 HEAD "Allocated MB" COL alloc FORMAT 99999999.00 HEAD "Allocated MB"
@@ -11,10 +6,12 @@ COL used FORMAT 99999999.00 HEAD "Used MB"
COL free FORMAT 99999999.00 HEAD "Free MB" COL free FORMAT 99999999.00 HEAD "Free MB"
COL max FORMAT 99999999.00 HEAD "MaxSize MB" COL max FORMAT 99999999.00 HEAD "MaxSize MB"
COL Pct_Used FORMAT 999.00 HEAD "% Used" COL Pct_Used FORMAT 999.00 HEAD "% Used"
COL nb_of_file FORMAT 999 HEAD "Nbr Of Files"
select /* db-html-report */ select /* db-html-report */
a.tablespace_name, a.tablespace_name,
t.bigfile, t.bigfile,
a.nb_of_file,
a.bytes_alloc/1024/1024 alloc, a.bytes_alloc/1024/1024 alloc,
(a.bytes_alloc - nvl(b.bytes_free, 0))/1024/1024 used, (a.bytes_alloc - nvl(b.bytes_free, 0))/1024/1024 used,
(nvl(b.bytes_free, 0))/1024/1024 free, (nvl(b.bytes_free, 0))/1024/1024 free,
@@ -24,6 +21,7 @@ from
( (
select select
f.tablespace_name, f.tablespace_name,
count(*) as nb_of_file,
sum(f.bytes) bytes_alloc, sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible, 'YES', f.maxbytes, 'NO', f.bytes)) maxbytes sum(decode(f.autoextensible, 'YES', f.maxbytes, 'NO', f.bytes)) maxbytes
from from
@@ -48,6 +46,7 @@ union all
select select
h.tablespace_name, h.tablespace_name,
dt.bigfile, dt.bigfile,
count(*) as nb_of_file,
(sum(h.bytes_free + h.bytes_used))/1024/1024 alloc, (sum(h.bytes_free + h.bytes_used))/1024/1024 alloc,
(sum(nvl(p.bytes_used, 0)))/1024/1024 used, (sum(nvl(p.bytes_used, 0)))/1024/1024 used,
(sum((h.bytes_free + h.bytes_used) - nvl(p.bytes_used, 0)))/1024/1024 free, (sum((h.bytes_free + h.bytes_used) - nvl(p.bytes_used, 0)))/1024/1024 free,

59
sql/20b_tablespaces.sql Normal file
View File

@@ -0,0 +1,59 @@
prompt <h2>Détail des tablespaces (dans toutes les PDB si la base est CDB) : </h2>
COL NAME FORMAT A20 HEAD "DB/PDB NAME"
COL TABLESPACE_NAME FORMAT A20 HEAD "Tablespace"
COL alloc_mb FORMAT 99999999.00 HEAD "Allocated MB"
COL used_mb FORMAT 99999999.00 HEAD "Used MB"
COL free_mb FORMAT 99999999.00 HEAD "Free MB"
COL max_mb FORMAT 99999999.00 HEAD "MaxSize MB"
COL Pct_Used FORMAT 999.00 HEAD "% Used"
COL nbr_of_files FORMAT 999 HEAD "Nbr Of Files"
COL BIGFILE FORMAT A8 HEAD "Bigfile"
select /* db-html-report */
a.con_id,
c.NAME,
a.tablespace_name,
t.bigfile,
a.nbr_of_files,
a.bytes_alloc/1024/1024 alloc_mb,
(a.bytes_alloc - nvl(b.bytes_free, 0))/1024/1024 used_mb,
(nvl(b.bytes_free, 0))/1024/1024 free_mb,
maxbytes/1024/1024 Max_mb,
(a.bytes_alloc - nvl(b.bytes_free, 0)) / maxbytes * 100 Pct_Used
from
(
select
f.con_id,
f.tablespace_name,
count(*) as nbr_of_files,
sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible, 'YES', f.maxbytes, 'NO', f.bytes)) maxbytes
from
cdb_data_files f
group by
con_id, tablespace_name
) a,
(
select
f.con_id,
f.tablespace_name,
sum(f.bytes) bytes_free
from
cdb_free_space f
group by
con_id, tablespace_name
) b,
v$containers c,
cdb_tablespaces t
where
a.con_id = b.con_id
and a.con_id = c.con_id(+)
and a.con_id = t.con_id
and a.tablespace_name = b.tablespace_name (+)
and a.tablespace_name = t.tablespace_name
order by
a.con_id,
c.NAME,
a.tablespace_name
;

View File

@@ -1,62 +1,25 @@
prompt <h2>Détail des tempfile : </h2> prompt <h2>Détail des tempfile : </h2>
COL con_id HEAD "CON ID" COL con_id HEAD "CON ID"
COL pdb_name HEAD "PDB Name" COL name HEAD "PDB Name"
COL file_id HEAD "File ID" COL file_id HEAD "File ID"
COL file_name HEAD "Tempfile"
COL tablespace_name FORMAT A20 HEAD "Tablespace" COL tablespace_name FORMAT A20 HEAD "Tablespace"
COL file_name HEAD "Tempfile"
COL file_size_mb FORMAT 999999999.00 HEAD "File Size MB"
-- COL space_used_mb FORMAT 999999999.00 HEAD "Space Used MB"
-- COL space_free_mb FORMAT 999999999.00 HEAD "Space Free MB"
COL maxsize_mb FORMAT 999999999.00 HEAD "Max Size MB"
-- COL percent_used FORMAT 999.00 HEAD "% Used"
COL autoextensible FORMAT A15 HEAD "Auto Extensible"
COL status head "Status" COL status head "Status"
-- COL online_status format a15 head "Online Status" COL file_size_mb FORMAT 999999999.00 HEAD "File Size MB"
COL maxsize_mb FORMAT 999999999.00 HEAD "Max Size MB"
COL autoextensible FORMAT A15 HEAD "Auto Extensible"
WITH select
-- Sous-requête pour les fichiers de données dans une CDB t.con_id,
cdb_files AS ( c.name,
-- cdb_files.sql t.file_id,
select /* db-html-report */ t.tablespace_name,
p.con_id AS pdb_id, t.file_name,
p.pdb_name AS pdb_name, t.status,
d.file_id, round(t.bytes/1024/1024) file_size_mb,
d.tablespace_name, round(t.maxbytes/1024/1024) maxsize_mb,
d.file_name, t.autoextensible
d.bytes/1024/1024 AS file_size_mb, from cdb_temp_files t, v$containers c
d.maxbytes/1024/1024 AS maxsize_mb, where t.con_id = c.con_id
d.autoextensible, order by t.con_id, t.file_id, t.file_name;
d.status
FROM
cdb_temp_files d
RIGHT JOIN cdb_pdbs p ON d.con_id = p.pdb_id
WHERE
(SELECT cdb FROM v$database) = 'YES'
ORDER BY p.pdb_id, d.tablespace_name, d.file_name
),
-- Sous-requête pour les fichiers de données dans une non-CDB
non_cdb_files AS (
-- non_cdb_files.sql
SELECT
0 AS pdb_id,
NULL AS pdb_name,
d.file_id,
d.tablespace_name,
d.file_name,
d.bytes/1024/1024 AS file_size_mb,
d.maxbytes/1024/1024 AS maxsize_mb,
d.autoextensible,
d.status
FROM
dba_temp_files d
WHERE
(SELECT cdb FROM v$database) = 'NO'
ORDER BY d.tablespace_name, d.file_name
)
-- Requête finale combinant les résultats des sous-requêtes
SELECT * FROM cdb_files
UNION ALL
SELECT * FROM non_cdb_files;

View File

@@ -1,21 +1,19 @@
prompt <h2>Top SQL</h2> prompt <h2>Top SQL</h2>
alter session set nls_date_format='DD/MM/YYYY HH24:MI:SS';
select /* db-html-report */ select /* db-html-report */
* from ( * from (
select select
a.inst_id, a.inst_id,
a.sql_id, a.sql_id,
a.elapsed_time / 1000000 as elapsed, -- to_char(numtodsinterval(a.elapsed_time/ 1000000, 'SECOND'), 'HH24:MI') as elapsed,
to_char(trunc(sysdate) + numtodsinterval(a.elapsed_time/ 1000000, 'SECOND'), 'HH24:MI:SS') as elapsed,
substrb(replace(a.sql_text,'',' '),1,55) as sql_text, substrb(replace(a.sql_text,'',' '),1,55) as sql_text,
a.cpu_time / 1000000 as cpu_time,
a.buffer_gets, -- Lecture en memoire a.buffer_gets, -- Lecture en memoire
a.disk_reads, -- Lecture sur disque a.disk_reads, -- Lecture sur disque
a.physical_read_bytes, round(a.physical_read_bytes /1024/1024) as physical_read_MB,
a.executions, a.executions,
a.rows_processed, a.rows_processed,
a.last_active_time, -- Last time the statistics of a contributing cursor were updated to_char(a.last_active_time, 'DD/MM/YYYY HH24:MI:SS') as last_active_time, -- Last time the statistics of a contributing cursor were updated
b.module b.module
from gv$sqlstats a, gv$sql b from gv$sqlstats a, gv$sql b
where a.sql_id=b.sql_id where a.sql_id=b.sql_id