TECH
QUESTION
자주하는 질문답변 입니다.
Oracle
작성자 | 유건데이타 | 등록일 | 2017-03-13 |
제목 | Temporary tablespace 의 group | ||
---|---|---|---|
10g이상에서의 버전에서는 temporary tablespaces 에 대해 group 을 지정하여 생성할 수 있고 consumer group 을
지정하여 resource manager 와 함께 적용하여 사용이 가능하다. 다음은 Temporary tablespace group 지정을 위한 기본적이 사항이다. 1. 하나의 temporary tablespace group 은 적어도 하나의 tablespace 가 존재해야 하고 maximum number tablespace 에 대한 limit 은 정해져 있지 않다. 2. Ttemporary tablespace 와 group name 을 동일하게 지정할 수 없다. 3. Temporary tablespace group 은 1) 한 group 에서 다른 group 으로 move 가 가능하고 2) Group 내에서 삭제 될 수 있으며 3) 추가적으로 add 가 가능하다. 4. Temporary tablespace group 사용으로 인해 1) Sort 결과를 유지하여 space 낭비를 막을 수 있고 2) 동시에 여러개의 session connect 시에도 서로 다른 temporary tablespaces 를 사용함으로써 temporary tablespaces 의 사용을 분산 시킬 수 있다. 3) Parallel operation 시에도 multiple temporary tablespaces 사용이 가능하다. Example 1. GROUP1 을 지정하고 GROUP1 에 속하는 temporary tablespace LMTEMP 1 를 생성한다. 이 때 GROUP 1 을 따로 생성할 필요 없고 temporary tablespace 생성시에 지정하도록 한다. SQL> create temporary tablespace LMTEMP 1 tempfile 'D:\ORACLE10\ORCL\temp1_01.dbf' size 50M tablespace group GROUP1; SQL> select * from dba_tablespace_groups; GROUP_NAME TABLESPACE_NAME ------------------------------ GROUP1 LMTEMP1 2. LMTEMP2 를 GROUP1 에 새로 추가한다. SQL> create temporary tablespace lmtemp2 tempfile 'D:\ORACLE10\ORCL\temp1_02.dbf' size 2M tablespace group group1; Tablespace created. SQL> select * from dba_tablespace_groups; GROUP_NAME TABLESPACE_NAME ------------------------------ GROUP1 LMTEMP1 GROUP1 LMTEMP2 3. 기존에 존재하는 LMTEMP1 를 GROUP2 로 move 한다. SQL> alter tablespace LMTEMP1 tablespace group GROUP2 ; Tablespace altered. SQL> select * from dba_tablespace_groups; GROUP_NAME TABLESPACE_NAME ------------------------------ GROUP2 LMTEMP1 GROUP1 LMTEMP2 4. LMTEMP1 이 속해 있던 GROUP2 에서 LMTEMP1 를 제외 시키고 다시 포함시킬 수 있다. SQL> alter tablespace LMTEMP1 tablespace group ''; Tablespace altered. SQL> select * from dba_tablespace_groups; GROUP_NAME TABLESPACE_NAME ------------------------------ GROUP1 LMTEMP2 SQL> select tablespace_name from dba_tablespaces where contents='TEMPORARY'; TABLESPACE_NAME ------------------------------ TEMP LMTEMP1 LMTEMP2 SQL> alter tablespace LMTEMP1 tablespace group GROUP1; Tablespace altered. 5. Temporary tablespace 와 group name 을 동일하게 지정할 경우 ORA-10918 에러가 발생한다. 즉, temporary tablespace 와 group name 을 동일하게 지정이 불가능하다. SQL> create temporary tablespace lmtemp5 tempfile 'D:\ORACLE10\ORCL\temp1_05.dbf' size 50M tablespace group lmtemp5; create temporary tablespace lmtemp5 * ERROR at line 1: ORA-10918: TABLESPACE GROUP name cannot be the same as tablespace name 6. 존재하던 모든 temporary tablespaces 를 drop 하게 되면 group 은 자동으로 remove 된다. SQL> create temporary tablespace LMTEMP3 tempfile 'D:\ORACLE10\ORCL\temp1_03.dbf' size 2M tablespace group GROUP2; Tablespace created. SQL> create temporary tablespace LMTEMP4 tempfile 'D:\ORACLE10\ORCL\temp1_04.dbf' size 2M tablespace group GROUP2; Tablespace created. SQL> select * from dba_tablespace_groups; GROUP_NAME TABLESPACE_NAME ------------------------------ GROUP1 LMTEMP1 GROUP1 LMTEMP2 GROUP2 LMTEMP3 GROUP2 LMTEMP4 SQL> drop tablespace lmtemp3 including contents and datafiles; Tablespace dropped. SQL> drop tablespace lmtemp4 including contents and datafiles; Tablespace dropped. SQL> select * from dba_tablespace_groups; GROUP_NAME TABLESPACE_NAME ------------------------------ GROUP1 LMTEMP1 GROUP1 LMTEMP2 7. Group 에 user 사용이 가능하도록 지정할 수 있다. SQL> alter user scott temporary tablespace GROUP1; User altered. 8. Temporary tablespace group 을 database level 의 default temporary tablespace 로도 지정할 수 있다. SQL> alter database Database altered. 만약, temporary tablespaces 가 default database temporary tablespace group 에 속해 있는경우 drop 시 ORA-10921 에러가 발생하게 된다. 즉, default temporary tablespace group 에 속해 있는 경우 drop 할 수 없다. SQL> drop tablespace LMTEMP2 including contents and datafiles; drop tablespace lmtemp2 including contents and datafiles * ERROR at line 1: ORA-10921: Cannot drop tablespace belonging to default temporary tablespace group Reference Documents |
Comment | |||
---|---|---|---|
등록된 코멘트가 없습니다. |