Update get_tablespaces_ddl.sql
ajout des tempfiles
This commit is contained in:
@@ -4,6 +4,9 @@
|
||||
--
|
||||
-- version avec la taille exacte des datafile occupée sur disque
|
||||
--
|
||||
-- Historique :
|
||||
-- 2021/11/24 - ajout des tempfiles
|
||||
|
||||
|
||||
set head off pages 0 feedback off lines 200
|
||||
|
||||
@@ -47,5 +50,28 @@ GROUP BY ts.tablespace_name,
|
||||
ts.block_size
|
||||
ORDER BY ts.tablespace_name;
|
||||
|
||||
SELECT 'CREATE TEMPORARY TABLESPACE "' || ts.tablespace_name || '" TEMPFILE ' || CHR (13) || CHR (10)
|
||||
|| LISTAGG ('' || df.file_name || '''' || ' SIZE '
|
||||
|| nvl(e.used_bytes,10*1024*1024) -- si taille nulle, on retourne 10M
|
||||
|| DECODE (
|
||||
df.autoextensible,
|
||||
'YES', ' AUTOEXTEND ON NEXT ' || df.increment_by * ts.block_size || ' MAXSIZE ' || FLOOR (maxbytes / POWER (1024, 2)) || 'M'
|
||||
),
|
||||
',' || CHR (13) || CHR (10))
|
||||
WITHIN GROUP (ORDER BY df.file_id, df.file_name)
|
||||
|| ';'
|
||||
ddl
|
||||
FROM dba_tablespaces ts,
|
||||
dba_temp_files df,
|
||||
(SELECT file_id, sum(decode(bytes,NULL,0,bytes)) used_bytes FROM dba_extents GROUP by file_id) e
|
||||
WHERE e.file_id (+) = df.file_id
|
||||
and ts.tablespace_name = df.tablespace_name
|
||||
GROUP BY ts.tablespace_name,
|
||||
ts.bigfile,
|
||||
ts.logging,
|
||||
ts.status,
|
||||
ts.block_size
|
||||
ORDER BY ts.tablespace_name;
|
||||
|
||||
exit
|
||||
|
||||
|
||||
Reference in New Issue
Block a user