select * from dba_indexes/dba_ind_columns/dbs_ind_expressions/v$object_usage;
########## 数据完整性的管理(Maintaining data integrity) ##########
alter table table_name drop constraint constraint_name;----drop 约束
alter table table_name add constraint constraint_name primary key(column_name1,column_name2);-----创建主键
alter table table_name add constraint constraint_name unique(column_name1,column_name2);---创建唯一约束
/*创建外键约束*/
alter table table_name add constraint constraint_name foreign key(column_name1) references table_name(column_name1);
/*不效验老数据,只约束新的数据[enable/disable:约束/不约束新数据;novalidate/validate:不对/对老数据进行验证]*/
alter table table_name add constraint constraint_name check(column_name like ’B%’) enable/disable novalidate/validate;
/*修改约束条件,延时验证,commit时验证*/
alter table table_name modify constraint constraint_name initially deferred;
/*修改约束条件,立即验证*/
alter table table_name modify constraint constraint_name initially immediate;
alter session set constraints=deferred/immediate;
/*drop一个有外键的主键表,带cascade constraints参数级联删除*/
drop table table_name cascade constraints;
/*当truncate外键表时,先将外键设为无效,再truncate;*/
truncate table table_name;
文章来源于领测软件测试网 https://www.ltesting.net/