Set Session Skip_Unusable_Indexes=True [message #131145] |
Thu, 04 August 2005 11:04 |
felipevinturini
Messages: 10 Registered: August 2005 Location: Brazil
|
Junior Member |
|
|
Hi All,
I would like to know if there is a way to set Skip_Unusable_Indexes=True for all sessions.
I would like to know if I can set this as default to all sessions. Is it possible?
Thanks.
|
|
|
Re: Set Session Skip_Unusable_Indexes=True [message #131151 is a reply to message #131145] |
Thu, 04 August 2005 11:48 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
in 10g, it is an instance level parameter.!
in lower versions,
1. if there are not may clients from which users connect to database, the set it in glogin.sql at every client.
or
2. create an after logon trigger.
use sys_context('userenv','session_user') = 'SCOTT' -- to identify scott as user whose session needs to be modified.
alter the session.
update:
Option 1 would be stupid!.
if it is set in glogin.sql, it will be affective for any user using the client against any database (identified by tnsnames.ora).
And Option2 is not working either!.
[Updated on: Thu, 04 August 2005 12:11] Report message to a moderator
|
|
|
Re: Set Session Skip_Unusable_Indexes=True [message #131158 is a reply to message #131145] |
Thu, 04 August 2005 12:34 |
|
Mahesh Rajendran
Messages: 10708 Registered: March 2002 Location: oracleDocoVille
|
Senior Member Account Moderator |
|
|
seems logon trigger is working!.
1 Create or replace trigger alt_session
2 after logon on database
3 begin
4 if sys_context('userenv','session_user') ='SCOTT' Then
5 execute immediate 'alter session set SKIP_UNUSABLE_INDEXES = TRUE' ;
6 end if;
7* end;
8 /
Trigger created.
oracle@mutation#sqlplus scott/tiger
SQL*Plus: Release 9.2.0.4.0 - Production on Thu Aug 4 13:28:15 2005
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 9.2.0.4.0 - 64bit Production
With the Partitioning option
JServer Release 9.2.0.4.0 - Production
scott@9i > create index myindex on emp(empno);
Index created.
scott@9i > alter table emp move tablespace users;
Table altered.
scott@9i > select index_name,status from user_indexes;
INDEX_NAME STATUS
------------------------------ --------
MYINDEX UNUSABLE
scott@9i > insert into emp (select * from emp);
14 rows created.
scott@9i > commit;
Commit complete.
scott@9i > alter session set skip_unusable_indexes=false;
Session altered.
scott@9i > insert into emp (select * from emp);
insert into emp (select * from emp)
*
ERROR at line 1:
ORA-01502: index 'SCOTT.MYINDEX' or partition of such index is in unusable state
|
|
|