Wednesday, December 22, 2010

What makes Exadata different from regular RAC?:

What makes Exadata different from regular RAC?
We recently migrated 6 of our 10+ TB production databases to Exadata server.

1. Smart scan:

To disable smart scan set cell_offload_processing=FALSE (default TRUE) for that database.

List of cell DB parameters:
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offload_compaction string ADAPTIVE
cell_offload_decryption boolean TRUE
cell_offload_parameters string
cell_offload_plan_display string AUTO
cell_offload_processing boolean TRUE
cell_partition_large_extents string DEFAULT

2. Flash cache:

- Frequently accessed data and index are automatically cached.
- control file read and write are cached.
- File header read and writes are cached.
- DBA's can pin objects in flash cache.

- table scan data is not cached.
- backup data is not cached.
- DB pump data is not cached.
- data file formating data is not cached.
- IO to mirror copy is not cached.

- DBA can cache an object by setting CELL_FLASH_CACHE setting to KEEP. The default value of this setting is DEFAULT.

3. Exadata Hybrid Columnar Compression:

EHCC is not pure columnar, it is hybrid columnar

Multiple Levels of compression
- Query Low
- Query High
- Archive Low
- Archive High

Algorithms:
LZO: Faster compression speeds, but lower ratios (Query Low)
ZLIB: Decent speeds and good ratios (Query High and Archive Low)
BZ2: Slow, but the highest ratios (Archive High)

4. Exadata storage index:

Transparent I/O Elimination with No Overhead.

- Exadata storage indexes maintain summary information about table data in memory.
* Store MIN and MAX values of columns.
* Typically one index entry for every MB of disk.
- Eliminates disk I/O if MIN and MAX can never match "WHERE" clause of a query.

5. DBFS (database file system) - Rest of the 10 SYSTEMDB disks can be used as DBFS.

6. IORM (I/O resource manager - Exadata specific)


Monitoring Exadata:

- Install GC agent on each compute node.
- No GC agent on cell nodes.
- Agent on one compute node talks with all cell nodes and collects data.
- Grid control plugin is installed in OMS.

Tuesday, June 22, 2010

Oracle masala at work - 3:

Oracle masala at work - 3:

1. Restore and recovery made easy with RMAN Data Recovery Advisor in Oracle 11g:
2. Restart Data Pump job after an error:
3. NFS mount options on Linux(RHEL) for expdp and impdp:
4. Useful Underutilized some Oracle Utilities:


1. Restore and recovery made easy with RMAN Data Recovery Advisor in Oracle 11g:

rman target /

-- If there is an error, this command will come back with the files to recover.
list failure;

-- This command will show you the exact cause of the error. 169 is failure ID from the "list failure;" command.
list failure 169 detail;

-- It responds with a detailed explanation of the error and how to correct it.
advise failure;

-- It responds with a detailed fix preview.
repair failure preview;

-- This command will fix the failure.
repair failure;

-- The following RMAN command recovers all corrupted blocks.
recover corruption list;


2. Restart Data Pump job after an error:

-- In order to find the System assigned name for the EXPDP/IMPDP job you can run the following query.
SELECT * FROM DBA_DATAPUMP_JOBS;

-- Attach the job from the above SQL.
$ impdp system/manager attach=job_name

-- Restart the job.
Import> start_job

-- Check the status of the job.
Import> status


3. NFS mount options on Linux(RHEL) for expdp and impdp:

mount options:
atlt200:/oracle_scratch on /oracle_scratchnfs type nfs (rw,rsize=32768,wsize=32768,hard,nointr,bg,nfsvers=3,tcp,actimeo=0,timeo=600,addr=xx.xx.xxx.xx)

uname -a: Linux atlt200 2.6.9-78.ELsmp #1 SMP Wed Jul 9 15:46:26 EDT 2008 x86_64 x86_64 x86_64 GNU/Linux
Server: Dell 2950


4. Useful Underutilized some Oracle Utilities:

