ORA-01031: 权限不足

上一篇 / 下一篇  2007-01-23 16:47:15

查看( 571 ) / 评论( 12 )
SQL> create index index_big_table on big_table(case temporary when 'N' then 'N' end);

create index index_big_table on big_table(case temporary when 'N' then 'N' end)

ORA-01031: 权限不足

SQL>

表属于当前用户,有create any index权限

TAG:

cjf107发布于2007-01-23 16:53:41
create index index_big_table on big_table( temporary );

这样能成功吗?
jlandzpa的个人空间 jlandzpa 发布于2007-01-23 16:57:28
有这种语法么?
warace发布于2007-01-23 16:58:53
索引还能这样啊,神了
frogprince-erp发布于2007-01-23 16:59:14
Re: ORA-01031: 权限不足

QUOTE:

最初由 liangf215 发布
[B]SQL> create index index_big_table on big_table(case temporary when 'N' then 'N' end);

create index index_big_table on big_table(case temporary when 'N' then 'N' end)

ORA-01031: 权限不足

SQL>

表属于当前用户,有create any index权限 [/B]
没有这莫建过,不知道行不行,看来又有东西学习了
liangf215的个人空间 liangf215 发布于2007-01-23 17:10:30

QUOTE:

最初由 cjf107 发布
[B]create index index_big_table on big_table( temporary );

这样能成功吗? [/B]
这样可以。

TOM的《...9i&10g编程艺术.》里的
liangf215的个人空间 liangf215 发布于2007-01-23 17:12:44
只对部分行建索引
cyr1974发布于2007-01-23 17:55:47
SQL*Plus: Release 10.2.0.1.0 - Production on 星期二 1月 23 18:10:33 2007

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options

SQL>  create table t ( x int );

表已创建。

SQL>  create index t_idx on
  2   t( case when x = 42 then 1 end );

索引已创建。

SQL>  set autotrace traceonly explain
SQL>  select /*+ index( t t_idx ) */ *
  2     from t
  3    where (case when x = 42 then 1 end ) = 1;

执行计划
----------------------------------------------------------
Plan hash value: 470836197

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

| Id  | Operation                   | Name  | Rows  | Bytes | Cost (%CPU)| Time
    |

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

|   0 | SELECT STATEMENT            |       |     1 |    13 |     1   (0)| 00:00
:01 |

|   1 |  TABLE ACCESS BY INDEX ROWID| T     |     1 |    13 |     1   (0)| 00:00
:01 |

|*  2 |   INDEX RANGE SCAN          | T_IDX |     1 |       |     1   (0)| 00:00
:01 |

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


Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(CASE "X" WHEN 42 THEN 1 END =1)

Note
-----
   - dynamic sampling used for this statement

SQL> set autotrace off
SQL>  select column_expression
  2     from user_ind_expressions
  3    where index_name = 'T_IDX';

COLUMN_EXPRESSION
--------------------------------------------------------------------------------
CASE "X" WHEN 42 THEN 1 END

SQL>  set autotrace traceonly explain
SQL>  select /*+ index( t t_idx ) */ *
  2     from t
  3    where (case when x = 42 then 1 end ) = 1;

执行计划
----------------------------------------------------------
Plan hash value: 470836197

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

| Id  | Operation                   | Name  | Rows  | Bytes | Cost (%CPU)| Time
    |

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

|   0 | SELECT STATEMENT            |       |     1 |    13 |     1   (0)| 00:00
:01 |

|   1 |  TABLE ACCESS BY INDEX ROWID| T     |     1 |    13 |     1   (0)| 00:00
:01 |

|*  2 |   INDEX RANGE SCAN          | T_IDX |     1 |       |     1   (0)| 00:00
:01 |

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


Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access(CASE "X" WHEN 42 THEN 1 END =1)

Note
-----
   - dynamic sampling used for this statement

SQL>
liangf215的个人空间 liangf215 发布于2007-01-23 18:02:50
书上的原代码哦
cyr1974发布于2007-01-23 18:11:41
楼主对该书研究很透彻  你使用哪个版本?
liangf215的个人空间 liangf215 发布于2007-01-23 19:44:21
9.2
cjf107发布于2007-01-24 11:37:04
grant query rewrite to your_user;

请问这样处理后可以了吗?
hanjs发布于2007-01-28 14:18:31
关注!
我来说两句

(可选)

日历

« 2008-09-07  
 123456
78910111213
14151617181920
21222324252627
282930    

我的存档

数据统计

  • 访问量: 190
  • 日志数: 21
  • 建立时间: 2008-03-31
  • 更新时间: 2008-03-31

RSS订阅

Open Toolbar