ADO Storage Tiering with customized function: Example
An exciting feature of 12c is Automatic Data Optimization (ADO). It can automate Compression Tiering and Storage Tiering. The documentation mentions that Storage Tiering can be based on a customized function, but there is no example for it. Therefore this posting.
[oracle@uhesse ~]$ sqlplus / as sysdba
SQL*Plus: Release 12.1.0.1.0 Production on Mon Dec 9 10:33:17 2013
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL> grant dba to adam identified by adam;
Grant succeeded.
SQL> connect adam/adam
Connected.
SQL> create tablespace tbs1 datafile '/home/oracle/prima/tbs1.dbf' size 10m;
Tablespace created.
SQL> create tablespace tbs2 datafile '/home/oracle/prima/tbs2.dbf' size 10m;
Tablespace created.
SQL> create table t (n number) partition by range (n)
(partition p values less than (2) tablespace tbs1);
Table created.
Nothing special so far, just two tablespaces and a partitioned table. My customized ADO policy is very simple and uses a working table:
SQL> create table adoflag (n number); Table created.
SQL> insert into t values (1); 1 row created. SQL> commit; Commit complete. SQL> insert into adoflag values (0); 1 row created. SQL> commit; Commit complete. SQL> create or replace function adofunc (object_number in number) return boolean as v_n number; begin select n into v_n from adoflag; if (v_n=1) then return true; else return false; end if; end; / Function created.
Now that function is attached to an ADO policy that is placed on the partition p – notice that Storage Tiering policies can be on the segment level only:
SQL> alter table t modify partition p ilm add policy tier to tbs2 on adofunc; Table altered. SQL> col policy_name for a10 SQL> select policy_name,enabled from dba_ilmpolicies; POLICY_NAM ENABLE ---------- ------ P1 YES
The name of the policy is provided automatically. ADO Tiering requires the following initialization parameter setting, regardless that the customized policy is not based on access respectively modification frequency of the partition p:
SQL> alter system set heat_map=on; System altered.
Attention: Setting this already means you need the Advanced Compression Option! And to me it seems funny that this parameter can be modified on the session level, but that’s how it is. I want to cause now the Storage Tiering, so I update the flag to 1, but that would lead to automatic action only when the next Auto Task maintenance window opens. Therefore I trigger the ADO Tiering manually.
SQL> update adoflag set n=1;
1 row updated.
SQL> commit;
Commit complete.
SQL> select tablespace_name from user_tab_partitions where table_name='T';
TABLESPACE_NAME
------------------------------
TBS1
SQL> declare
v_executionid number;
begin
dbms_ilm.execute_ilm (ilm_scope=>dbms_ilm.scope_schema,
execution_mode=>dbms_ilm.ilm_execution_offline,
task_id=>v_executionid);
end;
/
PL/SQL procedure successfully completed.
SQL> select task_id,policy_name,selected_for_execution from dba_ilmevaluationdetails;
TASK_ID POLICY_NAM SELECTED_FOR_EXECUTION
---------- ---------- ------------------------------------------
7 P1 SELECTED FOR EXECUTION
SQL> select tablespace_name from user_tab_partitions where table_name='T';
TABLESPACE_NAME
------------------------------
TBS2
It is possible to add a Storage Tiering policy to a non-partitioned table, but that is probably not a good idea. My observation at least with the current 12.1.0.1 is that open transactions on the non-partitioned table will cause the Storage Tiering to fail silently. Usually, the Storage Tiering will be a unique action on the segment. For testing purposes, though, you may want to trigger it multiple times. But the policy gets silently disabled after the first tiering although dba_ilmpolicies shows it as enabled:
SQL> select policy_name,enabled from dba_ilmpolicies;
POLICY_NAM ENABLE
---------- ------
P1 YES
SQL> alter table t move partition p tablespace tbs1 online;
Table altered.
SQL> declare
v_executionid number;
begin
dbms_ilm.execute_ilm (ilm_scope=>dbms_ilm.scope_schema,
execution_mode=>dbms_ilm.ilm_execution_offline,
task_id=>v_executionid);
end;
/
PL/SQL procedure successfully completed.
SQL> select tablespace_name from user_tab_partitions where table_name='T';
TABLESPACE_NAME
------------------------------
TBS1
SQL> select task_id,policy_name,selected_for_execution from dba_ilmevaluationdetails;
TASK_ID POLICY_NAM SELECTED_FOR_EXECUTION
---------- ---------- ------------------------------------------
44 P1 POLICY DISABLED
7 P1 SELECTED FOR EXECUTION
SQL> alter table t modify partition p ilm enable_all;
Table altered.
SQL> declare
v_executionid number;
begin
dbms_ilm.execute_ilm (ilm_scope=>dbms_ilm.scope_schema,
execution_mode=>dbms_ilm.ilm_execution_offline,
task_id=>v_executionid);
end;
/
PL/SQL procedure successfully completed.
SQL> select tablespace_name from user_tab_partitions where table_name='T';
TABLESPACE_NAME
------------------------------
TBS2
SQL> select task_id,policy_name,selected_for_execution from dba_ilmevaluationdetails;
TASK_ID POLICY_NAM SELECTED_FOR_EXECUTION
---------- ---------- ------------------------------------------
45 P1 SELECTED FOR EXECUTION
44 P1 POLICY DISABLED
7 P1 SELECTED FOR EXECUTION
I hope this helps to get an understanding of customized ADO policy functions and to stay clear of some of the pitfalls associated with that topic. As always: Don’t believe it, test it! 🙂
#ukoug_tech13 – Impressions
Yes, the second posting in a row about Oracle User Group Conference Impressions, can’t help it 🙂 Straight after the fantastic DOAG conference in Nürnberg, the Oracle circus moved on to Manchester for the UKOUG annual conference, which fulfilled the high expectations and turned out to be another great event!
I attended so many very good presentations that it’s too much to cover it all here, so let me just mention some of the highlights.
Andy Colvin’s talk about RMAN in Oracle Database 12c – Top New Features was instructive, although I knew the new features before. Particular useful is for example the full SQL capability that RMAN has now.
The live demo (I like that!) that he did about Table Point Recovery failed at the first try but succeeded at second try. Things like that never happen during the preparation for some reason 🙂
Larry Carpenter is always a show and his presentation about Oracle Active Data Guard: Next Generation Data Protection was again great. Love it when he says: „I don’t like Data Loss!“ Data Guard has again big improvements in the current version, probably the introduction of Far Sync Instances that enables Zero Data Loss across any distance is the most important new feature here.
Marcin Przepiorowski (I gladly call him Marcin, because it’s almost impossible to pronounce his last name) also presented about Data Guard, and I attended his talk about Using Data Guard Broker at the Oak Table World that was run in parallel. You may know that I am also always recommending to use the broker, and that is probably also what we are talking about here at the social event in the afternoon 🙂
Marcin standing backwards to the camera, on my right side is a smiling Osama Mustafa and the guy with the bottle of beer is my good friend Philippe Fierens. Thanks for your company, Philippe!
The Data Guard Round Table saw me again sitting together with Larry Carpenter as in Nürnberg before, and Larry answered again almost all the questions, making my presence so much easier 🙂
Another interesting Round Table was about Engineered Systems, where I finally met Jason Arneil in person. You see him here on the right side and Joel (Crocodile Dundee) Goodman in the middle
Joel and I have also been at the RAC & Grid Infrastructure Round Table, where Joel explained a good deal about Flex ASM and Flex Clusters to the audience.
My own presentation was again as in Nürnberg about Materialized View & Partition Change Tracking, but this time with another T-Shirt:
One little nerd’s anecdote: I was sitting next to Jonathan Lewis in the speaker’s lounge after my talk when I received a tweet from him, apologizing that he wasn’t able to attend although he announced that he would do it.
I turned to him and said: „Yes, I was missing you in the audience!“ and he was totally baffled to get talked to before he realized that it was me 🙂
My good friend Iloon Ellen-Wolf presented at the Oak Table World about What a DBA needs to know about APEX – very needful information as I think.
You see her in the middle of the next picture, showing The Three Musketeers from Oracle University:
My friends Iloon Ellen-Wolf, Joel Goodman and me were waving the OU flag with several presentations and round table talks.
Tom Kyte did the last presentation on Wednesday about the things he learned at the event:
He is not only a bright technical expert but also a very good entertainer on stage! Need to adopt something of it, but that will be hard… One thing he learned: Live demonstrations are dangerous! I agree, but that’s also the fun of it 🙂
Many thanks to the staff of the UKOUG for making this great event possible, I felt honored to be a part of it!
Also, I’d like to thank my friends Iloon, Jan, Philippe and Joel for giving me good company during the conference – really appreciated it! Hope to see you soon again at another conference 🙂
The #DOAG2013 – Impressions
First things first: It was a great event!
Many thanks to the DOAG staff for offering and organizing it, great job!
Top-Notch speakers and Oracle Celebrities with so many great presentations that I really felt sorry to be unable to clone myself in order to attend multiple sessions in parallel 🙂
Let me mention just a few that I attended:
There was Graham Wood with his talk DB Time-based Oracle Performance Tuning: Theory and Practice
One key point to take away: DB Time is time spent by foreground processes in the Database Layer and Performance Tuning actually means reducing DB Time
Another very interesting presentation was Kyle Hayley’s about Instant DB Cloning
One goodie here: Check out clonedb with MOS Note 1210656.1 or this article http://www.oracle-base.com/articles/11g/clonedb-11gr2.php
It went on with Larry Carpenter talking about Best Practices for Data Availability and Disaster Protection
One highlight was the 12c New Feature Application Continuity here, that makes failover really transparent (much better than ancient TAF did) to applications
On we went with Julian Dontcheff’s Upgrading to Oracle 12c
I was really pleased to meet him in person for the first time since we have had some contact over social media before – that’s one of the best things about these conferences 🙂
One highlight was the option to do upgrade to 12c (not just recompile!) in parallel.
Then came Joel Goodman with his presentation about RAC Global Resource Management Concepts
Take away: When you want to get a clue how Cache Fusion works under the covers, check out GV$BH, especially the STATUS column – or even better: Take a course from Oracle University about it 🙂
Mark Scardina then almost convinced me that it may indeed be useful do create Server Pools with his talk Why and How You Should Be Using Policy-Managed Oracle RAC Databases
Especially, you can control the start order and priority of services when servers get scarce (after a crash, e.g.)
My own presentation about Materialized Views & Partition Change Tracking almost filled room 2 and got strong applause, so I consider it a success 🙂
Key point is here
Very instructive talk followed by Mike Dietrich about Working with Multitenant Databases in Practice
You can download the slides from his blog. One highlight: In 12c, you have Full Transportable Export/Import which is a combination of Transportable Tablespaces and full export – very cool!
We saw a great presentation also by Kai Yu about Achieving Availability and Scalability with Oracle 12c Flex Clusters
and I was glad to meet him in person there! One key point: Flex Clusters need Flex ASM, but Flex ASM can also be used by Standard Clusters
Markus Michalewicz did a great job with his presentation about RAC 12c Best Practices – if I should recommend only one talk, this would probably be it.
One out of many key points was the recommendation to install Oracle Grid Infrastructure for a Cluster for any deployment; may it be a Single Instance Database or an Oracle RAC Database.
Then I went to Frank Schneede to hear about 12c New Features for Data Warehousing
One goodie: We have partial indexes available now for partitioned tables – local and global!
Very good – as usual – was also Christian Antognini with Query Optimizer 12c New Features
Enjoyed especially his demonstration of Adaptive Plans in 12c
A DOAG highlight was also the Data Guard Expert Panel – felt honored about the invite to join it together with a legend like Larry Carpenter 🙂
Oracle University was present at the DOAG Conference not only with Joel Goodman and me as speakers, we have had an OU booth also there:
Here you see Volker Enkrodt, one of our Sales Consultants, happy to answer customer questions about OU offerings and certifications.
All in all a great conference! Looking forward to DOAG 2014 already 🙂


