關閉特定物件統計資訊自動收集
最近幾天都在學習OCP相關考試題目,以後陸續把自己做錯或者感覺特別經典的題目記錄下來。
其實之前沒有想到資料庫還可以關閉特定表的資訊自動收集,直到看了以下這道題才知道。
然後去看了下資料如何關閉:
You have statistics collected for some selected tables. Your requirement is that the statistics for the
tables and all dependent indexes must not be overwritten by further statistics collection until a certain
point of time.
How would you achieve this?
A.Lock statistics for the tables.
B.Change STALE_PERCENT to zero for the tables.
C.Set the TIMED_STATISTICS parameter to TRUE.
D.Set the STATISTICS_LEVEL parameter to BASIC.
E.Set the OPTIMIZER_USE_PENDING parameter statistics to TRUE.
簡單說為了讓特定表的統計資訊不被覆蓋,可以把這些表的資訊收集關閉掉:
BEGIN
DBMS_STATS.lock_table_stats(USER,'STAT');
END;
其中stat為表名,相應的重新開啟
BEGIN
DBMS_STATS.unlock_table_stats(USER,'STAT');
END;
進一步,也可以對一個模式進行開關,工具包:
BEGIN
DBMS_STATS.GATHER_TABLE_STATS(OWNNAME => USER,
TABNAME => 'STAT',
ESTIMATE_PERCENT => 100,
METHOD_OPT => 'for all columns size skewonly',
CASCADE => TRUE);
END;
查詢統計結果:
SELECT NUM_ROWS, BLOCKS, EMPTY_BLOCKS, AVG_SPACE, CHAIN_CNT, AVG_ROW_LEN
FROM USER_TAB_STATISTICS
WHERE TABLE_NAME = 'STAT';
其實之前沒有想到資料庫還可以關閉特定表的資訊自動收集,直到看了以下這道題才知道。
然後去看了下資料如何關閉:
You have statistics collected for some selected tables. Your requirement is that the statistics for the
tables and all dependent indexes must not be overwritten by further statistics collection until a certain
point of time.
How would you achieve this?
A.Lock statistics for the tables.
B.Change STALE_PERCENT to zero for the tables.
C.Set the TIMED_STATISTICS parameter to TRUE.
D.Set the STATISTICS_LEVEL parameter to BASIC.
E.Set the OPTIMIZER_USE_PENDING parameter statistics to TRUE.
簡單說為了讓特定表的統計資訊不被覆蓋,可以把這些表的資訊收集關閉掉:
BEGIN
DBMS_STATS.lock_table_stats(USER,'STAT');
END;
其中stat為表名,相應的重新開啟
BEGIN
DBMS_STATS.unlock_table_stats(USER,'STAT');
END;
進一步,也可以對一個模式進行開關,工具包:
Statistics for a table or schema can be locked. After statistics are locked, you can make no modifications to the statistics until the statistics have been unlocked. Locking procedures are useful in a static environment in which you want to guarantee that the statistics never change.
The DBMS_STATS package provides two procedures for locking (LOCK_SCHEMA_STATS and LOCK_TABLE_STATS) and two procedures for unlocking statistics (UNLOCK_SCHEMA_STATS and UNLOCK_TABLE_STATS).
另外,手動收集資訊:BEGIN
DBMS_STATS.GATHER_TABLE_STATS(OWNNAME => USER,
TABNAME => 'STAT',
ESTIMATE_PERCENT => 100,
METHOD_OPT => 'for all columns size skewonly',
CASCADE => TRUE);
END;
SELECT NUM_ROWS, BLOCKS, EMPTY_BLOCKS, AVG_SPACE, CHAIN_CNT, AVG_ROW_LEN
FROM USER_TAB_STATISTICS
WHERE TABLE_NAME = 'STAT';
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/14888950/viewspace-1430701/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 關於oracle自動收集統計資訊Oracle
- 關閉及開啟oracle10g統計資訊自動收集功能Oracle
- Oracle統計資訊自動收集Oracle
- 關閉及開啟oracle10g統計資訊自動收集功能(轉)Oracle
- 關閉自動收集 for oracleOracle
- Win10系統關閉“小娜自動收集個人資訊”功能的方法Win10
- ORACLE 11g 自動收集統計資訊Oracle
- Oracle11g 統計資訊-----統計資訊自動收集任務Oracle
- Oracle11g 統計資訊——統計資訊自動收集任務Oracle
- 【Oracle】11g Oracle自動收集統計資訊Oracle
- Oracle 11g 之自動收集統計資訊Oracle
- Oracle10g 統計資訊的自動收集Oracle
- ORACLE10g自動收集CBO統計資訊Oracle
- [統計資訊系列7] Oracle 11g的自動統計資訊收集Oracle
- [zt] Oracle10g 自動收集收集CBO統計資訊設定Oracle
- Oracle的自動統計資訊不收集直方圖的資訊Oracle直方圖
- 如何在win10系統中關閉掉小娜自動收集個人資訊的功能Win10
- Oracle 11g無法自動收集統計資訊Oracle
- oracle 11g自動收集統計資訊介紹Oracle
- oracle 統計資訊過期判斷和自動收集Oracle
- 關於ORACLE自動統計CBO統計資訊Oracle
- 開啟oracle10g統計資訊自動收集功能Oracle
- Greenplum自動統計資訊收集-暨統計資訊不準引入的broadcastmotion一例AST
- 雞肋 -- ORACLE10g自動收集CBO統計資訊(ZT)Oracle
- oracle10g如何啟用禁用自動統計資訊收集Oracle
- 關於ORACLE自動統計CBO統計資訊[轉帖]Oracle
- iOS 關閉系統自動更新iOS
- Oracle收集統計資訊Oracle
- Oracle 統計資訊收集Oracle
- 收集oracle統計資訊Oracle
- ORACLE 收集統計資訊Oracle
- Oracle 11g 修改表級別的自動收集統計資訊比率Oracle
- Sqlserver關於統計資訊自動建立自動更新的知識點SQLServer
- Oracle 11g系統自動收集統計資訊的一些知識Oracle
- 【統計資訊】Oracle常用的收集統計資訊方式Oracle
- win10系統關閉自動更新怎麼關_windows10如何關閉自動更新Win10Windows
- 收集全庫統計資訊
- mysql如收集統計資訊MySql