Oracle 10g/10g - 실습

Table : Row Migration과 Chaining

I유령I 2010. 3. 4. 11:19
실습: 테이블의 상태 확인과 Rebuild


[oracle@ghost sql]$ sqlplus / as sysdba

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 4 10:52:20 2010

Copyright (c) 1982, 2005, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  285212672 bytes
Fixed Size                  1218992 bytes
Variable Size              92276304 bytes
Database Buffers          188743680 bytes
Redo Buffers                2973696 bytes
Database mounted.
Database opened.
SQL> col tablespace_name format a20
SQL> analyze table hr.employees compute statistics;

Table analyzed.

SQL> select num_rows, chain_cnt from dba_tables where table_name = 'EMPLOYEES';

  NUM_ROWS  CHAIN_CNT
---------- ----------
       107          0

SQL> create tablespace test         
  2  datafile '/home/oracle/oradata/testdb/test01.dbf' size 10m
  3  segment space management auto;

Tablespace created.

SQL> alter user hr quota 1m on test;

User altered.

SQL> conn hr/hr
Connected.
SQL> alter table employees move tablespace test;

Table altered.

SQL> conn / as sysdba
Connected.
SQL> select owner, table_name, tablespace_name from dba_tables
  2  where owner = 'HR' and table_name = 'EMPLOYEES';

OWNER                          TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------ --------------------
HR                             EMPLOYEES                      TEST

SQL> alter table hr.employees move tablespace example;

Table altered.

SQL> select owner, table_name, tablespace_name from dba_tables
  2  where owner = 'HR' and table_name = 'EMPLOYEES';

OWNER                          TABLE_NAME                     TABLESPACE_NAME
------------------------------ ------------------------------ --------------------
HR                             EMPLOYEES                      EXAMPLE

SQL>