【翻譯自mos文章】對於一個新建的db來說,對Dba_Feature_Usage_Statistics的查詢返回零行
來源於:
No Rows Returned from Dba_Feature_Usage_Statistics For Newly Created Database (文檔 ID 1943234.1)
適用於:
Oracle Database - Enterprise Edition - Version 10.2.0.1 and later
Information in this document applies to any platform.
症狀:
在一個新建立的db中,Dba_Feature_Usage_Statistics沒有rows
原因:
10g的輸出
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE 10.2.0.5.0 Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
SQL> select count(*) from dba_feature_usage_statistics;
COUNT(*)
----------
0
11g 輸出:
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE 11.2.0.4.0 Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production
SQL> select count(*) from dba_feature_usage_statistics;
COUNT(*)
----------
0
12c的輸出:
SQL> select * from v$version;
BANNER CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production 0
PL/SQL Release 12.1.0.2.0 - Production 0
CORE 12.1.0.2.0 Production 0
TNS for Linux: Version 12.1.0.2.0 - Production 0
NLSRTL Version 12.1.0.2.0 - Production 0
SQL> select count(*) from dba_feature_usage_statistics;
COUNT(*)
----------
0
解決方案:
這是預想的行為,可以查詢sysl.wri$_dbu_usage_sample
SQL> select * from wri$_dbu_usage_sample;
DBID VERSION LAST_SAMPLE_DATE LAST_SAMPLE_DATE_NUM LAST_SAMPLE_PERIOD TOTAL_SAMPLES SAMPLE_INTERVAL
---------- ----------------- ------------------- -------------------- ------------------ ------------- ---------------
2390668590 12.1.0.1.0 05/11/2014 05:31:29 1415165488 0 1 604800
上面的SAMPLE_INTERVAL 返回 604800,這個604800是以秒為單位的,變為天數為7天。