oracle date 去掉斜线,[20180329]删除带斜线的索引.txt

[20180329]删除带斜线的索引.txt

--//上午看链接:http://www.itpub.net/thread-2100824-1-1.html

--//开始没仔细看,实际上已经恢复了,索引名带斜线,看看如何删除.

1.环境:

SCOTT@book> @ &r/ver1

PORT_STRING                    VERSION        BANNER

------------------------------ -------------- --------------------------------------------------------------------------------

x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

create table t (id number,pad varchar2(200));

alter table t pctfree 0;

create unique index pk_t on t(id);

alter table t add constraint pk_t primary key (id) enable validate;

insert into t(id)   select rownum from dual connect by level<=734;

commit ;

drop table t;

flashback table  t;

SCOTT@book> flashback table  t to before drop ;

Flashback complete.

SCOTT@book> select index_name,table_name from user_ind_columns;

INDEX_NAME                     TABLE_NAME

------------------------------ ----------

BIN$aINvQyb0cR3gU05kqMD44Q/=$0 T

PK_DEPT                        DEPT

PK_EMP                         EMP

SCOTT@book> alter index "SCOTT"."BIN$aIkFIu0geuTgU05kqMDjWw==$0" rename to "BIN/A";

Index altered.

--//这样建立一个带斜线的索引.看看如何删除.

2.测试:

SCOTT@book> drop index 'BIN/A';

drop index 'BIN/A'

*

ERROR at line 1:

ORA-00953: missing or invalid index name

SCOTT@book> drop index "BIN/A";

drop index "BIN/A"

*

ERROR at line 1:

ORA-02429: cannot drop index used for enforcement of unique/primary key

--//注意看提示,这样已经正确了.但是因为建立的索引是主键.必须取消约束.

SCOTT@book> ALTER TABLE T MODIFY CONSTRAINT "BIN$aIkFIu0feuTgU05kqMDjWw==$0" DISABLE KEEP INDEX;

Table altered.

SCOTT@book> drop index "BIN/A";

Index dropped.

--//索引删除.使用双引号就ok了.实际上使用单引号是错误的.

SCOTT@book> create unique index pk_t on t(id);

Index created.

SCOTT@book> drop index 'PK_T';

drop index 'PK_T'

*

ERROR at line 1:

ORA-00953: missing or invalid index name

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值