{"id":191,"date":"2009-04-20T03:06:58","date_gmt":"2009-04-19T21:06:58","guid":{"rendered":"http:\/\/techsatwork.com\/blog\/?p=191"},"modified":"2016-01-07T11:31:13","modified_gmt":"2016-01-07T05:31:13","slug":"full-steam-ahead-with-db2-luw-versions","status":"publish","type":"post","link":"https:\/\/techsatwork.com\/?p=191","title":{"rendered":"Full steam ahead with DB2 LUW versions !"},"content":{"rendered":"<p>Did you know that IBM is ending official support for DB2 V8.2 on April 30th, 2009. Yep thats 15 days away and getting extended support will cost you an arm and a leg ! \u00c2\u00a0Lot of customers I know are unhappy because lot of third party applications do not certify DB2 9.x as a support backend database. The company I work for has a few of those. So we ended up with getting extended support for few of those servers and the rest we migrated them to DB2 V9.5 . \u00c2\u00a0DB2 V9.5 is pretty sweet. It has the long awaited thread based connection and handles memory management pretty well. You can run DB2 pretty much on auto pilot, but I highly recommend not to run on &#8220;self tuning&#8221; mode in critical production system. \u00c2\u00a0I believe human brains with experience are much superior to db2&#8217;s optimizer. \u00c2\u00a0<\/p>\n<p>DB2V9.5 takes the compression to the next level. \u00c2\u00a0IBM has improved the way DB2 builds the compression dictionary. In DB2 V9, there was only two ways to build the compression dictionary : \u00c2\u00a0One of which was to run an offline reorg with reset dictionary option that build the compression dictionary and the other was to run an INSPECT with rowcompestimate command. No rows were compressed unless either of these utilities was run. This required tables to be offline for the duration of the utilities. DB2 V9.5 improved the situation, \u00c2\u00a0IBM introduced the concept of Automatic Dictionary Creation (ADC). \u00c2\u00a0Research showed, a good compression dictionary can be build from sampling, remember I said good not perfect. ADC is based on data sampling. \u00c2\u00a0 In DB2 V9.5 \u00c2\u00a0ADC will start building\u00c2\u00a0a compression dictionary automatically when \u00c2\u00a0when the size of the table exceeds a threshold of approximately 2 MB and there is sufficient user data (at least 700KB) contained within the table once the threshold size is reached.<\/p>\n<p>Once the dictionary has been created and automatically inserted into the table, all future population of data is subject to being compressed. \u00c2\u00a0The concept of ADC is illustrated in the below diagram<\/p>\n<p><a href=\"https:\/\/techsatwork.com\/blog\/wp-content\/uploads\/2009\/04\/fig1-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"size-medium wp-image-199 alignleft\" title=\"Concept of ADC\" src=\"https:\/\/techsatwork.com\/blog\/wp-content\/uploads\/2009\/04\/fig1-1-300x201.png\" alt=\"fig1-1\" width=\"300\" height=\"201\" srcset=\"https:\/\/techsatwork.com\/wp-content\/uploads\/2009\/04\/fig1-1-300x201.png 300w, https:\/\/techsatwork.com\/wp-content\/uploads\/2009\/04\/fig1-1.png 497w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>From DB2 V9.5 in addition to the inspect utility and offline\u00c2\u00a0<code>table reorg<\/code>, you can now build a dictionary during\u00c2\u00a0<code>LOAD INSERT<\/code>,\u00c2\u00a0<code>LOAD REPLACE<\/code>,\u00c2\u00a0<code>REDISTRIBUTE DATABASE PARTITION GROUP<\/code>,\u00c2\u00a0<code>INSERT<\/code>, or\u00c2\u00a0<code>UPDATE<\/code>\u00c2\u00a0as long as the\u00c2\u00a0<code>COMPRESS\u00c2\u00a0<\/code>table attribute is turned on and compression threshold is met. \u00c2\u00a0DB2 9.5 also includes a new table UDF SYSPROC.ADMIN_GET_TAB_COMPRESS_INFO and a new administrative view SYSIBMADM.ADMINTABCOMPRESSINFO that can give detailed information regarding the compression of each table that is turned on for compression.<\/p>\n<p>DB2 Role based security is yet another features DB2 V9.5 brings to the table. \u00c2\u00a0Role based security is one of the features that was missing in DB2. All its competition : Oracle and MS SQL Server had role based security for a while. Well IBM satisfies that requirement.\u00c2\u00a0Roles simplify the administration and management of privileges by offering a capability equivalent to groups but without the same restrictions.\u00c2\u00a0Using new SQL commands you can grant and revoke authorities to a role and assign users to those roles.\u00c2\u00a0 Roles are very similar to groups, but where groups had to be defined to the operating system or security system, a role is strictly a DB2 object.<\/p>\n<p>DB2 High Availability Disaster Recovery (HADR) got some improvement in DB2 V9.5 too. \u00c2\u00a0IBM introduced configuration utility called db2haicu.\u00c2\u00a0db2haicu has an interactive command-line interface. db2haicu collects configuration information about your cluster, database instance, and machines by asking a series of questions and by directly investigating your system. Once the configuration information collected, db2haicu then creates an abstract model of your clustered environment called the cluster domain.<\/p>\n<p>Recovery Object Management is yet another feature I love in Db2 V9.5. \u00c2\u00a0We all know how annoying it was to manage the old backups, archive logs, load copy images. \u00c2\u00a0There is now an option in DB2 to automatically manage these and delete the obsolete ones.\u00c2\u00a0The DB2 database manager automatically prunes the database history file of entries that exceed the number specified in the\u00c2\u00a0<span class=\"parmname\">num_db_backups<\/span>\u00c2\u00a0configuration parameter and are older than the date specified by the\u00c2\u00a0<span class=\"parmname\">rec_his_retentn<\/span>\u00c2\u00a0configuration parameter. If you set the new configuration parameter\u00c2\u00a0<span class=\"parmname\">auto_del_rec_obj<\/span>\u00c2\u00a0to\u00c2\u00a0<span class=\"option\">ON<\/span>, the database manager will also delete backup images, load copy images, and log files associated with any history file entries that it automatically prunes. Once\u00c2\u00a0<span class=\"parmname\">auto_del_rec_obj<\/span>\u00c2\u00a0is enabled, the system will only perform this maintenance when both the\u00c2\u00a0<span class=\"parmname\">num_db_backups<\/span>\u00c2\u00a0and\u00c2\u00a0<span class=\"parmname\">rec_his_retentn<\/span>\u00c2\u00a0values are exceeded.<\/p>\n<p>DB2 Partitioning is a feature DB2 has been carrying for a while. Pre DB2 V9 had database partition commonly called as DPF . In this architecture the database instance is split into multiple nodes. This\u00c2\u00a0\u00c2\u00a0paid feature\u00c2\u00a0extends the capability of DB2 9 into the parallel,\u00c2\u00a0multi-partition environment, improving the performance and the scalability of very\u00c2\u00a0large databases. This allows very complex queries to execute much faster. DB2\u00c2\u00a0Enterprise 9 with DPF is an ideal solution for managing data warehousing and\u00c2\u00a0data mining environments, but it can also be used for large online transaction\u00c2\u00a0processing (OLTP) workloads. DPF can be logical or physical. In case of logical partition, the partitions reside on the same server and takes advantage if the symmetric multiprocess (SMP) where the CPU, disk and memory are shared among all the partitions. This is called share everything architecture. \u00c2\u00a0Physical partition on the other hand is designed to have each partition one\u00c2\u00a0separate\u00c2\u00a0physical servers where none of the resources are shared and hence is called share nothing architecture. \u00c2\u00a0In DPF, each node is its own instance, but one of the instance is the primary instance. It owns the other instances on the database partitioning facility.\u00c2\u00a0<\/p>\n<p>With DB2 9.x , IBM introduced one more level to partitioning, called table partitioning. This feature was already available in Db2 Z\/os, they now extended that to LUW as well.\u00c2\u00a0The <span><em>table partitioning <\/em><\/span>feature provides a way of creating a table where each\u00c2\u00a0range of the data in the table is stored separately.\u00c2\u00a0Each partition in your partitioned table is stored in a storage object that is also\u00c2\u00a0referred to as a data partition or a <span><em>range<\/em><\/span>. Each data partition can be in the same\u00c2\u00a0table space, separate table spaces, or a combination of both.\u00c2\u00a0A commonly used partitioning scheme is the date, where you may decide to clump together data in data partitions such as by year or month. \u00c2\u00a0One of the benefits of table partition is the improved query performance.\u00c2\u00a0The DB2 optimizer is data partition aware. Therefore, during query execution, only the relevant data partitions are scanned. Eliminating the need to scan data partitions that are not impacted by the query can result in improved performance. \u00c2\u00a0Below diagram illustrates it further :\u00c2\u00a0<\/p>\n<p><a href=\"https:\/\/techsatwork.com\/blog\/wp-content\/uploads\/2009\/04\/tablepartition.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-208\" title=\"tablepartition\" src=\"https:\/\/techsatwork.com\/blog\/wp-content\/uploads\/2009\/04\/tablepartition-300x113.png\" alt=\"tablepartition\" width=\"300\" height=\"113\" srcset=\"https:\/\/techsatwork.com\/wp-content\/uploads\/2009\/04\/tablepartition-300x113.png 300w, https:\/\/techsatwork.com\/wp-content\/uploads\/2009\/04\/tablepartition.png 445w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>Here is quick example of creating table paritioning :<\/p>\n<address> CREATE LARGE TABLESPACE ord_2008_Q1 PAGESIZE 4 K MANAGED BY AUTOMATIC\u00c2\u00a0STORAGE EXTENTSIZE 16 OVERHEAD 10.5 PREFETCHSIZE 16 TRANSFERRATE 0.14 \u00c2\u00a0BUFFERPOOL ibmdefaultbp ;\u00c2\u00a0\u00c2\u00a0<br \/>\nCREATE LARGE TABLESPACE ord_2008_Q2 PAGESIZE 4 K MANAGED BY AUTOMATIC\u00c2\u00a0STORAGE EXTENTSIZE 16 OVERHEAD 10.5 PREFETCHSIZE 16 TRANSFERRATE 0.14 \u00c2\u00a0BUFFERPOOL ibmdefaultbp ;<br \/>\nCREATE LARGE TABLESPACE ord_2008_Q3 PAGESIZE 4 K MANAGED BY AUTOMATIC\u00c2\u00a0STORAGE EXTENTSIZE 16 OVERHEAD 10.5 PREFETCHSIZE 16 TRANSFERRATE 0.14 \u00c2\u00a0BUFFERPOOL ibmdefaultbp ;<br \/>\nEXCLUSIVE IN ord_2008_Q1,<br \/>\n\u00c2\u00a0\u00c2\u00a0<\/p>\n<p>CREATE TABLE orders(id INT, shipdate DATE, \u00e2\u20ac\u00a6)<br \/>\nPARTITION BY RANGE(shipdate)<br \/>\n(<br \/>\nPARTITION 1q08 STARTING &#8216;1\/1\/2008&#8217; EXCLUSIVE IN ord_2008_Q1,<br \/>\nPARTITION 2q08 STARTING &#8216;4\/1\/2008&#8217; EXCLUSIVE IN ord_2008_Q2,<br \/>\nPARTITION 3q08 STARTING &#8216;7\/1\/2008&#8242; EXCLUSIVE IN ord_2008_Q3,<br \/>\nPARTITION 4q08 STARTING &#8217;10\/1\/2008&#8242;  ENDING AT \u00e2\u20ac\u02dc12\/31\/2008&#8217; EXCLUSIVE IN ord_2008_Q4<br \/>\n)<\/p>\n<p><span style=\"font-style: normal;\">You can roll-in and roll-out partition when required for example, when you need to add another partition for the Q1 2009, you can simply roll-in new partition by<\/span><\/p>\n<p><span>CREATE LARGE TABLESPACE ord_2009_Q1 PAGESIZE 4 K MANAGED BY AUTOMATIC\u00c2\u00a0STORAGE EXTENTSIZE 16 OVERHEAD 10.5 PREFETCHSIZE 16 TRANSFERRATE 0.14 \u00c2\u00a0BUFFERPOOL ibmdefaultbp ;<br \/>\n<\/span><\/p>\n<p><span>ALTER TABLE orders ADD PARTITION 1q09 \u00c2\u00a0STARTING &#8216;1\/1\/2009&#8242; ENDING AT \u00c2\u00a0&#8217;04\/1\/2009&#8217; \u00c2\u00a0EXCLUSIVE IN ord_2009_Q1;<\/span><\/p>\n<p><span style=\"font-style: normal;\"><em>S<\/em>imilarly\u00c2\u00a0you can roll-out a\u00c2\u00a0partition\u00c2\u00a0by using the DETACH command.<\/span><\/p>\n<p><span style=\"font-style: normal;\"><a href=\"https:\/\/techsatwork.com\/blog\/wp-content\/uploads\/2009\/04\/table-partion-rolledin.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-medium wp-image-211\" title=\"table-partion-rolled in\" src=\"https:\/\/techsatwork.com\/blog\/wp-content\/uploads\/2009\/04\/table-partion-rolledin-300x172.png\" alt=\"table-partion-rolled in\" width=\"300\" height=\"172\" srcset=\"https:\/\/techsatwork.com\/wp-content\/uploads\/2009\/04\/table-partion-rolledin-300x172.png 300w, https:\/\/techsatwork.com\/wp-content\/uploads\/2009\/04\/table-partion-rolledin.png 610w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/span><\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p>\u00c2\u00a0<\/p>\n<p><span style=\"font-style: normal;\">These are just glimpses of the numerous features IBM brings to DB2 V9.x. \u00c2\u00a0For detailed information on the features available on Db2 V9.x visit the IBM site.<\/span><\/p>\n<p><span style=\"font-style: normal;\"><br \/>\n<\/span><\/p>\n<\/address>\n","protected":false},"excerpt":{"rendered":"<p>Did you know that IBM is ending official support for DB2 V8.2 on April 30th, 2009. Yep thats 15 days away and getting extended support will cost you an arm and a leg ! \u00c2\u00a0Lot of customers I know are unhappy because lot of third party applications do not certify DB2 9.x as a support [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-container-style":"default","site-container-layout":"default","site-sidebar-layout":"default","site-transparent-header":"default","disable-article-header":"default","disable-site-header":"default","disable-site-footer":"default","disable-content-area-spacing":"default","footnotes":""},"categories":[3],"tags":[102,97,943,90,92,94,91,93,99,95,103,100,98,96,106,105,104,101,32],"class_list":["post-191","post","type-post","status-publish","format-standard","hentry","category-db2","tag-add-partion","tag-compression","tag-db2","tag-db2-95","tag-db2-compression","tag-db2-hadr","tag-db2-luw","tag-db2-new-features","tag-db2-partition","tag-db2-pure-xml","tag-detach","tag-migration","tag-partition","tag-pure-xml","tag-share-all","tag-share-nothing","tag-smp","tag-table-parition","tag-upgrade"],"_links":{"self":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=191"}],"version-history":[{"count":18,"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts\/191\/revisions"}],"predecessor-version":[{"id":1549,"href":"https:\/\/techsatwork.com\/index.php?rest_route=\/wp\/v2\/posts\/191\/revisions\/1549"}],"wp:attachment":[{"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techsatwork.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}