11_manager_tables
时间:2010-11-15 来源:forhope315
Chapter 11
11_manager_tables
ROWID
regular and temporary table
manage storage structures within a table
table
column
table tpye:
regular table(heap table)堆表
partiticon table
index-organized table
cluster 把相关的表放在共同的数据块上。
Regular table:
heap table
水桶 ,往里面丢小鱼,是不能保证顺序的
data types:
字符型 CHAR(N),NCHAR(N)(这里的N是国际化的意思,NATIONAL。char ,bit,汉字),VARCHAR2(N),NVARCHAR2(N)
数值型 NUMBER(P,S)
日期型 DATE,TIMESTAMP
大对象型 RAW(N),(2000k,gif图片),BLOB,CLOB,NCOB,BFILE,LONG,LONG RAW,
ROWID,UROWID型 U:universal
ORACLE 的IO操作是块操作的,所以要尽量设计成小表,减少IO量
SAP软件?
ROWID format:
创建表,可以加密,压缩等操作。
CREATE TABLE
掌握建表的存储参数:
ASSM
MSSM
PCTFREE
PCTUSED MSSD only
FREELIST MSSD only
INITRANS
segment 的管理方式 ,initial,next,pctincrease,miniextent,maxextent
碎片整理,re-organized
创建临时表:
create global temporary table emp as select * from scott.emp;
临时表有两个级别:
session on commit persve rows
transaction on commit delete rows
临时表的定义是永久的。是永久存在的。
Setting PCTFREE && PCTUSED
Row migration & Chaining
Row migration: PCTFREE
Row Chaining: BLOCK_SIZE,ROW PIECES (多个)
Reorg table: Nonpartitioned table
1,alter table hr.employees move tablespace data1;
2,导入导出一张表
3,重建一张表
SQL> select dbms_metadata.get_ddl('TABLE','EMP') FROM DUAL;
DBMS_METADATA.GET_DDL('TABLE','EMP')
--------------------------------------------------------------------------------
CREATE TABLE "SCOTT"."EMP"
( "EMPNO" NUMBER(4,0),
"ENAME" VARCHAR2(10),
Truncating a table:
truncate table hr.employees;
You cannot roll back a TRUNCATE statement.
Dropping a table:
drop table hr.departments cascade contraints;
Removing rows with the TRUNCATE statement can be faster than
removing all rows with the DELETE statement, especially if the table has numerous triggers,
indexes, and other dependencies.
Dropping a column:
alter table hr.employees drop column comments cacade contraints checkpoint 1000;
Renaming a column:
alter table table_name
rename column old_column_name
to new_column_name;
Using the UNUSED Option:
mark as unused and then removed later.
unused columns act as if they are not part of the table. desc can't seee the unused columns.
alter table t set unused column myname;
desc t ;
alter table t drop unused columns checkpoints 1000;
alter table t drop unused columns continue checkpoint 1000;
get information:
dba_tables;
dba_objects;
dba_extents
11_manager_tables
ROWID
regular and temporary table
manage storage structures within a table
table
column
table tpye:
regular table(heap table)堆表
partiticon table
index-organized table
cluster 把相关的表放在共同的数据块上。
Regular table:
heap table
水桶 ,往里面丢小鱼,是不能保证顺序的
data types:
字符型 CHAR(N),NCHAR(N)(这里的N是国际化的意思,NATIONAL。char ,bit,汉字),VARCHAR2(N),NVARCHAR2(N)
数值型 NUMBER(P,S)
日期型 DATE,TIMESTAMP
大对象型 RAW(N),(2000k,gif图片),BLOB,CLOB,NCOB,BFILE,LONG,LONG RAW,
ROWID,UROWID型 U:universal
ORACLE 的IO操作是块操作的,所以要尽量设计成小表,减少IO量
SAP软件?
ROWID format:
创建表,可以加密,压缩等操作。
CREATE TABLE
掌握建表的存储参数:
ASSM
MSSM
PCTFREE
PCTUSED MSSD only
FREELIST MSSD only
INITRANS
segment 的管理方式 ,initial,next,pctincrease,miniextent,maxextent
碎片整理,re-organized
创建临时表:
create global temporary table emp as select * from scott.emp;
临时表有两个级别:
session on commit persve rows
transaction on commit delete rows
临时表的定义是永久的。是永久存在的。
Setting PCTFREE && PCTUSED
Row migration & Chaining
Row migration: PCTFREE
Row Chaining: BLOCK_SIZE,ROW PIECES (多个)
Reorg table: Nonpartitioned table
1,alter table hr.employees move tablespace data1;
2,导入导出一张表
3,重建一张表
SQL> select dbms_metadata.get_ddl('TABLE','EMP') FROM DUAL;
DBMS_METADATA.GET_DDL('TABLE','EMP')
--------------------------------------------------------------------------------
CREATE TABLE "SCOTT"."EMP"
( "EMPNO" NUMBER(4,0),
"ENAME" VARCHAR2(10),
Truncating a table:
truncate table hr.employees;
You cannot roll back a TRUNCATE statement.
Dropping a table:
drop table hr.departments cascade contraints;
Removing rows with the TRUNCATE statement can be faster than
removing all rows with the DELETE statement, especially if the table has numerous triggers,
indexes, and other dependencies.
Dropping a column:
alter table hr.employees drop column comments cacade contraints checkpoint 1000;
Renaming a column:
alter table table_name
rename column old_column_name
to new_column_name;
Using the UNUSED Option:
mark as unused and then removed later.
unused columns act as if they are not part of the table. desc can't seee the unused columns.
alter table t set unused column myname;
desc t ;
alter table t drop unused columns checkpoints 1000;
alter table t drop unused columns continue checkpoint 1000;
get information:
dba_tables;
dba_objects;
dba_extents
相关阅读 更多 +