Home » RDBMS Server » Server Administration » Help:difference between LAST_ANALYZED of dba_tables and STATS_UPDATE_TIME column of dba_tab_stats_hi (Oracle 11.2.0.4. OS: AIX 6)
|
|
|
|
Re: Help:difference between LAST_ANALYZED of dba_tables and STATS_UPDATE_TIME column of dba_tab_stats_hi [message #662138 is a reply to message #662137] |
Tue, 18 April 2017 12:22   |
 |
abhi7394
Messages: 6 Registered: April 2017
|
Junior Member |
|
|
Hello Everyone,
Sorry for posting without proper format. Thanks for letting me know. I am posting it again.
the scenerio is like below. Every night after 23.00 stats on one table is calculated using one unix script which has below command. Table is partition table with 4 partitions.
DECLARE
v_part VARCHAR2(50);
v_nb PLS_INTEGER;
BEGIN
IF To_number(To_char(SYSDATE, 'HH24')) >= 22 THEN
-- entre 22h et 00h on calcule les stats pour la partition de la date courante :
-- T_FAC_STOCK_S24 : si exécuté avant 00h
v_part := 'DAT_'
||To_char(SYSDATE, 'YYYYMMDD');
ELSE
-- entre 00h et 22h on calcule les stats pour la partition de J-1
-- T_FAC_STOCK_S24 : si exécuté après 00h
v_part := 'DAT_'
||To_char(SYSDATE - 1, 'YYYYMMDD');
END IF;
SELECT Count(*)
INTO v_nb
FROM user_tab_partitions
WHERE table_name = '${STAT_NOM_TABLE}'
AND partition_name = v_part;
IF v_nb > 0 THEN
dbms_output.Put_line('Analyse la table ${STAT_NOM_TABLE}, pour la partition ' || v_part);
dbms_stats.Gather_table_stats(ownname => NULL, tabname => '${STAT_NOM_TABLE}', partname => v_part, estimate_percent => dbms_stats.auto_sample_size, degree => 4, FORCE => TRUE);
ELSE
dbms_output.Put_line('Analyse la table ${STAT_NOM_TABLE}');
dbms_stats.Gather_table_stats(ownname => NULL, tabname => '${STAT_NOM_TABLE}', estimate_percent => dbms_stats.auto_sample_size, degree => 4, FORCE =>TRUE);
END IF;
END;
/
In the morning at 11.00 Am 18th April when i checked the LAST_ANALYZED column of dba_tables it is showing below.
OWNER TABLE_NAME LAST_ANALYZED
------------ ----------------- -------------------
ODSFE3 T_FAC_STOCK_S24 17-04-2017 00:10:54
According to above output stats were not calculated on the script run of 17 April 23:00 . But then i checked dba_tab_stats_history and i got below output.
OWNER TABLE_NAME PARTITION_NAME STATS_UPDATE_TIME
----------- ------------- ------------------------- ------------------------------
ODSFE3 T_FAC_STOCK_S24 15-APR-17 01.00.54.360524 AM +02:00
ODSFE3 T_FAC_STOCK_S24 DAT_20170414 15-APR-17 08.30.16.958906 AM +02:00
ODSFE3 T_FAC_STOCK_S24 DAT_20170414 15-APR-17 03.38.16.819252 PM +02:00
ODSFE3 T_FAC_STOCK_S24 15-APR-17 03.38.16.819252 PM +02:00
ODSFE3 T_FAC_STOCK_S24 DAT_20170415 16-APR-17 12.15.09.720862 AM +02:00
ODSFE3 T_FAC_STOCK_S24 16-APR-17 12.15.09.720862 AM +02:00
ODSFE3 T_FAC_STOCK_S24 16-APR-17 12.40.10.563678 PM +02:00
ODSFE3 T_FAC_STOCK_S24 DAT_20170416 17-APR-17 12.10.54.320661 AM +02:00
ODSFE3 T_FAC_STOCK_S24 17-APR-17 12.10.54.320661 AM +02:00
ODSFE3 T_FAC_STOCK_S24 DAT_20170417 18-APR-17 12.25.22.288880 AM +02:00
ODSFE3 T_FAC_STOCK_S24 18-APR-17 12.25.22.288880 AM +02:00
ODSFE3 T_FAC_STOCK_S24 DAT_20170417 18-APR-17 01.00.39.981961 AM +02:00
ODSFE3 T_FAC_STOCK_S24 18-APR-17 01.00.39.981961 AM +02:00
Now i need your expertise in this situation. I want to understand should there be a difference between these LAST_ANALYZED of dba_tables and STATS_UPDATE_TIME column of dba_tab_stats_history columns , if yes then why and if no then what i am doing wrong here.
Thanks
Abhishek
|
|
|
|
|
|
|
|
|
|
|
Goto Forum:
Current Time: Fri May 02 03:27:31 CDT 2025
|