Update 21_datafile.sql

This commit is contained in:
Yacine31
2023-11-23 01:09:11 +01:00
parent 5db2cb95e4
commit c41096bd1a

View File

@@ -1,28 +1,49 @@
prompt <h2>Détail des datafiles : </h2>
COL file_id HEAD "File ID"
COL file_name HEAD "Datafile"
COL tablespace_name FORMAT A20 HEAD "Tablespace"
COL bytes FORMAT 99999999.00 HEAD "Size MB"
COL maxbytes FORMAT 99999999.00 HEAD "MaxSize MB"
COL Pct_Used FORMAT 999.00 HEAD "% Used"
COL file_size_mb FORMAT 99999999.00 HEAD "File Size MB"
COL space_used_mb FORMAT 99999999.00 HEAD "Space Used MB"
COL space_free_mb FORMAT 99999999.00 HEAD "Space Free MB"
COL maxsize_mb FORMAT 99999999.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 online_status format a15 head "Online Status"
SELECT
file_id, file_name, tablespace_name,
round(bytes/1024/1024,0) bytes,
round(maxbytes/1024/1024,0) maxbytes,
round(100*bytes/CASE WHEN maxbytes = 0 THEN 32767*1024*1024 ELSE maxbytes END) Pct_Used,
online_status,
status, autoextensible
FROM dba_data_files
ORDER BY
file_name;
select
d.file_id,
d.file_name,
d.tablespace_name,
a.bytes_alloc/1024/1024 file_size_mb,
(a.bytes_alloc - nvl(b.bytes_free, 0))/1024/1024 space_used_mb,
nvl(b.bytes_free, 0)/1024/1024 space_free_mb,
a.maxbytes/1024/1024 maxsize_mb,
round((a.bytes_alloc - nvl(b.bytes_free, 0)) / a.maxbytes * 100,2) percent_used,
d.autoextensible,
d.status,
d.online_status
from
(
select
f.file_id,
sum(f.bytes) bytes_alloc,
sum(decode(f.autoextensible, 'YES', f.maxbytes, 'NO', f.bytes)) maxbytes
from dba_data_files f group by file_id
) a,
(
select
f.file_id,
sum(f.bytes) bytes_free
from dba_free_space f group by file_id
) b,
dba_data_files d
where
a.file_id = b.file_id (+) and d.file_id=a.file_id
prompt <h2>Existance de blocks corrompus :</h2>
select * from v$database_block_corruption;