테이블스페이스 생성과 관리
실습 1. 데이터베이스의 데이터 파일과 테이블스페이스 상태 조회
SQL> select tablespace_name,status,contents,extent_management,segment_space_management
2 from dba_tablespaces;
SQL> select tablespace_name,bytes,file_name from dba_data_files;
실습 2. 현재 temporary tablespace 설정 확인
SQL> select tablespace_name,bytes,file_name from dba_temp_files;
SQL> select * from database_properties where property_name like '%TEMP%';
실습 3. temporary tablespace 생성과 default temporary tablespace 지정
SQL> create temporary tablespace tmp
tempfile '/home/oracle/oradata/testdb/temp01.dbf' size 10m
SQL> select tablespace_name,bytes,file_name from dba_temp_files;
실습 4. 사용자용 테이블 스페이스 생성법
SQL> create tablespace insa
datafile '/home/oracle/oradata/testdb/insa01.dbf' size 10m
segment space management auto; <- 10g에서는 사용 안 해도 기본으로 생성됩니다.
실습 3. 사용자용 테이블스페이스 확장
SQL> alter database datafile
2 '/home/oracle/oradata/testdb/insa01.dbf' resize 20m;
insa 테이블스페이스 데이터파일 추가!
SQL> alter tablespace insa
2 add datafile '/home/oracle/oradata/testdb/insa02.dbf' size 20m;
실습 4. OPEN 상태에서 Data file이동
step 1. Tablespace offline
step 2. Datafile mov (os command)
step 3. alter tablespace ~ rename ~
step 4. Tablespace online
SQL> alter tablespace insa offline;
SQL> !cp /home/oracle/oradata/testdb/insa02.dbf /home/oracle/oradata/
SQL> alter tablespace insa rename
datafile '/home/oracle/oradata/testdb/insa02.dbf'
to '/home/oracle/oradata/insa02.dbf';
SQL> alter tablespace insa online;
데이터 파일 같은경우는 Shutdown 한후 mount 단계에서 명령어를 쳐서 옮겨야만 한다
실습 5. Mount 상태에서 Datafile이동
step 1. DB Mount
step 2. Datafile move ( os command)
step 3. alter database rename file~
step 4. DB open
SQL> shutdown immediate
SQL> !cp /home/oracle/oradata/testdb/system01.dbf /home/oracle/oradata/system01.dbf
SQL> startup mount;
SQL> alter database rename
file '/home/oracle/oradata/testdb/system01.dbf'
to '/home/oracle/oradata/system01.dbf'
SQL> alter database open;
실습 6. 테이블스페이스의 삭제
SQL> drop tablespace insa including contents and datafiles;
'Oracle DataBase > Admin' 카테고리의 다른 글
User 생성과 관리 (0) | 2012.06.08 |
---|---|
PROFILE 생성과 관리 (0) | 2012.06.08 |
Redo log file 구성 및 관리 (0) | 2012.06.08 |
undo tablespace 생성 관리 (0) | 2012.06.08 |
Control file 다중화 실습 (0) | 2012.06.08 |