Friday, June 17, 2005
Tablespace Resize (10g)
Na versão 10g já há possibilidade de fazer resize na tablespace, anteriormente isso só era permitido através dos datafiles com o comando ALTER DATABASE ... autoextend_clause. Se a tablespace foi criada com a cláusula BIGFILE, ou seja, que tablespace permite apenas adicionar um datafile ou tempfile por tablespace. Veja no exemplo:
ops$marcio@ORA10G> create BIGFILE tablespace tbs datafile 'c:\temp\tbs_df.dbf' size 5m;
Tablespace created.
ops$marcio@ORA10G>
ops$marcio@ORA10G> select tablespace_name, sum(bytes)/1024 Kbytes
2 from dba_data_files
3 where tablespace_name = 'TBS'
4 group by tablespace_name
5 /
TABLESPACE_NAME KBYTES
------------------------------ -------------
TBS 5120
1 row selected.
ops$marcio@ORA10G>
ops$marcio@ORA10G> save tmp_space replace
Wrote file tmp_space.sql
ops$marcio@ORA10G> alter tablespace tbs resize 10m;
Tablespace altered.
ops$marcio@ORA10G> @tmp_space
ops$marcio@ORA10G> select tablespace_name, sum(bytes)/1024 Kbytes
2 from dba_data_files
3 where tablespace_name = 'TBS'
4 group by tablespace_name
5 /
TABLESPACE_NAME KBYTES
------------------------------ -------------
TBS 10240
1 row selected.
ops$marcio@ORA10G> select tablespace_name, bigfile
2 from dba_tablespaces
3 where bigfile = 'YES'
4 /
TABLESPACE_NAME BIG
------------------------------ ---
TBS YES
1 row selected.
ops$marcio@ORA10G>
ops$marcio@ORA10G> drop tablespace tbs including contents and datafiles;
Tablespace dropped.
Labels: New Feature