Update get_tablespaces_ddl.sql
This commit is contained in:
@@ -18,24 +18,24 @@ SELECT 'CREATE '
|
|||||||
|| DECODE (ts.bigfile, 'YES', 'BIGFILE ') --assuming smallfile is the default table space
|
|| DECODE (ts.bigfile, 'YES', 'BIGFILE ') --assuming smallfile is the default table space
|
||||||
|| 'TABLESPACE "' || ts.tablespace_name || '" DATAFILE ' || CHR(13) || CHR(10)
|
|| 'TABLESPACE "' || ts.tablespace_name || '" DATAFILE ' || CHR(13) || CHR(10)
|
||||||
|| LISTAGG(decode(p.value, NULL, ' ''' || df.file_name || '''') || ' SIZE '
|
|| LISTAGG(decode(p.value, NULL, ' ''' || df.file_name || '''') || ' SIZE '
|
||||||
-- || df.bytes -- on ne prends pas la taille du datafile, mais la taille ocupée used_bytes
|
|
||||||
-- || decode(floor(e.used_bytes/1024/1024),0,10,floor(e.used_bytes/1024/1024)) || 'M ' -- si taille nulle, on retourne 10M
|
|
||||||
|| CASE
|
|| CASE
|
||||||
-- si la taille est nulle ou < 1M on retourne 10M
|
-- si la taille est nulle ou < 1M on retourne 1M
|
||||||
WHEN e.used_bytes is NULL or e.used_bytes < (1024*1024)
|
WHEN e.used_bytes is NULL or e.used_bytes < (1024*1024)
|
||||||
THEN '10M'
|
THEN '1M'
|
||||||
ELSE to_char(floor(e.used_bytes/(1024*1024))) || 'M'
|
ELSE to_char(floor(e.used_bytes/(1024*1024))) || 'M'
|
||||||
END
|
END
|
||||||
|| DECODE (
|
|| DECODE (
|
||||||
df.autoextensible,
|
df.autoextensible,
|
||||||
'YES', ' AUTOEXTEND ON NEXT ' || ceil(df.increment_by*ts.block_size/1024/1024) || 'M MAXSIZE '
|
'YES',
|
||||||
|| CASE
|
' AUTOEXTEND ON NEXT ' || ceil(df.increment_by*ts.block_size/1024/1024) || 'M MAXSIZE '
|
||||||
WHEN maxbytes < POWER (1024, 2)
|
|| TO_CHAR (FLOOR (maxbytes / POWER (1024, 2))) || 'M'),
|
||||||
THEN
|
-- || CASE
|
||||||
TO_CHAR (maxbytes)
|
-- WHEN maxbytes < POWER (1024, 2)
|
||||||
ELSE
|
-- THEN
|
||||||
TO_CHAR (FLOOR (maxbytes / POWER (1024, 2))) || 'M'
|
-- TO_CHAR (maxbytes)
|
||||||
END),
|
-- ELSE
|
||||||
|
-- TO_CHAR (FLOOR (maxbytes / POWER (1024, 2))) || 'M'
|
||||||
|
-- END),
|
||||||
',' || CHR (13) || CHR (10))
|
',' || CHR (13) || CHR (10))
|
||||||
WITHIN GROUP (ORDER BY df.file_id, df.file_name)
|
WITHIN GROUP (ORDER BY df.file_id, df.file_name)
|
||||||
|| ';'
|
|| ';'
|
||||||
|
|||||||
Reference in New Issue
Block a user