PARAMETER_NAME TYPE VALUE ------------------------------------------------------------ --------------------------------- ------------------------- heat_map string OFF
PARAMETER_NAME TYPE VALUE ------------------------------------------------------------ --------------------------------- -------------------- heat_map string ON
sys@ORA122> conn sys/oracle as sysdba Connected.
sys@ORA122> show parameter heat_map
PARAMETER_NAME TYPE VALUE ------------------------------------------------------------ --------------------------------- -------------------- heat_map string OFF >>>>====CDB级别仍然是OFF状态
col OBJECT_NAME for a30 col SUBOBJECT_NAME for a40 SELECT SUBSTR(OBJECT_NAME,1,20) OBJECT_NAME, SUBSTR(SUBOBJECT_NAME,1,20) SUBOBJECT_NAME, TRACK_TIME, SEGMENT_WRITE, FULL_SCAN, LOOKUP_SCAN FROM V$HEAT_MAP_SEGMENT;
OBJECT_NAME SUBOBJECT_NAME TRACK_TIME SEGMENT_W FULL_SCAN LOOKUP_SC ------------------------------ ---------------------------------------- ------------------- --------- --------- --------- PK_T1 2019-03-06 13:23:18 NO NO YES T1 2019-03-06 13:23:18 YES YES NO
create table t1( t1_id number, t1_date date ) partition by range(t1_date) ( partition t1_date_p1 values less than (to_date('20180601', 'yyyymmdd')) tablespace tbs1, partition t1_date_p2 values less than (to_date('20180701', 'yyyymmdd')) tablespace tbs1, partition t1_date_p3 values less than (to_date('20180901', 'yyyymmdd')) tablespace tbs2, partition t1_date_p4 values less than (to_date('20181201', 'yyyymmdd')) tablespace tbs2, partition t1_date_p5 values less than (to_date('20190101', 'yyyymmdd')) tablespace tbs3, partition t1_date_p6 values less than (to_date('20190301', 'yyyymmdd')) tablespace tbs3 );
alter table t1 modify partition t1_date_p3 ilm add policy tier to tbs1 read only segment after 6 months of no access; alter table t1 modify partition t1_date_p4 ilm add policy tier to tbs1 read only segment after 6 months of no access; alter table t1 modify partition t1_date_p5 ilm add policy tier to tbs2 read only segment after 3 months of no access; alter table t1 modify partition t1_date_p6 ilm add policy tier to tbs2 read only segment after 3 months of no access; alter table t1 ilm add policy row store compress basic segment after 3 months of no access;
column policy_name format a20 column object_owner format a15 column object_name format a15 column subobject_name format a20 select policy_name, object_owner, object_name, subobject_name, object_type, inherited_from, enabled, deleted from user_ilmobjects;
POLICY_NAME OBJECT_OWNER OBJECT_NAME SUBOBJECT_NAME OBJECT_TYPE INHERITED_FROM ENABLED DELETED -------------------- --------------- --------------- -------------------- ------------------------------------------------------ ------------------------------------------------------------ ---------- --------- P6 XB T1 T1_DATE_P3 TABLE PARTITION POLICY NOT INHERITED YES NO P7 XB T1 T1_DATE_P4 TABLE PARTITION POLICY NOT INHERITED YES NO P8 XB T1 T1_DATE_P5 TABLE PARTITION POLICY NOT INHERITED YES NO P9 XB T1 T1_DATE_P6 TABLE PARTITION POLICY NOT INHERITED YES NO P10 XB T1 TABLE POLICY NOT INHERITED YES NO P10 XB T1 T1_DATE_P1 TABLE PARTITION TABLE YES NO P10 XB T1 T1_DATE_P2 TABLE PARTITION TABLE YES NO P10 XB T1 T1_DATE_P3 TABLE PARTITION TABLE YES NO P10 XB T1 T1_DATE_P4 TABLE PARTITION TABLE YES NO P10 XB T1 T1_DATE_P5 TABLE PARTITION TABLE YES NO P10 XB T1 T1_DATE_P6 TABLE PARTITION TABLE YES NO
禁用和删除ADO策略
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
/* 禁用(删除)表中的某个ADO策略*/ ALTER TABLE t1 ILM DISABLE POLICY P10; ALTER TABLE t1 ILM DELETE POLICY P10;
/* 禁用(删除)表中的全部ADO策略 */ ALTER TABLE t1 ILM DISABLE_ALL; ALTER TABLE t1 ILM DELETE_ALL;
/* 禁用(删除)分区中的某个ADO策略 */ ALTER TABLE t1 MODIFY PARTITION t1_date_p3 ILM DISABLE POLICY P6; ALTER TABLE t1 MODIFY PARTITION t1_date_p3 ILM DELETE POLICY P6;
/* 禁用(删除)分区中的全部ADO策略 */ ALTER TABLE t1 MODIFY PARTITION t1_date_p4 ILM DISABLE_all; ALTER TABLE t1 MODIFY PARTITION t1_date_p4 ILM DELETE_ALL;
指定段级别压缩和存储层
1 2 3 4 5 6 7 8 9 10 11 12 13
段级别压缩目前只试用于EXADATA
ALTER TABLE t1 ILM ADD POLICY COMPRESS FOR ARCHIVE HIGH SEGMENT AFTER 6 MONTHS OF NO MODIFICATION; ALTER TABLE t1 ILM ADD POLICY * ERROR at line 1: ORA-64307: Exadata Hybrid Columnar Compression is not supported for tablespaces on this storage type
/* 增加存储层策略 */ ALTER TABLE sales_ado ILM ADD POLICY TIER TO my_low_cost_tablespace;
指定行级别的压缩层
HCC只适用EXADATA
1 2 3 4 5 6 7 8 9 10 11 12 13 14
ALTER TABLE t1 ILM ADD POLICY COLUMN STORE COMPRESS FOR QUERY ROW AFTER 30 DAYS OF NO MODIFICATION; ALTER TABLE t1 * ERROR at line 1: ORA-64307: Exadata Hybrid Columnar Compression is not supported for tablespaces on this storage type
ALTER TABLE t1 ILM ADD POLICY ROW STORE COMPRESS ADVANCED ROW AFTER 60 DAYS OF NO MODIFICATION;
Table altered.
ADO参数
查询有哪些参数
1 2 3 4 5 6 7 8 9 10 11 12
SELECT NAME, VALUE FROM DBA_ILMPARAMETERS;
NAME VALUE ---------------------------------------------------------------------- ---------- ENABLED 1 RETENTION TIME 30 JOB LIMIT 2 EXECUTION MODE 2 EXECUTION INTERVAL 15 TBS PERCENT USED 85 TBS PERCENT FREE 25 POLICY TIME 0
可以通过CUSTOMIZE_ILM过程自定义ADO参数
1 2 3 4 5 6 7 8 9 10
BEGIN DBMS_ILM_ADMIN.CUSTOMIZE_ILM(DBMS_ILM_ADMIN.TBS_PERCENT_USED, 85); DBMS_ILM_ADMIN.CUSTOMIZE_ILM(DBMS_ILM_ADMIN.TBS_PERCENT_FREE, 25); END; /
SQL> BEGIN DBMS_ILM_ADMIN.CUSTOMIZE_ILM(DBMS_ILM_ADMIN.ABS_JOBLIMIT, 10); END; /