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

简介: [20180329]删除带斜线的索引.txt --//上午看链接:http://www.itpub.net/thread-2100824-1-1.html --//开始没仔细看,实际上已经恢复了,索引名带斜线,看看如何删除.

[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

目录
相关文章
excel删除空格之后的字符
excel删除空格之后的字符
|
Java Maven
快速删除所有以.lastUpdate结尾的文件
快速删除所有以.lastUpdate结尾的文件
1162 0
|
Perl
Sed 删除包含某些字符串的行
sed -i '/关键字符/d' 文件名
1684 0
将文件a.txt的字符串前加上序号“1:”、“2:”、…。
将文件a.txt的字符串前加上序号“1:”、“2:”、…。
127 0
|
SQL 测试技术 索引
[20180509]函数索引问题.txt
[20180509]函数索引问题.txt https://jonathanlewis.wordpress.com/2018/05/07/fbis-dont-exist/ --//重复测试: 1.
1095 0
|
关系型数据库 Linux 索引
[20180212]函数索引问题.txt
[20180212]函数索引问题.txt --//11g下,如果函数索引,字段出现重复,出现ORA-54015: Duplicate column expression was specified.
981 0
|
Oracle 关系型数据库 数据库管理
[20170209]索引范围访问2.txt
[20170209]索引范围访问2.txt --ITPUB网友问的问题: http://www.itpub.net/thread-2083504-1-1.html --索引范围扫描是如何访问数据块的? 1 FOR  (根节点-> 分支节点->叶节点->...
687 0
|
SQL Oracle 关系型数据库
[20150803]使用函数索引注意的问题.txt
[20150803]使用函数索引注意的问题.txt --昨天在10g下优化时遇到一个奇怪的问题,做一个记录: --首先说明一下,最近一段时间在做一个项目的优化,这个项目实际上ETL项目: http://baike.
842 0
|
Oracle 关系型数据库 Linux
[20150508]列顺序问题.txt
[20150508]列顺序问题.txt --链接: https://viveklsharma.wordpress.com/2015/04/30/cpu-cycles-for-column-skipping/ --测试列顺序对CPU cost的影响: S...
686 0

热门文章

最新文章