SKIP_UNUSABLE_INDEXES Initialization
From : metalink[@more@]
Information in this document applies to any platform.
Setting this parameter to TRUE disables error reporting of indexes and index partitions marked UNUSABLE.
The SKIP_UNUSABLE_INDEXES, which in earlier releases was a session parameter,is now an initialization parameter with a default value of TRUE.
In earlier releases default value of this parameter is false.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production
SQL> connect scott/tiger
SQL> create table EMP_RANGE(
2 EMPNO NUMBER(4) NOT NULL,
3 ENAME VARCHAR2(10),
4 SAL NUMBER(7,2)
5 )
6 partition by range (empno)
7 (
8 partition P1 values less than (10),
9 partition P2 values less than (20),
10 partition P3 values less than (30),
11 partition P4 values less than (MAXVALUE));
Table created.
SQL> create index indx_emp on emp_range (empno);
SQL> begin
2 for x in 1..100
3 loop
4 insert into emp_range values (x,'dsadas',x*12);
5 end loop;
6 end;
7 /
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
SQL> alter table emp_range truncate partition p2;
Table truncated.
SQL> select index_name,status from user_indexes where table_name='EMP_RANGE';
INDEX_NAME STATUS
------------------------------ --------
INDX_EMP UNUSABLE
SQL> select * from emp_range where empno=45;
select * from emp_range where empno=45
*
ERROR at line 1:
ORA-01502: index 'SCOTT.INDX_EMP' or partition of such index is in unusable
state
SQL> alter session set skip_unusable_indexes=true;
Session altered.
SQL> select * from emp_range where empno=45;
EMPNO ENAME SAL
---------- ---------- ----------
45 dsadas 540
The error doesn't occur in Oracle Database 10g when executing the same query if the index is marked UNUSABLE because default value of SKIP_UNUSABLE_INDEXES is true
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Prod
PL/SQL Release 10.1.0.2.0 - Production
CORE 10.1.0.2.0 Production
TNS for 32-bit Windows: Version 10.1.0.2.0 - Production
NLSRTL Version 10.1.0.2.0 - Production
SQL> connect scott/tiger
/* create table,index as mentioned in previous steps */
SQL> select index_name,status from user_indexes where table_name='EMP_RANGE';
INDEX_NAME STATUS
-------------------- --------
INDX_EMP UNUSABLE
SQL> set autotrace on explain
/* Optimizer chooses FULL TABLE SCAN */
SQL> select * from emp_range where empno=45;
EMPNO ENAME SAL
-------- ---------- ----------
45 dsadas 540
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=1 Bytes=33)
1 0 PARTITION RANGE (SINGLE) (Cost=3 Card=1 Bytes=33)
2 1 TABLE ACCESS (FULL) OF 'EMP_RANGE' (TABLE) (Cost=3 Card=
1 Bytes=33)
Subject: | SKIP_UNUSABLE_INDEXES Initialization Parameter in Oracle Database 10g | |||
Doc ID: | Note:281500.1 | Type: | HOWTO | |
Last Revision Date: | 05-MAR-2008 | Status: | PUBLISHED |
In this Document
Goal
Solution
References
Applies to:
Oracle Server - Enterprise Edition - Version:Information in this document applies to any platform.
Goal
This article discusses about the initialization parameter SKIP_UNUSABLE_INDEXES in Oracle Database 10gSetting this parameter to TRUE disables error reporting of indexes and index partitions marked UNUSABLE.
The SKIP_UNUSABLE_INDEXES, which in earlier releases was a session parameter,is now an initialization parameter with a default value of TRUE.
In earlier releases default value of this parameter is false.
Solution
Following are the steps to check the same.SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
PL/SQL Release 9.2.0.1.0 - Production
CORE 9.2.0.1.0 Production
TNS for 32-bit Windows: Version 9.2.0.1.0 - Production
NLSRTL Version 9.2.0.1.0 - Production
SQL> connect scott/tiger
SQL> create table EMP_RANGE(
2 EMPNO NUMBER(4) NOT NULL,
3 ENAME VARCHAR2(10),
4 SAL NUMBER(7,2)
5 )
6 partition by range (empno)
7 (
8 partition P1 values less than (10),
9 partition P2 values less than (20),
10 partition P3 values less than (30),
11 partition P4 values less than (MAXVALUE));
Table created.
SQL> create index indx_emp on emp_range (empno);
SQL> begin
2 for x in 1..100
3 loop
4 insert into emp_range values (x,'dsadas',x*12);
5 end loop;
6 end;
7 /
PL/SQL procedure successfully completed.
SQL> commit;
Commit complete.
SQL> alter table emp_range truncate partition p2;
Table truncated.
SQL> select index_name,status from user_indexes where table_name='EMP_RANGE';
INDEX_NAME STATUS
------------------------------ --------
INDX_EMP UNUSABLE
SQL> select * from emp_range where empno=45;
select * from emp_range where empno=45
*
ERROR at line 1:
ORA-01502: index 'SCOTT.INDX_EMP' or partition of such index is in unusable
state
SQL> alter session set skip_unusable_indexes=true;
Session altered.
SQL> select * from emp_range where empno=45;
EMPNO ENAME SAL
---------- ---------- ----------
45 dsadas 540
The error doesn't occur in Oracle Database 10g when executing the same query if the index is marked UNUSABLE because default value of SKIP_UNUSABLE_INDEXES is true
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Prod
PL/SQL Release 10.1.0.2.0 - Production
CORE 10.1.0.2.0 Production
TNS for 32-bit Windows: Version 10.1.0.2.0 - Production
NLSRTL Version 10.1.0.2.0 - Production
SQL> connect scott/tiger
/* create table,index as mentioned in previous steps */
SQL> select index_name,status from user_indexes where table_name='EMP_RANGE';
INDEX_NAME STATUS
-------------------- --------
INDX_EMP UNUSABLE
SQL> set autotrace on explain
/* Optimizer chooses FULL TABLE SCAN */
SQL> select * from emp_range where empno=45;
EMPNO ENAME SAL
-------- ---------- ----------
45 dsadas 540
Execution Plan
----------------------------------------------------------
0 SELECT STATEMENT Optimizer=ALL_ROWS (Cost=3 Card=1 Bytes=33)
1 0 PARTITION RANGE (SINGLE) (Cost=3 Card=1 Bytes=33)
2 1 TABLE ACCESS (FULL) OF 'EMP_RANGE' (TABLE) (Cost=3 Card=
1 Bytes=33)
References
Oracle Database Administrator's Guide 10g Release 1 (10.1)Keywords
10G; SKIP_UNUSABLE_INDEXES;來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/66634/viewspace-1013030/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- skip_unusable_indexesIndex
- Initialization
- list initialization
- The SPFILE Initialization Parameter
- 初始化 (Initialization)
- 引數SKIP_UNUSABLE_INDEXES的一點測試!Index
- Special Characters in Initialization Parameter Files
- OPTIMIZER_MODE Initialization Parameter
- Understanding Initialization Parameters (85)
- Other SGA Initialization Parameters (96)
- SKIP_UNUSABLE_INDEXES的使用與索引失效解決方法Index索引
- [VRDevice] Initialization of device oculus failed.VRdevAI
- Rules Governing Initialization Parameter FilesGo
- DB_NAME Initialization Parameter (87)
- DB_DOMAIN Initialization Parameter (88)AI
- The SGA_TARGET Initialization Parameter (74)
- 10g新增初始化引數SKIP_UNUSABLE_INDEXESIndex
- Talking about Android Initialization ProcessAndroid
- Initialization Parameter Files and Server Parameter Files (287)Server
- Step 3: Create the Initialization Parameter File (61)
- DB_BLOCK_SIZE Initialization Parameter (92)BloC
- The SGA_MAX_SIZE Initialization Parameter (72)
- Entity Framework Code-First(6):Database InitializationFrameworkDatabase
- UNDO_MANAGEMENT Initialization Parameter (118)
- WPF initialization for opening and unitialization for closing process
- Initialization of bean failed; nested exception is java.lang.StackOverflowErrorBeanAIExceptionJavaError
- Entity Framework Code-First(17):Database Initialization StrategyFrameworkDatabase
- Powercenter8.1.1之啟動Service initialization failedAI
- RMAN-00554: initialization of internal recovery manager package failedPackageAI
- Setting the Buffer Cache Initialization Parameters (108)
- DB_CACHE_SIZE Initialization Parameter (109)
- Swift中Initialization的一些個人總結Swift
- device eth0 does not seem to be present, delaying initializationdev
- failure in css initialization opening OCR 問題處理AICSS
- The DB_nK_CACHE_SIZE Initialization Parameters (110)
- Initialization Parameter Changes from 9i to 10g
- 給你的專案啟動提提速:Lazy Initialization
- Double-check idiom for lazy initialization of instance fields