Unix Technical Forum

Privileges for creating indexes depends on type of index?

This is a discussion on Privileges for creating indexes depends on type of index? within the Oracle Miscellaneous forums, part of the Oracle Database category; --> Hello all, I have a special kind of index (selective uniqueness index, as described in Tom Kyte's book Effective ...


Go Back   Unix Technical Forum > Database Server Software > Oracle Database > Oracle Miscellaneous

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-08-2008, 01:03 PM
dean
 
Posts: n/a
Default Privileges for creating indexes depends on type of index?

Hello all,

I have a special kind of index (selective uniqueness index, as
described in Tom Kyte's book Effective Oracle by Design). The index is
great, but I seem to need additional privileges compared to simpler
indexes.

create table T (IS_ACTIVE varchar2(1), F1 varchar2(1), F2 varchar(1));

Table created.

create unique index MY_INDEX1 on T ( F1 );

Index created.

create unique index MY_INDEX2
on T ( case when IS_ACTIVE = 'N' then F1 end,
case when IS_ACTIVE = 'N' then F2 end);



case when IS_ACTIVE = 'N' then F2 end)
*
ERROR at line 3:
ORA-01031: insufficient privileges



Anyone know what the specific privilege could be?
I have the following granted to this user:

create any index
create any procedure
create any view
create any snapshot
create table
unlimited tablespace
alter any table

plus the roles CONNECT and RESOURCE

Thanks for any help.
Dean

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-08-2008, 01:03 PM
dean
 
Posts: n/a
Default Re: Privileges for creating indexes depends on type of index?

ps Make that Oracle 9.2i on Windows.

-Dean

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-08-2008, 01:03 PM
sybrandb
 
Posts: n/a
Default Re: Privileges for creating indexes depends on type of index?

On Jun 18, 4:01 pm, dean <deanbrow...@yahoo.com> wrote:
> Hello all,
>
> I have a special kind of index (selective uniqueness index, as
> described in Tom Kyte's book Effective Oracle by Design). The index is
> great, but I seem to need additional privileges compared to simpler
> indexes.
>
> create table T (IS_ACTIVE varchar2(1), F1 varchar2(1), F2 varchar(1));
>
> Table created.
>
> create unique index MY_INDEX1 on T ( F1 );
>
> Index created.
>
> create unique index MY_INDEX2
> on T ( case when IS_ACTIVE = 'N' then F1 end,
> case when IS_ACTIVE = 'N' then F2 end);
>
> case when IS_ACTIVE = 'N' then F2 end)
> *
> ERROR at line 3:
> ORA-01031: insufficient privileges
>
> Anyone know what the specific privilege could be?
> I have the following granted to this user:
>
> create any index
> create any procedure
> create any view
> create any snapshot
> create table
> unlimited tablespace
> alter any table
>
> plus the roles CONNECT and RESOURCE
>
> Thanks for any help.
> Dean


The usual and desirable route for questions like this is to go to
http://tahiti.oracle.com, find the SQL-reference manual, search for
CREATE INDEX in the Contents page, go to that entry and search for
'function-based index' on that page.
By doing so, I found the answer to your question in less than 1
minute.

I quote

To create a function-based index in your own schema on your own table,
in addition to the prerequisites for creating a conventional index,
you must have the QUERY REWRITE system privilege. To create the index
in another schema or on another schema's table, you must have the
GLOBAL QUERY REWRITE privilege. In both cases, the table owner must
also have the EXECUTE object privilege on the function(s) used in the
function-based index. In addition, in order for Oracle to use function-
based indexes in queries, the QUERY_REWRITE_ENABLED parameter must be
set to TRUE, and the QUERY_REWRITE_INTEGRITY parameter must be set to
TRUSTED.

Could you please explain why you think it is faster to post to an
Usenet forum instead of being only a *little* bit more industrious.
You would have learned something on your own! Don't you like that? Or
do you like to depend on this forum, or better still: to parasite on
it, making it do *your* work?

--
Sybrand Bakker
Senior Oracle DBA


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-08-2008, 01:03 PM
dean
 
Posts: n/a
Default Re: Privileges for creating indexes depends on type of index?

On Jun 18, 10:45 am, sybrandb <sybra...@gmail.com> wrote:
> On Jun 18, 4:01 pm, dean <deanbrow...@yahoo.com> wrote:
>
>
>
>
>
> > Hello all,

>
> > I have a special kind of index (selective uniqueness index, as
> > described in Tom Kyte's book Effective Oracle by Design). The index is
> > great, but I seem to need additional privileges compared to simpler
> > indexes.

>
> > create table T (IS_ACTIVE varchar2(1), F1 varchar2(1), F2 varchar(1));

>
> > Table created.

>
> > create unique index MY_INDEX1 on T ( F1 );

>
> > Index created.

>
> > create unique index MY_INDEX2
> > on T ( case when IS_ACTIVE = 'N' then F1 end,
> > case when IS_ACTIVE = 'N' then F2 end);

>
> > case when IS_ACTIVE = 'N' then F2 end)
> > *
> > ERROR at line 3:
> > ORA-01031: insufficient privileges

>
> > Anyone know what the specific privilege could be?
> > I have the following granted to this user:

>
> > create any index
> > create any procedure
> > create any view
> > create any snapshot
> > create table
> > unlimited tablespace
> > alter any table

>
> > plus the roles CONNECT and RESOURCE

>
> > Thanks for any help.
> > Dean

>
> The usual and desirable route for questions like this is to go tohttp://tahiti.oracle.com, find the SQL-reference manual, search for
> CREATE INDEX in the Contents page, go to that entry and search for
> 'function-based index' on that page.
> By doing so, I found the answer to your question in less than 1
> minute.
>
> I quote
>
> To create a function-based index in your own schema on your own table,
> in addition to the prerequisites for creating a conventional index,
> you must have the QUERY REWRITE system privilege. To create the index
> in another schema or on another schema's table, you must have the
> GLOBAL QUERY REWRITE privilege. In both cases, the table owner must
> also have the EXECUTE object privilege on the function(s) used in the
> function-based index. In addition, in order for Oracle to use function-
> based indexes in queries, the QUERY_REWRITE_ENABLED parameter must be
> set to TRUE, and the QUERY_REWRITE_INTEGRITY parameter must be set to
> TRUSTED.
>
> Could you please explain why you think it is faster to post to an
> Usenet forum instead of being only a *little* bit more industrious.
> You would have learned something on your own! Don't you like that? Or
> do you like to depend on this forum, or better still: to parasite on
> it, making it do *your* work?
>
> --
> Sybrand Bakker
> Senior Oracle DBA- Hide quoted text -
>
> - Show quoted text -


Thanks for the reply! I didn't know it was a function based index,
sorry.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 08:22 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0
www.UnixAdminTalk.com