Automatic Data Optimization (ADO) allows you to create policies
for data compression (Smart Compression) and data movement, to implement
storage and compression tiering. Smart Compression refers to the ability to
utilize Heat Map information to associate compression policies, and compression
levels, with actual data usage. Oracle Database periodically evaluates ADO
policies, and uses the information collected by Heat Map to determine when to
move and / or compress data. All ADO operations are executed automatically and
in the background, without user intervention.
ADO policies can be specified at the segment or row level for tables and
table partitions. Policies will be evaluated and executed automatically in the
background during the maintenance window. ADO policies can also be evaluated
and executed anytime by a DBA, manually or via a script.
ADO policies specify what conditions (of data access) will
initiate an ADO operation – such as no access, or no modification, or creation
time – and when the policy will take effect – for example, after n days or
months or years. Conditions in ADO policies are not limited to Heat Map data:
you can also create custom conditions using PL/SQL functions, extending the
flexibility of ADO to use your own data and logic to determine when to move or
compress data.
ADO work in conjunction with the Heat Map feature and allows
us to create new policies which specify conditions to dictate when data will be
moved or compressed based on statistics related to the data usage at the 1)
tablespace, 2) object and even row level .
Real-time data access statistics are collected
in memory in the V$HEAT_MAP_SEGMENT view and then those are regularly pushed by
DBMS_SCHEDULER_JOBS to tables which residing on disk.
We have DBA views like DBA_HEAT_MAP_SEG_HISTOGRAM
and DBA_HEAT_MAP_SEGMENT.
Heat Map is enabled at the instance level by
setting the pfile/sp-file parameter HEAT_MAP to ON.
Here's is an example.....
1) Connect to the noncdb database as sys.
sqlplus
sys/oracle@localhost:1521/noncdb as sysdba
2) Create two tablespaces, . Each tablespace should have a
10M data file.
a) ilmtbs
b) low_cost_store.
create tablespace
ilmtbs datafile '/u01/app/oracle/oradata/noncdb/ilmtbs1.dbf' size 10m reuse autoextend off extent management local;
create tablespace
low_cost_store datafile '/u01/app/oracle/oradata/noncdb/lowcoststore1.dbf' size
10m reuse
autoextend off extent management local;
autoextend off extent management local;
3) Unlock the SCOTT account, grant it unlimited quota on the two
tablespaces. Grant the necessary privileges to SCOTT.
alter user scott
identified by tiger account unlock;
alter user scott
quota unlimited on ilmtbs;
alter user scott
quota unlimited on low_cost_store;
grant alter
tablespace, select any dictionary to scott;
grant all on ts$ to
scott;
grant all on
dba_segments to scott;
4) Enable heat map
tracking.
alter system set
heat_map=on scope=both;
5) Create a table as below:
create table
scott.employee (EMPNO NUMBER(4) NOT NULL,ENAME VARCHAR2(10),JOB VARCHAR2(9),MGR NUMBER(4),HIREDATE DATE,
SAL NUMBER(7,2),COMM NUMBER(7,2),DEPTNO NUMBER(2))tablespace ilmtbs;
SAL NUMBER(7,2),COMM NUMBER(7,2),DEPTNO NUMBER(2))tablespace ilmtbs;
6) Insert about 3500 rows
into SCOTT.employee table.
insert into
scott.employee (empno, ename, job, mgr, hiredate, sal, comm, deptno)select
empno, ename, job, mgr, hiredate, sal, comm, deptno from scott.emp;
declare
blowup PLS_INTEGER := 8;
sql_test clob;
begin
for i in 1..blowup loop
sql_test := 'insert /*+ append */ into scott.employee select * from scott.employee';
execute immediate sql_test;
commit;
end loop;
end;
/
blowup PLS_INTEGER := 8;
sql_test clob;
begin
for i in 1..blowup loop
sql_test := 'insert /*+ append */ into scott.employee select * from scott.employee';
execute immediate sql_test;
commit;
end loop;
end;
/
select count(*)
from scott.employee;
This should fill up more than 5% of the tablespace, so that there
is less than 95% free space.
7) Verify that the table is stored in the ilmtbs tablespace.
select tablespace_name, segment_name
from dba_segments where segment_name='EMPLOYEE';
8) Connect as scott to the database.
connect
scott/tiger@localhost:1521/noncdb
9) Verify that heat map tracking collected statics for
SCOTT.employee.
select OBJECT_NAME,SEGMENT_WRITE_TIME ,
SEGMENT_READ_TIME, FULL_SCAN
FROM user_heat_map_segment
WHERE OBJECT_NAME='EMPLOYEE';
10)
Check the current freespace in the ilmtbs tablespace.
col tablespace format A16