|
1. »õ·Î¿î Tablespace Create
$ svrmgrl
SVRMGR> connect / as sysdba
SVRMGR> startup
SVRMGR> create tablespace test
2 datafile '$HOME/DATA/DISK5/test_01.dbf'
3 size 10k ;
SVRMGR> select tablespace_name, bytes, file_name from dba_data_files ;
2. Table Create ÈÄ table ¿¡ rowµéÀ» insert
$ sqlplus scott/tiger
SQL> create table test
2 (name varchar2(10))
3 storage (initial 4k)
4 tablespace test ;
SQL> insert into test values ('TEST') ;
SQL> insert into test select * from test ;
SQL> / <-- ¾Æ·¡ÀÇ error ¸Þ¼¼Áö°¡ ³ª¿Ã ¶§±îÁö ¿©·¯¹ø ¹Ýº¹ÇÑ´Ù.
ORA-01653: unable to extend table SCOTT.TEST by 5 in tablespace TEST
3. Tablespace¸¦ ´Ã¸°´Ù.
SQL> connect system/manager
SQL> alter tablespace test add datafile '$HOME/DATA/DISK6/test02_dbf' size 30k ;
SQL> select tablespace_name, bytes, file_name from dba_data_files ;
SQL> connect scott/tiger
SQL> insert into test select * form test ;
¶Ç´Â ´ÙÀ½ÀÇ ¹æ¹ýÀ¸·Î datafileÀ» resizeÇÑ´Ù.
SQL> connect system/manager
SQL> alter database datafile '$HOME/DATA/DISK5/test_01.dbf' resize 50k ;
SQL> select tablespace_name, bytes, file_name from dba_data_files ;
SQL> !ls -la $HOME/DATA/DISK5
SQL> connect scott/tiger
SQL> insert into test select * from test ;
SQL> commit ;
4. Å×½ºÆ®°¡ ³¡³ª¸é Drop
SQL> connect system/manager
SQL> drop tablespace test including contents ;
SQL> select tablespace_name, bytes, file_name from dba_data_files ;
SQL> !ls -la $HOME/DATA/DISK5
SQL> !ls -la $HOME/DATA/DISK6
--> datafileÀÌ ±×´ë·Î Á¸ÀçÇÑ´Ù. (reuseÇϱâ À§Çؼ--´Ù½Ã datafileÀ» ¸¸µé¶§ ¼Óµµ°¡ ºü¸£´Ù.)
5. Datafileµµ »èÁ¦
SQL> !rm $HOME/DATA/DISK5/test_01.dbf
SQL> !rm $HOME/DATA/DISK6/test_02.dbf
SQL> !ls -la $HOME/DATA/DISK5
SQL> !ls -la $HOME/DATA/DISK6
$ svrmgrl
SVRMGR> connect / as sysdba
SVRMGR> shutdown immediate
SVRMGR> exit
|