2007년 12월 04일
tablespace sql문
Last Modified
by ides
http://tequiero35.egloos.com/
1. 데이터 파일과 관련된 구조 확인
SQL> connect / as sysdba
SQL> select file_name, tablespace_name
from dba_data_files; // dba_data_files : view
2. 현재 DB의 테이블 스페이스 확인
SQL> select tablespace_name
from dba_tablespaces;
3. 테이블 스페이스 생성
SQL> create tablespace TS_NAME datafile 'E:\oralce\oradata\test\ts_name01.dbf' size 10m;
4. 각 user의 default tablespace 확인
SQL> connect / as sysdba
SQL> select username, default_tablespace, temporary_tablespace
from dba_users
where username in ('SCOTT');
5. 테이블의 테이블 스페이스 확인
SQL> select table_name, tablespace_name
from dba_tables
where table_name in ('TESTTABLE');
6. 테이블의 테이블 스페이스 변경
SQL> alter table T_NAME move tablespace USER_TSNAME;
//T_NAME 테이블의 테이블 스페이스를 USER_TSNAME로 변경.
7. 테이블 스페이스 변경
SQL> connect / as sysdba
SQL> alter tablespace TS_NAME offline normal; //offline 상태에서는 스키마 객체 만들 수 없다.
SQL> alter tablespace TS_NAME online;
cf. offline normal : tablespace에 있는 data file들이 오류 없으면 offline 가능
temporary offline : 오류 있어도 임시적으로 offline 가능
immediate offline : tablespace의 어떠한 data file에 대한 check point 없이 즉시 offline 가능
8. 테이블 스페이스 삭제
SQL> connect / as sysdba
SQL> drop tablespace TS_NAME;
9. default tablespace 변경
SQL> connect / as sysdba
SQL> alter user SCOTT default tablespace users; //users 테이블 스페이스로 변경
<REFERENCE>
http://www.oraclejava.co.kr/zboard/view.php?id=LecOracle&page=2&sn1=&divpage=1&sn=off&ss=on&sc=on&keyword=tablespace&select_arrange=headnum&desc=asc&no=58
이 글과 관련있는 글을 자동검색한 결과입니다 [?]
- Oracle에서 사용자 추가/삭제 by 메멘토
- User생성과 TableSpace by 낭길리마
- Oracle 테이블스페이스 데이터파일 이름 바꾸기 by 시험さま
- table space config by RUNE
# by | 2007/12/04 15:20 | [P] Oracle | 트랙백 | 덧글(0)





☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]