From 346c0f7fb02e4fb463052cd7c7fdb74515b794db Mon Sep 17 00:00:00 2001 From: Yacine31 Date: Wed, 24 Nov 2021 05:20:11 +0100 Subject: [PATCH] Update get_tablespaces_ddl.sql MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit mot clé SIZE e double corrigé tiens compte de format OMF pour DF et TempFile --- get_tablespaces_ddl.sql | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/get_tablespaces_ddl.sql b/get_tablespaces_ddl.sql index 87238cd..41de0aa 100644 --- a/get_tablespaces_ddl.sql +++ b/get_tablespaces_ddl.sql @@ -18,7 +18,6 @@ SELECT 'CREATE ' || DECODE (ts.bigfile, 'YES', 'BIGFILE ') --assuming smallfile is the default table space || 'TABLESPACE "' || ts.tablespace_name || '" DATAFILE ' || CHR(13) || CHR(10) || LISTAGG(decode(p.value, NULL, ' ''' || df.file_name || '''') || ' SIZE ' - || ' SIZE ' -- || df.bytes -- on ne prends pas la taille du datafile, mais la taille ocupée used_bytes || nvl(e.used_bytes,10*1024*1024) -- si taille nulle, on retourne 10M || DECODE ( @@ -51,7 +50,7 @@ GROUP BY ts.tablespace_name, ORDER BY ts.tablespace_name; SELECT 'CREATE TEMPORARY TABLESPACE "' || ts.tablespace_name || '" TEMPFILE ' || CHR (13) || CHR (10) - || LISTAGG (' ''' || df.file_name || '''' || ' SIZE ' + || LISTAGG(decode(p.value, NULL, ' ''' || df.file_name || '''') || ' SIZE ' || nvl(e.used_bytes,10*1024*1024) -- si taille nulle, on retourne 10M || DECODE ( df.autoextensible, @@ -63,7 +62,8 @@ SELECT 'CREATE TEMPORARY TABLESPACE "' || ts.tablespace_name || '" TEMPFILE ' 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 + (SELECT file_id, sum(decode(bytes,NULL,0,bytes)) used_bytes FROM dba_extents GROUP by file_id) e, + (select VALUE from v$parameter where name='db_create_file_dest') p WHERE e.file_id (+) = df.file_id and ts.tablespace_name = df.tablespace_name GROUP BY ts.tablespace_name,