bbed (Block Browser and Editor, Password is "blockedit")
oradebug
nid (Rename DBID and Database Name)
adrci (11g)
trcsess (trcsess utility allows trace information from multiple trace files to be identified and consolidated into a single trace file from 10g)
trace Analyzer (trcanlzr.sql - Trace Analyzer utility is available via download on the Oracle Metalink web site)
trcasst (Analyxing Listener Trace file)
deinstall (11gR2 - Deinstall Failed GRID or Oracle home’s - File is under $ORACLE_HOME/deinstall directory)
csscan (Character Set Migration Utility - $ csscan \"sys/keepsaf3 as sysdba\" FULL=Y, to create character set migration utility schema, run @?/rdbms/admincsminst.sql)
wrap (hide the PL/SQL code)
cemutlo (cemutlo -n gives the cluster name)

renamedg (11gR2 ASM - Rename the ASM diskgroup)
kfed (ASM - display the diskgroup information)


Tools:
CHM (formerly know as IPD/OS) - Oracle Cluster Health Monitor.
ORION - Oracle I/O Calibration Tool - Load test tool.

Renaming ASM Disk group in Oracle 11gR2:

Renaming ASM Disk group in Oracle 11gR2:


The renamedg utility is new in Oracle 11gR2 and it's documented in the storage administrator’s guide.
You can use this tool to rename ASM diskgroups. The prerequisite is to unmount the disk group on all cluster nodes.
The tool works in 2 phases, in the first phase it generates a configuration file and in the second phase it discovers the disks and rename the disk group.



How to use renamedg command to rename the ASM diskgroup?

The following example demonstrates how to rename the ASM diskgroup from A_DATA to B_DATA.


a. Setup the environment:

$ . oraenv
+ASM1

$ export PATH=$PATH:/dev/oracleasm/disks
$ echo $PATH


b. Dismount the ASM diskgroup to be renamed on all cluster nodes:

$ asmcmd umount A_DATA -- on all nodes.


c. Verify the diskgroup was dismounted:

$ crsctl status resource ora.A_DATA.dg

NAME=ora.A_DATA.dg
TYPE=ora.diskgroup.type
TARGET=OFFLINE, OFFLINE
STATE=OFFLINE, OFFLINE


d. Using renamedg utility to rename the diskgroup:

$ renamedg phase=both dgname=A_DATA newdgname=B_DATA verbose=true


Output:
----***********----
Parsing parameters..

Parameters in effect:

Old DG name : A_DATA
New DG name : B_DATA
Phases :
Phase 1
Phase 2
Discovery str : (null)
Clean : TRUE
Raw only : TRUE
renamedg operation: phase=both dgname=A_DATA newdgname=B_DATA verbose=true
Executing phase 1
Discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:S_1873_0681 with disk number:0 and timestamp (32937868 1717605376)
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:S_1873_0685 with disk number:1 and timestamp (32937868 1717605376)
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:S_1873_0681 with disk number:0 and timestamp (32937868 1717605376)
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:S_1873_0685 with disk number:1 and timestamp (32937868 1717605376)
Checking if the diskgroup is mounted
Checking disk number:0
Checking disk number:1
Checking if diskgroup is used by CSS
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for ORCL:S_1873_0681
Modifying the header
Looking for ORCL:S_1873_0685
Modifying the header
Completed phase 2
Terminating kgfd context 0x2b06e27d20a0
----***********----


e. Mounting the ASM diskgroup:

$ asmcmd mount B_DATA -- on all nodes.


f. Check if the diskgroup was renamed and mounted successfully:

$ crsctl status resource ora.B_DATA.dg

NAME=ora.B_DATA.dg
TYPE=ora.diskgroup.type
TARGET=ONLINE , ONLINE
STATE=ONLINE on atld380, ONLINE on atld381

Yaaa, diskgroup has been renamed from A_DATA to B_DATA successfully.



Possible error when issuing renamedg command:

Error: "KFNDG-00408: disk (string:string) could not be discovered error"
Solution: Add the ASM disk path to $PATH environment variable "export PATH=$PATH:/dev/oracleasm/disks"


Output:
----***********----
Checking for hearbeat...
Re-discovering the group
Performing discovery with string:
Identified disk ASM:/opt/oracle/extapi/64/asm/orcl/1/libasm.so:ORCL:S_1873_0638 with disk number:0 and timestamp (32937868 354065408)
Checking if the diskgroup is mounted
Checking disk number:0
Checking if diskgroup is used by CSS
Generating configuration file..
Completed phase 1
Executing phase 2
Looking for ORCL:S_1873_0638
ERROR: -9(Error 7217, OS Error ()
)KFNDG-00408: file not found; arguments: [] [ORCL:S_1873_0638]


Terminating kgfd context 0x2b3ddb1d80a0
----***********----



The renamedg command usage:

$ renamedg -help

Parsing parameters..
phase Phase to execute (phase=ONE|TWO|BOTH), default BOTH

dgname Diskgroup to be renamed

newdgname New name for the diskgroup

config intermediate config file

check just check-do not perform actual operation,
(check=TRUE/FALSE), default FALSE

confirm confirm before committing changes to disks,
(confirm=TRUE/FALSE), default FALSE

clean ignore errors (clean=TRUE/FALSE), default TRUE

asm_diskstring ASM Diskstring (asm_diskstring='discoverystring',
'discoverystring1' ...)

verbose verbose execution (verbose=TRUE|FALSE), default
FALSE

keep_voting_files Voting file attribute,
(keep_voting_files=TRUE|FALSE), default FALSE


Q:
a.
Do we need to modify the asm_diskgroups initialization parameter after renaming the disk groups?

No, you don’t have to. The renamedg utility is smart enough to update the asm_diskgroups initialization parameter.


b.
How do I rename the ASM disk group with datafile in it?

After rename the disk group, start the database in MOUNT mode and rename the datafiles using "ALTER DATABASE RENAME FILE . . . TO . . ." command to OPEN the database.


c.
Does it mater how many disks in the disk group?

No, tried with 2 disks DG and also with 8 disks DG.

Saturday, June 5, 2010

Compare and Generate the Object Metadata(Structure) Difference in Oracle 11gR2:

Compare and Generate the Object Metadata(Structure) Difference in Oracle 11gR2:

The DBMS_METADATA_DIFF package provides interfaces to compare and generate database objects structure difference between databases.


SQL> select * from tab;

TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
X TABLE
Y TABLE

SQL> desc x
Name Null? Type
----------------------------------------- -------- -------------
ENO NOT NULL NUMBER(10)
ENAME VARCHAR2(20)
SAL NUMBER(10)

SQL> desc y
Name Null? Type
----------------------------------------- -------- -------------
ENO NUMBER(10)
ENAME VARCHAR2(20)


set heading off;
set echo off;
set pages 999;
set long 90000;

1. Compare the tables in same schema:

SQL> show user
USER is "TEST"
SQL> select dbms_metadata_diff.compare_alter('TABLE','X','Y','TEST','TEST') from dual;

ALTER TABLE "TEST"."X" DROP ("SAL")
ALTER TABLE "TEST"."X" DROP CONSTRAINT "X_PK"
ALTER TABLE "TEST"."X" RENAME TO "Y"


SQL> select dbms_metadata_diff.compare_alter('TABLE','Y','X','TEST','TEST') from dual;

ALTER TABLE "TEST"."Y" ADD ("SAL" NUMBER(10,0))
ALTER TABLE "TEST"."Y" ADD CONSTRAINT "X_PK" PRIMARY KEY ("ENO") USING INDEX P
CTFREE 10 INITRANS 2 STORAGE ( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENT
S 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLA
SH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) ENABLE
ALTER TABLE "TEST"."Y" RENAME TO "X"

SQL>


2. Compare the tables in different schemas in same database:

SQL> show user
USER is "SYSTEM"
SQL> select dbms_metadata_diff.compare_alter('TABLE','Y','X','TEST','TEST2') from dual;

ALTER TABLE "TEST"."Y" ADD ("SAL" NUMBER(10,0))
ALTER TABLE "TEST"."Y" ADD CONSTRAINT "X_PK" PRIMARY KEY ("ENO") USING INDEX P
CTFREE 10 INITRANS 2 STORAGE ( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENT
S 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLA
SH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) ENABLE
ALTER TABLE "TEST"."Y" RENAME TO "X"

SQL>


3. Compare the tables in different databases:
-- Assume we are comparing the object between Test and Stage databases and the database link is created between Stage and Test.
-- Stage DB: SODS
-- Test DB: TODS
-- Database Link from Stage to Test: TODS.WORLD


TODS:
SQL> desc x
Name Null? Type
----------------------------------------- -------- -------------
ENO NOT NULL NUMBER(10)
ENAME VARCHAR2(20)
SAL NUMBER(10)

SODS:
SQL> desc x
Name Null? Type
----------------------------------------- -------- -------------
ENO NUMBER(10)
ENAME VARCHAR2(20)


SQL> show user
USER is "TEST"
SQL> select * from global_name;

GLOBAL_NAME
--------------------------------
SODS.WORLD


SQL> select dbms_metadata_diff.compare_alter('TABLE','X','X','TEST','TEST',NULL,'TODS.WORLD') from dual;

ALTER TABLE "TEST"."Y" ADD ("SAL" NUMBER(10,0))
ALTER TABLE "TEST"."Y" ADD CONSTRAINT "X_PK" PRIMARY KEY ("ENO") USING INDEX P
CTFREE 10 INITRANS 2 STORAGE ( INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENT
S 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT FLA
SH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT) ENABLE
ALTER TABLE "TEST"."Y" RENAME TO "X"

SQL>


Notice: Use of the DBMS_METADATA_DIFF package requires the Oracle Enterprise Manager Change Manager license.

Tuesday, May 25, 2010

Compare and Fix the Object Data in Oracle 11g:

Compare and Fix the Object Data in Oracle 11g:


The DBMS_COMPARISON package provides interfaces to compare and sync database objects at different databases. The index columns in a comparison must uniquely identify every row involved in a comparison.

The following constraints satisfy this requirement:

- A primary key constraint
- A unique constraint on one or more non-NULL columns

If these constraints are not present on a table, then use the index_schema_name and index_name parameters in the CREATE_COMPARISON procedure to specify an index whose columns satisfy this requirement.


Simple Test:
drop table test.x PURGE;
drop table test2.x PURGE;

create table test.x (eno number(10), ename varchar2(20), sal number(10));
create table test2.x (eno number(10), ename varchar2(20), sal number(10));

alter table test.x add constraint x_pk primary key (eno);
alter table test2.x add constraint x_pk primary key (eno);


insert into test.x values (100, 'VJ', 100000);
insert into test.x values (101, 'ASHRAY', 100001);
insert into test.x values (102, 'DUMPA', 200000);
insert into test.x values (103, 'REDDY', 300000);
commit;

insert into test2.x values (100, 'VJ', 100000);
insert into test2.x values (101, 'ASHRAY', 100000);
insert into test2.x values (102, 'DUMPA', 200001);
insert into test2.x values (103, 'REDDY', 300000);
commit;

select * from test.x;
select * from test2.x;


-- Drop the existing comparison:

SELECT comparison_name, schema_name FROM dba_comparison;

BEGIN
dbms_comparison.drop_comparison (comparison_name => 'comp1');
END;
/


-- Create the comparison:
-- dblink_name is NULL because both schemas on the same database.

BEGIN
dbms_comparison.create_comparison (comparison_name => 'comp1',
schema_name => 'test',
object_name => 'x',
dblink_name => NULL,
remote_schema_name => 'test2',
remote_object_name => 'x'
);
END;
/


-- Check the difference "YES/NO":

set serveroutput on size 99999;

DECLARE
CONSISTENT BOOLEAN;
scan_info dbms_comparison.comparison_type;
BEGIN
CONSISTENT :=
dbms_comparison.compare (comparison_name => 'comp1',
scan_info => scan_info,
perform_row_dif => TRUE
);
DBMS_OUTPUT.put_line ('Scan ID: ' || scan_info.scan_id);

IF CONSISTENT = TRUE
THEN
DBMS_OUTPUT.put_line ('No differences were found.');
ELSE
DBMS_OUTPUT.put_line ('Differences were found.');
END IF;
END;
/
Scan ID: 11
Differences were found.

PL/SQL procedure successfully completed.


-- Comparison Summary:
-- Where scan_id is from the above dbms_comparison.compare PL/SQL block.

set linesize 120;
COL schema_name for a20;
COL object_name for a20;
COL comparison_name for a20;

SELECT s.scan_id, c.comparison_name, c.schema_name, c.object_name,
s.current_dif_count
FROM user_comparison c, user_comparison_scan_summary s
WHERE c.comparison_name = s.comparison_name AND s.scan_id = 11;


-- Comparison Details:

set linesize 120;
COL record_value for a50;
COL local_rowid for a12;
COL remote_rowid format a12;

SELECT c.column_name, r.index_value record_value,
CASE
WHEN r.local_rowid IS NULL
THEN 'No'
ELSE 'Yes'
END local_rowid,
CASE
WHEN r.remote_rowid IS NULL
THEN 'No'
ELSE 'Yes'
END remote_rowid
FROM dba_comparison_columns c,
dba_comparison_row_dif r,
dba_comparison_scan s
WHERE c.comparison_name = 'COMP1'
AND r.scan_id = s.scan_id
-- AND s.last_update_time > SYSTIMESTAMP - 1 / 24 / 12 -- Last 5 min.
AND r.status = 'DIF'
AND c.index_column = 'Y'
AND c.comparison_name = r.comparison_name
ORDER BY r.index_value;


-- Fix the difference in the remote table:

DECLARE
scan_info dbms_comparison.comparison_type;
BEGIN
dbms_comparison.converge
(comparison_name => 'comp1',
scan_id => 11,
scan_info => scan_info,
converge_options => dbms_comparison.cmp_converge_local_wins
);
DBMS_OUTPUT.put_line ('Local Rows Merged: ' || scan_info.loc_rows_merged);
DBMS_OUTPUT.put_line ('Remote Rows Merged: ' || scan_info.rmt_rows_merged);
DBMS_OUTPUT.put_line ('Local Rows Deleted: ' || scan_info.loc_rows_deleted);
DBMS_OUTPUT.put_line ('Remote Rows Deleted: ' || scan_info.rmt_rows_deleted);
END;
/
Local Rows Merged: 0
Remote Rows Merged: 2
Local Rows Deleted: 0
Remote Rows Deleted: 0

PL/SQL procedure successfully completed.


Results:

Before:
select * from test.x;
select * from test2.x;

SQL> select * from test.x;

ENO ENAME SAL
---------- -------------------- ----------
100 VJ 100000
101 ASHRAY 100001
102 DUMPA 200000
103 REDDY 300000

SQL> select * from test2.x;

ENO ENAME SAL
---------- -------------------- ----------
100 VJ 100000
101 ASHRAY 100000 <=== Old
102 DUMPA 200001 <=== Old
103 REDDY 300000


After:
select * from test.x;
select * from test2.x;

SQL> select * from test.x;

ENO ENAME SAL
---------- -------------------- ----------
100 VJ 100000
101 ASHRAY 100001
102 DUMPA 200000
103 REDDY 300000

SQL> select * from test2.x;

ENO ENAME SAL
---------- -------------------- ----------
100 VJ 100000
101 ASHRAY 100001 <=== New
102 DUMPA 200000 <=== New
103 REDDY 300000

SQL>

Q:
a.
Can I fix the CLOB/BLOB column data?

No, the DBMS_COMPARISON package cannot compare data in columns of the following data types:

- LONG, LONG RAW, ROWID, UROWID, CLOB, NCLOB, BLOB and BFILE
- User-defined types (including object types, REFs, varrays, and nested tables)
- Oracle-supplied types (including any types, XML types, spatial types, and media types)


b.
Can I fix the object data in 11g by comparing the object in 10g?

Yes, The local database that runs the DBMS_COMPARISON package must be 11g but the remote database must be 10gR1 and up.


c.
Can I compare packages/procedure/functions?

No, the DBMS_COMPARISON package can compare the following types of database objects:

Tables, Single-table views, Materialized views, Synonyms for tables, single-table views and materialized views.


d.
Do I need to have primary key on compare object?

No, but each column in the single-column/composite index must either have a NOT NULL constraint or be part of the primary key.


e.
What privileges do I need to compare the objects?

Granting EXECUTE on CREATE_COMPARISON package to selected users or roles. (or) Granting EXECUTE_CATALOG_ROLE to selected users or roles.

Tuesday, April 20, 2010

No Segment Vs Invisible Vs Unusable Indexes in Oracle 11gR2:

No Segment Vs Invisible Vs Unusable Indexes in Oracle 11gR2:

No Segment/Virtual Indexes (8i and up):

Virtual indexes allow us to simulate the existence of an index and test its impact without actually building the actual index.
Only sessions marked for Virtual Index usage will be affected by their existence. Their creation does not affect new sessions.
Virtual indexes will be used only when the initialization parameter "_use_nosegment_indexes" is set to TRUE.
The Rule based optimizer does not recognize Virtual Indexes but the CBO does recognize them.
Dictionary view DBA_SEGMENTS will not show entries for Virtual Indexes. [DBA|ALL|USER]_OBJECTS view will have an entry.
They are permanent and continue to exist unless dropped. Make sure to drop virtual indexes after analysis and tuning is completed.
Statistics can be gathered on virtual indexes in the same way as regular indexes.
Oracle will prevent us from creating another virtual index with the same column list, but it will allow us to create a real index with the same column list.

To detect a virtual index in the database run the following SQL (these indexes don't have any columns in dba_ind_columns):

SELECT index_owner, index_name
FROM dba_ind_columns
WHERE index_name NOT LIKE 'BIN$%'
MINUS
SELECT owner, index_name
FROM dba_indexes;



Invisible Indexes (11gR1 and up):

Beginning with Release 11g, you can create invisible indexes. An invisible index is an index that is ignored by the optimizer unless you explicitly set the OPTIMIZER_USE_INVISIBLE_INDEXES initialization parameter to TRUE at the session or system level.

ALTER SESSION SET optimizer_use_invisible_indexes=TRUE;
ALTER SYSTEM SET optimizer_use_invisible_indexes=TRUE;


Using invisible indexes, you can do the following:
- Test the optimizer behave on the application before dropping an index.
- Use the index for certain operations or modules of an application without affecting the overall performance of the application.
- It's also useful for some DELETE operations in Database Machine (Oracle EXADATA).


An invisible index is maintained during DML statements.
Statistics can be gathered on an invisible indexes.
The current visibility status of an index is indicated by the VISIBILITY column of the [DBA|ALL|USER]_INDEXES views.
Using ALTER INDEX we can make the index INVISIBLE or VISIBLE.
We can REBUILD an invisible index.

INDEX hit will not work with an invisible index.
/*+ opt_param('optimizer_use_invisible_indexes','TRUE') */ -- we CAN'T use opt_param hint
We CAN'T modify index partition to Invisible, it's at Index level.



Unusable Indexes (11gR2):

Zero Sized Unusable Indexes:
In Oracle 11gR2 when the index or index partition marked as unusable, oracle automatically drop any index segment space.
This means we can release OLD(Not Active) index partition space and we can keep NEW(Active) partition indexes.

ALTER INDEX MODIFY PARTITION UNSABLE;

Once we make an index unusable, we will not see the segment in [DBA|ALL|USER]_SEGMENTS view, but we will have entry in [DBA|ALL|USER]_IND_PARTITIONS view.
The column SEGMENT_CREATED(column value: YES/NO) shows whether a segment exists for that partition.
unlike previous oracle releases(< 11gR2), we can query the unusable partition data, but it uses full table scan instead of an index scan, because the corresponding index partition is unusable and cannot be used by the optimizer.
When you query against NEW(Active) partition, it uses the corresponding index scan.
If a table is truncated, the unusable index partition will become usable again and Oracle Database will re-create the segment.