w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Oracle Partition Table : Data is not inserted in the right Partition

DBA_TABLES.NUM_ROWS is the number of rows counted when optimizer statistics were gathered. It does not necessarily represent the real number of rows. Regardless of what is inserted in the table, until statistics are gathered the query will look like this:

select partition_name, num_rows
from dba_tab_partitions
where table_name = 'JOURNAL1';

PARTITION_NAME  NUM_ROWS
--------------  --------
PART1   
PART2   
PART3   
PART4   
PART5   

Gathering statistics will set the number of rows but the number will not stay up-to-date:

begin
    dbms_stats.gather_table_stats('PRODBMDB', 'JOURNAL1');
end;
/

select partition_name, num_rows
from dba_tab_partitions
where table_name = 'JOURNAL1';

PARTITION_NAME  NUM_ROWS
--------------  --------
PART1                  0
PART2                  0
PART3                  0
PART4                  0
PART5                  0




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.