在什么情况下建表能自动生成(唯一)索引ORACLE数据库中?
创建表并定义主键将自动创建唯一索引。(因为主键=notnullunique)
例如
SQL>createtabletestuuuCreateuu1(
2idint,
3Valvarchar(10),
4primarykey(id)
5)
tablecreated。
或者,在创建表时,为指定字段定义唯一约束。Unique
然后数据库会自动为这个字段创建一个唯一的索引。
如何在Oracle数据库中按用户名重建索引?
使用rebuild语句
alterindexindexuuNameREBUILDTERindexindexuNamerebuildonline
您还可以删除索引并重新生成它
删除索引indexindexuName在表名称(列名称)上创建索引indexindexuName