DDL (Data Definition Language 数据定义语言)
create table 创建表
alter table 修改表
drop table 删除表
truncate table 删除表中所有行
create index 创建索引
drop index 删除索引
当执行DDL语句时,在每一条语句前后,oracle都将提交当前的事务。如果用户使用insert命令将记录插入到数据库后,执行了一条DDL语句(如create table),此时来自insert命令的数据将被提交到数据库。当DDL语句执行完成时,DDL语句会被自动提交,不能回滚。
DML (Data Manipulation Language 数据操作语言)
insert 将记录插入到数据库
update 修改数据库的记录
delete 删除数据库的记录
当执行DML命令如果没有提交,将不会被其他会话看到。除非在DML命令之后执行了DDL命令或DCL命令,或用户退出会话,或终止实例,此时系统会自动发出commit命令,使未提交的DML命令提交。
Table 14.8 Online DDL Support for Index Operations
OperationIn PlaceRebuilds TablePermits Concurrent DMLOnly Modifies Metadata
Creating or adding a secondary index
Yes
No
Yes
No
Dropping an index
Yes
No
Yes
Yes
Adding aFULLTEXTindex
Yes*
No*
No
No
Table 14.9 Online DDL Support for Primary Key Operations
OperationIn PlaceRebuilds TablePermits Concurrent DMLOnly Modifies Metadata
Adding a primary key
Yes*
Yes*
Yes
No
Dropping a primary key
No
Yes
No
No
Dropping a primary key and adding another
Yes
Yes
Yes
No
Table 14.10 Online DDL Support for Column Operations
OperationIn PlaceRebuilds TablePermits Concurrent DMLOnly Modifies Metadata
Adding a column
Yes
Yes
Yes*
No
Dropping a column
Yes
Yes
Yes
No
Renaming a column
Yes
No
Yes*
Yes
Reordering columns
Yes
Yes
Yes
No
Setting a column default value
Yes
No
Yes
Yes
Changing the column data type
No
Yes
No
No
Dropping the column default value
Yes
No
Yes
Yes
Changing the auto-increment value
Yes
No
Yes
No*
Making a columnNULL
Yes
Yes*
Yes
No
Making a columnNOT NULL
Yes*
Yes*
Yes
No
Table 14.11 Online DDL Support for Foreign Key Operations
OperationIn PlaceRebuilds TablePermits Concurrent DMLOnly Modifies Metadata
Adding a foreign key constraint
Yes*
No
Yes
Yes
Dropping a foreign key constraint
Yes
No
Yes
Yes
Table 14.12 Online DDL Support for Table Operations
OperationIn PlaceRebuilds TablePermits Concurrent DMLOnly Modifies Metadata
Changing theROW_FORMAT
Yes
Yes
Yes
No
Changing theKEY_BLOCK_SIZE
Yes
Yes
Yes
No
Setting persistent table statistics
Yes
No
Yes
Yes
Specifying a character set
Yes*
Yes*
No
No
Converting a character set
No
Yes
No
No
Optimizing a table
Yes*
Yes
Yes
No
Rebuilding with theFORCEoption
Yes*
Yes
Yes
No
Performing a null rebuild
Yes*
Yes
Yes
No