oracle删除主键,删除索引

主键

--查询主键
SELECT * from user_cons_columns c where c.table_name = '表名';

--删除主键
alter table 表名 drop constraint 主键名;

--新增主键
alter table 表名 add constraint 主键名 primary key(字段名);

索引

--删除普通索引
drop index 索引名字;

--创建普通索引
create index 索引名 on 表名(索引对应的列名);

--创建组合索引
create index 索引名 on 表名(列名1,列名2);

--创建主键索引
alter table 表名 add constraint 表名 add constraint 索引名 primary key (主键);

--删除主键索引
alter table 表名 drop constraint 索引名;

--查询索引
select * from user_ind_columns where index_name='索引名';
select * from user_indexes where table_name='表名';

原文地址:https://www.cnblogs.com/xh_Blog/p/15266946.html