tech_memo/ORACLE
統計情報のロック解除 †
- ロックされているテーブルの一覧
select table_name, stattype_locked from dba_tab_statistics where owner = 'HOGE' and stattype_locked is not null;
- ロックの解除
begin
dbms_stats.unlock_table_stats('HOGE', 'HOGE_TABLE');
end;
/
統計情報の最終取得時刻確認 †
select TABLE_NAME,num_rows,last_analyzed from DBA_TABLES where owner='[ユーザー]' order by last_analyzed desc;
パーティションの場合 †
- 参考 : http://d.hatena.ne.jp/yohei-a/20100125/1264409523
- パーティション表
select table_owner, table_name, partition_name, to_char(last_analyzed, 'YYYY-MM-DD HH24:MI:SS') "LAST_ANALYZED"
from dba_tab_partitions
where table_owner in ('SCOTT')
order by table_owner, table_name, partition_name;
- パーティションインデックス
select index_owner, index_name, partition_name, to_char(last_analyzed, 'YYYY-MM-DD HH24:MI:SS') "LAST_ANALYZED"
from dba_ind_partitions
where index_owner in ('SCOTT')
order by index_owner, index_name, partition_name;
サブパーティションの場合 †
- サブパーティション表
select table_owner, table_name, partition_name, subpartition_name, to_char(last_analyzed, 'YYYY-MM-DD HH24:MI:SS') "LAST_ANALYZED"
from dba_tab_subpartitions
where table_owner in ('SCOTT')
order by table_owner, table_name, partition_name, subpartition_name;
- サブパーティションインデックス
select index_owner, index_name, partition_name, subpartition_name, to_char(last_analyzed, 'YYYY-MM-DD HH24:MI:SS') "LAST_ANALYZED"
from dba_ind_subpartitions
where index_owner in ('SCOTT')
order by index_owner, index_name, partition_name, subpartition_name;
指定したテーブルの統計情報の更新 †
サブパーティションの統計情報も取得する †
自動メンテナンスタスクの状態確認 †
- optimizer_stats列がENABLEだと有効
set linesize 200
col window_name for a20
col window_next_time for a40
SELECT window_name, window_next_time, window_active, autotask_status, optimizer_stats, segment_advisor, sql_tune_advisor
FROM dba_autotask_window_clients;
統計情報の取得 ON/OFF †
統計情報のコントロール †
- 11g
- http://d.hatena.ne.jp/yohei-a/20120105/1325747902
- 確認
set linesize 200
col window_name for a20
col window_next_time for a40
SELECT window_name, window_next_time, window_active, autotask_status, optimizer_stats, segment_advisor, sql_tune_advisor
FROM dba_autotask_window_clients;
最新の20件
2023-01-26
2022-11-11
2022-03-02
2022-02-03
2021-11-18
2021-11-11
2021-10-27
2021-10-04
2021-09-30
2021-08-24
2021-04-01
2021-02-25
2020-08-13
2020-05-22
2020-04-16
2020-04-15
2020-03-23
2020-03-12
2020-02-27
今日の20件
- counter: 343
- today: 2
- yesterday: 0
- online: 1