Está en la página 1de 196

IBM Software

Information Management
An IBM Proof of Technology


IBM DB2 10.1 Administration
for the Experienced Oracle DBA
Presentations
An IBM Proof of Technology
PoT.IM.06.1.027.14

Copyright IBM Corporation, 2004, 2012
US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

Version 7.0 December 7, 2012
Burt Vialpando & Vikram Khatri





DB2 10.1 Administration for the Experienced Oracle DBA Proof of Technology Announcement

DB2 10.1 Administration
for the Experienced Oracle DBA

A Proof of Technology
IBM

DB2

10.1 comes with many powerful features that help ease the day-to-day activities all DBAs
must perform in every IT shop. In this Proof of Technology, specific comparisons with Oracle are made
throughout to help customers better understand the feature and function differences between DB2 and
the competitive Oracle product. This session consists of both presentation and hands-on lab exercises.
Objective
This session enables customers to gain an understanding of IBM DB2 10.1 administration, evaluate the
DB2 10.1 administration vs. Oracle administration, and expedite their purchasing decision process. In
brief, DBAs already working with Oracle, or those considering adding Oracle to their repertoire, will be
able to see just how easy and yet powerful DB2 administration can be.
Audience
This Proof of Technology is for Data Management Architects, Database Administrators and Database
Developers and other decision influencers evaluating IBM technologies either from an Oracle shop or
from those considering Oracle as an alternative.
Core Topics
Introduction & Overview
DB2 vs. Oracle product offering comparison.
Instance Exploration & the CLP
Instance management, Command Line Processor usage & registry variables.
Database Exploration
Create & manage databases, key database features
Data Studio
The IBM DBA and developer Eclipse based GUI tool
CLPPlus & Oracle compatibility
The new DBA command line tool and creating PL/SQL objects and more.
Security Concepts
Authorities, privileges, groups, roles, encryption, label security and more.
Autonomic Computing
Auto memory management, parameter configuration, storage management
and utility throttling, intelligent backup, REORG & RUNSTATS.
Elective Topics
Deep Compression
DB2s industry leading, deep compression capability.
Explain Facilities & the optimizer
Learn the basics of the DB2 optimizer and make your queries run better.
DB2 Workload Manager (WLM)
Meet service level agreements by intelligently sharing all your database
resources between disparate resources
Monitoring (DB2 core capabilities)
Core engine snapshots, SQL functions, db2pd and event monitors
pureXML
What the DBA needs to know about pureXML, an industry unique approach.
Multidimensional Clusters (MDCs)
Maximize query performance with row co-location unique to the industry.
Data Movement Utilities
Core engine load, import, export, db2move, db2look, db2relocatedb & more.
Backup, Restore & Recovery
Core engine functionality for keeping your data safe.
Additional Misc. Topics
Temporal data management, multi-temperature storage, federation, DB2
Cloud offerings
Length
2 full days, 9:00 AM to 5:30 PM






DB2 10.1 Administration for the Experienced Oracle DBA
An IBM Proof of Technology
DETAILED AGENDA

I. CORE TOPICS
Introduction and Overview 10 minutes
Presentation - 10 slides 10 minutes
This covers IBM DB2 and Oracle product offerings. Highlighted is the fact that DB2 offers a complete and
robust set of products for any and every IT shop.

01 - Instance Exploration and Using the CLP 1 hour 30 minutes
Presentation 20 slides 35 minutes
This covers environment and registry variables as well as parameters. This is followed with a lesson on
using the DB2 Command Line Processor to facilitate the labs. Highlighted is ease of instance creation
and ease of CLP use.

Lab 01 Exercises 55 minutes
Operating system directories and files
Start and stop a DB2 instance
CLP introduction
Create a new DB2 instance
Catalog a DB2 instance
Extra exercises: db2support, instance administrative views, db2diag, db2pd, db2cfexp,inspect & the
Generic Control Facility

02 Database Creation and Exploration 1 hour 15 minutes
Presentation 21 slides 45 minutes
This covers the Oracle vs. DB2 system catalog, table space and storage handling differences. It also
discusses some basic administration differences between the two databases. Highlighted is ease of
database creation and basic maintenance.

Lab 02 Exercises 35 minutes
General database commands
DB2 system and local database directories
Creating a database
Exploring various functionality features: database administration views, memory tracking, event
monitoring, database size/capacity
Extra exercises: Altering a table



DB2 10.1 Administration for Experienced DBAs Page 2 of 7 PoT Detailed Agenda

03 Data Studio 1 hour 10 minutes
Presentation 27 slides 35 minutes
IBM Data Studio is the latest in a complete tool for both DBA and developers. Its graphical user interface
is easy to use and powerful. Many of its features will be shown in this presentation and lab topic.

Lab 03 Exercises 45 minutes
Launching Data Studio
Connecting to and managing a database (instance and database management and running SQL)
Exploring tables, overview diagrams, editing and sampling data, generating DDL and table
maintenance
Extra Exercise: Debug a stored procedure
Extra Exercise: Performance profile a stored procedure

04 CLPPlus and Oracle Compatibility 1 hour 5 minutes
Presentation 17 slides 30 minutes
First, the presentation gives an overview of how the new command line interface called the CLPPlus
works. Then a demonstration of Oracle compatibility features is done.

Lab 04 Exercises 40 minutes
Logging on to CLPPlus
Interactive CLPPlus commands
Running a script file in CLPPlus batch mode
Oracle compatibility examples (SQL and PL/SQL examples, migrating an Oracle schema, auto_reval,
currently committed, anonymous block PL/SQL)

05 - Security Concepts 1 hour 10 minutes
Presentation 19 slides 30 minutes
This covers the basic Oracle vs. DB2 security approach differences as well as common terminology. It
also covers DB2 privileges and authorities. Highlighted is ease of use and reasons why DB2s security
approach is a highly affective one.

Lab 05 Exercises 40 minutes
Instance level security
Database level security
Object level security
Using the system catalog security views
User and group overview
Schemas
Viewing database authorities
Column and row level security
Schemas
Extra exercise: db2audit and AUDIT POLICY (instance and database level auditing examples)
Extra exercise: LBAC quick look


DB2 10.1 Administration for Experienced DBAs Page 3 of 7 PoT Detailed Agenda

06 Autonomic Computing 1 hour 20 minutes
Presentation 28 slides 45 minutes
This covers what autonomic computing is and how the following autonomic features work in DB2: Self
Tuning Memory Manager (STMM) Automatic Storage, Utility Throttling and the Configuration Advisor.
Finally, automatic maintenance for RUNSTATS, REORGS and backups is shown. Highlighted are all the
reasons Oracle DBAs will be delighted with the ease of use and power of these features as compared to
Oracle.

Lab 06 Exercises 25 minutes
Self-Tuning Memory Manager (STMM)
Automatic Storage
Autoconfigure
Extra exercise: Automatic Maintenance
Extra exercise: Statistic Profiling
Extra exercise: SYSTOOLS setup






DB2 10.1 Administration for Experienced DBAs Page 4 of 7 PoT Detailed Agenda

II. ELECTIVE TOPICS
07 Deep Compression 60 minutes
Compression - 16 slides - 20 minutes

Lab 07 Exercises - 25 minutes
Compression - 20 minutes
Estimating compression
Full REORG compression
REORG with sample data compression
Automatic dictionary compression
Index Compression

08 - Explain Facilities and the Optimizer 1 hour 10 minutes
Presentation 15 slides 25 minutes
This presentation quickly compares Oracle and DB2 explain facilities, but then dives into discussing the
various DB2 explain utilities and what each is best suited for. An overview of the DB2 optimizer is also
given.

Lab 08 Exercises 45 minutes
Create explain tables
Set up explain example using a UNION ALL view (sub lesson)
Visual Explain in Data Studio
Visual Explain tuning a query (design change example, SQL change example)
Using db2exfmt explain multiple queries at once
Extra exercise: Using db2expln (static mode and dynamic mode examples)
Extra exercises: REBIND and ROW MOVEMENT

09 DB2 Workload Manager (WLM) - 1 hour 40 minutes
Presentation - 38 slides - 60 minutes
The DB2 Workload Manager can manage and control all work executed in your DB2 database. Each
user that requests work is mapped to a workload that in turn controls the amount of CPU, prefetch and
buffer pool used. In addition, thresholds can limit or remap activities dynamically. This allows different
users to get different amounts of resource in the database, even if when executing identical workloads.

Lab 09 Exercises - 40 minutes
Setting up a custom workload manager environment
Setting up and running a simulated workloads (three different users with different WLM capabilities)
Using db2pd for monitoring and reporting
Working with WLM event monitors
Misc WLM lessons



DB2 10.1 Administration for Experienced DBAs Page 5 of 7 PoT Detailed Agenda

10 Monitoring 1 hour
Presentation 15 slides 30 minutes
This topic covers all the DB2 core engine monitoring capabilities: snapshots, SQL table functions, event
monitors, usage lists, db2pd, db2top

Lab 15 Exercises 30 minutes
Snapshot monitoring switch use and a snapshot example
Event monitoring using a statement event monitor to break down the execution of SQL in a stored
procedure
Data Studio stored procedure profiling
Lightweight monitoring using SQL table functions and db2pd

11 DB2 pureXML 1 hour
Presentation 16 slides 30 minutes
This covers what a DBA needs to know about XML in DB2: What XML is, why it is used in the industry
and how to use it in a DB2 database. Highlighted is the fact that DB2 uses a unique hybrid hierarchical
and relational database engine that handles XML in a pure, native format.

Lab 11 Exercises 30 minutes
Creating an XML supporting database and an XML supporting table
Inserting and exploring XML data
Importing & Exporting XML data
Creating indexes on XML data
Extra exercises: Registering and validating with an XSR

12 Multidimensional Clusters (MDCs) 1 hour
Presentation 18 slides 30 minutes
DB2 MDCs can define a table in such a way as to have it clustered on more than one dimension which
can give performance benefits for many query scenarios as well as alleviating the need to reorganize the
data. Since there is nothing like this in Oracle, this flagship DB2 feature is described and an overview is
given of how it works as well as when and why you would use it.

Lab 12 Exercises 30 minutes
Set up CARS and CARS_MDC table example
Explore MDC table space, table and index usage through the catalog
Explore MDC table organization, visually with Data Studio
Use db2batch to test MDC performance
Extra exercise: MDC performance timing tests using stored procedures



DB2 10.1 Administration for Experienced DBAs Page 6 of 7 PoT Detailed Agenda

13 - Data Movement Utilities 1 hour 30 minutes
Presentation 33 slides - 60 minutes
A quick comparison of Oracle vs. DB2 data movement utilities is made. Then DB2 utilities are focused on
by giving an overview of them and their usages. Then each of these is described: export, import, load,
db2move, backup, restore, standby, transportable database, and replication. Emphasis is on showing
rich selection and variety of data movement utilities and options in DB2

Lab 13 Exercises 30 minutes
db2relocatedb
db2move and db2look
SYSPROC.ADMIN_MOVE_TABLE
Data ingest

14 - Backup, Restore & Recovery 2 hours
Presentation - 26 slides 45 minutes
This covers architecture and training comparisons between Oracle and DB2. It then hones in on DB2
functionality for the following: offline backup, history file, offline restore, configure database logging, online
backup, online restore, incremental backup & restore and recover dropped tables. Though powerful in
scope, DB2 ease of use is highlighted.

Lab 14 Exercises 75 minutes
Create test database
Offline backup & restore
Configure database logging
Online database backup
Database restore (recovery mode)
Recover dropped table
Extra exercise: Restore history file
Extra exercise: Move table space location (redirected restore)
Extra exercise: Online table space backup & restore
Extra exercise: Incremental and Delta backup & restore

16 Additional Misc. Topics 1 hour 30 minutes
All topics presentations
Temporal data management - 12 slides - 20 minutes
Multi-temperature storage - 4 slides - 10 minutes
Federation - 4 slides - 10 minutes
DB2 Cloud offerings - 4 slides - 10 minutes

Temporal data management, time travel query Lab - 20 minutes
Temporal data management, build, insert, update, delete
Time travel query examples

Federation Lab - 20 minutes
Show federation through a pre-built script
Show federation through a GUI

DB2 10.1 Administration for Experienced DBAs Page 7 of 7 PoT Detailed Agenda

PoT Revision History
Version Revision Description By Whom When
4.1 PoT update for DB2 9.7 (Cobra) Release
Burt Vialpando
Vikram Khatri
09/01/2009
4.2 PoT update for DB2 9.7 Fix Pack 1 Burt Vialpando 04/05/2010
5.0
PoT update for DB2 9.7 Fix Pack 3, Data Studio
2.2.0.2 and VM image on Windows 7 Enterprise
Burt Vialpando 09/23/2010
5.1 PoT update for DB2 9.7 Fix Pack 5, Data Studio 3.1 Burt Vialpando 10/21/2011
6.0 PoT update for DB2 10.1, Data Studio 3.1.1 Burt Vialpando 04/15/2012
6.1 Minor corrections to materials Burt Vialpando 08/25/2012
7.0 Rewritten for SUSE Linux Burt Vialpando 12/07/2012

2012 IBM Corporation
An IBM Proof of Technology
IBM DB2 10.1 Administration
For the Experienced Oracle DBA
Part 1 Core Topics
Version 7.0 December 7, 2012
Burt Vialpando & Vikram Khatri
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Welcome to the Technical Exploration Center
Introductions
Access restrictions
Restrooms
Emergency Exits
Smoking Policy
Breakfast / Lunch / Snacks location and times
Special meal requirements?
2
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Proof of Technology (PoT) Overview
Part 1 Agenda Core Topics
IBM

DB2

Introduction & Overview


DB2 Instance Exploration & Using the CLP - Lab 01
DB2 Database Creation and Exploration - Lab 02
IBM Data Studio - Lab 03
DB2 CLPPlus and Oracle Compatibility - Lab 04
DB2 Security Concepts - Lab 05
DB2 Autonomic Computing - Lab 06
DB2 Deep Compression - Lab 07
DB2 Explain Facilities & the Optimizer - Lab 08
DB2 Workload Manager - Lab 09
DB2 Monitoring (core engine) - Lab 10
DB2 pureXML

- Lab 11
DB2 Multidimensional Clusters - Lab 12
DB2 Data Movement Utilities (core engine) - Lab 13
DB2 Backup, Restore & Recovery (core engine) - Lab 14
Additional Misc. DB2 Topics - Lab 15
Core Topics
Elective Topics
3
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Proof of Technology
Schedule
Activity
Session
Length
Hour:Mins
Running
Total
Hour:Mins
Start
Time
End
Time
Day 1 PoT greetings, intro and logistics 0:10 0:10 9:00 AM 9:10 AM
DB2 Introduction & overview 0:10 0:20 9:10 AM 9:20 AM
Instance and the CLP presentation 0:35 0:55 9:20 AM 9:55 AM
break 0:10 1:05 9:55 AM 10:05 AM
Lab 01 0:55 2:00 10:05 AM 11:00 AM
Database presentation 0:45 2:45 11:00 AM 11:45 AM
lunch 0:45 3:30 11:45 AM 12:30 PM
Lab 02 0:40 4:10 12:30 PM 1:10 PM
Data Studio presentation 0:35 4:45 1:10 PM 1:45 PM
Lab 03 0:45 5:30 1:45 PM 2:30 PM
break 0:10 5:40 2:30 PM 2:40 PM
CLPPlus & Oracle Compatibility presentation 0:30 6:10 2:40 PM 3:10 PM
Lab 04 0:40 6:50 3:10 PM 3:50 PM
Security presentation 0:30 7:20 3:50 PM 4:20 PM
Lab 05 0:40 8:00 4:20 PM 5:00 PM
Day 2 Autonomic Computing presentation 0:45 0:45 9:00 AM 9:45 AM
Lab 06 (or finish up any other core labs) 0:45 1:30 9:45 AM 10:30 AM
Elective topics 5:25 6:55 10:30 AM 3:55 PM
wrap up and surveys 0:05 7:00 3:55 PM 4:00 PM
4
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
PoT Overview
Scope, assumptions and icons
The scope is for DB2 for Linux

UNIX

and Windows

(LUW)
The goal is to demonstrate specific IBM DB2 methodologies for implementing your current
DBA skill set in DB2
The target audience is the experienced Oracle database administrator (DBA)
Reasonably deep knowledge of relational database principles is assumed
With a technical knowledge of Oracle specifics
The target audience should know the operating system (OS) reasonably well
The labs will be done in a SUSE Linux environment
Knowing how to get around in Unix will be important to the labs
5
Slide with a focus on DB2 only
Slide with an extra cost feature or product
DB2 10.1 latest feature
Presentation icons
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
PoT Overview
Using Vmware Stay in full screen mode
If you ever get out of full screen mode click on this icon
6
2012 IBM Corporation
An IBM Proof of Technology
IBM DB2 Introduction & Overview
10 slides
Burt Vialpando
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 for Linux UNIX and Windows Packaging
DB2 editions
DB2 10.1 Editions
DB2 Express-C (no cost download and deploy - optional license available)
Windows, Linux, Solaris
4 GB memory, 2 cores
DB2 Express Edition
Windows, Linux, Solaris, IBM AIX

, HP-UX, Linux on system z


8 GB memory, 4 cores
DB2 Developer Edition
Easy licensing to support all the features a DB2 developer would need
DB2 Workgroup Server Edition
Windows, Linux, Solaris, IBM AIX, HP-UX, Linux on system z
64 GB memory, 4 sockets, 16 cores
DB2 Enterprise Server Edition
Windows, Linux, Solaris, IBM AIX, HP-UX, Linux on system z
No limit on memory and CPU
DB2 Advanced Enterprise Server Edition
Same as DB2 ESE but with many more features licensed
8
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 for Linux UNIX and Windows Packaging
DB2 OS platforms
OS Software Hardware
AIX AIX Version 6.1 (64-bit kernel required)
AIX Version 7.1 (64-bit kernel required)
64-bit Common Hardware Reference Platform
(CHRP) architecture, excluding POWER3

All processors that are capable of running the


supported AIX operating systems
HP-UX HP-UX 11iv3 (11.31) Itanium

based HP Integrity Series Systems
Linux Red Hat Enterprise Linux 5 Update 6
Red Hat Enterprise Linux 6
SUSE Linux Enterprise Server 10 SP3
SUSE Linux Enterprise Server 11 SP1
x86, 32-bit Intel

and AMD processors
x64, 64-bit AMD64 & Intel EM64T processors
POWER

(System i

, System p

, and POWER
Systems that support Linux)
IBM System z196

,IBM System z9 or z10

Solaris Solaris 10 (64-bit kernel required) UltraSPARC or SPARC64


Solaris x64 (Intel 64 or AMD64)
Windows XP Professional, Enterprise, Ultimate
Vista Business, Enterprise, Ultimate
Windows 7 Professional, Enterprise,
Ultimate
(all above either 32-bit or 64-bit)
All Intel and AMD processors capable or running
the supported Windows operating systems,
32-bit and 64-bit.
9
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 for Linux UNIX and Windows Packaging
Features and functions supported by edition part 1
Feature / Function DB2 Express-C DB2 Express DB2 Workgroup DB2 Enterprise
Server
DB2 Advanced
Enterprise Server
IBM Data Studio YES YES YES YES YES
pureXML Storage YES YES YES YES YES
Temporal Data Mgmt / Time Travel Query * YES YES YES YES YES
Compression for Backup YES YES YES YES YES
Row Column Access Control * No YES YES YES YES
Label Based Access Control No YES YES YES YES
SQL Replication No YES YES YES YES
High Availability Disaster Recovery
(with Tivoli System Automation)
No YES YES YES YES
Online Reorg No YES YES YES YES
Advanced Copy Services No YES YES YES YES
Multi-Temperature Storage * No No No YES YES
Materialized Query Tables No No No YES YES
Multi-Dimensional Clustering No No No YES YES
Query Parallelism No No No YES YES
Connection Concentrator No No No YES YES
Table Partitioning No No No YES YES
Plan Lockdown No No No YES YES
Scan Sharing No No No YES YES
10
*
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 for Linux UNIX and Windows Packaging
Features and functions supported by edition part 2
Feature / Function DB2 Express-C DB2 Express DB2 Workgroup DB2 Enterprise
Server
DB2 Advanced
Enterprise Server
DB2 pureScale No No YES W/ pureScale Feature W/ pureScale Feature
Row Compression (with index, XML, etc.) No No No With Storage
Optimization Feature
YES
Geodetic Extender No No No Geodetic Feature Geodetic Feature
Homogenous Q Replication No No No No YES (restricted to LUW only)
Workload Management No No No Partial (monitoring) YES
Continuous Data Ingest * No No No No YES
InfoSphere Data Replication No SPP SPP SPP YES
InfoSphere Optim Performance Manager
(with Extended Insight)
No SPP SPP SPP YES
InfoSphere Optim Configuration Manager No SPP SPP SPP YES
InfoSphere Optim Query Workload Tuner No SPP SPP SPP YES
InfoSphere Optim pureQuery Runtime for
LUW
No SPP SPP SPP YES
InfoSphere Optim Data Architect No SPP SPP SPP YES (10 users)
11
*
SPP = Separately purchasable product
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 for Linux UNIX and Windows Packaging
Optimized for your business
Pick the DB2 that fits your needs
1. A single machine with a dedicated database
Linux, Unix and Windows
Grow by adding more processors and more memory (scale up)
Start small and grow bigger by simply using more disk space
Best suited for the majority of business requirements, from small to the large scale
2. A multiple logical or physical machine with partitioned database (DPF)
Linux, Unix and Windows
Grow by adding more logical or physical nodes (scale out)
Best suited for data warehousing needs
IBM Smart Analytics System (ISAS) is a pre-configured appliance for different classes
3. A multiple logical or physical machines with a shared database (pureScale)
AIX and Linux
Optimized for the OLTP operations with a focus on the continuous availability
A shared database used by all DB2 members
Grow by adding logical or physical DB2 members
12
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 for Linux UNIX and Windows Packaging
Installation methods & utilities
Installation Method Windows UNIX
DB2 Setup Wizard Yes Yes
db2_install script No Yes
Response File ( Silent ) Installation
(db2setup r)
Yes Yes
Manual installation No Yes
To install DB2:
On UNIX, you can be a non-root user
On Windows, you need to be an Administrator
Tool Comment
db2prereqcheck Checks system prerequisites before an install
db2rfe Enable root functionality later after a non-root install
db2rspgn Generate a response file from a current install should one not exist
db2iprune Prune files from install for unused features making it smaller
db2val Check the state of an install
db2_deinstall Uninstall features, can use a response file UNIX only
db2unins Uninstall features, can use a response file Windows only
InstallFixPack Install fix packs
Linux & UNIX Hardware & OS
Minimum Requirements:
Resource Oracle
Requirement
DB2 Requirement
CPU 1 - 1GHz processor 1 - 1GHz processor
RAM 1GB 512 MB min. (1GB
recommended)
Swap space 1.5GB 50% of RAM
Temp space 200MB 60MB
System drive - 40MB
13
Install related tools
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Tools & Products Comparison
Administration & development tools & products
Oracle IBM Description of Usage
Oracle 11g Enterprise DB2 Enterprise Server 10.1 CE Relational Database Management System
Real Application Clusters pureScale CE Active / Active multi-node processing
Enterprise Manager
Database Configuration
Assistant
Administration Assistant
IBM Data Studio XT
InfoSphere Optim Performance Manager
InfoSphere Optim Configuration Manager
DB2 Recovery Expert
GUI database master console, control,
management, recovery, etc.
SQL Developer IBM Data Studio XT GUI command line and procedure developer
SQL*Plus CLPPlus CE
DB2 Command Line Processor (CLP) CE
OS level line oriented database access
SQL Analyzer DB2 Visual Explain XT (with IBM Data Studio)
db2exfmt, db2expln CE
InfoSphere Optim Query Workload Tuner
Query analysis & visual explains
Oracle Forms Developer DB2 Table Editor Developer Suite Forms creation, development, usage
Resource Manager DB2 Workload Manager CE Workload control
Database Replay InfoSphere Optim Query Capture and Replay Workload capture and testing replay
CE = Part of Core Engine
XT = Extra tool that comes with the Core Engine
14
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Tools & Products Comparison
High availability, communication & connectivity products
Oracle IBM Description of Usage
Data Guard High Availability / Disaster Recovery CE High availability and/or disaster recovery solution
Transparent Gateway
Access Managers for IBM
CICS, IBM Information
Management System, DB2
IBM InfoSphere Federation Server
IBM DB2 Connect
DB2 Homogeneous Federation CE
Federation & information integration
Advanced Replication
Message Broker
DB2 SQL Replication CE
IBM InfoSphere Change Data Capture
InfoSphere Replication Server
IBM MQSeries

Replication, message queuing


Internet Commerce Server
Internet Application Server
WebSphere Portal Studio
IBM Enterprise Information Portal
Internet servicing, connection
Spatial & Intermedia
Time Series
IBM Content Manager family
IBM FileNet

family
Image searching, content management, process
management
Hyperion IBM Cognos

Business Intelligence (BI) and Reporting Server


CE = Part of Core Engine
15
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Tools & Products Comparison
Internet, java, data warehousing & OLAP tools & products
Oracle IBM Description of Usage
JDeveloper
Designer
Portal (WebDB)
Objects
IBM Data Studio XT
InfoSphere Data Architect
Java & web development & object modeling
Data Mart Suite
Warehouse Builder
InfoSphere Warehouse
InfoSphere Change Data Capture
InfoSphere DataStage

InfoSphere Replication Server


DB2 AlphaBlox

IBM OmniFind

Data Warehouse building , data movement,


management
Pure*Integrate InfoSphere QualityStage Data cleansing
Express Server
Express Objects
InfoSphere Warehouse Cubing Services
Cognos Business Intelligence
OLAP, data marts, cubes
Discoverer
Reports
Cognos Business Intelligence
IBM DataQuant
Reporting - in all its forms
Data Mining Suite
Darwin
InfoSphere Mining with IBM Cognos

InfoSphere Streams
IBM Smart Analytics System
Data mining
XT = Extra tool that comes with the Core Engine
16
2012 IBM Corporation
An IBM Proof of Technology
Lab 01 INSTANCE
20 slides
Burt Vialpando
DB2 Instance Exploration and Using
the Command Line Processor (CLP)
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Server Architecture
The DB2 instance overview
A DB2 Instance is also called a Database Manager or DBM
An instance performs the following (for the databases they manage):
Overall database memory usage & defaults:
Utility impact limits
Sort, hash, Java and other heap limits and defaults
Monitoring:
Health
Snapshot
Auditing (instance level)
Diagnostic & notification logging
Connection management
User authentication
Communication protocols
Agents & pooling management
Transaction management
Workload Management dispatcher service
Federation control
Distributed transaction management (DPF)
Inter-partition communication (DPF)
18
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Server Architecture
The Oracle unique System ID (SID)
An Oracle SID is a logical access to database physical structures
An Oracle SID in a (non-RAC) environment can
Access only one database at a time
Oracle terms " instance" & " database" often used interchangeably by DBAs &
users, however:
Instance is logical and related to memory and processes
Database is persistent and related to files
19
pfile / spfile
Data
files
Redo log
files
Buffer
Pools
Data
cache
Dictionary
Database 2
Oracle Instance 2
Processes
Archived
Log files
Redo log
files
Control file
Password file pfile / spfile
Data
files
Redo log
files
Buffer
Pools
Data
cache
Dictionary
Database 1
Oracle Instance 1
Processes
Archived
Log files
Redo log
files
Control file
Password file
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Server Architecture
The DB2 instance
A DB2 instance is a logical access to database logical and physical structures
A DB2 instance (non pureScale) can access more than one database at a time
Note: most production instances manage only one database
In a DB2 instance
Many Engine Dispatchable Units (EDUs) are shared by all databases
Instance configuration parameter (dbm cfg) affects all databases in that instance
Database configuration parameters (db cfg) exist for each database
DB2 terms " instance" & " database" have very distinct meanings
20
DBM config
Data
Files
Log files
DB Thread
EDUs
Buffer
Pools
Buffer
Pools
Catalog DB config
Database 1
Log files
Data
Files
DB Thread
EDUs
Buffer
Pools
Buffer
Pools
Catalog DB config
Database 2
DB2 Instance
Process
EDUs
DBM
Thread
EDUs
Archived
Log files
Archived
Log files
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Server Architecture
Oracle processes list (not exhaustive)
* Can be many
Level Process Purpose
Required Server Server processes - Either dedicated or shared, performs requests for the client
SMON System monitor - Space maintenance & crash recovery agent
PMON
CKPT
Process monitor - Cleans up failed user processes and frees of resources of these processes
Check point - Flushes modified data from the buffer cache to the disk and updates the control
file and data files by doing a header update (DBWn actually does the data file write)
DBWn * Database writer - Writes the dirty buffers from the database buffer cache to the data files on disk
LGWR Log Writer - Performs sequential writes from the redo log buffer to the redo log files on disk
Optional MMAN Memory Manager - SGA & PGA memory broker
MMOM Manageability Monitor - AWR problem detection and self tuning
MMNL Manageability Monitor Light - Transfer statistics AWR collects to disk
RECO Resolve for distributed databases - (DISTRIBUTED_TRANSACTIONS mode)
ARCn * Archive log monitor - Writes redo logs to archive areas (in ARCHIVE LOG mode)
SNPn * Snapshot & job scheduler
Dnnn * & Snnn * Dispatchers - shared server processing agent
CTWR Change Tracking Writer - RMAN support
CJQ0, J000 Job Coordinator & Scheduler - assigns jobs to the job queue processes
DBRM Resource Manager
DIA0 Diagnosability Process Zero - hand detection and deadlock resolution
DIAG Diagnostic Dumps
SMCO Space Management Coordinator - proactive space allocation and reclamation
ASM Automatic Storage Management - related processes are ASMB, ARB, RBAL
EMNC Event Monitor - event management coordination
FBDA Flashback Data Archive
DMON Data Guard Broker
21
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Server Architecture
DB2 Engine Dispatchable Unit list (not exhaustive)
* Can be many
Level EDU Purpose Similar to in
Oracle
Instance
db2sysc Main System controller Server
PROCESS db2wdog Watchdog - UNIX systems only, handles abnormal termination PMON & SMON
db2fmp Fenced process executes stored procedures and user defined functions
db2acd Autonomic computing for health monitor and automatic maintenance MMOM & MMNL
Instance
db2resync Re-sync agent - scans the global re-sync list RECO
THREAD db2cart Invokes user exits to archive or retrieve log files (Archive Log) ACRn
db2fmd Fault Monitor keeps instances and monitoring up
db2ipccm Inter-process listener - handles local client programs Listener
db2tcpcm, &
others *
TCP/IP remote communication listener, & other listeners (depending upon which
protocols are specified in the DB2COMM variable)
Listener
db2disp Client connection concentrator dispatcher Dnnn & Snnn
db2wlmd
db2wlmt
db2wlmtm
Workload Manager collects Workload Manager statistics
Workload Manager Dispatcher scheduling thread
Workload Manager Dispatcher timer thread
DBRM
Database
db2loggr Log reader - manipulates log files to handle transaction processing & recovery PMON
THREAD db2loggw Log writer flushes logs from log buffer to transaction logs on disk LGWR
db2stmm Self-tuning memory manager MMAN
db2uext2 Archive log monitor ARCn
db2pfchr* Buffer pool pre-fetcher
db2pclnr* Buffer pool page cleaner DBWn & CKPT
db2taskd Background database tasks SNPn
db2logts Table space tracking logs which table spaces are in which logs CTWR
db2hadrp/s High Availability and Disaster Recovery primary and secondary server threads DMON
Application
db2agent * Various agent threads Server
22
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Server Architecture
DB2 listing EDUs (processes and threads)
db2pd -edus
Oracle note:
On the OS use: ps ef | grep [SID]
or
in SQL*Plus use: v$bgprocess
23
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Memory Architecture (with background processes)
Oracle Linux/UNIX example
Redo Log
Buffer
SGA
Oracle Instance
Shared Pool
Library Cache
Dictionary Cache
PMON DBWR SMON CKPT LGWR others others others
User
Process
Server
Process
PGA
Oracle Database
Oracle Session *
sort_area_size
hash_area_size
bitmap_merge_area_size
create_bitmap_area_size
MMAN MMOM CKPT ARCn SNPn ASM
* Dedicated Server example
Java Pool
(optional)
Large Pool
(optional)
Data Buffer Cache
db_2k_cache_size
db_4k_cache_size
keep recycle
db_cache_size - default
(e.g. db_block_size = 8k)
db_16k_cache_size
db_32k_cache_size
Streams Pool
(optional)
Other
PL/SQL Area
SQL Area
Control Structures
Latches / locks
Background processes
pfile, control files, data files, etc.
Result Cache
BV
24
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Memory Architecture (with background EDUs)
DB2 Linux/UNIX example
* Database Partitioning Feature ** Can be controlled by DB2 Self-Tuning Memory Manager
DB2 Instance
Monitor Heap
mon_heap_sz
db2agent
DB2 Database
DB2 Application
App. Shared Memory
aslheapsz dir_cache
App. Private Memory
agent_stack_sz
applheapsz
sortheap
App. Global Memory
app_ctl_heap_sz (WF *)
Audit Buffer
(optional)
audit_buf_sz
db2fmtlg
db2wdog
db2gds
db2ipccm
db2dlock db2pclnr db2loggr db2loggw
Buffer Pools **
4k buffer pool
8k buffer pool
16k buffer pool
4k buffer pool
4k buffer pool
32k buffer pool
Database Heap
logbuffsz
catalog_cache_sz
Utility Heap
util_heap_sz
Package
Cache **
pckcachesz
Lock List **
locklist
Sorting **
sheapthres_shr
8k buffer pool
Other memory
areas
db2pfch
db2resyn
db2tcpcm
db2sysc
others
others
local
remote
db2syslog
db2rebal
FCM Buffs (DPF *)
(optional)
fcm_num_buffers
rqrioblk
sortheap
database_memory
java_heap_sz
stmtheap
stat_heap_sz
Instance processes & threads
Database threads
BV
25
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Parameter Configuration
Comparison
Oracle Parameter Fact DB2 Parameter Fact
300+ parameters for 11g 120+ DB and 90+ DBM parameters for 10.1
PFILE required at database creation Generates parameters on its own at instance and
database creation
DBAs use templates or pre-created PFILEs to
create a database
DBAs use AUTOCONFIGURE to generate at
database creation
DBAs need to convert PFILE to SPFILE at
some point manually
The DB and DBM have SPFILE like functionality
by default
DBAs need to know those parameters that are
static as they can only be changed with
SCOPE=SPFILE
An instance restart is needed to make this take
affect
DBAs do not concern themselves with scope as
they can change any parameter any time
Those parameters that require an instance restart
or a database reactivation will display a message
stating this
DBAs check for scope change by looking in two
dynamic views:
v$parameter (current instance setting)
v$spparameter (spfile values)
DBAs see parameters that have not been changed
(deferred value) in the current instance and
database by using two administrative views:
sysibmadm.dbcfg
sysibmadm.dbmcfg
26
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Registry / Environment Variables
DB2s unique approach
DB2 registry variables
Manage DB2 customization without the need for many OS environment variables simplify
your .profiles
Allow for changes to DB2 without a system reboot
Use db2set or use the Configuration Assistant to manage
DB2 uses only 2 specific environment variables (OS controlled): db2path, db2instance
Oracle environment variables
Variable example Function
db2adminserver
db2comm
db2include
db2instance (e)
db2instdef
db2owner
db2path (e)
db2system
Specifies which instance runs the admin. server
Started communications manager
Path to include in SQL searches
Current instance
Default instance
Instance owning machine
Directory where product is installed
Server name id
Variable example Function
ora_cwd
ora_sid_pfile
oracle_home
oracle_sid
oracle_base
nls_lang
rdbms_archive
rdbms_control
sqlpath
Current Oracle directory
Path to init.ora file
Environment where products run
Default Instance (SID)
Root of the Oracle directory tree
Language, character & territory set
Location of backup database files
Location of backup database control files
Location of SQL scripts
27
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
> db2set all [displays all set variables, including global ones]
> db2set h [displays help detail on this command]
> db2set lr [displays all available variables, set or not]
> db2set db2bqtime=2 [sets a particular variable to a particular value]
> db2set db2bqtime= [resets the value to its default]
db2 => !db2set all [interactive CLP mode requires OS ! invocation method]
[i] DB2COMM=TCPIP
[i] DB2AUTOSTART=YES
[g] DB2SYSTEM=potserver
[g] DB2ADMINSERVER=dasusr1
db2set
The profile Registry Variable interface
28
LEGEND
[e] Environment Variables OS controlled
[g] Global Registry Variables effects entire server
[i] Instance Registry Variables effects current instance
[n] Node Registry Variables (not shown) node controlled
[u] User Registry Variables (not shown) user controlled
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Command Line Processor (CLP)
The three modes
The CLP has three modes:
Mode Comments
Command OS prompt, prefaced with a db2 before each command
OS commands can be mixed with DB2 commands:
> db2 get dbm cfg | grep AUTO
> db2 select * from mytable > outfile.txt
Batch OS prompt, db2 and an -f option to designate the input file:
> db2 f inputfile.sql
Interactive CLP prompt, default: db2 =>
Can run OS commands with a !
> db2 [enter]
db2 => get dbm cfg
db2 => select * from mytable
db2 => !ls a
29
Windows Note:
The Windows operating system
requires an OS shell to run DB2
commands. It is invoked using
this: db2cmd
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
CLP Help
> db2 ?
db2 [option ...] [db2-command | sql-statement |
[? [phrase | message | sqlstate | class-code]]]
option: -a, -c, -d, -e{c|s}, -finfile, -i, -lhistfile, -o, -m, -n,
-p, -q, -rreport, -s, -t, -td;, -v, -w, -x, -zoutputfile.
db2-command:
ACTIVATE DATABASE GET CONTACTS REDISTRIBUTE DB PARTITION
ADD CONTACT GET/UPDATE DB CFG REFRESH LDAP
ADD CONTACTGROUP GET/UPDATE DBM CFG REGISTER LDAP
ADD DATALINKS MANAGER GET DBM MONITOR SWITCHES REGISTER XMLSCHEMA
etc.,
GET CONTACTGROUP RECONCILE XQUERY
GET CONTACTGROUPS RECOVER
Note: Some commands are operating system specific and may not be available.
For further help:
? db2-command - help for specified command
? OPTIONS - help for all command options
? HELP - help for reading help screens
The preceding three options can be run as db2 <option> from an OS prompt.
!db2ic - DB2 Information Center (Windows only)
This command can also be run as db2ic from an OS prompt.
> db2 ? sql0100 [this is an example of an SQL message help request]
Tip:
db2 ? help helps you
read and use help
screens
-----------------------------------
db2 help launches the
Information Center
Tip:
db2 ? help helps you
read and use help
screens
-----------------------------------
db2 help launches the
Information Center
Tip:
db2 ? help helps you
read and use help
screens
-----------------------------------
db2 help launches the
Information Center
30
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Command Line Processor Option Settings
Backend process wait time (seconds) (DB2BQTIME) = 1
No. of retries to connect to backend (DB2BQTRY) = 60
Request queue wait time (seconds) (DB2RQTIME) = 5
Input queue wait time (seconds) (DB2IQTIME) = 5
Command options (DB2OPTIONS) =
Option Description Current Setting
--------- ---------------------------------------------- --------------------
-a Display SQLCA OFF
-c Auto-Commit ON
-d Retrieve / display XML declarations OFF
-e Display SQLCODE/SQLSTATE OFF
-f Read from input file OFF
-i Pretty print XML data OFF
-l Log commands in history file OFF
-m Print number of rows OFF
-n Remove new line character OFF
-o Display output ON
-p Display interactive input prompt ON
-q Preserve whitespace for XML data OFF
-r Save output to report file OFF
-s Stop execution on command error OFF
-t Set statement termination character OFF
-v Echo current command OFF
-w Display FETCH/SELECT warning msgs ON
-x Suppress printing of column headings OFF
-z Save all output to output file OFF
db2 => list command options
CLP Options
Tip:
Leaving the interactive mode
turns off your db2option settings!
-------------------------------------------
? options is different from list
command options
-------------------------------------------
Most db2option switches can be
temporarily overridden in a batch
mode
Tip:
Leaving the interactive mode
turns off your db2option settings!
-------------------------------------------
? options is different from list
command options
-------------------------------------------
Most db2option switches can be
temporarily overridden in a batch
mode
Tip:
Leaving the interactive mode
turns off your db2option settings!
-------------------------------------------
? options is different from list
command options
-------------------------------------------
Most db2option switches can be
temporarily overridden in a batch
mode
Setting CLP option examples
db2 => update command options using a OFF [turns this off]
db2 => set DB2OPTIONS=+a [Windows alternative for the same thing]
db2 => export DB2OPTIONS=+a [UNIX alternative for the same thing]
31
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
CLP Prompt Customization
> db2set db2_clpprompt= DB2 CLP %da@%d: [sets the prompt to look like this]
Database Connection Information
Database server = DB2/LINUXX8664 10.1.2
SQL authorization ID = DBAPOT
Local database alias = SAMPLE
DB2 CLP DBAPOT @SAMPLE:
Variable Value Assigned During Runtime
%i The local alias of instance currently attached
%d The local alias of database currently connected
%ia The authid of the current instance attachment
%da The authorization ID of the current database connection
%n New line
> db2set db2_clpprompt =" Yes Master? "
> db2set db2_clpprompt=" (Instance: %i, Database: %d):"
CLP RUNTIME VARIABLES
32
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
CLP History and runcmd Commands
Command history [reverse] [n] displays the last commands cached
20 ascending is default display and 20 is the default cached
Set db2_clp_histsize registry variable to change cache size
runcmd runs the numbered command from the history cache
These ONLY work in interactive mode
db2 => history
db2 => runcmd 3
db2 => history
1 connect to sample
2 list command options
3 select * from sysibm.sysdummy1

20 select * from customer


db2 =>
db2 => runcmd 3
IBMREQD
-------------
Y
1 record(s) selected
db2 =>
33
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
CLP Edit Command
Command edit [editor] [n] invokes editor with
Last history command [if not specified]
Number n history command [if specified by number n]
Number n from last history command [if specified with negative number n]
edit and edit -1 are the same command
Editor used default order
Editor named in the edit command
Editor specified by the DB2_CLP_EDITOR registry variable
Editor specified by the VISUAL environment variable
Editor specified by the EDITOR environment variable
Windows - the Notepad editor; UNIX- the vi editor
After editor is closed
You will be asked to execute the above command (y/n)?
y executes the command and caches it for history retrieval
n does not execute the command, but caches it for history retrieval
34
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
CLP Command Window
Batch mode example
Batch or shell files can execute saved DB2 command files
These can produce yet other output files for various purposes
Here is a Generate RUNSTATS commands example
-x to suppress column headings
-td to set the end of command delimiter as @
-f to indicate input file name
-z to indicate output file name
db2 connect to sample
db2 -x -td@ -f CLPxmp01.db2 -z CLPxmp01OUT.txt
db2 connect reset
CLPxmp01.sh
CLPxmp01.db2 CLPxmp01OUT.txt
select 'RUNSTATS ON TABLE'||
rtrim(tabschema)||'.'||tabname||
ON ALL COLUMNS ALLOW WRITE ACCESS;'
from sysstat.tables
where card = -1@
RUNSTATS ON TABLE SYSIBM.SYSVIEWSON
ALL COLUMNS ALLOW WRITE ACCESS;
RUNSTATS ON TABLE SYSIBM.SYSVIEWDEPON
ALL COLUMNS ALLOW WRITE ACCESS;
etc.
35
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
CLP Command Window
SQLCOMPAT Running Oracle scripts with the CLP
First you need to set up DB2 enabling an Oracle environment
See slide: CLPPlus - Getting started by enabling an Oracle environment in DB2:
Then, you can do the following:
PLSQL_script01.sql
CREATE PACKAGE BODY ClassPackage AS
PROCEDURE AddStudent(p_StudentID IN students.id%TYPE,
p_Course IN classes.course%TYPE) IS
BEGIN
INSERT INTO reg_students (student_id, course)
VALUES (p_StudentID, p_Course);
COMMIT;
END AddStudent;
(more procedures and functions)
/
The CLP understands the PL/SQL backslash /
Run the PL/SQL script using the CLP
36
db2 SET SQLCOMPAT PLSQL
db2 -f PLSQL_script01.sql
2012 IBM Corporation
An IBM Proof of Technology
DB2 Database Creation and
Exploration
22 slides
Burt Vialpando
21 slides
Burt Vialpando
Lab 02 DATABASE
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Database Administration Basics
Manual database creation step by step comparison
Oracle DB2
#1 Set environment variables:
ORACLE_SID, ORACLE_BASE,
ORACLE_HOME
Set registry variables:
DB2INST, DB2INSTPROF
(DB2PATH is set during install)
#2 Create password file
(using orapwd)
N/A DB2 uses external authentication, no
need to do this
#3 Create pfile N/A DB2 invokes autoconfigure automatically
#4 STARTUP NOMOUNT DB2START (to start the instance)
#5 CREATE DATABASE CREATE DATABASE
#6 Build data dictionary views
(using catalog.sql)
N/A DB2 CREATE DATABASE does this
#7 Build PL/SQL packages
(using catproc.sql)
N/A DB2 CREATE DATABASE does this
#8 Update tnsnames.ora with SID
(or use other Oracle Net method)
Optional CATALOG DATABASE in another
instance
38
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Database Administration Basics
Starting/stopping instances, databases and applications comparison *
Oracle DB2
STARTUP 1. DB2START (or START DBM)
2. ACTIVATE DATABASE (or CONNECT TO
DATABASE)
STARTUP NOMOUNT DB2START
1. ALTER DATABASE MOUNT
2. ALTER DATABASE OPEN
ACTIVATE DATABASE
SHUTDOWN (or SHUTDOWN NORMAL) DB2STOP (or STOP DBM)
SHUTDOWN TRANSACTIONAL 1. QUIESCE INSTANCE DEFER
2. DB2STOP
SHUTDOWN IMMEDIATE DB2STOP FORCE
SHUTDOWN ABORT DB2_KILL
ALTER SYSTEM QUIESCE RESTRICTED QUIESCE DATABASE [IMMEDIATE / DEFER]
ALTER SYSTEM KILL SESSION [SID, SERIAL] FORCE APPLICATION [ALL / HANDLENAME]
* These are rough equivalents only to give you a basic idea of DB2 capability
39
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Database Administration Basics
DB2 automating instance and database availability
DB2 Utility or
Command
Description Authority
Required
db2iauto UNIX only. Autostarts a DB2 instance upon a UNIX
system boot.
In Windows, you set the service property for that instance
to "startup automatic (as an administrator).
root
or
SYSADM
db2fm UNIX only. Configures the fault monitor. Once the DB2
instance is up, you use the DB2 fault monitor to keep it
up.
SYSADM
dasauto The DB2 utility that will autostart the DB2 Administration
Server.
DASADM
autorestart A database configuration parameter. If you set this, the
instance that manages that database will automatically
reactivate it in the event it abnormally ended and initiate a
crash recovery of that database.
SYSADM
or
DBADM
sqle_activate_db
sqle_deactivate_db
Application programming interfaces (APIs) that an
application can use to activate or deactivate a database.
You application server and applications can control this
functionality if desired.
SYSADM,
SYSCTRL
or
SYSMAINT
40
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Database Administration Basics
Oracle data dictionary vs. DB2 system catalog
Oracle Dictionary vs. DB2 System Catalog contents *
Oracle Data Dictionary Contents
SYS.xxxx$ - Base Tables
SYS.V_$ or V$ - Administrative views
SYS.GV_$ or GV$ - Administrative views (RAC)
DBA_% - System views all database
ALL_% - System views all owned
USER_% - System views all accessible
Oracle 11g can have 1,600+ entries in the dictionary
DB2 System Catalog Contents
SYSIBM - Base tables
SYSCAT - Read-only views, defined for
catalog base tables
SYSSTAT - Updateable views
SYSIBMADM - Administrative views (similar to V$_)
All Oracle dictionary views *
DB2 10.1 has 415+ entries in the catalog
SELECT column-name FROM user_tables;
SELECT column-name FROM user_views;
SELECT column-name FROM syscat.tables
WHERE OWNER=user AND
TYPE=T;
SELECT column-name FROM syscat.tables
WHERE OWNER=user AND
TYPE=V;
* Registry variable DB2_COMPATIBILITY_VECTOR=ORA set before creation of a DB2 database will create an
additional 100+ Oracle dictionary views under SYSIBMADM. These include DICT*, ALL*, DBA*, USER*, etc.
41
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Physical Database Storage Model
Storage structure hierarchy differences, DB2 vs. Oracle
Oracle & DB2 share a similar physical database storage model
Below shows the slight differences in concept & semantics
42
OS Block
Logical
Physical
Oracle Block
Extent
Segment
Table space
Database
Datafile
Oracle
Storage Structure Hierarchy
OS Block
Logical
Physical
DB2 Page
Extent
Object
Table space Container
DB2
Storage Structure Hierarchy
Storage Group (optional)
Database
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Physical Database Storage Model
Table space types, DB2 vs. Oracle
* DMS & SMS are used under the covers of an automatic storage table space
Oracle Table Space Types
System & sysaux
Non-System
Temporary
Dictionary Managed
Locally Managed (default)
Permanent
Bigfile
Smallfile (default)
Dictionary Managed
Locally Managed (default)
Transportable
Undo
DB2 Table Space Types
Database Managed (DMS) *
Regular
Temporary (system & user)
Large
System Managed (SMS) *
Temporary (system & user)
Oracle table space storage settings
INITIAL
NEXT
MINEXTENTS
MAXEXTENTS
PCTINCREASE
FREELIST/GROUPS
DB2 table space storage settings
PAGESIZE
EXTENTSIZE
PREFETCHSIZE
OVERHEAD
TRANSFERRATE
BUFFERPOOL
43
Storage Group
Data Tag
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Physical Database Storage Model
DB2 table space creation & review
DB2 table space creation
Only SYSADM & SYSCTRL authorities can perform this
Only created & active buffer pools may be used in a CREATE TABLESPACE command
Buffer pools are dynamic & take immediate affect when added, dropped or altered
DFT_PREFETCH_SZ can be set to let DB2 calculate optimal prefetching
To review information on table spaces, use:
Data Studio (data source explorer)
SYSCAT.TABLESPACES catalog view
LIST TABLESPACES command
CREATE [ LARGE / REGULAR / [SYSTEM / USER] TEMPORARY ]
TABLESPACE tablespace-name
PAGESIZE integer
MANAGED BY [ AUTOMATIC STORAGE][ SYSTEM / DATABASE ]
[ system-container / database-container ]
EXTENTSIZE [ no-pages / integer ]
PREFETCHSIZE [ no-pages / integer ]
BUFFERPOOL bufferpool-name
OVERHEAD [no-milliseconds / INHERIT]
TRANSFERRATE [no-milliseconds / INHERIT]
DATA TAG [ integer / INHERIT / NONE]
USING STORAGE GROUP [sto-group-name]

AUTORESIZE YES
;
44
INHERIT means the table
space will get its behavior
from its storage group
CREATE STOGROUP sto-group-name
ON [path]
OVERHEAD no-of-milliseconds
DEVICE READ RATE no-megabytes-second
DATA TAG [integer / NONE]
;
The use of storage groups is
optional if automatic storage
is not used
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Physical Database Storage Model
DB2 container types for DMS & SMS
DMS is for database managed table spaces
All Oracle table spaces translate to DMS type
DMS is like an Oracle locally managed, uniform extent table space
Recommended for user data table spaces
Use AUTORESIZE is like Oracle AUTOEXTEND
Use ALTER TABLESPACEREDUCE to reclaim all space on table space
SMS is for system managed table spaces
Recommended for the catalog and temporary table spaces
Operating system controlled
No database alterations possible to the container(s)
More containers can be added to it only with a redirected restore
DMS - Database Managed SMS - System Managed
File Device
Directory
/database/tablespace/prod1
Oracle note:
Oracle has no equivalent of
an SMS table space
45
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Physical Database Storage Model Feature
Multi-Temperature Storage Support *
Maximize your newest and fastest storage for your most important data
e.g. keep only the data you need for instant access on your solid state storage
Extend the life of your older storage
e.g. keep infrequently used data on it
Utilize storage groups in the automatic storage pool to manage this with ease
Administrative commands make moving data between storage systems easy
Prioritize data by what it is and where it resides
Integrate fully with DB2 Workload Manager and InfoSphere Optim Data Growth solutions
46
Sto_Grp_Hot
SSD RAID
(Very Fast)
Fibre Channel / SAS RAID
(Fast)
SATA RAID
(Medium)
2012 Q1 2011 Q4 2011 Q3 2011 Q2 2011 Q1 2010 Q4 2010 Q1
DB2 Range Partitioned Table
Sto_Grp_Warm Sto_Grp_Cold
tbspc9 tbspc8 tbspc7 tbspc6 tbspc5 tbspc4 tbspc1

FOR MORE DETAILS


SEE MISC. TOPICS
Oracle note:
Oracle ASM does not
have this capability.
* Enterprise Server
Editions only
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Physical Database Storage Model Feature
Temporal Data Management and Time Travel Query
Temporal Data Management gives you:
Time Travel Query capability without the burden of changing the application
or creating complex trigger/function/procedure solutions
Optimized environments for meeting audit and compliance inquiries
Standardized support for temporal INSERT, UPDATE and DELETE operations
Reduced risks, lower costs and DBA time savings
EMPLOYEES_TB
EMPLOYEES_HISTORY_TB
EmpID Dept System_start System_end
12345 M15 05/31/2000 12/30/9999
EmpID Dept System_start System_end
67890 K25 11/15/1995 03/31/2000
12345 J13 11/15/1995 12/31/1998
12345 M24 12/31/1998 05/31/2000
History automatically
maintained by DB2
Temporal Data Management
SELECT Dept FROM employees_tb
WHERE EmpID=12345;
SELECT Dept FROM employees_tb
FOR SYSTEM_TIME
AS OF 01/01/1997
WHERE EmpID = 12345;
See data
as it is
right now
See data
as it was
in the past
Time Travel Query
Oracle note:
Oracle does not have
this capability.
47
FOR MORE DETAILS
SEE MISC. TOPICS
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Physical Database Storage Model Feature
Deep compression* feature highlights
Dictionary based symbol for compressing or decompressing data rows
Lempel-Ziv (LZ) based algorithm creates a static dictionary based at the table level
A single table dictionary is stored within the table object for recurring large domain patterns
Compression is also done adaptively at the page level
Smaller page stored dictionaries are for the ever changing page level patterns
Data resides compressed on pages
On the table space disk giving significant I/O bandwidth savings
In buffer pools giving memory savings & improvement in performance
In recovery log disk & archive log tape
Compression is easy to implement and use
DBA just uses these keywords: COMPRESS YES
Compression done during insert, update, import or load
Table dictionary is built on the fly with Automatic Dictionary Creation after a 1 MB sample
Page dictionaries are built adaptively any time repeating patterns are detected
Compression done in many ways:
48
* Enterprise Server Editions only
FOR MORE DETAILS SEE
COMPRESSION TOPIC
Data
2 levels
Indexes
3 techniques
XML
XDAs
Temp tables
5 usages
Replicated
tables
Log
archives
Inline
LOBs
Oracle note:
Oracle has significantly less ways
to do compression than DB2
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Physical Database Storage Model Feature
Range partitioned tables *
Partitioning column
Must be base data types:
No LOB or XML
Can be multiple columns
Can be generated column
Flexible DDL options
Short, long or mixed forms
Direct specific table space usage
Handy keywords:
INCLUSIVE, EXCLUSIVE, MINVALUE,
MAXVALUE, etc.
Easy maintenance
Roll-in and roll-out ability
On-line SET INTEGRITY
Supports local indexes
Supports global indexes
Tablespace1
Table1.Part1
1 <= COL1 < 34 67 <= COL1 <= 99
Tablespace2
Table1.Part2
34 <= COL1 < 67
Tablespace3
Table1.Part3
CREATE TABLE table1(col1 INT)
IN tablespace1, tablespace2, tablespace3
PARTITION BY RANGE(col1)
(STARTING FROM (1) ENDING (99) EVERY (33));
Short Form
CREATE TABLE table1(col1 INT)
PARTITION BY RANGE(col1)
(STARTING FROM (1)
ENDING(33) IN tablespace1,
ENDING(66) IN tablespace2,
ENDING(99) IN tablespace3);
Long Form
* Enterprise Server Editions only
49
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Database Administration
Online REORG of tables (and indexes) when data needs maintenance
Oracle DB2
Documentation and sites like OTN show seven
simple steps to do this:
Documentation shows one step to do this
in two different modes* :
#1. Check if table can be redefined:
EXEC Dbms_Redefinition.Can_Redef_Table(S1.TB1)
#1. To do a classic** reorg
REORG TABLE T1
#2. Create new table:
CREATE TABLE TB2 TABLESPACE TS1 AS SELECT
#2. To do an in place reorg
REORG TABLE T1 INPLACE
#3. Start redefinition:
EXEC Dbms_Redefinition.Can_Redef_Table
(S1.TB1,TB2,REDEFINE CLAUSE)
#4. Sync new table with interim data
EXEC Dbms_Redefinition.Can_Redef_Table(S1.TB1,TB2..)
#5. Add new keys:
ALTER TABLE TB2 ADD CONSTRAINT
#6. Complete redefinition:
EXEC Dbms_Redefinition.Can_Redef_Table(S1.TB1,TB2..)
#7. Drop old table:
DROP TABLE TB1
* Modes described on next slide
** Classic mode rebuilds indexes as well as the data REORG
50
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Database Administration
DB2 REORG modes
DB2 REORG Characteristic Classic In place (AKA online*)
Performance Faster Slower (up to 20 times)
Clustering Factor of data at completion Good
May not be perfectly clustered
(if activity is done during REORG)
Concurrency (access to table)
No Access or
Read Only
Read Only or
Full Access
Data Storage Space Requirement Significant Not Significant
Logging Storage Space Requirement Not Significant Could Be Significant
User Control
(ability to pause & restart process)
Less Control More Control
Recoverability
All or nothing;
it either succeeds or fails
Recoverable
Index Rebuild ** Done Not Done
Supported for every type of table Yes No
Specify Index (other than clustering index) Yes No
Use of Temporary Table Space Yes No
* Online REORG not available with DB2 Express Editions ** Index rebuilds are done separately in Oracle
51
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Database Administration
DB2 Materialized Query Table* (MQT) vs. Oracle Materialized View
Oracle Materialized View DB2 Materialized Query Table (MQT)
CREATE [ 1] MATERI ALI ZED VI EW
[ 2] PROD. DAI LYSUM
[ 6] TABLESPACE TABLESPACE1
[ 4] BUI LD I MMEDI ATE
[ 5] REFRESH FAST ON DEMAND
[ 3] AS SELECT
A. ORGUNT_SI D ORGUNT_SI D,
C. DPTCHRT_SI D DPTCHRT_SI D,
C. ANCDPT_SI D DPT_SI D,
B. TMFRAM_SI D TMFRAM_SI D,
B. STRTDT STRTDT,
SUM( A. ONSALEFLG) ONSALEFLG,
COUNT( A. ONSALEFLG) ONSALEFLGCNT,
SUM( A. SALES) SALES,
COUNT( A. SALES) SALESCNT,
SUM( A. SHRI NK) SHRI NK,
COUNT( A. SHRI NK) SHRNKCNT,
COUNT( *) RECORDCNT
FROM PROD. DAYTOT A,
PROD. CALDTL B,
PROD. DPTCHR C
WHERE B. CAL_SI D = 100
AND B. TMFRAM_SI D ! = 10
AND A. DT BETWEEN B. STRTDT AND B. ENDDT
AND A. DPT_SI D = C. RPTDPT_SI D
GROUP BY A. ORGUNT_SI D, C. DPTCHRT_SI D,
C. ANCDPT_SI D, B. TMFRAM_SI D,
B. STRTDT ;
CREATE [ 1] TABLE
[ 2] PROD. DAI LYSUM
[ 3] AS( SELECT
A. ORGUNT_SI D AS ORGUNT_SI D,
C. DPTCHRT_SI D AS DPTCHRT_SI D,
C. ANCDPT_SI D AS DPT_SI D,
B. TMFRAM_SI D AS TMFRAM_SI D,
B. STRTDT AS STRTDT,
SUM( A. ONSALEFLG) AS ONSALEFLG,
COUNT( A. ONSALEFLG) AS ONSALEFLGCNT,
SUM( A. SALES) AS SALES,
COUNT( A. SALES) AS SALESCNT,
SUM( A. SHRI NK) AS SHRI NK,
COUNT( A. SHRI NK) AS SHRNKCNT,
COUNT( *) AS RECORDCNT,
FROM PROD. DAYTOT A,
PROD. CALDTL B,
PROD. DPTCHR C
WHERE B. CAL_SI D = 100
AND B. TMFRAM_SI D <> 10
AND A. DT BETWEEN B. STRTDT AND B. ENDDT
AND A. DPT_SI D = C. RPTDPT_SI D
GROUP BY A. ORGUNT_SI D, C. DPTCHRT_SI D,
C. ANCDPT_SI D, B. TMFRAM_SI D,
B. STRTDT)
[ 4] [ I NTI ALLY DEFERRED]
[ 5] REFRESH DEFERRED
[ 6] I N TABLESPACE1 I NDEXES I N TABLESPACE2 ;
* Enterprise Server Editions only
52
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Database Partitioning Feature (DPF) *
The big data solution
Optimized for data warehousing
Based upon a shared nothing architecture
Each DB2 node has its own part of the database to process
Coordinating DB2
node
Collects results from
all other nodes
Divide and conquer
Each database partition runs a query on its own part of the
database and the final result is assembled at the coordinating node
Scale out by adding
nodes to more
physical or logical
servers
Part 0 Part 1 Part 2 Part 3 Part 4
53
Oracle note:
Oracle does not have
this shared nothing
capability.
* Only available through Warehouse Editions
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureScale Feature
The OLTP for active / active continuous availability solution
Optimized for fast transaction processing with active failover
Based upon IBM clustering technology CF Member with RDMA
Modeled from a proven IBM mainframe Sysplex methodology to access shared data
Shared storage database (e.g. GPFS)
Standby CF
member gets
updates from
primary CF
member
Primary CF
member
maintaining
global buffer
pool and global
lock manager
Each DB2 member has its locking, buffer pool & log
files. Note: a member is NOT a database partition.
Interrupt free RDMA calls via network cluster interconnect
Add / remove DB2
members dynamically
54
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Management *
Overview
FOR MORE DETAILS
SEE WLM TOPIC
* Enterprise Server Editions only
55
User requests
User requests
User requests
User requests
User requests
User requests
User requests
User requests
System requests
System requests
Maintenance
requests
Workload A
Workload B
Workload C
Service Subclass A
Service Subclass B
Default User Class
Default System Class
Default Maintenance
Class
DB2 Data Server
Default User
Workload
WLM CLASS AIX2 (or Linux)
Service Super-class 1
AIX/Linux Workload Manager
Thresholds
Thresholds
Thresholds
Requests
Initiate all work in
DB2 (even system
and maintenance
work) which will be
mapped to a specific
service class.
Use default classes
if not defined.
Threshold
Establish limits of use over a
database, workload or service class
Workload
Is how work is routed
to a DB2 service
class.
Serves as primary
point of identity and
control for submitters
of work.
Uses attributes like
application name,
system or session
user, client
workstation and so
on, to map to each
connection
Work Action Sets
Work Action Sets
Work Action Set
Control specific types of activities
over a database or service class
Workload Manager Monitoring
db2pd, Event, SQL Functions & Procedures
Service Class
Is where the work for a
database is executed.
Is the primary point of
resource assignment,
control and monitoring.
Uses a 2-Tier hierarchy
which defines super-classes
to provide common
attributes across
subclasses. This provides a
more complex division of
execution.
Service Class
On AIX or Linux
Each DB2 service class can
be associated with an AIX or
Linux Workload Manager
service class for tight OS
integration.
Thresholds
WLM CLASS AIX1 (or Linux)
WLM CLASS AIX3 (or Linux)
BV
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Geodetic and Spatial Extenders
Global vs. flat mapping
DB2 Geodetic Data Management Feature *
Treats the Earth as a globe
Uses a latitude and longitude coordinate system on an ellipsoidal Earth model
Geometric operations are precise, regardless of location
It is built on the Hipparchus library, which is licensed from Geodyssey Limited
Best used for global data sets and applications that cover large areas on the
Earth, where a single map projection cannot provide the accuracy required by
the application
DB2 Spatial Extender
Treats the Earth as a flat map
Uses planimetric (flat-plane) geometry, which means that it approximates the
round surface of the Earth by projecting it onto a flat plane
These projections do cause some distortion which is characteristic of all flat-
map projection
Built on the ESRI shape library, which is licensed from ESRI
Best used for local and regional data sets that are well represented in projected
coordinates, and for applications where location accuracy is not important
For example, a medical insurance company might want to know the locations of
hospitals and clinics within a state or province
* Enterprise Editions only with Geodetic Feature
56
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Non-obvious Database Administration Term / Feature Mapping
DB2 vs. Oracle
Oracle Term / Feature DB2 Term / Feature
Alert Log
Dump files
Administration Notification Log
DB2Diag Log
Archive Redo Log Archive Log
Autoextend Autoresize
Data Dictionary System Catalog
Data Dictionary Cache Catalog Cache
Data Cache Buffer Pool
Data File Container
Dbms_repair Inspect
Dump datafile #block# (ALTER SYSTEM) db2dart
Enable Restricted & Quiesce Quiesce
Large pool Utility Heap
Library Cache Package Cache
Materialized View Materialized Query Table (MQT)
pfile or spfile (init.ora) DBM Configuration
DB Configuration
Statement Cache Package Cache
Transparent Application Failover (TAF) Automatic Client Reroute
V_$ views (dynamic views) Administration Views (SYSIBMADM)
57
2012 IBM Corporation
An IBM Proof of Technology
IBM Data Studio
Lab 03 DATASTUDIO
27 slides
Burt Vialpando
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Data Studio
Database management and application development environment
Database and data object management features:
Supports DPF and pureScale databases
Data source connections: browse data objects and their properties
Editors and task assistants: data object create, alter or drop
Modification of privileges: data objects & auth IDs
Data manipulation: edit, extract & load
Data diagrams: visualization of data object relationships
Change impact analysis
Compare and sync databases
Save changes and undo them
Application development features:
Editors & task assistants: create, test, debug & deploy stored procedures & UDFs
SQL Query builder, SQL & XQuery editors
Visual Explain
Routine debugger
Web services creation, XML & SQLJ development
59
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Data Studio
Platforms, packaging and databases supported
Platforms supported:
Windows 7, Windows Vista, Windows XP Professional, Windows 2008
Packaging options
Full client: Complete feature set, has Java IDE
Admin client: Lighter weight, DBA oriented, lacks Java IDE
Web Console: Separate browser based monitoring interface
Database full object management and database support:
DB2 for Linux, Unix and Windows 10.1, 9.8, 9.7, 9.5, 9.1
Database simple object management support:
DB2 for z/OS
Informix
Oracle
These database sources
will not be a focus of this
presentation
60
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Data Studio
Built on the Eclipse framework
Eclipse definition:
Open extensible Integrated Development Environment (IDE)
Developed by IBM, donated to the open source community, managed by
eclipse.org
Eclipse perspectives are visual containers for a set of views and editors that
are different for each context
Eclipse tools operate on files in a workspace
Workspace holds 1 or more top level projects
Projects map to directories in file system
Plug-in access via workspace and resource APIs
Eclipse benefits:
Full IDE support of: Java, C/C++/C#, PERL, PHP, HTML, JSP, EJB, etc.
Advanced drag and drop features
Open integration for other administrative and development tools
Easy adding of new tools to existing installed products via shell sharing
61
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Data Studio
How Eclipse based products work together
Operating System layer
Java VM JDBC
Eclipse Platform
IBM Software Development Platform
InfoSphere Optim Plug-ins
Eclipse (E) + IBM Software Development Platform (I) + Optim Plug-in
E + I + Data Modeling Plug-in = InfoSphere Optim Data Architect
E + I + Tuning Plug-in = InfoSphere Optim Query Workload Tuner
62
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Data Studio
Eclipse basic terminology
63
Perspective
A collection of
views and
editors
View
Data Project
Explorer
View
Data
Source
Explorer
Editor
(SQL PL
example)
View
SQL Results
Editor
Properties
Customizable
Open, close or resize
views and editors in
the perspective and
drag and drop them
anywhere.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Password Management
Simple one screen capability
Manage all passwords and connections in one screen
64
Apply the same user
name and password to
any or all database
connection properties
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explorers
Connection working sets
Create a collection of databases that you will be working with
65
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explorers Data Source vs. Administration
Hierarchical vs. flat presentation styles
66
Hierarchical Presentation:
Data Source Explorer
Flat Presentation:
Administration Explorer
All objects
regardless
of schema
Choose
presentation
type
All objects
for a given
schema
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Administration Explorer
Object List Editor
Object Lists help you work with several similar objects at the same time
With flat presentation: work with several objects that have different parents
67
Tables
Listing, editing
and exploring
Schemas
Listing, editing
and exploring
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explorers
Filtering the objects
In either hierarchical or flat presentations, filter any object type
68
Filter schemas
that start with
GO
Filter tables
that contain
ORD
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Task Assistant
Definition and options
A task assistant is analogous to a GUI wizard
A task assistant guides you through the process of setting options for a
select database administration command
Perform administration e.g.: backup, force application, grants, etc.
Perform object maintenance e.g.: create index, alter table, etc.
A task assistant can have these elements:
Settings area
Specify options and other input needed for a command to run
Command section
Displays the command being generated by the settings area
Optionally allows you to edit and save the command
Messages section
Displays progress of the command running or completed
69
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Task Assistant
Example: backup database (administration task)
70
produce these
DB2 commands
These
settings
Settings are
in multiple
screens
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Task Assistant
Example: extended table alter (object task)
Table in
alter state
Review
changes
Related
objects
automatically
maintained
Data
preserved
Columns
screen
Add attribute
button
Alter attribute
71
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Task Assistant
Example: create / alter storage groups and table spaces
72
Storage
Groups
Table
Spaces
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Task Assistant
Example: Managing authorities and privileges
73
Object
privilege
management
Database
authority
management
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Executing SQL
Example
Create, format and execute SQL from a powerful context sensitive editor
74
Edit / run SQL
Intelligent context
sensitive editor
[F5]
Format your SQL
One of the many
options
Validate your SQL
Use the appropriate
version
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Visual Explain
Generate an interactive access plan diagram
75
Drill down into
any node to see
more detail
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Analyze Impact
Discover object dependencies
Easily see how your objects relate to each other
76
Impacted Objects
Diagram
Impacted Objects
Detail list
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Overview Diagram
Discover object relationships
Generate simple overview diagrams of your tables
By using defined RI or even inferred relationships through intelligent modeling
77
Move, change or
edit any object or
relationship in
the diagram
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Editing Data
Intuitive insert, update, delete interface
78
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Debug Perspective
Example: Debug a stored procedure
79
Debug
Perspective
Step over
Step into
Step return
----
Step filters
Breakpoint
Follow code
through
debug
session
Monitor
changing
variables
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Object Migration
Compare and migrate technique Comparison of source and target
Compare source and target then copy from left to right then generate DDL
80
Choose selected
objects to
generate DDL
Copy from
Left to
Right
Easily see
differences of
objects at
any level
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Object Migration
Compare and migrate technique Review and deploy
Review DDL to deploy to target
81
Choose target
Flags potential problems
before deployment
(Example here: source DB
was Oracle compatible but
target DB is not.)
Review / edit DDL
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
pureScale support
Member viewer and task assistant
pureScale members viewer and task assistant
82
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Data Studio Web Console
Browser based database monitoring and job control overview
Browser based database monitoring job control
Health Overview Summary
Server Status
Operations (day to day operation issues)
Database Partition Status
pureScale member and cluster facility status
Connection status (by application and utilities running)
Storage status (including table spaces)
Recovery related alert issues
Alert management
Configure all of the above with customized thresholds
Create email or other notification methods
Job management
Create, schedule, review and edit DB2 maintenance jobs
83
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Data Studio Web Console
Examples
Health Summary
Alert configuration
Job management
84
2012 IBM Corporation
An IBM Proof of Technology
CLPPlus and Oracle Compatibility
Lab 04 CLPPLUS
17 slides
Burt Vialpando
DB2
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
CLPPlus
A familiar command line environment for the experienced Oracle DBA
CLPPlus Command Examples Comment
REM, RUN, @, @@, . Remarks and run operations
SET TERMOUT off, LINESIZE 250, ECHO on, TIMING
on, WRAP off, AUTOCOMMIT off, etc.
SET commands for CLPPlus script environment settings (too
many to list here)
SPOOL myfile_out.txt Direct output to a file
ACCEPT [substitution_variable_name] Keyboard input of substitution variable
DEFINE, UNDEFINE Create or replace variable
COLUMN [colname] format 9,999
heading My heading JUSTIFY, etc.
Format output data as well as headings for that data
TTITLE & BTITLE Report headings and footers
BREAK & COMPUTE Aggregate types of functionality
REPFOOTER, REPHEADER Footer and header controls
EXEC [procname] Executes a procedure
CONNECT & DISCONNECT Connect to or disconnect from a DB2 database
EXIT & QUIT Leave CLPPlus session
HELP, ? Help on CLPPlus
HOST [OS_command] (or !) Execute operating system commands
DESCRIBE, REORGCHCK Table operations
WHENEVER OSERROR, WHENEVER SQLERROR Error trap and control
EDIT, INPUT, APPEND, CLEAR, DEL, GET, etc. Buffer control commands
86
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
CLPPlus
Invoking and running scripts
CLPPlus Invoking Syntax:
clpplus [user]/[password]@[host]:[port]/[database] @[script]
REM Oracle script example
set echo off;
set linesize 100;
set pagesize 50;
set headsep '!'
set newpage 1;
column COL1 format a20 heading 'Col1!Name'
column COL2 format 9,999 heading 'Col2!Name'
spool outfile.rpt;
SELECT COL1, COL2 FROM MY_TABLE ORDER BY 1;
spool off;
exit;
example_script.sql
87
clpplus burt/pass123@localhost:50000/ora2db2 @example_script.sql
Note: CLPPlus will be in an
interactive session if a script
is not called using @[script]
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2s Oracle Compatibility
Getting started by enabling an Oracle environment in DB2
Oracle Enablement Step Comments
#1 - Set registry variable:
(Note: each feature has its own bit position value, so
it is possible to enable any individual feature or
combination of features. The value ORA enables
them all for the most complete Oracle compatibility.)
Sets compatibility features:
Rownum
DUAL
(+) Outer Join
Connect By (hierarchical queries)
Number data type
Varchar2 data type
Date data type
Truncate table
Character literals (Graphic and Char)
Data dictionary compatible views
PL/SQL compilation and execution ability
#2 - Restart instance: Make the compatibility vector take affect;
the instance environment is now compatible
#3 - Create Oracle enabled DB2 database: Creates the Oracle-like dictionary and
exploits Oracle data types
88
db2set db2_compatibility_vector=ORA
db2stop
db2start
db2 create database ora2db2
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Compatibility
Objects that run without change in DB2
Oracle object DB2 object Comment
Package Module CREATE PACKAGE statement accepted by DB2, but a
DB2 module is the result object created
DB2 modules can be altered to add or drop objects
within them, unlike Oracle packages
Procedure Stored
Procedure
Function User Defined
Function (UDF)
Trigger Trigger
Public synonyms Parameterized timestamps Data type anchoring Call statements with parameters
Cursor data types Autonomous transactions Implicit casting Call statement with defaults
Constants Create or replace NEXTVAL / CURVAL Positional call statements
MINUS Statement concentrator Unnamed inline views Created global temporary tables
FORALL IN BULKCOLLECT INTO Declared types Declared procedures
and more
Other PL/SQL and SQL features and behavior:
89
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Compatibility
Oracle data types supported
Table Data Type Comment
NUMBER Exploits P6 hardware accelerated DECFLOAT
VARCHAR2 NULL = , trailing blank sensitive collation
TIMESTAMP(n) 0 (date + time) <= N <= 12 (date + time + picoseconds)
DATE Year to seconds, SYSDATE
PL/SQL Data Type Comment
BOOLEAN In procedural code
INDEX BY Associative arrays in procedural code
VARRAY Regular arrays in procedural code
Row Type In procedural code, VARRAY, INDEX BY
Ref Cursor Allows passing, and predefining of cursors
90
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Compatibility
Oracle built-in function examples *
Built-in Function Type Examples
Conversion and
Formatting
TO_CHAR, TO_DATE, TO_TIMESTAMP, TO_NUMBER,
TO_CLOB, ROUND, VARCHAR_FORMAT,
HEX_TO_RAW, INSTRB, TO_SINGLE_BYTE
Datetime arithmetic
ADD_MONTHS, DAYNAME, LAST_DAY,
MONTHS_BETWEEN,MONTHNAME, NEXT_DAY,
ROUND_TIMESTAMP, TRUNC_TIMESTAMP,
TIMESTAMP_FORMAT, TO_DATE, TIMESTAMPDIFF
String manipulation
INITCAP, RPAD, LPAD, INSTR, REVERSE,
LOCATE_IN_STRING, TRUNCATE, TRUNC, LISTAGG,
SUBSTR2, LTRIM, RTRIM, MOD
Misc
DECODE, NVL, NVL2, LEAST, GREATEST, BITAND,
EXTRACT, UNNEST, RATIO_TO_REPORT
* Note: DB2 already had a very diverse and rich set of functions. These examples are showing the additional ones created to support Oracle
compatibility for functions that were previously only in Oracle with these particular names.
91
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Compatibility
Oracle supplied packages
Package Comment
DBMS_OUTPUT print debugging and simple reporting
DBMS_DDL Obfuscate DDL objects
DBMS_ALERT Cross session semaphoring
DBMS_PIPE Cross session data pipe
DBMS_JOB Job scheduler
DBMS_LOB Alternate API to DB2 native LOB functions
DBMS_SQL Alternate API to PREPARE/EXECUTE
DBMS_UTILITY Misc functions and procedures
UTL_FILE Server side I/O API
UTL_MAIL Server API to email
UTL_SMTP Server API to SMTP
92
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Compatibility
Flexible data type casting
Traditionally, DB2 has supported strict typing:
In accordance with SQL standard
However, there is an industry trend towards weak typing:
For PERL, RUBY, PHP, etc
DB2 now supports:
Implied casting between data types
Assign or compare numeric types to strings
Allow un-typed parameter markers and un-typed NULLs
SELECT ?, NULL, MY_UDF(?, NULL) FROM T
SELECT * FROM T WHERE INTEGER_COL = 42
93
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Compatibility
Auto revalidation
Automatic revalidation is new in Cobra enabled by:
AUTO_REVAL db cfg parameter example:
update db cfg using AUTO_REVAL IMMEDIATE;
Value Description
DEFERRED All dependent objects are revalidated the next time that
they are accessed
Default for newly created databases
DISABLED Behaves the same as in previous releases of DB2
Default for migrated databases
IMMEDIATE All dependent objects will be revalidated immediately after
they are invalidated
DEFERRED_FORCE Behaves the same way as DEFERRED - with an additional
CREATE with error feature enabled
AUTO_REVAL Options
94
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Compatibility
Auto revalidations vis--vis manual revalidation
During an ALTER, REPLACE or DROP of an object, dependent objects may
be marked invalid but these can be revalidated:
Immediately as soon as the ALTER completes
Deferred as soon as the invalidated object is referenced
This simplifies revalidation for DBAs during schema changes
Manual revalidation:
Invalid object names are reviewable and stored in catalog view:
SYSCAT.INVALIDOBJECTS
Revalidate objects manually using a stored procedure
call SYSPROC.ADMIN_REVALIDATE_DB_OBJECTS();
95
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Compatibility
Create with errors
This is a special usage of AUTO_REVAL
DEFERRED_FORCE
When set, you can create an object that depends upon another object that
doesnt yet exist
DB2 creates the object anyway and gives you an error code
Later, create the object the error-created object depends on
the error-created object will revalidate at its next access
Example - TABLE1 does not exist when this code is executed:
create view VIEW1 as select * from TABLE1;
create table TABLE1 (col1 integer);
insert into TABLE1 values (1),(2),(3);
select * from VIEW1;
VIEW1 created with an error code
VIEW1 revalidated at this time
and is successful
96
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Compatibility
Soft invalidation
Soft invalidation is set using a registry variable:
This allows you to replace or drop an object without requiring an exclusive
lock to do so
The replace or drop succeeds even if other applications are using it
It simplifies DBA maintenance work
Supports the following actions:
REPLACE or DROP ALIAS
REPLACE or DROP FUNCTION
REPLACE or DROP TRIGGER
REPLACE or DROP VIEW
ALTER TABLE DETACH PARTITION
db2set DB2_DDL_SOFT_INVAL=ON
select * from VIEW1;
replace view VIEW1;
Very long query begins
replace occurs immediately;
no locking needed
Very long query completes
Soft Invalidation Example:
97
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Concurrency
DB2 isolation levels overview
ANSI Isolation Level Locking Affects
Repeatable Read
(RR)
Any row that is referenced in any manner to produce a result set is
locked until the transaction ends
Example: Scan 1,000 rows to find 10 rows in a result set locks the 1,000 rows scanned
Read Stability
(RS)
Any row that is actually retrieved to produce the result set is locked
until the transaction ends
Example: Scan 1,000 rows to find 10 rows in a result set locks the 10 row result set
Cursor Stability *
(CS)
The row that is currently being referenced in the result set will return
the currently committed value of that row with no locks
Example : Scan 1,000 rows to find 10 rows in a result set no rows are locked
(Note: CS without currently committed will lock the 1 row the cursor is positioned on*)
Uncommitted Read
(UR)
The row that is currently being referenced in the result set will return
the uncommitted value of that row with no locks
Example: Scan 1,000 rows to find 10 rows in a result set no rows are locked
* This is the new currently committed default for DB2 isolation level CS. You can set DB2 to use CS that does not use currently
committed, which will lock the single row currently being referenced to wait for outcome.
98
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Concurrency
Currently Committed Readers dont block writers / writers dont block readers
Currently Committed (CC) always applies lock avoidance
Feedback to the locklist tracks the location of the committed data
In the log buffer
In the log files
Provides no locking for known committed data
Read transactions will never block write transactions and vice versa
Insert records not committed will be skipped
Write transactions will continue to block other write transactions (as Oracle does)
CC controlled by CUR_COMMIT DB CONFIG parameter
ON = Default (CS always uses CC)
AVAILABLE = Must specifically request CC
DISABLED = Provides pre DB2 9.7 behavior
Emp Table
rowid empid name office sal
1 1234 Burt Y2/11 11
2 6354 Corey A1/21 43
3 7836 Shen C3/46 21
4 1325 Mike X1/03 33
5 5456 Ramon D2/18 22
Locklist
rowid Lock log
1 X(D)
3 X(U)
5 X(I) -
DEL: Emp,1,1234,Burt,Y2/11,11
Log Buffer
UPD: Emp,3,7836,Shen,D2/18C3/46
INS: Emp,5,5456,Ramon,D2/18
Active Logs
INS:Emp,2,6354,Corey,A1/21, 43
INS:Emp,4,1325,Mike,X1/03,33
Archive Logs
99
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Concurrency
Setting DB2 isolation
At the statement level:
SELECT (INTO), DELETE, UPDATE ... WITH {RR, RS, CS, UR}
SELECT (INTO), DELETE, UPDATE ... WAIT FOR OUTCOME
For dynamic SQL within the current session:
SET CURRENT ISOLATION = {RR, RS, CS, UR} or SET ISOLATION {RR, RS, CS, UR}
At precompile or bind time:
ISOLATION {RR, RS, CS, UR} option of the command line processor PREP or BIND
commands
CONCURRENTACCESSRESOLUTION has two options:
USE CURRENTLY COMMITTED
WAIT FOR OUTCOME
From the DB2 Call Level Interface (CLI):
For DB2 Call Level Interface, change the isolation level as part of the DB2 Call Level
Interface configuration (db2cli.ini). This can be done either by:
UPDATE CALL LINE INTERFACE CFG FOR SECTION sectionname USING
TXNISOLATION {1, 2, 4, 8}
where:
1 = SQL_TXN_READ_UNCOMMITTED - Read Uncommitted (Uncommitted Read)
2 = SQL_TXN_READ_COMMITTED (default) - Read Committed (Cursor Stability)
4 = SQL_TXN_REPEATABLE_READ - Repeatable Read (Read Stability)
8 = SQL_TXN_SERIALIZABLE - Serializable (Repeatable Read)
Editing db2cli.ini and setting applTxnIsolation = {1, 2, 4, 8}
100
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Concurrency
Setting DB2 isolation (continued)
From DB2 Call Level Interface or Open Database Connectivity
(ODBC) at run time:
For Isolation Level:
Use the SQLSetConnectAttr() function with the SQL_ATTR_TXN_ISOLATION attribute to
set the transaction isolation level for the current connection referenced by the
ConnectionHandle.
For Currently Committed behavior: SQL_ATTR_CONCURRENT_ACCESS_RESOLUTION
attribute
When working with JDBC or SQLJ at run time:
Use the setTransactionIsolation() method in the java.sql interface connection, where:
TRANSACTION_SERIALIZABLE = Repeatable read
TRANSACTION_REPEATABLE_READ = Read stability
TRANSACTION_READ_COMMITTED = Cursor stability
TRANSACTION_READ_UNCOMMITTED = Uncommitted read
On a Command Line Processor (CLP) Connection:
CHANGE ISOLATION TO {RR, RS, CS, UR, NC} where NC stands for No Commit
On database servers that support REXX:
CHANGE SQLISL TO {RR|CS|UR|RS|NC} {RR, RS, CS, UR, NC}
101
2012 IBM Corporation
An IBM Proof of Technology
DB2 Security Concepts
Lab 05 SECURITY
19 slides
Burt Vialpando
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security Terms
Both DB2 and Oracle use these
Authentication vs. Authorization
Authentication - Determines who the user is by identifying with a password
DB2 use external as default, Oracle internal
Authorization - Grants privileges to that user once authenticated
Both databases support this concept similarly
Explicit vs. Implicit Access
Explicit - Granted directly to user, role or group
Implicit - Granted when a database or database object is created
Indirect - Inherited through execution of packaged code
Data Control Language
DCL - Subset of SQL that performs security definitions in the database
Security Views Where security definitions are kept in the database
Dictionary (Oracle) - SYS.DBA_%PRIVS%
Catalog (DB2) - SYSCAT.%AUTH
Schemas Where database objects are logically grouped together
User bound (Oracle) - Requires a user (or account) to exist to have a schema to exist
True (DB2) - Creates schemas even if a user does not exist. The schema is simply a
logical qualifier (or bucket) for objects.
103
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security Accounts
DB2 true schema support vs. Oracle users for schemas
Typical automatically created users (or accounts)
Oracle
ANONYMOUS APEX_PUBLIC_USER BI CTXSYS
DBSNMP DIP EXFSYS FLOWS_030000
FLOWS_FILES HR IX MDDATA
MDSYS MGMT_VIEW OE OLAPSYS
ORACLE_OCM ORDPLUGINS ORDSYS OUTLN
OWBSYS PM SCOTT SH
SI_INFORMATION_SCHEMA SYS SYSMAN SYSTEM
SPATIAL_CSW_ADMIN_USR TSMSYS WKPROXY WKSYS
SPATIAL_WFS_ADMIN_USR WK_TEST WMSYS XDB
XS$NULL
DB2
none
DB2 true schema does not require a creation of users (accounts) to support
schemas for various tooling, repositories or application needs
Oracle does require this
Users created through Oracles DBCA (or any other method) should be checked to make sure they are
locked and expired
Each can be a back door into your database.
Here is a typical list of users created in Oracle when DBCA creates a database and
installs a few options:
104
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security Model
DB2 security model overview
105
AUTHORIZATION
AUTHENTICATION
Authenticate
Here!
DB2 Client
Data
Encryption
Instance 1 Instance 2
CLIENT
AUTHENTICATION
GSSPLUGIN
AUTHENTICATION
LDAP
AUTHENTICATION
DB2 Client
Data
Encryption
Authenticate
Here!
Authenticate
Here!
DB2 Client
Data
Encryption
Instance 5
DB2 Client
System (instance)
Authorities
Database
Authorities
Object Privileges
Plug-ins
KERBEROS
AUTHENTICATION
Instance 4
DB2 Client
Plug-ins
Authenticate
Here!
Plug-ins
Authenticate
Here!
Instance 3
Plug-ins
Kerberos
Server
Table
View Role
Index Package
XSR
Workload
Schema
Sequence
Routine
Security
Label
Global
Variable
Table
Space
Server
Module
Nickname
Setsessionuser
IMPLICIT_SCHEMA
QUIESCE_CONNECT
CREATE_EXTERNAL_ROUTINE
CREATE_NOT_FENCED_ROUTINE
BINDADD
SECADM
DBADM
CONNECT
CREATETAB
LOAD
ACCESSCTRL
DATAACCESS
SQLADM
WLMADM
EXPLAIN
SYSADM
SYSCTRL
SYSMAINT
SYSMON
SERVER
AUTHENTICATION
BV
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security Administration
DB2 administrators relationship *
System Administrator SYSADM:
Implicitly granted to instance owner
Granted specifically by assignment of DBM CFG: SYSADM_GROUP
Granted specifically to Computer Administrator (Windows only)
Does not automatically have DATAACCESS and ACCESSCTRL to databases in the
instance
Security Administrator SECADM:
Implicitly granted to user who creates a database
Even the instance owner does not have SECADM by default
Granted specifically by another SECADM
Does not automatically have data access in the database
Grants DATAACCESS and ACCESSCTRL to others
Database Administrator DBADM:
Implicitly granted to user who creates a database
Granted specifically by SECADM
Default is to have DATAACCESS and ACCESSCTRL in the database unless restricted
during the grant
106
* As of DB2 9.7, these authorities default capabilities changed in the way they work with each other
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security Administration
DB2 instance level authority summary
FUNCTION SYSADM SYSCTRL SYSMAINT SYSMON
Migrate / Restore Database YES
Grant / Revoke table space privileges YES
Update DBM CFG YES
Stop / start db2audit YES
Quiesce instance YES YES
Update db / node database partitions / dcs directories YES YES
Force users off YES YES
Create / Drop Database (automatically get DBADM) YES YES
Create / Drop / Alter Table Space YES YES
Restore to new Database YES YES
Use any table space YES YES
Update DB CFG YES YES YES
Backup / Restore Database / Table Space YES YES YES
Perform roll forward recovery YES YES YES
Start / Stop Instance YES YES YES
Run Trace YES YES YES
Get snapshots, monitors and switches & some LIST cmds YES YES YES YES
107
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security Administration
DB2 database level authority summary part 1
FUNCTION SECADM ACCESSCTRL DATAACCESS
Create / alter / drop security objects YES
Grant / revoke all authorities and privileges YES
Transfer ownership YES
Execute / Grant ownership on audit routines YES
Audit statement YES
Connect authority YES
Create / alter / drop label based security objects YES
Create / alter / drop row permissions and column masks YES
Grant / revoke most database authorities YES YES
Grant / revoke all object privileges YES YES
Select on catalog views and tables YES YES YES
LOAD authority YES
Select / insert / update / select on all tables, views, MQTs,
nicknames
YES
Execute on all routines & packages YES
108
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security Administration
DB2 database level authority summary part 2
FUNCTION DBADM SQLADM WLMADM EXPLAIN
Has all database authorities except SECADM specific
(DATAACCESS & ACCESSCTRL can also be restricted)
YES
Create / alter / drop non-security objects YES
Read log files YES
Query table space state / quiesce table space YES
Update log history files YES
Create / activate / drop event monitors YES YES
Reorg indexes / tables YES YES
Use RUNSTATS YES YES
Select privileges on system catalog views / tables YES YES
Flush package and opt profile cache YES YES
Explain / prepare / execute on system-defined explain routines YES YES YES
Certain clauses of alter on Workload Manager objects YES YES YES
Create / alter / drop / grant / revoke all Workload Manager
objects
YES
Execute on system-defined Workload Manager routines YES
109
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security Plug-in DLLs
Control password expiration, complexity, etc.
DB2 security plug-ins are dynamically loadable libraries that provide:
Client authentication
Server authentication
Group retrieval membership information
All control the password expiration, complexity and use through DB2
DB2 uses 2 types of authentication mechanisms
1. User ID/Password
DB2 uses an OS plug-in for a default if not otherwise specified
2. Generic Security Service (GSS) API
Kerberos uses this methodology for example
DB2 can mix and match plug-in usage
User ID/password
client plug-in
Kerberos
client plug-in
Kerberos
server plug-in
User ID/password
server plug-in
Security layer
DB2 Server
GSS-API
server plug-in
Plug-in interface
Client
Plug-ins
Server
Plug-ins
GSS-API
client plug-in
Group plug-in
110
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security Access Control
Row and Column Access Control (RCAC) *
Row permission and column mask approach has three key advantages:
No database user is inherently exempted from them, even users that have DATAACCESS
Data protection is assured, regardless of how it is accessed
Application changes are not required to take advantage of them
Does not apply to DB2 applied internal processing
Like explain table population, MQT refresh, temporal history table inserts, etc.
111
CREATE PERMISSION Payroll-Table-Permissions
ON PAYROLL_TB FOR ROWS WHERE
CURRENT TIME BETWEEN 8:00 AND 17:00
AND VERIFY_GROUP_FOR_USER(USER, Teller)= 1
AND PAYROLL_TYPE = OPEN
ENFORCED FOR ALL ACCESS
ENABLE;
Row Permission
CREATE MASK Payroll-Salary-Mask
ON PAYROLL FOR COLUMN salary RETURN
CASE WHEN
VERIFY_ROLE_FOR_USER(USER, HR)= 1
THEN salary
ELSE NULL
END
ENABLE;
Column Mask
ALTER TABLE PAYROLL_TB
ACTIVATE ROW ACCESS CONTROL;
ALTER TABLE PAYROLL_TB
ACTIVATE COLUMN ACCESS CONTROL;
Activate at
the table
level
Limits to a
particular role
Activate at
the
permission
level
Limits table
to a
particular
time of use
For only
these rows
* Also referred to as Fine-Grained Access Control (FGAC)
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Row and Column Access Control (RCAC)
New scalar functions and SECURED keyword
112
VERIFY_ROLE_FOR_USER(user, role1, role2, )
VERIFY_GROUP_FOR_USER(user, group1, group2, )
VERIFY_TRUSTED_CONTEXT_FOR_USER(user, role1, role2, )
Returns 1 if any roles are
associated with the user in
the list. If not, it returns a 0.
Returns 1 if any groups are associated with the
user in the list. If not, it returns a 0.
Note: LDAP groups can be used here as well.
Returns 1 if any role that is acquired through a
trusted connection is in or contains any of the
roles in the list. If not, returns 0.
ALTER FUNCTION MYFUNCT1 SECURED;
CREATE MASK Payroll-Salary-Mask
ON PAYROLL FOR COLUMN salary RETURN
CASE WHEN
VERIFY_ROLE_FOR_USER(USER, HR)= 1
THEN MYFUNCT1(salary)
ELSE NULL
END
ENABLE;
UDFs and triggers that are used in an RCAC
environment should be secured. Here is an
example of usage.
Here SALARY is masked, so a UDF that is
invoked on this column needs to be secured.
New Scalar Functions
New keyword: SECURED
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
113
Security Access Control
DB2 Label Based Access Control (LBAC) *
Label Based Access Control (LBAC)
Also called DB2 Advanced Access Control Feature
A label is associated with both user sessions and data
rows or columns
Rules for comparing users & data labels allow access
controls to be applied at the row level
SELECT * FROM EMP
WHERE SALARY >= 50000 ;
Labels may consist of multiple
components
1. Hierarchical (tree)
2. Group (array)
3. Set types (these are unique to DB2)
Row labels appear as a single additional
column in a protected table
Regardless of the number of label
components
User labels are granted by a security
administrator
SECADM authority (granted by SYSADM)
No LBAC SEC=254 SEC=100 SEC=50 ID SALARY
255 60000
100 50000
50 70000
50 45000
60 30000
250 56000
102 82000
100 54000
75 33000
253 46000
90 83000
200 78000
= row returned = row returned = row returned
113
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
114
Security Auditing
DB2 Instance and database level auditing
Managed by SYSADM and SECADM
At Instance level by SYSADM by using db2audit tool
At database level by SECADM by using AUDIT POLICY and AUDIT commands
Audit is granular to the level of table, user, group, role, SYSADM, DBADM, SECADM
Audit Features
Audit logs are separate for each database
Audit logs location can be changed
Audit logs can be archived
Audit policies can be created to control audit configuration within a database
Individual databases and objects can have their own audit configurations
Auditing individual SQL statements is completely configurable
CURRENT CLIENT special registers allows client information to be put in audit logs
db2audit configure datapath /db2audit"
archivepath /db2auditArchive"
db2audit configure scope all status both
db2audit start
[. SQL statements that trigger auditing]
db2audit flush
db2audit stop
db2audit archive
db2audit extract delasc to /db2audit from files
/db2auditarchive/db2audit.instance.
log.0.20071215103050
db2 CREATE AUDIT POLICY SENSITIVE_DATA_POLICY
CATEGORIES EXECUTE WITH DATA STATUS BOTH
ERROR TYPE AUDIT
db2 AUDIT TABLE EMPLOYEE USING POLICY
SENSITIVE_DATA_POLICY
db2 CALL SYSPROC.AUDIT_ARCHIVE(/db2auditArchive', -2 )
db2 CALL SYSPROC.AUDIT_DELIM_EXTRACT
(NULL,/db2auditarchive,null, %20071215%',null)
DBAs should ask application
developers to start using
CURRENT CLIENT_*
registers in applications for
better audits
SYSADM (Instance Level - db2audit) SECADM (Database Level)
114
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security
DB2 trusted context
Trusted Contexts:
Are database objects that provide greater control when you use
restricted and/or sensitive privileges
Especially useful when many application servers use a single user id
Allow middle-tier servers or applications to assert the identity of the
end-user to the database
Can then acquire additional capabilities not allowed outside the trusted
context
Implicitly: Application uses trusted context as-is
Explicitly: Application can switch users without re-authenticating
Create a trusted connection when a connection attribute matches
trusted context attributes:
System authorization ID: Represents the user who establishes a database
connection
IP address (or domain name): Represents the host from which a database
connection was established
Data stream encryption: Represents the encryption setting (if any) for the
data communication between the database server and the database client
CREATE TRUSTED CONTEXT appsrvercx
BASED UPON CONNECTION USING
[1] SYSTEM AUTHID appsrvid
ENABLE
[2] ATTRIBUTES (ADDRESS 9.13.116.224 ENCRYPTION HIGH)
[3] DEFAULT ROLE appsrvrl
[4] WITH USE FOR usermgr WITH AUTHENTICATION ROLE mgrrole;
Trusted Contexts defined having:
[1] System authid used to establish the connection
[2] Trust attributes used to establish the connection
[3] Default role (optional)
[4] A list of authids allowed to switch (optional)
115
userB userD userC userA
Trusted Connection
wasUserB, context2
Trusted Connection
wasUserA, context1
Context2:
wasUserB allow
userC; userD
Context1:
wasUserA allow
userA; userB
DB2 Database
Middle Tier
Application Server
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Security
DB2 Secure Sockets Layer (SSL) & Transport Layer Security (TLS)
DB2 can use both SSL & TLS
Provides Federal Information Processing Standard (FIPS) compliance
Enable a client to authenticate a server
By exchanging digital certificates
Provide private communication between client and server
By using AES encryption
Easy setup through configuration parameters (names start with: SSL_*)
There is an SSL handshake that does the following:
- Client requests an SSL connection listing its SSL version and supported cipher suites
- Server responds with a selected cipher suite
- Server sends its digital certificate to the client
- Client verifies the validity of the server's certificate (server authentication)
- Client and server securely negotiate a session key
- Client and server securely exchange information using the key selected above
Digital
Certificate
Database
Encrypted
Communication
Signer
Certificate
Database
iKeyman tool iKeyman tool
TCP/IP
SSL (JSSE)
JCC Client
TCP/IP
SSL (GSKit)
DB2 Server
116
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
General security issues
DB2 vs. Oracle comparisons
DB2 Security Oracle Security
Groupings:
Roles: Supports roles similar to Oracle, but can grant
to users, groups or other roles
Groups: Supports groups as defined in the OS
Authorities: Instance or database level groupings of
privileges, similar to system privileges in Oracle
Trusted Contexts: Trusted Connections established
through Trusted Contexts, can be tied to a role
Groupings:
Roles: Provide a many to many relationship
between users and privileges.
Some roles are already pre-defined (like DBA) and
others are user created.
Oracle roles do not distinguish between system
and object privileges as they can be mixed.
Authentication: is plug-in controlled
Security plug-ins (DLLs or exits) for client and server
authentication as well as group management
Default plug-ins use OS authentication DLLs
Authentication is by one of these methods
Client side
Server side
GSS Plug-in
Kerberos server
Authentication: determined at user creation time
External or global: Those who exist as
operating system or security package users
Note: You still have to create each and every one of
these users in the Oracle database!
Internal: Those who do not exist as operating
system or security package users must have
passwords identified internally by Oracle
User definition: defined outside the database
User definition: defined in the database
Level: Security in DB2 starts at the instance Level: Security in Oracle starts at the database
117
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
General security issues
DB2 vs. Oracle comparisons (continued)
Oracle Security DB2 Security
Auditing (passive security) available Auditing (passive security) with db2audit utility, a
free core engine functionality
Proprietary approach to security
Does have many security evaluations
Does support Kerberos & PKI
Extra fee to support these
Note: Even if external security packages are used for
Oracle authentication, matching user ids must be
created in each database anyway!
Standards approach to security
Common Criteria at evaluation assurance level 4 (EAL4)
Supports all security standards, including Kerberos
authentication on AIX, Solaris, Window2000/XP, OS/390
with encryption, Windows domain support, LSA, access
tokens, DB2_EXTSECURITY register, etc.
Sets checking for users at client or server at the instance
& database levels
Provides password encryption checking using this
All security support without fees
Table data encryption by:
Pre 10g - DBMS_OBFUSCATION_TOOLKIT
package
uses DES encryption (later deemed ineffective)
10g onward DBMS_CRYPTO package
uses AES encryption
Table data encryption uses RCD (RC2) block cipher
encryption method
Uses 128-bit secret keys derived from an MD5 message
digest
Provided through a set of built-in functions
118
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
IBM Optim Security Solutions
Enterprise data life cycle management
Optim Data Privacy Solution
- Align application data management with your business
objectives to optimize performance, control costs and
reduce risk
De-identify confidential information to protect privacy
and support compliance initiatives such as HIPAA,
GLBA, DDP, PIPEDA, Safe Harbour, and others
Apply a range of masking techniques to transform
personally-identifying information & other
confidential corporate data
Leverage prepackaged data masking routines to
transform complex data elements such as credit
card numbers, email addresses and national
identifiers, while retaining their contextual meaning
Substitute test environments with realistic,
fictionalized data, creating a safe sandbox for
application testing
Consolidate and mask data from multiple
interrelated applications to create a production-like
test environment that accurately reflects end-to-end
business processes.
Optim Data Growth & Test Data Management
- Streamline Test Data Management to improve
application quality, cut IT costs and accelerate
solution delivery
Apply selection criteria to ensure complete test
coverage
Edit data within its relational context to create
error and boundary conditions
Compare baseline data against successive test
run results to identify errors and improve
application quality
Minimize storage footprint of test environments
to cut costs
Consolidate data from multiple interrelated
applications to create a production-like test
environment that accurately reflects end-to-end
business processes
Save data extracts to quickly and easily refresh
test environments
Apply a single, scalable enterprise data management solution across applications (Oracle E-Business Suite, PeopleSoft Enterprise,
Siebel, JD Edwards EnterpriseOne, AmdocsCRM), databases (DB2, Informix Dynamic Server, Oracle, Sybase, SQL Server, XML)
and platforms (Windows, UNIX/Linux, z/OS)
Ask us about how to get
more information
on this product!
119
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Encryption Expert
Additional DB2 tool goes beyond core engine utilities
Ask us about how to get
more information
on this product!
- Help organizations comply with regulations and
legislative acts to ensure private and confidential
data:
Protects DB2 server on line file usage (EE FS Agent)
Protects DB2 database backups by using offline
encryption technology (EE Backup Agent)
Compresses database backups to save storage space
Ensures privacy and enables compliance
Encrypts at high speeds
Provides centralized policy and key management
Utilizes policies that control which keys are used
Audits key usage
All encryption is transparent to current processes and
usage
Performs standard AES 128/256 encryption
Securely exchange encrypted archives with affiliates
without divulging internal keys
Encryption Expert Server
Security
Server
Keys, Policies,
Logs
Web
Admin
Soap/https
https
120
2012 IBM Corporation
An IBM Proof of Technology
Lab 06 AUTONOM
28 slides
Burt Vialpando
DB2 Autonomic Computing
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Autonomic Computing
Definition
Autonomic computing architecture provides
a foundation on which self-managing
information technology systems can be built
Self-managing autonomic systems exhibit
the characteristics of CHOP:
Self-Configuring
Self-Healing
Self-Optimizing
Self-Protecting
Originally, autonomics described the
human bodys ability to regulate itself, e.g.
Increased heart and breathing rate for more
blood and oxygen flow during a crisis
Sweating to cool down the body when it gets
hot
Autonomic computing systems have the ability to manage themselves and dynamically adapt to change i n
accordance with business policies and objectives.
This enables computers to identify and correct problems often before they are noticed by IT personnel.
They can also learn , adapt and protect themselves for future situations.
Self-
Configuring
Self-
Healing
Self-
Protecting
Self-
Optimizing
Increased
Responsiveness
Adapt to dynamic-
ally changing
environments
Business resiliency
Discover, diagnose
& act to prevent
disruptions
Operational
efficiency
Tune resource &
balance workloads to
maximize use of IT resource
Secure information
and resources
Anticipate, detect, identify
and protect against attacks
Autonomic Computing Attributes
Self-managing systems that deliver
As described by: Brent Miller Senior Technical Staff Member,
Autonomic Computing Architecture, IBM Corporation
122
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Self-Tuning Memory Manager (STMM)
Autonomics for managing DB2 memory usage
DB2 Self-Tuning Memory Manager uses out of the box autonomics which:
Constantly re-evaluated cached based memory usage
Optimizes current workload up to 60 times an hour
Stops tuning if it reaches optimal configuration
Is on by default for single partition databases, but can be turned off
Use db parameter SELF_TUNING_MEM OFF
Can share OS memory with database memory automatically
Use db parameter DATABASE_MEMORY AUTOMATIC
Can share various cached based database memory heaps with each other
Set these to AUTOMATIC
E BUFFER POOLS
E PCKCACHESZ
E LOCKLIST
E SHEAPTHRES_SHR
E SORTHEAP
QUESTION:
Do I need to learn the DB2 cached
based memory model in order to tune it?
NOTE:
DB2 Self-Tuning Memory Manager manages cache based memory
in DB2 for performance.
Functional based memory used by application programs are
controlled by the parameter APPLICATION_MEMORY, or if this is set
to AUTOMATIC then INSTANCE_MEMORY will control this.
ANSWER:
Not at all. DB2 Self-Tuning Memory
Manager handles this for you!
123
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Self-Tuning Memory Manager
DB2 automatic memory usage
Setting a few database parameters & the buffer pools to AUTOMATIC
Makes DB2 share the entire system memory, when needed, as shown below
The database borrows memory from the operating system, or gives it back
The buffer pools share memory with each other, even converting the various page sizes
The other database memory heaps share with each other as well as the buffer pools
* Registry variable db2_mem_tuning_range limits upper and lower ranges of OS memory usage
124
BUFFER
POOL 1
BUFFER
POOL 2
BUFFER
POOL 3
BUFFER
POOL 4
DATABASE_MEMORY
OPERATING SYSTEM MEMORY
PCKCACHESZ (Package Cache)
LOCKLIST (Lock List)
SHEAPTHRES
_SHR
SORTHEAP
(Sorts &
Hash Joins)
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Self-Tuning Memory Manager
Parameter setting details
DB2 Self-Tuning Memory Manager itself is on by default for newly created databases
IBM Data Studio can turn this off -change SELF_TUNING_MEM to OFF
Or use the following CLP command:
UPDATE DB CFG FOR DATABASE [db-name] USING SELF_TUNING_MEM OFF;
Buffer pools are set to SIZE AUTOMATIC by default if size is not specified
To freeze this, use IBM Data Studio to alter the buffer pool size to a set page amount
Or use the following CLP command:
ALTER BUFFERPOOL [bufferpool-name] size [pages];
DATABASE_MEMORY is AUTOMATIC by default for newly created databases
IBM Data Studio can turn this off - change DATABASE_MEMORY to COMPUTED
Or use the following CLP command:
UPDATE DB CFG FOR DATABASE [db-name] USING DATABASE_MEMORY
COMPUTED;
125
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Self-Tuning Memory Manager
Parameter setting details (continued)
Package Cache and Lock List set to AUTOMATIC by default
To freeze their sizes, use IBM Data Studio to alter their sizes to a fixed page amount
Or use the following CLP commands:
UPDATE DB CFG FOR DATABASE [db-name] USING PCKCACHE_SZ [pages];
Sorting and hash joins are controlled by three different parameters
By default the DBM parameter SHEAPTHRES is set to 0 to put sorts in database shared
memory; it must be set to 0 for STMM to manage sort memory
By default DB parameters SHEAPTHRES_SHR and SORTHEAP are set to AUTOMATIC
Use the IBM Data Studio to alter these or the following CLP commands to change them:
UPDATE DBM CFG USING SHEAPTHRES [pages];
UPDATE DB CFG FOR DATABASE [db-name] USING SHEAPTHRES_SHR [pages];
UPDATE DB CFG FOR DATABASE [db-name] USING SORTHEAP [pages];
UPDATE DB CFG FOR DATABASE [db-name] USING LOCKLIST [pages];
126
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Self-Tuning Memory Manager
Why so useful?
New DB2 DBAs benefit right away from DB2 Self-Tuning Memory Manager
But theres more to it than that
Experienced DB2 memory tuning experts can benefit with DB2 Self-Tuning Memory
Manager when:
Database memory usage is not known at the time of the tuning (guessing is required)
Database memory usage is known, but fluctuates greatly hour by hour (or day by day)
Database buffer pools are many and differ in page sizes (difficult to tune)
System (OS) memory usage is not entirely known, greatly fluctuates or is not completely used
Partitioned databases have individual varying memory requirements
127
70,000
60,000
50,000
40,000
30,000
20,000
10,000
No Tuning
(Default)
Expert Tuned
(Benchmark)
16,713 16,713
63,302 63,302
63,796 63,796
16,713
63,302
63,796
STMM
Tuned
Benchmark Comparisons TPM
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Automatic Memory Management
Oracle Automatic (Shared) Memory Management A(S)MM
Bottom Line:
DBAs will love DB2 Self-Tuning Memory Manager ease of use, power and flexibility!
O To use Oracle AMM, set MEMORY_TARGET parameter
For SGA, it will manage these pools (if you do not set SGA_TARGET -ASMM):
1) db cache, 2) shared pool, 3) Java pool, 4) large pool and 5) streams pool
For all PGA (if you do not set PGA_AGGREGATE_TARGET)
O Oracle AMM is not like DB2 STMM because:
SGA non standard block size pools are not managed by ASMM
With ASMM, if your default block size is 8K, then 2K, 4K, 16K & 32K caches do not participate
With STMM, you manage any and all buffer pools of any page size
Oracle Inter-Instance memory sharing cannot be accomplished by AMM
With AMM, you can only manually de-allocate from MEMORY_MAX_TARGET
With STMM, memory can be given to and taken from the OS - automatically
SGA pools managed are an all or nothing proposition
ASMM either manages all 5 SGA pools, or it manages none of them - individual SGA pools
can only be set to a minimum size or be set to 0
STMM allows any or all memory caches (pools) to be set to a static size if desired
SGA keep & recycle pools are not managed by ASMM
Oracle keep pool critical for memory pinning and only matches default db cache block size
DB2 buffer pools can be isolated and set statically for table space object pinning
128
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Automatic Storage
DB2 automatic storage how does it work?
1. Enabled by default when you create a database in DB2 10.1:
For migrations from previous DB2 versions, add a storage group to enable it:
CREATE DATABASE
2. Create table space with the following:
CREATE TABLESPACE MANAGED BY AUTOMATIC STORAGE
CREATE STOGROUP [sto-grp-name] ON [path/drive]
129
Note: Default storage group created is IBMSTOGROUP
Thats it! Under the covers, DB2 creates, names and sizes the data files needed to support the
table space without any DBA intervention.
Path or drive can be any number of subdirectories, mount points or drives
Path or drive list can be added to later with an ALTER or CREATE STOGROUP command
DB2 manages all automatic storage containers within this path
Smart enough to make temporary table spaces SMS, all others DMS
Automatically stripes containers for you by your number of paths or drives
Create other DMS or SMS table spaces outside automatic storage if desired
Health Monitor indicators signal if paths or drives about to become full
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Automatic Storage
Oracle Automatic Storage Management (ASM) how does it work?
ASM implemented as a special, separate, Oracle instance
Recommend: oracle_home of its own
Required: OS authentication to connect and administer
Required: its own init.ora file with special parameters to govern it
and many other maintenance intensive actions
Required: one ASM instance per server
Required: its own set of memory
Usually around 100 MB
All databases using ASM now critically tied to ASM
ASM has to be the first instance up and the last down on any server using it
ASM instance failure effectively fails all table spaces using it in all databases using it
Bottom Line:
DBAs will love the DB2 Automatic Storage ease of use!
130
Note: Oracle Managed files (OMF) has a similarity to, but is not really like, DB2 automatic storage:
OMF only controls one data file name and requires the one target path to use a logical volume manager.
OMF cannot use multiple paths for table space data files and does not create new data files when needed.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Utility Throttling
How does it work in DB2?
Instance level throttling set with one DBM cfg parameter
UTIL_IMPACT_LIM
Sets percent of impact for all utilities on the system
Default is 10
Now UTIL_IMPACT_PRIORITY for each utility can be set
Determines relative rank of importance of all throttled utilities
Entire throttled utility set bound by limit of UTIL_IMPACT_LIM
These utilities can be executed with a UTIL_IMPACT_PRIORITY
subcommand
Backup
Runstats
Other already running utilities* can be throttled using
These line commands:
LIST UTILITIES SHOW DETAIL;
SET UTIL_IMPACT_PRIORITY FOR [utility] TO [priority];
* Includes: load, reorg, rebalance, redistribute, async_index_cleanup,
crash_recovery, restart_recreate_index, restore, rollforward_recovery
131
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Utility Throttling
How does it work in Oracle?
Backup (RMAN)
Set RATE option of CHANNEL command
Data Pump
Set PARALLEL parameter
Other utilities can use resource plans
Requires ADMINISTER_RESOURCE_MANAGER privilege
Uses DBMS_RESOURCE_MANAGER package
Very customizable
Create consumer groups, plan directives and so on
But is very complex
Requires extensive set up to use
Are you using these Oracle throttling methods?
Bottom Line:
DBAs will love the DB2 utility throttling power & built-in ease of use!
132
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
AUTOCONFIGURE
DB2 all-in-one performance parameter tuning utility
DB2 autonomics runs the AUTOCONFIGURE utility at database creation time
This automatically sets many of your instance and database parameters for you
An already created databases can be tuned with AUTOCONFIGURE
Scope for changes is NONE, DB or DB and DBM
AUTOCONFIGURE suggests optimum instance and database tuning parameter
settings based upon a set of 10 user input values or default values
Autonomics automatically senses everything else it needs to know
ANSWER:
AUTOCONFIGURE!
QUESTION:
How can I tune my performance
related configuration parameters and
buffer cache ALL AT ONCE?
133
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
AUTOCONFIGURE
Architecture
Expert Heuristics
Configuration
Settings
Configuration Model
(AUTOCONFIGURE)
Automatically Detected
Environment
Characteristics
10 User
Input Values
134
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
AUTOCONFIGURE
10 user input values
Keyword Valid Value
Range
Default
Value
Explanation
mem_percent
1-100 25 Percentage of memory to dedicate to DB2 as
derived from parameter : instance_memory
workload_type
Simple, Mixed,
Complex
Mixed Online transaction processing (OLTP) I/O
intensive, Data warehousing CPU intensive
num_stmts
1-1,000,000 10 Number of statements per unit of work
tpm
1-200,000 60 Transactions per minute
admin_priority
Performance,
Recovery, Both
Both Optimize for more transactions per minute or
better recovery time
is_populated
Yes, No Yes Is the database populated with data?
num_local_apps
0-5,000 0 Number of local connected applications
num_remote_apps
0-5,000 10 Number of connected remote applications
Isolation
RR, RS, CS, UR RR Isolation Level of applications
bp_resizable
Yes, No Yes Are buffer pools resizable?
135
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
AUTOCONFIGURE
Autonomically detected environment characteristics
Environment Autonomically Detected System Characteristics
System
Number of physical disks & spindles
Physical memory size
CPU information (number of online and configured CPU)
OS Features (OS type and release Linux, UNIX, Windows)
Database
Size of database
Number of tables
Number of Indexes
Number of table spaces
Buffer pools
Name, size and page size for each buffer pool
Number of buffer pools
136
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology 137
AUTOCONFIGURE
Configuration parameter settings - output
Environment Configuration Parameter Settings
Instance
AGENT_STACK_SZ ASLHEAPSZ FCM_NUM_BUFFERS INTRA_PARALLEL
MAX_QUERYDEGREE NUM_INITAGENTS NUM_POOLAGENTS PRIV_MEM_THRESH
RQRIOBLK SHEAPTHRES
Database
APP_CTL_HEAP_SZ APPLHEAPSZ CATALOGCACHE_SZ * CHNGPGS_THRESH
DFT_EXTENT_SZ DBHEAP APPGROUP_MEM_SZ DFT_DEGREE
DFT_PREFETCH_SZ LOCKLIST * DFT_QUERYOPT LOGBUFSZ
LOGFILSIZ LOGPRIMARY LOGSECOND MAXAPPLS
MAXLOCKS UTIL_HEAP_SZ NUM_IOCLEANERS NUM_IOSERVERS
PCKCACHESZ * SOFTMAX SORTHEAP * SELF_TUNING_MEM *
STAT_HEAP_SZ STMTHEAP SHEAPTHRES_SHR *
AUTO_MAINT AUTO_DB_BACKUP AUTO_TBL_MAINT AUTO_REORG
AUTO_RUNSTATS AUTO_STMT_STATS AUTO_STATS_PROF AUTO_PROF_UPD
Buffer pools Buffer Pool Size *
* Self Tuning Memory related parameters
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
AUTOCONFIGURE
Command line *
138
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
AUTOCONFIGURE
Command line output example: DB (Database)
Sample Output (DBM and DB Configuration Parameters)
139
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
AUTOCONFIGURE
Oracle offering comparison
Oracle DB2
No real equivalent
The Database Configuration Assistant
(DBCA) has a few template choices for
parameter defaults for database creation
only.
Oracle has some parameters you can set
to automatic and ADDM helps tune one
at a time, but these are not the same as
AUTOCONFIGURE.
Nothing in Oracle will aid you to
proactively set all performance
parameters and cache settings all at
once, in one tool.
AUTOCONFIGURE!
Normally database tuning experts have to
change one parameter at a time and retest
each time to see how the change acts with
all other parameters.
DB2 gives you a huge head start in this
process its a performance parameter
tuning expert in a box!
Bottom Line:
DBAs will love the DB2 powerful and easy to use parameter configuration tool!
140
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Automatic Maintenance
Autonomics approach overview
DB2 Automatic Maintenance:
Only performs activities that need to be done
Uses set it and forget it autonomics
Determines when (and whether) to run
BACKUPs
RUNSTATs
REORGs
Optimizes resources by
Phase I - Determining best time to run any given activity in:
Online window
Offline window
Phase II - Running only required activities
Is easy to manage
GUI wizard walks you through the entire process
Saves your settings in a profile & can be run over and over again
Has a learning capability
Internal scheduling continually estimates times to completion
If window not large enough
Will not run those activities it cannot complete
Will notify you through the Health Monitor
Youll like me.
Ill make your job
easier!
141
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Automatic Maintenance
IBM Data Studio task assistant vs. line command
142
LINE COMMAND CONFIGURATION
There are stored procedures you can
use to manually update automatic
maintenance:
AUTOMAINT_GET_POLICY
AUTOMAINT_GET_POLICYFILE
AUTOMAINT_SET_POLICY
AUTOMAINT_SET_POLICYFILE
GUI
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Automatic Maintenance
Concepts used
All options use these concepts:
Maintenance Windows (or Timing)
Defined as:
Periods of time for hours of the day, days of the week or month
For online and offline time periods
Inside or outside defined time periods
DB2 uses this window to consider running selected utilities
This window should be a relatively unused time period for your database
Notification
List of contacts can be built and used to notify results of auto maintenance actions
Throttling
Auto maintenance uses adaptive utility throttling which it controls all by itself
The defined maintenance window is used as the overriding priority
Uses a fixed 7% limit on resources
Maintenance queue table functions
To monitor runstats in the maintenance queue use: MON_GET_AUTO_RUNSTATS_QUEUE
To monitor all other auto maintenance activities use: MON_GET_AUTO_MAINT_QUEUE
143
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Automatic Maintenance
Auto_% DB configuration parameters
db cfg
~~~~~ ~~
~~~~~~~
~~~~~ ~~~
~~ ~~~~ ~
db cfg
~~~~~ ~~
~~~~~~~
~~~~~ ~~~
~~ ~~~~ ~
db cfg
~~~~~ ~~
~~~~~~~
~~~~~ ~~~
~~ ~~~~ ~
AUTO_MAINT Parent to all other auto_% parameters. Sets auto maintenance at a global level.
Enabled: All recorded values for child parameters take effect.
AUTO_DB_BACKUP Enabled: Allows for automatic BACKUP operations.
AUTO_TBL_MAINT Parent parameter to all other (non backup) auto_% parameters.
Enabled: All recorded values for child parameters take effect.
AUTO_REORG
Enabled: Allows for automatic table and index REORG operations.
AUTO_RUNSTATS Enabled: Allows for automatic asynchronous RUNSTATS operations.
AUTO_STMT_STATS Enabled: Allows for real-time, synchronous statistics gathering.
AUTO_STATS_VIEW Enabled: Allows for statistical view statistic gathering.
AUTO_SAMPLING Enabled: Allows for sampling of large tables.
144
auto_tbl_maint
auto_maint
auto_db_backup
auto_runstats auto_reorg
auto_stats_view auto_stmt_stats auto_sampling
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Automatic Maintenance
Backup settings & workings
BACKUP option uses these settings:
Criteria
Time elapsed since last full backup since specified by number of hours
(Also, if backup has never run before)
Log space used between backups more than specified number of 4K pages
Location
File System (Disk)
(Automatically deletes old copy in chosen directory)
Tape
Tivoli Storage Manager
X/Open Backup Services API (XBSA)
Vendor DLL
Mode
Online - Archive log (retain) mode supported
(Default maintenance mode for this setting is 24 x 7)
Offline Archive log and circular log both supported
(Uses QUIESCE DATABASE in DEFER mode to allow transactions to complete)
145
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Automatic Maintenance
REORG settings & workings
Auto REORG option uses these settings:
All tables
Can include or exclude system catalog tables
Selected tables
Can use a simple or custom filter to select range of tables to run against
Custom filter can point to a control table which contains only the names of tables you
desire an automatic REORG to be performed on
Has other options for REORG like:
Size of table limit (helps avoid REORG on very large tables)
Offline storage location (temporary storage location)
Dictionary rebuild/no rebuild (for compressed tables)
Index reorg mode (read or write options)
Auto REORG works by
Using REORGCHK_TB_STATS and REORGCHK_IX_STATS stored procedures
Determines which tables and indexes to perform REORG on
Performs classic table REORG on table data
Only during a specified offline table maintenance window
with no write access during reorganization
with no access at all during shadow copy change-over
Performs index REORGs during online or offline table maintenance windows
Keeps working data in SYSTOOLS schema tables
146
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Auto RUNSTATS asynchronous collection
DBA selects range of tables for consideration (using GUI)
The out of the box default is all tables
Utility is non contentious uses new special kernel locking protocols
Utility uses a collection algorithm that learns over time how fast the statistics change
Compares histograms on a per table basis
Determines the minimum set of statistics that give optimal performance improvement
Asynchronously runs background RUNSTATS for tables determined to need it
Keeps working data in SYSTOOLS schema tables
Supports statistical views and large table sampling
Real-time statistics - synchronous collection
DBA sets AUTO_STMT_STATS db cfg parameter
Utility collecting statistics when needed by that query at run time
Ignores the maintenance windows; runs anytime queries run
Uses many different techniques to maximize synchronous collection
Like placing statistics in statistics cache and writing to the catalog later
Limiting the time spent to collect statistics (5 seconds by default)
Submitting asynchronous collection if necessary
Fabricating statistics through extrapolation
Automatic Maintenance
RUNSTATS settings & workings
147
ASAP!
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Automatic Maintenance
Oracle automatic system tasks
Oracle Automated Maintenance Tasks is effectively job scheduling
This ability ONLY comes with Oracle Enterprise Manager (OEM) Diagnostic
Pack and is set up with the DBCA
For example, is not available on Express editions
This is provided in all editions of DB2
Uses customizable maintenance_window_group for jobs to run under
For statistics collection
Uses DBMS_AUTO_TASK and DBMS_STATS packages
Calls GATHER_STATS_PROG to collect optimizer statistics for all objects in the
database
Where there are either no statistics or stale statistics (defined as 10% row changes
by default, but can be overridden globally or by table)
For Oracle REORGs (MOVEs)
You must manually check for and schedule jobs yourself
Only supported for tables (DB2 is tables and indexes)
For Backups
Using DBCA can set up a job to do an incremental backup
Segment & SQL Tuning advisors
These tools are automatically fed information from AWR
You must engage the tools manually to affect anything in your database
Oracle
uses scheduled jobs,
not me, and I do all
the work
for you!
Bottom Line:
DBAs will love the DB2 powerful and easy to use automatic maintenance facility!
148
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
We appreciate your feedback.
Please fill out the survey in order to improve this educational event.
SIMPLIFIED CHINESE HINDI JAPANESE
ARABIC RUSSIAN TRADITIONAL CHINESE TAMIL THAI
FRENCH
GERMAN
ITALIAN
SPANISH
BRAZILIAN PORTUGUESE
Thank you
149
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
End of Core Topics
Presentation by:
Burt Vialpando
IBM Executive IT Specialist, The Open Group Distinguished IT Specialist, IBM IT Certification Board
IBM Certified Database Administrator for DB2 10.1 for Linux, UNIX and Windows
IBM Certified Advanced Database Administrator for DB2 V9.7 for Linux, UNIX and Windows
IBM Certified Solutions Developer DB2 9.7 SQL Procedures
IBM Certified Application Developer DB2 9
IBM Certified Solutions Designer for DB2 Business Intelligence V8
IBM Certified Solutions Expert for DB2 UDB V7.1 Database Administration for IBM OS/390
Oracle 11g Database Administrator Certified Associate
IBM Plateau Level 1 Inventor
burt.vialpando@us.ibm.com
Vikram Khatri
IBM Senior Certified IT Specialist for DB2 Migrations
IBM Advanced Technical Expert DB2 for Clusters
IBM Certified Database Administrator for DB2 UDB V8.1 for Linux UNIX and Windows
IBM Certified Solutions Expert for DB2 UDB V8.1 Family Application Development
Project Management Professional Certified
IBM Plateau Level 1 Inventor
vikram.khatri@us.ibm.com
150
2012 IBM Corporation
An IBM Proof of Technology
IBM DB2 10.1 Administration
For the Experienced Oracle DBA
Part 2 Elective Topics
Version 7.0 December 7, 2012
Burt Vialpando & Vikram Khatri
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Proof of Technology (PoT) Overview
Part 2 Agenda Elective Topics
2
IBM

DB2

Introduction & Overview


DB2 Instance Exploration & Using the CLP - Lab 01
DB2 Database Creation and Exploration - Lab 02
IBM Data Studio - Lab 03
DB2 CLPPlus and Oracle Compatibility - Lab 04
DB2 Security Concepts - Lab 05
DB2 Autonomic Computing - Lab 06
DB2 Deep Compression - Lab 07
DB2 Explain Facilities & the Optimizer - Lab 08
DB2 Workload Manager - Lab 09
DB2 Monitoring (core engine) - Lab 10
DB2 pureXML

- Lab 11
DB2 Multidimensional Clusters - Lab 12
DB2 Data Movement Utilities (core engine) - Lab 13
DB2 Backup, Restore & Recovery (core engine) - Lab 14
Additional Misc. DB2 Topics - Lab 15
Core Topics
Elective Topics
2012 IBM Corporation
An IBM Proof of Technology
Lab 07 COMPRESS
16 slides
Burt Vialpando
DB2 Deep Compression
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
The nature of data
4
As data continues to grow, the cardinality of the data drops. As it turns out there
just are not that many truly "unique" things in the world. Now, they may be unique
when used in combination, like DNA, but the basic elements themselves are not all
that varied. Consider the Periodic Table of Elements - everything in our world is
made up of this rather small set of basic elements in combination. Apply the
concept to data, and you find the same is true.
There may be over 300 million people in the US, but there are only approximately
78,800 unique last names, producing very low cardinality, with huge "clumps" in
certain name sets. First name is even more severe, coming in at about 6,600
unique first names (4,400 for the females, 2,200 for males).
The names of cities and streets and their "normalized", address corrected
adornments (Street, Avenue, etc.) are also of very low cardinality.
The English language has about 64,000 words, and those in most common use
count less than 10,000.
Product names, descriptions and attributes (e.g. "Dolby Digital") also tend to be
highly redundant and of low cardinality.
DB2 uses the above principles: Symbol based compression works well over a large
domain of data first, since the data within the domain is statistically not that variant
The nature of data
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
Recap of feature highlights
Dictionary based symbol for compressing or decompressing data rows
Lempel-Ziv (LZ) based algorithm creates a static dictionary based at the table level
A single table dictionary is stored within the table object for recurring large domain patterns
Compression is also done adaptively at the page level
Smaller page stored dictionaries are for the ever changing page level patterns
Data resides compressed on pages
On the table space disk giving significant I/O bandwidth savings
In buffer pools giving memory savings & improvement in performance
In recovery log disk & archive log tape
Compression is easy to implement and use
DBA just uses these keywords: COMPRESS YES
Compression done during insert, update, import or load
Table dictionary is built on the fly with Automatic Dictionary Creation after a 1 MB sample
Page dictionaries are built adaptively any time repeating patterns are detected
Compression done in many ways:
5
Data
2 levels
Indexes
3 techniques
XML
XDAs
Temp tables
5 usages
Replicated
tables
Log
archives
Inline
LOBs
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
Static (or classic) Row Compression for data
Table level row compression for data
There is only one dictionary for the entire table or table partition
Contains values that appear frequently across the larger domain of the entire table
Uses a Lempel-Ziv algorithm to create a compression dictionary
Is called static because the dictionary is created in one of two ways
1. By default - with Automatic Dictionary Creation on the fly after a 1 MB sample is detected
This is the easiest to implement
But gives up some compression benefits
2. Purposefully - with a table REORG or an on line table move
This gives the best over all table level, large domain compression
But requires DBA work to attain
6
CREATE TABLE CUSTOMER_INFO
COMPRESS YES STATIC;
ALTER TABLE CUSTOMER_INFO
COMPRESS YES STATIC; (01) Vialpando
(02) Waterson
(03) 824 Lakeside Drive
(04) 101 Mill Creek Road
(05) Dallas Texas 75063
Uncompressed Rows
Compressed Rows
(01) (03) (05)
(02) (04) (05)
Vialpando 824 Lakeside Drive Dallas Texas 75063
Waterson 101 Mill Creek Road Dallas Texas 75063
Compression Dictionary
To enable static-only compression on a table:
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
Adaptive Row Compression for data
Page level row compression for data, compliments table level compression
A dictionary per page is created for this smaller domain
Adapts for changing data characteristics over time
Compression rates improve as data grows and changes
Improvements over table level (static only) compression are usually much higher
Occurs during: inserts, updates, imports, loads, reorgs, table-moves and redistributes
Key point: table REORGs are not required to maintain high compression
7
CREATE TABLE CUSTOMER_INFO
COMPRESS YES;
ALTER TABLE CUSTOMER_INFO
COMPRESS YES;
Adaptive compression on a table is the default if
using compression. Here are ways to enable this:
CREATE TABLE CUSTOMER_INFO
COMPRESS YES ADAPTIVE;
ALTER TABLE CUSTOMER_INFO
COMPRESS YES ADAPTIVE;
No compression Static table level
compression (only)
3x
With page level
adaptive
compression
7.4x
900
MB
300
MB
122
MB
DB2 compression examples
Or:
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
Data compression level and opportunity: DB2 vs. Oracle
8
DB2 compresses data at the entire table or table partition level
Example: your name randomly falls 1,000,000 times in a DB2 table, but if your name fell
only once per page or extent, you would still get it compressed 1,000,000 times
Oracle compresses data at the block level only
Example: your name randomly falls 1,000,000 times in an Oracle table, but if your name
fell only once per block, no compression would result!
DB2 adaptive compression will further compress at the page level
Adds the newly introduced data pattern compression benefits Oracle has
DB2 looks not only across multiple columns, but even on partial columns
Example: your Greek name is rare, but ends in opolous like many of your fellow Greeks.
The string opolous could be compressed thousands of times along with the ending of
many other Greek names.
Oracle only looks at entire columns for compression
Example: your Greek name ends in opolous, but is rare and only appears a few times in
the database. It will not be compressed at all.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
Index compression: DB2 vs. Oracle
DB2: automatically chooses an appropriate index
algorithm with no work required by the DBA:
1. RID list compression
Instead of storing RIDs explicitly, only the first is stored and the
others are referenced as an offset of that RID.
2. Variable slot directory
The slot directory is not fixed and is dynamically adjusted to fit as
many index keys as it needs to so each two byte entry in the slot
directory corresponds to a different index key on the page.
3. Prefix compression
Keys are stored in sorted order and adjacent values of prefixes are
stored only once.
All the above automatically used by DB2 when you simply set
compression on for a table
<00 00 00 04, 00 00>,
<00 00 00 04, 00 01>,
<00 00 00 04, 00 02>,
<00 00 00 04, 00 00>,
<1>,
<1>,
(a, a, a),
(a, a, b),
(a, a, c),
(a, a, a),
(, ,b),
(, ,c),
AA 01 Burt
AA 02 Shen
AA
01 Burt
02 Shen
9
Oracle: only uses one algorithm and requires more work
Prefix compression - ONLY
Requires DBA work to implement by doing the following:
1. Select candidate indexes for prefix compression
2. Run script to analyze candidate indexes
3. Select the indexes that will achieve best compression
4. Run script to compress targeted indexes
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
DB2 index compression usage
Activated by default
When row compression is activated for the table
Exceptions: MDC blocks, XML meta and path
Opt in or out any index from compression if desired
CREATE INDEX with the COMPRESS [YES|NO] option
ALTER INDEX with the COMPRESS [YES|NO] option
followed by an index reorg
Savings information:
Function ADMIN_GET_INDEX_COMPRESS_INFO estimates compression savings for
uncompressed index
COMPRESS and PCTPAGESSAVED in the SYSINDEXES catalog table show if an index
is defined as compressed and the percentage saved respectively
Note: Oracle compression for indexes available with prefix key compression technique only
which is a subset of what DB2 offers. See:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_5011.htm#SQLRF01209
10
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
Index compression measurements
Index compression uses idle CPU cycles and
idle cycles spent waiting for I/O to compress
& decompress index data
Databases not CPU bound are able to
achieve better performance, especially in
inserts and updates
Simple Index Compression Tests - Elapsed Time
49.24
83.99
53.89
49.12
68.3
44.07
0 10 20 30 40 50 60 70 80 90
Si mpl e Sel ect
Si mpl e Insert
Si mpl e Update
Seconds
Wi thout Index Compressi on Wi th Index Compressi on
Simple Index Compression Tests - CPU Analysis
34.5
34.8
16.2
20.8
23.6
33.9
16.7
17.5
1.6
2.0
2.6
2.5
37.1
36.4
49.1
46.3
48.2
45.0
11.7
11.4
33.3
30.9
25.9
18.5
0% 20% 40% 60% 80% 100%
Sel ect: Base
Sel ect: Ixcomp
Insert: Base
Insert: Ixcomp
Update: Base
Update: Ixcomp
Machi ne Uti l i zati on
user system i dl e i owai t
22% Faster
23% Faster
Runs
As fast
* Lower is better
*
Index Compression Space Savings
31%
55%
16%
24%
20%
57%
50%
0% 10% 20% 30% 40% 50% 60% 70%
TD-EDW
SPAR
DDMV
SAP-ssqj
SAP-sd
SAP-bw
TPC-DS
T
y
p
e

o
f

D
a
t
a
b
a
s
e
Percentage Compressed
Average 36%
* Higher is better
*
11
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
XML Data Area (XDA) and LOB compression
12
Return compression information by using
Admin view:
ADMINTABCOMPRESSINFO
Function:
ADMIN_GET_TAB_COMPRESS_INFO_V97
When a table is set: COMPRESS YES
XML that is stored in-line (or in the base table row) is compressed with the data row
dictionary
LOBs that are stored in-line are compressed with the data row dictionary
XML that is stored in a separate XDA is compressed in its own XDA dictionary
CUSTOMER_ID CUSTOMER_DOC

12345 <cust>
<info>...</info>
</cust>

CREATE TABLE CUSTOMER_INFO


(CUSTOMER_ID INTEGER, CUSTOMER_DOC XML, )
COMPRESS YES;
CUSTOMER_INFO
DB2 STORAGE
Table row data XDA
All
compressed
12
Note: Oracle compression for XML only available through
Secure Files implementation technique that requires using
ASM as well. See:
http://www.oracle.com/technology/products/database/oracle11g/pdf/adva
nced-compression-whitepaper.pdf
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
Temporary tables
Five different usages:
User created temporary tables - CGTT
User declared temporary tables - DGTT
System temporary tables :
Sorts
Joins
aggregates
Goals of use:
Reduce the amount of temporary disk space required
Has no performance penalty as a result of the extra processing required for row compression
Increase in query performance a side benefit, but not the goal
Temporary tables will be compressed by default
When compression license is applied to the database
There is no additional action required by DBAs or users
DB2 evaluates the query and applies compression where appropriate
When used, requires extra 3MB for dictionary
To see compression benefit:
Use utility db2pd
13
Note: Oracle compression does not extend to temporary tables
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
Archived Logs
14
Archive logs compressed at time of archive movement
The database manager will automatically compress log extents when they are moved
from the active log path to the archive location
Upon retrieval (e.g. during ROLLBACK and ROLLFORWARD) the database manager
automatically expands compressed log files when they are moved from the archive into
the active or overflow log paths
Enabled independently for primary or secondary archive methods
Accomplished with database parameters
Archive locations must be disk, TSM or vendor
Will affect all objects in the archive log
Objects not compressed will be compressed
Data already compressed will not necessarily experience more compression however
UPDATE DB CFG FOR TDB2 USING LOGARCHMETH1 DISK:/vol_auxillary1/archive/db2
UPDATE DB CFG FOR TDB2 USING LOGARCHCOMPR1 ON
UPDATE DB CFG FOR TDB2 USING LOGARCHMETH2 DISK:/vol_auxillary2/archive/db2
UPDATE DB CFG FOR TDB2 USING LOGARCHCOMPR2 ON
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression
Replicated tables
Set iFilterOption in the db2ReadLog API to decompress log data before returning log records
Create a table with both COMPRESS YES and DATA CAPTURE CHANGES
CREATE TABLE...
DATA CAPTURE CHANGES...
COMPRESS YES;
15
Dictionary
db2ReadLog API
iFilerOption ON
Log
Compressed user data in logs
Uncompressed user data in logs
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression Comparison
Performance overhead DB2 vs. Oracle
16
I/O bandwidth savings for both DB2 and Oracle
The greater the compression, the larger the savings
More data read with less reads as more rows read with less I/O
This translates to logging as well more log written in less time and space
Memory / buffer pool (cache) saving for both DB2 and Oracle
The greater the compression, the larger the savings
More data stored in memory with less space
CPU cost for both DB2 and Oracle
Rows must be decompressed before being processed for evaluation
The greater the compression, the larger the potential cost
If there is any CPU headroom at all, the I/O and memory benefits can sometimes
neutralize the cost of CPU cycles
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression Comparison
Application transparency & read impact DB2 vs. Oracle
Both DB2 and Oracle offer application transparency
The database engine handles the compress / decompress automatically
Only data that is selected in a query needs to be uncompressed
The database checks the existing symbols (in the dictionary or page header) to see if the
data can be compressed
If so, stores the compressed data in the buffer pool
Application changes are not required to use compression
Note on impact on reads DB2 and Oracle are similar:
If a query needs to scan many rows, compressed data requires less I/O by the server.
Data remains compressed in the buffer pool, so you can get more rows in the buffer pool.
This will help to increase the speed that the database can respond to the queries.
The hit comes when the database has to uncompress the data before returning it to the
application.
If the queries read a number of rows to find the data that is needed, the savings of the
reduced I/O can quickly overcome the slight hit to uncompress the data. Because of this:
Many customers will see performance increases on reads
Even CPU bound read-only applications can perform well
17
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Deep Compression Comparison
DB2 vs. Oracle recap DB2 delivers superior compression
Compression Feature DB2 10.1 Oracle 11g R2
Table general
Table large domain pattern matching
Table page (block) pattern matching
Table column value
Table multi-column value
Table substring value
Table XML (in-line and XDA)
Table LOBs in-line
Index general
Index prefix
Index variable slot (dynamic prefix)
Index rid list
User temp CGTT & DGTT
System temp sort overflow
System temp join temps
System temp aggregate temps
Replication
Archive log
18
2012 IBM Corporation
An IBM Proof of Technology
Lab 08 EXPLAIN
DB2 Explain Facilities &
the Optimizer
15 slides
Burt Vialpando
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explain Facilities
Compared
Oracle
Tables created with UTLXPLAN.SQL
Syntax EXPLAIN PLAN to generate plan
DBMS_XPLAN package to format plan data
SQL Tuning Advisor with 11g console is GUI interface, but
Text based output
Performance Manager with SQL Analyze is complete visual
explain
DB2
Tables created with EXPLAIN.DDL
Syntax EXPLAIN [PLAN] to generate plan
Uses a variety of utilities to format plan data
Visual Explain is GUI interface / GUI output tool
All tools are free with all versions of DB2
20
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explain Facilities
DB2 explain tools overview
To see the access plan information available for packages of static SQL
statements (static mode)
Shows the actual implementation of access plan
Shows on the fly execute and explain or explain from cache (dynamic mode)
Line command driven
Text output with text based graphs
To see the access plan information available for packages of static SQL
statements (static mode)
Shows the actual implementation of access plan
Shows on the fly execute and explain or explain from cache (dynamic mode)
Line command driven
Text output with text based graphs
db2expln
To see the access plan information available for packages of static SQL
statements (static mode)
Shows the actual implementation of access plan
Shows on the fly execute and explain or explain from cache (dynamic mode)
Line command driven
Text output with text based graphs
db2expln
Formatter for previously stored explain data from optimizer information only
Line command driven
Text output with text based graphs
Formatter for previously stored explain data from optimizer information only
Line command driven
Text output with text based graphs
db2exfmt
Formatter for previously stored explain data from optimizer information only
Line command driven
Text output with text based graphs
db2exfmt
Run from the IBM Data Studio
Entirely GUI driven
Provides a visual graph of the plan
Allows drill-down on objects and nodes for more detail
Run from the IBM Data Studio
Entirely GUI driven
Provides a visual graph of the plan
Allows drill-down on objects and nodes for more detail
Visual
Explain
Run from the IBM Data Studio
Entirely GUI driven
Provides a visual graph of the plan
Allows drill-down on objects and nodes for more detail
Visual
Explain
21
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explain Facilities
DB2 tool characteristics
Characteristics Desired Explain
Tables
Visual
Explain
db2exfmt db2expln
GUI Interface Yes
Text Output Yes Yes
Static SQL supported Yes Yes Yes Yes
Dynamic SQL supported Yes Yes Yes Yes
CLI Applications supported Yes Yes Yes
Detailed Optimizer information supplied Yes Yes Yes
Suited for multiple statement analysis Yes Yes Yes
Information accessible from within
application
Yes
Available to DRDA* application requests Yes
Quick & Dirty static SQL analysis Yes
* Distributed Relational Database Architecture
22
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explain Facilities
DB2 explain* tables
Explain Table Function
EXPLAIN_INSTANCE
Main control table that has RI to all others.
A DELETE from this table will cascade to all the others.
EXPLAIN_STATEMENT
Contains the text of the SQL statement as it exists for the different
levels of Explain information.
EXPLAIN_ARGUMENT
Represents the unique characteristics for each individual operator,
if there are any.
EXPLAIN_OBJECT
Identifies those data objects required by the access plan
generated to satisfy the SQL statement.
EXPLAIN_OPERATOR
Contains all the operators needed to satisfy the SQL statement by
the SQL compiler.
EXPLAIN_PREDICATE
Identifies which predicates are applied by a specific operator.
EXPLAIN_STREAM
Represents the input and output data streams between individual
operators and data objects.
23
* Advise Tables: tables named ADVISE_* used for explain mode processing shown in following slide
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explain Facilities
DB2 dynamic SQL explain modes
Explain Mode Function
NO (default) Disables explain. No explain info. captured.
SQL statements executed and real-time statistics are used if available.
YES Enables explain. Causes explain info. to be captured into explain tables.
SQL statements executed and real-time statistics are used if available..
EXPLAIN Enables explain. Causes explain info. to be captured into explain tables.
SQL statements not executed.
REOPT Enables explain. Causes explain info. to be captured into explain tables but only at
re-optimization time when host variables are resolved.
SQL statements executed and real-time statistics are used if available.
RECOMMEND INDEXES Enables explain. Causes explain info. to be captured into explain tables & populates
ADVISE_INDEX table.
SQL statements not executed.
EVALUATE INDEXES Enables explain. Uses indexes in ADVISE_INDEX table.
SQL statements not executed.
RECOMMEND PARTITIONINGS Enables explain. Causes explain info. to be captured into explain tables & populates
ADVISE_PARTITION table.
SQL statements not executed.
EVALUATE PARTITIONINGS Enables explain. Uses indexes in ADVISE_PARTITION table.
SQL statements not executed.
DB2 Dynamic SQL Explain Control:
Set special register with SET CURRENT EXPLAIN MODE = [value]
Set interactively or embed in an application; it can be dynamically prepared and executed.
24
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explain Facilities
DB2 static SQL explain bind values
Explain Bind Values Function
NO (default) Disables explain. No explain info. captured.
SQL statements executed.
YES Enables explain. Causes explain info. to be captured into explain tables for:
Static SQL at prep / bind time
Reoptimizable incremental statements at run time
SQL statements executed.
REOPT Enables explain. Causes explain info. to be captured into explain tables for:
Reoptimizable incremental statements at run time
Dynamic SQL at run time overriding CURRENT EXPLAIN MODE.
SQL statements executed.
ALL Enables explain. Causes explain info. to be captured into explain tables for:
Static SQL at prep / bind time
Reoptimizable incremental statements at run time
Dynamic SQL at run time overriding CURRENT EXPLAIN MODE.
SQL statements executed.
DB2 Static SQL explain control:
External programs: Explained at bind (or pre-compile) time
In bind (or pre-compile) command, use EXPLAIN [value]
SQL PL routines (stored procedures, UDFs and methods): Explained when created
Global level - use registry variable setting DB2_SQLROUTINE_PREPOPTS=EXPLAIN [value]
Session level - use stored procedure setting SET_ROUTINE_OPTS(EXPLAIN [value])
25
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explain Facilities
Explain terminology
OPERATOR TYPE FUNCTION
INSERT, UPDATE, DELETE Perform the operations named.
FETCH Retrieves data from a table, given a specific pointer to the record.
TBSCAN A table scan is examination of an entire table row by row.
Index Scanning
IXSCAN, EISCAN, RIDSCN
IXSCAN points to rows, sorted for fast access.
EISCAN operates with multiple ranges of values.
RIDSCN retrieves the row pointers (Row IDs) from a set of index records.
XSCAN, XISCAN, XANDOR XML scan & navigation, XML index access, XML ANDing
FILTER Reduces a set of row to only those required.
UNIQUE, pUNIQUE Removes duplicates
Joins NLJOIN, MSJOIN, UNION,
IXAND, HSJOIN, ZZJOIN
Nested Loop, Merge Scan, Union (concatenation), Index ANDing (dynamic bit map),
Hash and ZigZag
GRPBY Group by rows, and performs column function calculations on the groups.
SORT Sorts rows in the order of specified columns, and optionally eliminates duplicate entries.
TQUEUE Transfers table data between agents
GENROW Generates a table of rows
RETURN Return data from a query to a user
TEMP Stores a set of results for re-use elsewhere in the query.
Timerons An invented relative unit of measure. Timerons are determined by the optimizer based on internal values such as
statistics that change as the database is used.
Node Numbered section of each explain plan. To read a plan, start at bottom right and work right to left, bottom to top. There
are two kinds of nodes: Operator (the action that is performed) & Operand (the object the action is performed against)
26
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explain Facilities
DB2 visual explain using IBM Data Studio
Operator Type
Timerons
Nodes
Operator #
27
SHAPE KEY
Tables: Rectangles
Indexes: Diamonds
Operators: Octagons
Functions: Hexagons
Tqueues: Parallelograms
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Explain Facilities
db2exfmt output
28
Operator Type
Nodes
Operator #
Timerons
(can be changed to
show other stats)
Rows
I/O Cost
Timerons
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Optimizer
SQL compiler process
Parse Query Validate Syntax. Query created and
stored in Query Graph Model.
Check Semantics Ensure no inconsistencies, verify
data types, etc.
Rewrite Query Alter entire query into a form more
easily optimized.
Pushdown Analysis Federated database usage only,
remote or local evaluation
determined.
Optimize Plan Determine best plan based on cost.
Remote SQL Gen. Federated database usage only,
makes possible some part of the
final plan to be remote.
Generate Exec. Code Takes plan and Query Graph Model
to build executable access plan.
29
Execute
Plan
Check
Semantics
Parse
Query
Rewrite
Query
Pushdown
Analysis
Optimize
Access Plan
Remote SQL
Generation
Generate
Executable Code
Query
Graph
Model
SQL Query
SQL Compiler
BV
Explain
Tables
db2expln
tool
Executable
Plan
db2exfmt
tool
Visual
Explain
Access
Plan
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Optimizer
Multi-core parallelism and parallel scan on partitioned indexes
30
Benefits:
Provides maximum performance and scaling for the
industrys ever increasing multi-core processor machines
Eases set up and maintenance by avoiding the need to
partition based on cores
Improves performance of both OLTP and OLAP workloads
on a single server
Is easily enabled or disabled for particular workloads
How it works:
Data is scanned by multiple subagents per partition
regardless of cores per partition mapping
will rebalance agent usage automatically
Partitioned indexes are parallel scanned
by key values and numbers of key entries
A subagent is assigned a new range when it has completed
its work on the current range
index partitions are scanned sequentially with subagents
potentially scanning different index partitions at any point in time
without waiting for each other.
only the subset of index partitions that is relevant to the query
based on data partition elimination analysis is scanned
subagent subagent subagent subagent
Data
Database partition
SQL Query
Indexes
UPDATE DBM CFG INTRA_PARALLEL YES
UPDATE DB CFG DFT_DEGREE
ALTER WORKLOAD MAXIMUM DEGREE
SET CURRENT DEGREE
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Optimizer Highlights basic features
Comparison to Oracle optimizer capabilities
DB2 Oracle
Optimizer influencing done in many ways
Query optimization class
Subcommands
OPTIMIZE FOR n ROWS
FETCH FIRST n ROWS ONLY
Registry variables
Volatile cardinality
Informational constraints
Selectivity clause
Optimization profiles
Optimizer guidelines
DB2 was cost based from its inception: version 1
Optimizer influencing mostly through
Hints
Environment variables
Cost based only since version 7
Rules based not supported since 10g
Dynamic bitmap indexing
Engine determines when these are needed
and builds them in memory on the fly.
Static bitmap indexing
DBA determines when to build them.
Maintained statically like all other indexes.
Buffer pool per table space
Each table space can have its own memory area dedicated to it.
Cache (buffer pool) per block size
Memory allocation can be separated by objects of the
same block size only.
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology 31
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology 32
DB2 Optimizer Highlights advanced features
Comparison to Oracle optimizer capabilities
DB2 Oracle
Scan Sharing
Multiple scanners coordinate the shared use of buffer pool pages.
When a scan of a large set of data is started, subsequent queries
can jump on that scan at any point to share the benefit of the
data being scanned and jump off when finished. This reduces the
need for multiple passes of data for different queries that are not
identical but require the same data for their result set.
Cursor Sharing
Can work similarly to DB2 scan sharing, but the caveat is
that the queries sharing the cursor have to be identical,
otherwise independent scans are invoked.
Plan Lockdown
DB2 uses compiled packages for static access paths kept in the
catalog and are always created by default.
These packages can also be versioned.
No packaged code
SQL Profiling and Stored Outlines give some of the
functionality of a DB2 package, but require manual
creation and maintenance and do not have the scope
and power of the default DB2 package.
Connection Concentration *
Allows applications to stay connected without resources being
consumed on the DB2 host (Z/OS) server. You can have
thousands of users active in applications and only have a few
threads active on the DB2 host server.
N/A
Oracle is not available on Z/OS hosts.
* Do not confuse this with DB2 connection pooling which is similar to Oracle MTS
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
InfoSphere Optim Query Workload Tuner *
Go beyond explain to tune your single queries
33
Query Tools
Formatter
Transforms queries for readability
Annotator
Provides statistics and costing information
Access Path Graph
A visual explain with extra features
Query Reporter
Create table, index & predicate reports in HTML or text
Access Plan Explorer
Sort columns for easy impact analysis details
Visual Plan Hints
Created optimization profiles
Candidate Indexes
Eclipse based interface
Run stand-alone in Eclipse framework or
Integrate with other Optim tools
Query Advisors
Index Advisor
Recommend to add new, delete old or change
existing indexes
Query Advisor
Rewrite your query using best practices
Access Path Advisor
Identify access path issues by ranking severity
Statistics Advisor
Recommend best way to gather statistics
Workload Advisors
Workload advisor capture sources
OPM repository, package cache, catalog, flat
files, XML files, etc.
Workload statistics advisor
Analyzes workloads for relevant RUNSTATS
Consolidates and saves output to stats profiles
Workload Statistical Views advisor
Workload Index advisor
Ask us about how to get
more information
on this product!
* Available for Z/OS as well as LUW
2012 IBM Corporation
An IBM Proof of Technology
DB2 Workload Manager
Lab 09 WLM
38 slides
Burt Vialpando
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager (WLM)
Overview of features
DB2 Workload
Serves as the primary point of control based on the source of submitters of
work and routes work to service classes via connection attributes
DB2 Service Class
Serves as the primary point of resource control for all executing work
activities
DB2 Threshold
Provides limits to control behaviors of database activities based on
predictive and reactive elements for all activities occurring in a database or
service class
DB2 Work Action Set (work action work class set work class)
Provides ability to discriminate between different types of database
activities (read, write, call, DML, DDL and load) occurring in a database or
service class
DB2 WLM control capabilities
DB2PD utility, table functions, stored procedures and event monitors
provide real-time as well as historical monitoring capabilities
35
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager
Features diagram a first look
User requests
User requests
User requests
User requests
User requests
User requests
User requests
User requests
System requests
System requests
Maintenance
requests
Workload A
Workload B
Workload C
Service Subclass A
Service Subclass B
Default User Class
Default System
Class
Default Maintenance
Class
DB2 Data Server
Default User
Workload
Service Super-class 1
Thresholds
Thresholds
Thresholds
Work Action Sets
Work Action Sets
WLM Control Capabilities
db2pd, Event, SQL Functions & Procedures
Thresholds
Work Action Sets
36
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload
Definition and customization options
A DB2 workload is an object used to identify incoming work
based on its source
Workloads are defined by providing mapping values for a set of
connection attributes:
APPLNAME
SYSTEM_USER
SESSION_USER
SESSION_USER GROUP
SESSION_USER ROLE
ADDRESS
CLIENT_USERID
CLIENT_APPLNAME
CLIENT_WRKSTNNAME
CLIENT_ACCTNG
Workloads are executed by a given evaluation order (POSITION)
By default, this the order in which they are created
...but this can be specified during CREATE or ALTER
Activities of the workload can now be monitored and controlled
37
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload
Client identification fields
DB2 client identification fields identify the application or end-user
currently using a connection
Can be accessed by SQL using these read-only special registers:
CURRENT CLIENT_USERID
CURRENT CLIENT_APPLNAME
CURRENT CLIENT_WRKSTNNAME
CURRENT CLIENT_ACCTNG
Can be set client side by
Invoking the sqleseti API
Setting java connection client information attributes
Can be set server side by:
Invoking the SYSPROC.WLM_SET_CLIENT_INFO procedure
Values also show up in a number of places
Audit logs
Event monitors
APPL_INFO snapshot output
WLM_GET_SERVICE_CLASS_WORKLOAD_OCCURRENCES_v97 table function
Lock timeout report
38
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload
Identifying a Command Line Processor (CLP) script as an application
When a CLP file input option is used, the CLP automatically sets the
value of CURRENT CLIENT_APPLNAME to reflect the input file name
You can invoke the SYSPROC.WLM_SET_CLIENT_INFO stored
procedure in a CLP script in order to set any client identification field
CURRENT CLIENT_USERID = db2admin
CURRENT CLIENT_WRKSTNNAME = Floor01-desk99
CURRENT CLIENT_APPLNAME = IT Department
CURRENT CLIENT_ACCTNG = NULL
CURRENT CLIENT_WORKLOAD=NULL
db2 f testme.sql CURRENT CLIENT_APPLNAME = testme.sql
db2 call WLM_SET_CLIENT_INFO(db2admin, Floor01-desk99, IT Department,
NULL, NULL)
39
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload
Identifying middleware end users
Many middleware applications use a shared authorization ID
This can be problematic because there is:
A loss of accountability for changes - inability to audit individual user actions
An increased security exposure - all users have access to the same set of privileges
More difficulty in problem determination
An inability to enforce security standards that require end-user identification
The best solution is use of the DB2 Trusted Context capability to assert end-
user identity
Some middleware applications provide an option to set client ID fields
automatically
e.g. WebSphere

Application Server 6.0 and 6.1


Other middleware applications allow SQL statements at strategic points
e.g. Cognos

, MicroStrategy
For your middleware applications you can:
Use a native mechanism to set these fields - if available
Use sqleseti API
Use WLM_SET_CLIENT_INFO stored procedure - if SQL statements can be injected
40
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload
Examples of defining a DB2 workload
CREATE WORKLOAD Main_WL APPLNAME(Main_App);
All connections with application name of Main_App.
CREATE WORKLOAD Secondary_WL APPLNAME(Main_App)
SESSION_USER GROUP(OtherUsers)
POSITION BEFORE Main_WL ;
All connections with application name of Main_App
where session user belongs to group OtherUsers.
Always evaluated before workload Main_WL.
41
Main_WL
Workload
Secondary_WL
Workload
User requests
User requests
User requests
User requests
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload
Customized environment: how workloads fit Into DB2 workload manager
Main_WL , Secondary_WL and default workloads how they are evaluated
42
System Requests
Application Name = Main_Apps
and
Session User Group = OtherUsers
Application Name = Main_Apps
All other user requests
DB2 engine processes & threads
User Requests
Service Subclass
Default User Class
Default System Class
Default Maintenance
Class
DB2 Data Server
Default User
Workload
Service Super-class
Main_WL
Workload
#1
#2
#3
User requests
User requests
User requests
User requests
User requests
User requests
System requests
System requests
Maintenance
requests
Secondary_WL
Workload Service Subclass
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Service Class
Definition and customization options
A DB2 service class is the primary point of resource assignment to
all database requests
All work in a DB2 database executes in a service class
Acts as a unique execution environment for any grouping of work
Provides the ability to independently monitor and control this group of work
A service class modifies the resource priorities of that work:
CPU Shares [HARD/SOFT] CPU SHARES
CPU Limit CPU LIMIT
External WLM tag OUTBOUND CORRELATOR
Prefetch (I/O) Priority PREFETCH
Buffer pool Priority BUFFERPOOL
A service class can be created in a two-tier hierarchy:
Service superclass
Service subclass
These allow for more complex division of execution environment
and provide a better emulation of a real world model
There are three default service classes:
Default user class
Default system class
Default maintenance class
43
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Service Class
Examples of defining a service class
CREATE SERVICE CLASS Main_SC
HARD CPU SHARES 3000
PREFETCH PRIORITY MEDIUM
BUFFERPOOL MEDIUM;
CREATE SERVICE CLASS High_SC
UNDER Main_SC
SOFT CPU SHARES 6000
PREFETCH PRIORITY HIGH
BUFFERPOOL HIGH;
44
CREATE SERVICE CLASS Low_SC
UNDER Main_SC
HARD CPU SHARES 1000
PREFETCH PRIORITY LOW
BUFFERPOOL LOW;
High_SC
service sub-class
Main_SC
Service class
Low_SC
service sub-class
Note: Any activities that end up running in a
super service class (in this example Main_SC)
will actually run under its default service
subclass that uses all of its service class
settings.
CPU shares are controlled via
the WLM Dispatcher, which will
be discussed in detail later.
NOTE: There are four new DBM config. parameters that will control
the dispatching services in your database:
WLM_DISPATCHER: Starts/stops dispatcher services
WLM_DISP_CONCUR: Controls thread concurrency
WLM_DISP_CPU_SHARES: Enables/disables CPU shares
WLM_MIN_UTIL: Control minimum CPU utilization
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Service Class
Examples mapping workloads to service classes
ALTER WORKLOAD Secondary_WL
SERVICE CLASS Low_SC ;
45
ALTER WORKLOAD Main_WL
SERVICE CLASS High_SC ;
High_SC
service sub-class
Main_SC
Service class
Low_SC
service sub-class
Note: In this example, no work is
directly mapped to the service
superclass Main_SC, at least so ar.
It is possible to define super or sub
service classes that dont do any work,
so be careful about how you model
your environment.
User requests
User requests
User requests
User requests
Secondary_WL
Workload
Main_WL
Workload
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Service Class
WLM Dispatcher key concepts
46
The WLM Dispatcher
Is built-in technology to allocate CPU resources to work being executed in WLM
Controls CPU resources by using relative % shares and actual % limits
The shares approach maximizes usage of CPU
The limit approach ensures free CPU for other processing needs
Is self contained, platform independent, flexible and easy to implement
Soft CPU Shares
Relative CPU % usage that is enforced only when demand exceeds capacity
Gives the service class the ability to consume more than its share of CPU resources
The share amount is a maximum usage by percent, but only when the system is fully utilized
For high priority activities with preferential treatment
Hard CPU Shares
Relative CPU % usage is always enforced
Caps the service class ability to consume CPU resources by share
The share amount is the maximum usage by percent, regardless of system utilization
For lower priority activities (especially if they are high impact)
CPU LIMIT
Actual maximum CPU % resource usage, regardless of other activity
Can co-exist with Soft CPU Shares or Hard CPU Shares
Example of use: two departments share a database, each in different classes. Use CPU
LIMIT so that one class will not over allocate CPU away from another, for any reason.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Service Class
WLM Dispatcher usage example
47
Service class A
starts out using its
allocation of shares,
which proportionally
is 60%. The others
are 30% and 10%.
The CPU is fully
utilized.
Service class A
doesnt have
enough work to
utilize all its shares
and begins to give
them up.
Service classes B
and C use soft
shares, so they
take up the slack
and split those
shares from A.
Soft CPU Shares Example
Service class A
starts out using its
allocation of shares,
which proportionally
is 60%. The others
are 30% and 10%.
The CPU is fully
utilized.
Service class A
doesnt have
enough work to
utilize all its shares
and begins to give
them up.
Service class C
uses soft shares
and takes all the
shares from A.
Service class B
uses hard shares
and was already at
its limit, so it gets
no more.
Hard CPU Shares Example
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Service Class
Integrating DB2 WLM and the AIX or Linux WLM
DB2 service classes offer the optional ability to tightly integrate DB2
processing with AIX WLM service classes
Each DB2 service class can be associated with a specific AIX or Linux WLM service class
All agents working in a DB2 service class will automatically be associated by DB2
with the identified AIX or Linux WLM service class
Adds chargeback capability based on CPU consumption
Example:
AIX and Linux WLM provides sophisticated management of CPU to
maximize utilization of that resource while respecting any explicit
allocations
Allocation of CPU done via CPU shares assigned to AIX WLM service classes
CPU shares can be adjusted dynamically using AIX WLM interfaces
Provides the ability to borrow unused CPU shares from other service classes
Provides Operating System (OS) level statistics per AIX service class
ALTER SERVICE CLASS Main_SC
OUTBOUND CORRELATOR _DB2_Main ;
48
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Service Class
Customized environment: AIX or Linux workload manager integration
49
AIX or Linux WLM
Environment
User requests
User requests
System requests
System requests
Maintenance
requests
Default User Class
Default System Class
Default Maintenance
Class
DB2 Data Server
Default User
Workload
_DB2_Main
_DB2_High
_DB2_default_user
_DB2_system
_DB2_maintenance
User requests
User requests
User requests
User requests
Secondary_WL
Workload
High_SC
service sub-class
Main_SC
Service class
Main_WL
Workload
Low_SC
service sub-class
_DB2_Low
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Threshold
Definition and customization options
A DB2 threshold is a way to define and enforce execution boundaries in the
database
Oversees different aspects within DB2, e.g.
connections, temp space used, SQL cost, rows returned, etc.
Provides support for common scenarios, e.g.
controlling rogue queries or concurrency control
Threshold domains:
Database applies to any activity in the database
Service Class applies only to activities in this service class or superclass
Workload applies to the workload or work action
Statement applies to a particular statement
Threshold enforcement:
Database
Database partition
Workload
Threshold action options:
Terminate the activity: STOP EXECUTION
An error is returned to the application
Allow activity to keep processing: CONTINUE
No error is returned to the application
Collect detailed activity information: COLLECT ACTIVITY DATA
50
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Threshold
Examples
Database Thresholds
CREATE THRESHOLD " Detect High Estimates"
FOR SERVICE CLASS " Marketing" ACTIVITIES
ENFORCEMENT DATABASE
WHEN ESTIMATEDSQLCOST > 100000
COLLECT ACTIVITY DATA WITHOUT DETAILS
CONTINUE;
CREATE THRESHOLD " Stop Long Queries"
FOR DATABASE ACTIVITIES
ENFORCEMENT DATABASE
WHEN ACTIVITYTOTALTIME > 10 MINUTES
COLLECT ACTIVITY DATA WITH DETAILS AND VALUES
STOP EXECUTION;
Service Class Thresholds
CREATE THRESHOLD MaxActivitiesInPayroll
FOR WORKLOAD PAYROLL ACTIVITIES
ENFORCEMENT WORKLOAD OCCURRENCE
WHEN CONCURRENTWORKLOADACTIVITIES > 10
STOP EXECUTION;
Workload Thresholds
CREATE THRESHOLD DBMAXTEMPSPACE
FOR DATABASE ACTIVITIES
ENFORCEMENT DATABASE PARTITION
WHEN SQLTEMPSPACE > 50 M
STOP EXECUTION;
CREATE THRESHOLD LONGRUNNINGQUERIES
FOR SERVICE CLASS MANAGERS ACTIVITIES
ENFORCEMENT WORKLOAD OCCURRENCE
WHEN ACTIVITYTOTALTIME > 10 HOURS
COLLECT ACTIVITY DATA WITH DETAILS AND VALUES
CONTINUE;
CREATE THRESHOLD STOPLARGEQUERY
FOR WORKLOAD Reporting ACTIVITIES
ENFORCEMENT WORKLOAD OCCURRENCE
WHEN ROWSRETURNED > 1000000
STOP EXECUTION;
51
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Threshold
Priority aging (AKA in-progress activity aging) using threshold remapping
Priority aging can automatically raise or lower the priority of in-progress
activities over time
e.g. use priority aging to control longer-running activities, so that throughput
for shorter-running activities can be improved
This is accomplished with service subclass thresholds that can remap one
service subclasses to another service subclasses
52
WORKLOAD User requests
User requests
CREATE THRESHOLD Bump_Slow_Activities"
FOR SERVICE CLASS LOW_SC
ENFORCEMENT DATABASE
WHEN CPUTIMEINSC > 60 MINUTES
REMAP ACTIVITY TO MED_SC
MAIN_SC
HIGH_SC
service subclass
MED_SC
service subclass Remapping threshold
LOW_SC
service subclass
Remapping threshold
CREATE THRESHOLD Bump_Med_Activities"
FOR SERVICE CLASS MED_SC
ENFORCEMENT DATABASE
WHEN CPUTIMEINSC > 30 MINUTES
REMAP ACTIVITY TO HIGH_SC
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Threshold
Data Tag remapping using thresholds
53
Similar to priority aging, only the threshold is not based on aging
Thresholds use Data Tags on tables spaces (or their storage groups) to
reactively remap running activities
Alter stogroup SG_HIGH DATA TAG 1;
Alter stogroup SG_MED DATA TAG 3;
Alter stogroup SG_LOW DATA TAG 5;
CREATE THRESHOLD REMAP_HIGH_TO_MED
FOR SERVICE CLASS HIGH_SC
UNDER MAIN_SC ACTIVITIES
ENFORCEMENT DATABASE PARTITION
WHEN DATATAGINSC IN (3,5)
REMAP ACTIVITY TO MED_SC;
CREATE THRESHOLD REMAP_MED_TO_LOW
FOR SERVICE CLASS MED_SC
UNDER MAIN_SC ACTIVITIES
ENFORCEMENT DATABASE PARTITION
WHEN DATATAGINSC IN (5)
REMAP ACTIVITY TO LOW_SC;
MAIN_SC
LOW_SC
MED_SC
HIGH_SC
Remapping threshold
Remapping threshold
SG_HIGH
Data Tag 1
SG_MED
Data Tag 3
SG_LOW
Data Tag 5
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Work Action Set
Definition and customization options
A DB2 work action set
Is an optional object where you can create and group work actions
Classifies activities based on what they are
based on attributes of the activity to apply different actions to different activity types
Contrast: workloads classify activities based on who submitted them
Contrast: thresholds control execution boundaries regardless of what or who
Work action set domains:
Database
Service Superclass
Workload
Work action sets actions:
WHEN a threshold for an activity
PREVENT EXECUTION stops an activity
COLLECT ACTIVITY DATA writes to an event monitor
COUNT ACTIVITY creates a turnstile counter
Work action set usage examples
Restrict the number of concurrent LOADs allowed to execute on the database
Put DML in a different service class than DDL
Put READ queries > 100 timerons in a different service subclass
54
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Work Action Set
Work class sets: required for work action sets
A DB2 work class set
Contains and manages a group of work classes
A DB2 work class
Is classified by work class types:
READ, WRITE, CALL, DML, DDL, LOAD and ALL
Provides predictive identification - the ability to take action before work is done
Work class set example #1:
Work class set example #2:
CREATE WORK CLASS SET Large_Queries
(WORK CLASS Large_Est_Cost WORK TYPE DML
FOR TIMERONCOST FROM 9999 TO UNBOUNDED,
WORK CLASS Large_Cardinality WORK TYPE DML
FOR CARDINALITY FROM 1000 TO UNBOUNDED);
CREATE WORK CLASS SET DML_Usage
(WORK CLASS READ_Class WORK TYPE READ)
(WORK CLASS WRITE_Class WORK TYPE WRITE);
55
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Work Action Set
Examples
Example #2 - Database Work Action Set
CREATE WORK ACTION SET DB_Actions
FOR DATABASE USING WORK CLASS SET Large_Queries
(WORK ACTION ONE_CONCURRENT_QUERY ON WORK CLASS Large_Est_Cost
WHEN CONCURRENTDBCOORDACTIVITIES > 1 AND QUEUEDACTIVITIES > 1
COLLECT ACTIVITY DATA CONTINUE,
WORK ACTION TWO_CONCURRENT_QUERIES ON WORK CLASS Large_Cardinality
WHEN CONCURRENTDBCOORDACTIVITIES > 2 AND QUEUEDACTIVITIES > 2
STOP EXECUTION);
See work class set
example #2
Example #1 - Service Class Work Action Set (Mapping to subclasses)
CREATE WORK ACTION SET Admin_Apps_Actions
FOR SERVICE CLASS Marketing
USING WORK CLASS SET DML_Usage
(WORK ACTION MAP_READS ON WORK CLASS READ_Class MAP ACTIVITY TO Users ,
WORK ACTION MAP_WRITES ON WORK CLASS WRITE_Class MAP ACTIVITY TO Managers );
See work class set
example #1
56
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Work Action Set
Using table space or storage group Data Tags
57
Alter or create a table space (or its storage group) to contain a data tag value
Data tags can be used predictively by a work action set to map activities
Alter tablespace TS_HIGH DATA TAG 1;
Alter tablespace TS_MED DATA TAG 5;
Alter tablespace TS_LOW DATA TAG 9;
CREATE WORK CLASS SET WCS_DATATAG
(WORK CLASS HIGH_WC WORK TYPE DML DATA TAG LIST CONTAINS 1,
WORK CLASS MED_WC WORK TYPE DML DATA TAG LIST CONTAINS 5,
WORK CLASS LOW_WC WORK TYPE DML DATA TAG LIST CONTAINS 9);
CREATE WORK ACTION SET MAIN_WAS FOR SERVICE CLASS MAIN_SC
USING WORK CLASS SET WCS_DATATAG
(WORK ACTION MAP_HIGH ON WORK CLASS HIGH_WC
MAP ACTIVITY TO HIGH_SC,
WORK ACTION MAP_MED ON WORK CLASS MED_WC
MAP ACTIVITY TO MED_SC,
WORK ACTION MAP_LOW ON WORK CLASS LOW_WC
MAP ACTIVITY TO LOW_SC);
The work action set Main_WAC is on
the super service class Main_SC.
It maps activities to a different sub-
service class depending upon the data
tag in the table spaces those activities
are accessing.
WORKLOAD
Main_SC
High_SC
Med_SC
Low_SC
Main_WAS
TS_HIGH
TS_MED
TS_LOW
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Work Action Set
Using a work action set for simple counts - scenario
Take advantage of the COUNT ACTIVITY action to create a turnstile
counter for different work types of interest
Very light-weight
Collects information prior to start of execution when work is analyzed by
Work Action Set
Activity information is gathered at end of execution
Basic Steps:
Create a Work Class Set to define the work types of interest
Create a Work Action Set on the database or a specific service super class
to count the things of interest using the COUNT ACTIVITY action
Report the statistics
58
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Work Action Set
Using a work action set for simple counts - solution
SELECT DBPARTITIONNUM,
SUBSTR(WORK_CLASS_NAME,1,18) AS WORK_CLASS_NAME,
ACT_TOTAL,
LAST_RESET
FROM TABLE(WLM_GET_WORK_ACTION_SET_STATS('Counting Things of Interest', -2))
ORDER BY DBPARTITIONNUM, WORK_CLASS_NAME;
DBPARTITIONNUM WORK_CLASS_NAME ACT_TOTAL LAST_RESET
--------------------------- -------------------------------- ------------------- --------------------------------------
0 * 2 2008-02-17-23.40.24.643394
0 Big Query 0 2008-02-17-23.40.24.643205
0 Moderate Query 4 2008-02-17-23.40.24.643279
0 Small Query 16 2008-02-17-23.40.24.643348
3 record(s) selected.
CREATE WORK ACTION SET Counting Things of Interest"
FOR DATABASE
USING WORK CLASS SET " How We See Things"
(WORK ACTION " Count Big Ones"
ON WORK CLASS " Big Query"
COUNT ACTIVITY,
WORK ACTION " Count Moderate Ones"
ON WORK CLASS " Moderate Query"
COUNT ACTIVITY,
WORK ACTION " Count Small Ones"
ON WORK CLASS Small Query"
COUNT ACTIVITY);
Notice work class
set defined with
work action set
59
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager Monitor & Control Capabilities
Monitoring features
60
User requests
User requests
User requests
User requests
User requests
User requests
System requests
System requests
Maintenance
requests
Summary
Workload
Managers
service sub-class
Default User Class
Default System Class
Default Maintenance
Class
DB2 Data Server
Default User
Workload
Marketing
Service class
Reporting
Workload
Threshold
Work Action Set
Threshold
DB2PD utility
SQL table functions
SQL procedures
Event monitors
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager Monitor & Control Capabilities
DB2PD: ADHOC real-time monitoring
db2pd -workloads [none/workloadID]
Returns a list of workload definitions in memory.
db2pd -serviceclasses [none/serviceclassID]
Returns information about the service classes for a database.
db2pd -workactionsets [none/workactionsetID]
Returns information about all enabled work action sets, as well as all the enabled
work actions in the enabled work action sets.
db2pd -workclasssets [none/workclasssetID]
Returns information about all work class sets that have been referenced by an
enabled work action set, as well as all work classes in those work class sets.
db2pd -thresholds [none/thresholdID]
Returns information about thresholds.
The db2pd utility is enhanced for DB2 Workload Manager to return operational
information from the DB2 database system memory sets at the time the command is run
The identifier (ID) parms are optional and if left out return all the values of that feature
61
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager Monitor & Control Capabilities
Table functions: ADHOC SQL monitoring *
SQL Table Function Description
MON_GET_ACTIVITY_DETAILS Returns detailed information about a specific activity
WLM_GET_CONN_ENV Returns for a particular connection the values of settings
that control collection of activity data and section actuals.
WLM_GET_QUEUE_STATS Returns basic statistics of one or more concurrency
thresholds
WLM_GET_SERVICE_CLASS_AGENTS_V97 Returns a list of current agents in the specified service class
WLM_GET_SERVICE_CLASS_WORKLOAD
_OCCURRENCES_V97
Returns a list of workload occurrences in the specified
service class
WLM_GET_SERVICE_SUBCLASS_STATS Returns statistics of one or more service subclasses
WLM_GET_SERVICE_SUPERCLASS_STATS_V97 Returns statistics of one or more service superclasses
WLM_GET_WORK_ACTION_SET_STATS Returns basic statistics of one or more work action sets
WLM_GET_WORKLOAD_OCCURRENCE_
ACTIVITIES_V97
Returns a list of all activities for the given application on the
specified partition which have not yet completed
WLM_GET_WORKLOAD_STATS_V97 Returns basic statistics of one or more workloads
* Provides in memory information are not snapshots.
Supports single or multiple database partitions.
62
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager Monitor & Control Capabilities
Lock wait example with database partitioning
1. Get a call from a user that their application appears hung
Determine in the conversation that their session authorization ID is BURT_V
2. Using the WLM_GET_SERVICE_CLASS_WORKLOAD_OCCURRENCES table
function, look up the application ID for all connections with the
SESSION_USER value of BURT_V
SELECT SESSION_USER,
COORD_PARTITION_NUM,
APPLICATION_HANDLE
FROM TABLE(WLM_GET_SERVICE_CLASS_WORKLOAD_OCCURRENCES('','',-2))
WHERE SESSION_USER = BURT_V;
SESSION_USER COORD_PARTITION_NUM APPLICATION_HANDLE
----------------------- -------------------------------------- -----------------------------------
BURT_V 2 131130
1 record(s) selected.
63
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager Monitor & Control Capabilities
Control using workload manager stored procedures
DB2 Workload Manager Stored Procedures:
Stored Procedure Description
WLM_CANCEL_ACTIVITY Cancels a given activity
WLM_CAPTURE_ACTIVITY_IN_PROGRESS Gathers information for an activity, including any child
activities, and writes it to the active activities event monitor.
WLM_COLLECT_STATS Gathers and resets statistics on service classes, work
classes and threshold queues, and writes them to the
statistics event monitor.
WLM_SET_CLIENT_INFO Allows you to set the values of any of the client information
fields at the DB2 server by using a CALL statement.
WLM_SET_CONN_ENV Enables for a particular connection the collection of activity
data and measurement of section actuals.
Example: WLM_CANCEL_ACTIVITY
Call procedure to use DB2 internal interrupt mechanism to cancel the activity
Application receives a -4725 SQLCODE
db2 => call wlm_cancel_activity(131130,2,1)
Return Status = 0 Found in lock
wait example
64
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager Monitor & Control Capabilities
Activity event monitor - workload capture support overview
65
User requests
User requests
User requests
User requests
User requests
User requests
System requests
System requests
Maintenance
requests
Secondary
WL Workload
High_SC
service sub-class
Default User Class
Default System Class
Default Maintenance
Class
DB2 Data Server
Default User
Workload
Main_SC
Service class
Main_WL
Workload
Threshold
Work Action Set
Threshold
Workload information
Service class information
Activity classification
Agent/Application info.
Execution statistics
Statement text
Compilation environment
Input data values
and more!
Activity Event
Monitors
Low_SC
service sub-class
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager Monitor & Control Capabilities
Activity event monitor - definition and customization options
A DB2 Workload Manager event monitor is a created DB2 object that collects
information as events occur in the database
Contrast: DB2PD, table functions & procedures capture information when the
utility or SQL itself is executed
DB2 Workload Manager event monitor events:
ACTIVITIES Records event when an activity finishes executing or before the
completion of execution if event is triggered by WLM_CAPTURE_ACTIVITY_IN_PROGRESS
procedure.
STATISTICS Specifies that the event monitor records a service class, workload, or
work class event either every n minutes set by WLM_COLLECT_INT DB CFG parameter or
when the WLM_COLLECT_STATS procedure is called.
THRESHOLD VIOLATIONS Specifies that the event monitor records a threshold
violation event when a threshold is violated. Such events can be recorded at any point in
the life of an activity, not just at completion.
DB2 Workload Manager event monitor collection output:
TABLE If not specified, WLM will derive the table name and
table space
FILE OS file with .evt extension
PIPE Named Pipe or AIX FIFO
66
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager Monitor & Control Capabilities
Activity event monitor workload capture support details
DB2 Workload Manager event monitor activities
Belong to a service class or workload with clause: COLLECT ACTIVITY DATA
Belong to a work class whose associated work action is: COLLECT ACTIVITY DATA
Identified as an activity that violates a threshold with clause: COLLECT ACTIVITY DATA
Prior to completing, have been identified in a call to the procedure:
WLM_CAPTURE_ACTIVITY_IN_PROGRESS
DB2 Workload Manager event monitor statistics
Collected on workloads, service classes, work classes and threshold queues
There are many and they differ depending upon DB2 Workload Manager object type
Histograms can be created to provide bins for discreet ranges of data (distribution information)
Example:
CREATE HISTOGRAM TEMPLATE LifetimeTemp
HIGH BIN VALUE 100000;
ALTER SERVICE CLASS Marketing
HISTOGRAM TEMPLATE LifetimeTemp;
67
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager Monitor & Control Capabilities
Activity event monitor examples
Activities event monitor usage
Statistics event monitor usage
Threshold event monitor usage
CREATE EVENT MONITOR DB2Activities FOR ACTIVITIES WRITE TO TABLE;
SET EVENT MONITOR DB2Activities STATE 1;
ALTER WORKLOAD Reporting COLLECT ACTIVITY DATA ON COORDINATOR WITH DETAILS;
CREATE EVENT MONITOR DB2Statistics FOR STATISTICS WRITE TO FILE;
SET EVENT MONITOR DB2Statistics STATE 1;
ALTER SERVICE CLASS Marketing COLLECT AGGREGATE ACTIVITY DATA BASE;
CALL SYSPROC.WLM_COLLECT_STATS();
CREATE EVENT MONITOR DB2Threshvio FOR THRESHOLD VIOLATIONS WRITE TO TABLE
THRESHOLD VIOLATIONS (TABLE tb_viol IN myts_1) CONTROL (TABLE tb_ctrl IN myts_2);
SET EVENT MONITOR DB2Thtreshvio STATE 1;
68
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
69 69
DB2 Workload Manager Monitor & Control Capabilities
Historical monitoring
Historical Monitoring options:
Repetitive calls to table functions where output is stored in a table
Activity event monitors to capture details for each and every activity running on the
database and then analyze the results for activity type counts at a later time
Work action set usage
To gather detailed distribution information on work classes of interest:
COLLECT AGGREGATE ACTIVITY DATA
To gather simple counts on the different work classes:
COUNT ACTIVITY
Work action set approach can gather counts on activities
Can customize what activities of interest and group using additional attributes through
work class definitions
Can view current work action set statistics at any time via table function:
WLM_GET_WORK_ACTION_SET_STATS
Can use automatic collection mechanism to collect statistics from work action set at
regular intervals to create a history over time
69
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager Monitor & Control Capabilities
Workload capture support monitoring and control possibilities
Use fishing for costly queries as possible performance tuning targets
As a light-weight way to keep an eye out for ones that get away (e.g. very large queries
that you might want to analyze in more detail)
Create database thresholds on estimated cost that collect information for later analysis
but use the CONTINUE option so as to not affect the running queries
Keep control of badly behaving applications connection growth
Some vendor applications manage a connection pool dangerously where if the response
time slows down on existing connections, more connections are opened
This often makes things worse for the database
Keep control on the number of connections by pointing these applications at a unique
workload and then using the number of workload occurrence limit to control how many
connections can be open at any one time
Use the default option in the Work Action Set to catch oddities
If you think you have a work class that defines everything you expect to see, add in a
default ALL Work Class and have your work action set list it as the last class considered
so that any activity not falling into the other classes falls into this work action
You can gather information on these unexpected visitors
Check the work action set statistics to see if there are any entries in the special * work
class reported
70
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Workload Manager
Summary diagram: an overview of workload manager concepts
71
User requests
User requests
User requests
User requests
User requests
User requests
User requests
User requests
System requests
System requests
Maintenance
requests
Workload A
Workload B
Workload C
Service Subclass A
Service Subclass B
Default User Class
Default System Class
Default Maintenance
Class
DB2 Data Server
Default User
Workload
WLM CLASS AIX2 (or Linux)
Service Super-class 1
AIX/Linux Workload Manager
Thresholds
Thresholds
Thresholds
Requests
Initiate all work in
DB2 (even system
and maintenance
work) which will be
mapped to a specific
service class.
Use default classes
if not defined.
Threshold
Establish limits of use over a
database, workload or service class
Workload
Is how work is routed
to a DB2 service
class.
Serves as primary
point of identity and
control for submitters
of work.
Uses attributes like
application name,
system or session
user, client
workstation and so
on, to map to each
connection
Work Action Sets
Work Action Sets
Work Action Set
Control specific types of activities
over a database or service class
Workload Manager Monitoring
db2pd, Event, SQL Functions & Procedures
Service Class
Is where the work for a
database is executed.
Is the primary point of
resource assignment,
control and monitoring.
Uses a 2-Tier hierarchy
which defines super-classes
to provide common
attributes across
subclasses. This provides a
more complex division of
execution.
Service Class
On AIX or Linux
Each DB2 service class can
be associated with an AIX or
Linux Workload Manager
service class for tight OS
integration.
Thresholds
WLM CLASS AIX1 (or Linux)
WLM CLASS AIX3 (or Linux)
Work Action Sets
BV
2012 IBM Corporation
An IBM Proof of Technology
Lab 15 MONITOR
15 slides
Burt Vialpando
DB2 Monitoring
(core engine)
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Database Monitoring
Overview of types of core engine monitoring techniques
Monitor
Type
Characteristics
Data
base
level
Appli-
cation
level
Control
by
Interfaces
Snapshot
Taken at specified time of invocation
Has a moderate performance cost
switch CLP
API
SQL function / procedure
Administrative view
Event
Taken automatically when the event occurs
Has a moderate performance cost
Is a created database object
start / stop SQL
db2evmon
Usage List
Taken automatically at DML operation time
Has a moderate performance cost
Is a created database object

SET USAGE
LIST
STATE
SQL Table Functions
SQL
Functions
Taken at a specified time of invocation
Has low performance cost
Query Any client that can run a
query
db2pd
Taken at a specified time of invocation
Has no performance cost
May return unknown results (uses a peek
into database system memory sets)
db2pd
invocation
db2pd itself
db2top
UNIX only, snapshot based utility db2top db2top itself
Data Studio
Web Console
(see Data Studio topic for details)
Start/Stop
server
Browser
73
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Snapshot Monitor
Instance control (default control)
Monitor Switch DBM Parameter Information Provided
BUFFER POOL DFT_MON_BUFPOOL Number of reads and writes, time taken
LOCK DFT_MON_LOCK Lock wait times, deadlocks
SORT DFT_MON_SORT Number of heaps used, sort performance
STATEMENT DFT_MON_STMT Start / stop time, statement identification
TABLE DFT_MON_TABLE Measure of activity (rows read / written)
UOW DFT_MON_UOW Start / end times, completion status
TIMESTAMP DFT_MON_TIMESTAMP Timestamps for all above switches and all active event monitors
Defaults for instance and database collection controlled with:
See what is set by default:
GET DBM MONITOR SWITCHES;
DBM System Monitor Information Collected
Switch list for db partition number 0
Buffer Pool Activity Information (BUFFERPOOL) = OFF
Lock Information (LOCK) = OFF
Sorting Information (SORT) = OFF
SQL Statement Information (STATEMENT) = ON 07-20-2009 16:04:30.070073
Table Activity Information (TABLE) = OFF
Take Timestamp Information (TIMESTAMP) = ON 07-20-2009 16:04:30.070073
Unit of Work Information (UOW) = OFF
74
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Snapshot Monitor
Application level control
GET MONITOR SWITCHES;
Monitor Recording Switches
Switch list for db partition number 0
Buffer Pool Activity Information (BUFFERPOOL) = ON 07-20-2009 16:04:30.070073
Lock Information (LOCK) = OFF
Sorting Information (SORT) = OFF
SQL Statement Information (STATEMENT) = ON 07-20-2009 16:04:30.070073
Table Activity Information (TABLE) = OFF
Take Timestamp Information (TIMESTAMP) = ON 07-20-2009 16:04:30.070073
Unit of Work Information (UOW) = ON 07-20-2009 16:04:30.070073
Individual applications can start a monitor switch, just for them, with *:
Where [switch-name] = BUFFERPOOL, LOCK, SORT, STATEMENT, TABLE, UOW, TIMESTAMP
To see which switches are on for your application, use *:
UPDATE MONITOR SWITCHES USING [switch-name] ON;
* API: db2MonitorSwitches
75
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Snapshot Monitor
GET SNAPSHOT
Instance level snapshot examples: *
Database level snapshot examples: *
GET SNAPSHOT FOR ALL DATABASES;
GET SNAPSHOT FOR DBM;
GET SNAPSHOT FOR ALL APPLICATIONS;
GET SNAPSHOT FOR ALL BUFFERPOOLS;
* API: db2GetSnapshot
GET SNAPSHOT FOR TABLES ON SAMPLE;
GET SNAPSHOT FOR DYNAMIC SQL ON SAMPLE;
GET SNAPSHOT FOR ALL ON SAMPLE;
GET SNAPSHOT FOR TABLESPACES ON SAMPLE;
GET SNAPSHOT FOR LOCKS ON SAMPLE;
GET SNAPSHOT FOR BUFFERPOOLS ON SAMPLE;
Database Snapshot
Database name = SAMPLE
Database path =
/home/dbapot/dbapot/NODE0000/SQL00001/MEMBER0000/
Input database alias =
Database status = Active
Catalog database partition number = 0
Catalog network node name =
etc.
Table Snapshot
Table List
Table Schema = SYSIBM
Table Name = SYSDBAUTH
Table Type = Catalog
Data Object Pages = 1
Index Object Pages = 5
Rows Read = 3
Rows Written = 0
Overflows = 0
Page Reorgs = 0
etc.
76
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Snapshot Monitor
Snapshot administrative views schema: SYSIBMADM
SYSIBMADM Administrative Views
SNAPAGENT SNAPAPPL SNAPAPPL_INFO SNAPDBM / SNAPDB
SNAPBP SNAPBP_PART SNAPCONTAINER SNAPSTMT
SNAPDYN_SQL SNAPFCM SNAPFCM_PART SNAPHADR
SNAPSUBSECTION SNAPSWITCHES SNAPTAB SNAPTAB_REORG
SNAPTBSP SNAPTBSP_PART SNAPTBSP_QUIESCER SNAPTBSP_RANGE
SNAPUTIL SNAPUTIL_PROGRESS SNAPSTORAGEPATHS SNAPDETAILLOG
Using administrative
views with a GUI
77
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Event Monitor
Catch events when they occur
Event Type When Collected
CHANGE HISTORY Any changes to: DB & DBM config, registry, DDL or utility execution
LOCKING At lock timeout, lock wait and deadlock time
STATEMENTS End of SQL statement
CONNECTIONS End of Connection
DATABASE Database deactivation
BUFFERPOOLS Database deactivation
TABLESPACES Database deactivation
TABLES Database deactivation
Activities WLM event (like completion of an activity in a Service class)
Statistics WLM_COLLECT_INT setting
Threshold Violations At detection of violation
Package cache At detection of package cache changes
Unit of work At completion of Unit of Work
An event monitor is a created object in a DB2 database that:
Returns information for events specified
Writes output to a TABLE, FILE or PIPE
Is started manually or automatically upon database activation
78
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Event Monitor
Examples
Deadlock event monitor - usage example
CREATE EVENT MONITOR MyDeadlocks FOR DEADLOCKS
WRITE TO TABLE
DEADLOCK (TABLE tb_deadlocks IN ts_deadlocks);
SET EVENT MONITOR MyDeadlocks STATE 1;
(workload runs deadlocks detected and captured)
SELECT * FROM tb_deadlocks;
db2evtbl utility - generate event monitor DDL example
db2evtbl -schema dbapot -evm
EvmonTables TABLES > OUT.DDL
CREATE EVENT MONITOR Evmon_Tables
FOR TABLES
WRITE TO TABLE
TABLE (TABLE dbapot.TABLE_Evmon_Tables
INCLUDES (DATA_OBJECT_PAGES,
DATA_PARTITION_ID,
EVENT_TIME,
etc.
OUT.DDL
db2caem utility example
db2caem d SAMPLE
-st select * from staff
This creates the activity event monitor and capture
information of details, section and values, as well as actuals
for the SQL statement "select * from staff".
79
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Usage List
The DML usage recorder
A usage list is a database object that
Records each DML statement section that references a particular table or index
Also captures statistics about how that section affects each object
All table types supported except:
Aliases, nicknames, views, created temporary tables, detached tables, hierarchy tables
Only the following index types are supported:
Regular, block, dimension block, clustering
Lists are stored in the monitor heap ( mon_heap_sz )
So increase if necessary
Tracks over 50 different metrics for tables, examples are:
Rows read/inserted/deleted/updated, number of references, last updated, wait times and more
80
CREATE USAGE LIST USL_MON_PAYROLL
FOR TABLE PAYROLL_TB
LIST SIZE 500
WHEN FULL DEACTIVATE
ACTIVE ON START DATABASE;
Table or index
Default is 100
Default is WRAP
Default is INACTIVE.
To activate, use:
SET USAGE LIST
STATE
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Usage List
Functions for retrieving information
Retrieve information from usage list using the following table functions:
MON_GET_TABLE_USAGE_LIST - Table usage list information
MON_GET_INDEX_USAGE_LIST - Index usage list information
MON_GET_USAGE_LIST_STATUS - The current status of the usage list
Example:
81
SELECT * FROM
TABLE( MON_GET_TABLE_USAGE_LIST(NULL, 'USL_MON_PAYROLL', 3));
USAGELISTSCHEMA USAGELISTNAME TABSCHEMA TABNAME MEMBER . . . LAST_UPDATED . . .
--------------- --------------- --------- ---------- ------ . . . -------------------------- . . .
ISAYYID USL_MON_PAYROLL ISAYYID PAYROLL_TB 3 . . . 2012-03-03-10.20.22.727803 . . .
ISAYYID USL_MON_PAYROLL ISAYYID PAYROLL_TB 3 . . . 2012-03-03-10.20.58.202161 . . .
2 record(s) selected.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
SQL Built-in Function Monitoring
Lightweight approach to monitoring Schema: SYSPROC
Type DB Parameter SQL Output Function * XML Output Function
SYSTEM MON_REQ_METRICS MON_GET_UNIT_OF_WORK MON_GET_UNIT_OF_WORK_DETAILS
MON_GET_WORKLOAD MON_GET_WORKLOAD_DETAILS
MON_GET_CONNECTION MON_GET_CONNECTION_DETAILS
MON_GET_SERVICE_SUBCLASS MON_GET_SERVICE_SUBCLASS_DETAILS
MON_GET_FCM
MON_GET_FCM_CONNECTION_LIST
MON_GET_MEMORY_POOL
MON_GET_MEMORY_SET
ACTIVITY MON_ACT_METRICS MON_GET_PKG_CACHE_STMT MON_GET_ACTIVITY_DETAILS
MON_GET_PKG_CACHE_STMT_DETAILS
MON_GET_LOCKS
MON_GET_APPL_LOCKWAIT
OBJECT MON_OBJ_METRICS MON_GET_TABLE
MON_GET_BUFFERPOOL
MON_GET_CONTAINER
MON_GET_INDEX
MON_GET_TABLESPACE
SELECT * FROM TABLE(MON_GET_BUFFERPOOL(cast(NULL as bigint), -2)) AS t;
* These are examples and
is not an exhaustive list
82
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
db2pd
A quick and immediate memory set interface
Can see snapshot like information on instances, databases, objects, etc.
Without snapshot overhead, locking or latching
Can even see some information when a database is not activated
Database example:
Instance example:
db2pd db SAMPLE > output.txt
Database SAMPLE not activated on database partition 0.
Instance DB2 uses 32 bits and DB2 code release SQL09071
with level identifier 08020107
Informational tokens are DB2 v9.7.100.31, s090621,
NT3297, Fix Pack 1.
Operating System Information:
etc.
output.txt
db2pd memblocks file=out.txt
All memory blocks in DBMS set.
Address DataAddrss PoolID PoolName BlkAge Size
0x7A8B0068 0x7A8B0080 77 fcmsess 3 844800
0x7A8A0048 0x7A8A0060 77 fcmsess 2 6000
0x7A85FFC8 0x7A85FFE0 77 fcmsess 1 262144
0x7A7F0068 0x7A7F0080 79 fcmchan 3 94208
etc.
out.txt
83
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
db2top
A lightweight, UNIX only, snapshot based stand alone utility
Using snapshots, you can monitor the following with this utility:
Databases, table spaces, dynamic SQL, statements, HADR, skewing, sessions, buffer
pools, locks, partitions, federation, agents, memory, utilities and bottlenecks.
Interactive usage example:
db2top d SAMPLE
84
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
InfoSphere Optim Performance Manager
Browser based, time based, extended insight capable monitoring
85
Overview of capabilities
View Health Summary of multiple DB2 instances
Real-time view of currently open connections, current
table space states, and current running utilities
For single partition, multi-partition or pureScale
databases
With predefined monitoring templates for OLTP, BI,
SAP, development or test
End-to-end response time monitoring of
Application server
Database client
Database server
Network
Ask us about how to get
more information
on this product!
Integration capabilities
IBM DB2 Workload Manager
To create, alter and monitor your WLM environment
IBM Tivoli Composite Application Manager
To provide an enterprise consolidated view
IBM InfoSphere Optim Query Tuner and IBM InfoSphere
Optim pureQuery Runtime
To speed up and tune your applications
Browser based dashboards
Show performance overviews with health indicators
Easily flag problem spots with set indicator alerts
sent to the Web User Interface, n email account
or a page number
Drill down to display detailed metrics on:
Locking conflicts, deadlocks, timeouts
Long running or un-tuned SQL statements
Sorting or prefetching issues
Buffer pool, cache, heap size issues
Operating system memory or CPU shortages
Partition skews or overloaded partitions
Log performance issues
Review all of this information through a history time
slider
Show detailed or aggregate levels of information
Generate canned reports and more
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
InfoSphere Optim Configuration Manager *
Monitor and manage your clients and servers efficiently
86
Manage Servers
Discover and explore your servers
Keep a central repository for all
discovered information
Use a common data model to classify
and persist discovered information
Automatically find:
databases
subsystems
instances
Schedule jobs to monitor server side
changes
Track configuration changes
Integrate with InfoSphere Optim
Performance Manager
Ask us about how to get
more information
on this product!
Manage Clients
Discover and explore your clients
Automatically find:
Java clients
Non-Java clients (.NET, CLI)
Isolate applications - put them into a:
Penalty Box to throttle them
Proving Ground to test capabilities
before implementation
Tune Workload Balancing properties
Redirect database connections
easy application migration
Throttle database connections
* Available for Z/OS as well as LUW
2012 IBM Corporation
An IBM Proof of Technology
Lab 11 pureXML
16 slides
Burt Vialpando
DB2 pureXML
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML (part of the core engine capability)
XML in the industry
XML (eXtensible Markup Language) is
A hierarchical data model
A self describing data representation
Whereas HTML is display representation
Flexible
Used on any platform, with any OS or
programming language
Fully Unicode compliant
Used throughout the industry to provide information
interchange
XML usage is desirable when
Data is inherently hierarchical or nested in nature
Data sets have sparsely populated attributes
Schema changes occur frequently
Variable or many schemas exist for any given data
source
Combining structured & unstructured data is required
XML usage is driven by
Application architects & programmers
SOA implementation
Industry standards
DBAs will need to know
How to administer XML in their databases
What options they have for doing so
id=77
XML text document
well formed
book
title price
author
authors
author
keywords
keyword keyword
id=99 XML relational
Databases
DB2
Databases
59
Shen Wat Burt Vee
XML
Document Tree
<book>
<authors>
<author id= 77" >Shen Wat</author>
<author id= 99" >Burt Vee</author>
</authors>
<title>DB2 Databases</title>
<price>59</price>
<keywords>
<keyword>XML</keyword>
<keyword>relational</keyword>
</keywords>
</book>
88
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
XML pure native storage what this means
DB2 stores XML in a parsed hierarchical format
Relational columns are stored in relational format
XML columns are stored natively in a hierarchical
format
Not as a LOB (CLOB or BLOB)
Not shredded into relational tables
As pure native XML!
DB2 is a hybrid data server
Has all the advantages of a relational database
Has all the advantages of a hierarchical
database
XML is a new SQL data type
No XML parsing for query evaluation
Efficient XML document tree storage
Hybrid queries now available using
SQL/XML or XQuery
Either can go after relational or hierarchical
data in the same query
CUSTOMER_ID CUSTOMER_DOC
12345 <cust>
<info>...</info>
</cust>

CUSTOMER_INFO
DB2 STORAGE DB2 STORAGE DB2 STORAGE
CREATE TABLE CUSTOMER_INFO
(CUSTOMER_ID INTEGER,
CUSTOMER_DOC XML, );
89
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
XML storage parsing
DB2 puts XML data into the same table space with the relational data
DB2 uses a compression technique (Xerces) to parse and store XML data
Tag names are coded as unique integers
DB2 XML storage benefits
Comparisons & navigation are faster
Storage is reduced
XQuery model is persisted
0 dept
1 employee
2 id
3 name
4 phone
5 office
String Table
SYSIBM.
SYSXMLSTRINGS
Path Table
SYSIBM.
SYSXMLPATHS
0 /
1 /0
2 /0/1
3 /0/1/3
4 /0/1/4
5 /0/1/5
Xerces Parse
0
3
1
4 2=77
Shen Wat
5
888-555-1212 123
3
1
4 2=99
Burt Vee
5
888-555-9999 234
dept
employee
Shen Wat 888-555-1212 123
employee
Burt Vee 888-555-9999 234
id=77 name phone office id=99 name phone office
90
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
XML nodes and regions
XML document tree hierarchy stored in DB2 pages by nodes (XDAs)
Nodes can be elements, attributes, text, etc.
Name, namespace, namespace prefix (stringIDs)
Type annotation (pathID)
Pointer" to parent
List of pointers to children
Inlined values (attribute/text values)
Documents that dont fit on one page are split into regions
DB2 automatically creates a regions index for you
To navigate XML data regions & nodes within regions
0
3
1
4 2=77
Shen Wat
5
888-555-1212 123
3
1
4 2=99
Burt Vee
5
888-555-9999 234
1 Table Space Page 1 Table Space Page
regions
index
XDA XDA
91
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
XML basic DML usage
Create tables with XML data types
INSERT into and SELECT from these columns natively from within your applications
No LOBs involved
No shredding involved
CREATE TABLE CUSTOMER_INFO
(CUSTOMER_ID INTEGER, CUSTOMER_NAME CHAR(20), CUSTOMER_DOC XML);
INSERT INTO CUSTOMER_INFO VALUES
(12345, MYCO INC., :xmldoc );
SELECT CUSTOMER_ID, CUSTOMER_NAME, CUSTOMER_DOC
FROM CUSTOMER_INFO
WHERE CUSTOMER_NAME = MYCO INC.;
INSERT INTO CUSTOMER_INFO VALUES
(12345, MYCO INC.,
XMLPARSE (DOCUMENT '<?xml version=" 1.0" encoding=" UTF-8" ?><customerinfo>
<owner>Burt Vee</owner><addr country=" United States" ><street>1122 Lake Ave.</street>
<city>Dallas</city><prov-state>Texas</prov-state><pcode-zip>75063</pcode-zip></addr>
<phone type=" work" >8888-555-9999</phone></customerinfo>'
PRESERVE WHITESPACE));
OR
92
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
Advanced XML table usage
XML inline storage for XML documents 32K or smaller
Define a table with column XML INLINE LENGTH n-bytes
This avoids storage in the XDA and the need for a regions index
Check constraints on XML columns during INSERT or UPDATE
Uses IS VALIDATED predicate against an XML-expression
Update or Modify XML documents
Uses TRANSFORM XML-expression
ALTER TABLE [table-name] ADD CONSTRAINT [constraint-name]
CHECK ([xml-column-name] IS VALIDATED ...);
UPDATE customer set [xml-column-name] = XMLVALIDATE(
XMLQUERY(' declare default element namespace
" http://[sample-namespace]" ;
TRANSFORM
COPY [xquery-expression];
CREATE TABLE [table-name] (
[xml-column-name] XML INLINE LENGTH [n-bytes] )
93
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
Loading or importing XML
Loading XML in DB2 has a similar syntax to loading LOBs
Use XML FROM to point to XML subdirectory containing individual XML documents
Use XMLCHAR data modifier to activate XML FROM
Though the syntax is similar, this is not loading XML as LOBs!
Import syntax is the same as LOAD syntax
Input Data File:
s:\shared\cust_load.dat
LOAD FROM s:\shared\cust_load.dat OF DEL
XML FROM s:\shared\XMLdocs
MODIFIED BY XMLCHAR
REPLACE INTO XMLCUSTOMER;
Input data file, delimited format
Subdirectory where XML documents are located
s:\shared\XMLdocs\C1.XML
s:\shared\XMLdocs\C2.XML
XML documents:
s:\shared\XMLdocs\
CUSTOMER_ID CUSTOMER_NAME CUSTOMER_DOC
12345 MYCO INC. <XDS FIL=C1.XML/>
23456 YOURCO LTD. <XDS FIL=C2.XML/>

CUST_ID CUST_NAME CUSTOMER_DOC
12345 MYCO INC. <XDS FIL=C1.XML/>
23456 YOURCO LTD. <XDS FIL=C2.XML/>

pointer
94
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
Other DB2 XML utility, command and functionality support
* Oracle note:
Oracle cannot create an index using any XMLPATTERN expression.
This can be a key differentiator in XML performance
EXPORT TO s:\shared\cust_exp.del
XML TO s:\shared\XMLdocs
MODIFIED BY XMLCHAR

XQUERY
EXPORT
CREATE INDEX [index-name]
ON [table-name][col-name]

GENERATE KEY USING XMLPATTERN


[xml-pattern]
CREATE INDEX *
RUNSTATS ON TABLE [table-name]

ON ALL COLUMNS
EXCLUDING XML COLUMNS
RUNSTATS
DB2BATCH d [database-name]

-m <owner>Burt Vee</owner>'

DB2BATCH
DB2LOOK
DB2LOOK

-xs -xdir
DB2SUPPORT

- xml_generate
DB2SUPPORT
EXPLAIN
EXPLAIN PLAN

FOR XQUERY [expression]


CREATE NICKNAME ON
[table with XML column]
FEDERATION TRIGGERS
CREATE TRIGGER
BEFORE
XMLVALIDATE()
95
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
Other XML functionality support
XML support has been added to other DB2 functionality, like:
IBM Data Studio:
Visual Explain
SQL Assist
Create table task assistant
Create index task assistant
xQuery Builder
Programming interfaces:
Stored procedure variable call
CLP support
C or C++ (embedded SQL or DB2 Call
Level Interface)
COBOL
Java (JDBC or SQLJ)
C# and Visual Basic (DB2(R) .NET
Data Provider)
IBM Data Studio XML Cell Editor
96
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
XQuery overview
DB2 supports two primary query languages: SQL and XQuery
Each can retrieve relational or XML data or a combination of the two
SQL has the following XML functions
XMLQUERY - executes an XQuery and returns the result sequence
XMLTABLE - executes an XQuery, returns the result sequence as a relational table (if possible)
XMLEXISTS - determines if an XQuery returns a result (i.e. a sequence of one or more items)
XMLCAST - cast to or from an XML data type
XMLPARSE - parses character/BLOB data, produces XML value
XMLSERIALIZE - converts an XML value into character/BLOB data
XMLVALIDATE - validates XML value against an XML schema and type-annotates the XML value
XMLGROUP - returns single top level element to represent a table
XMLROW - returns a sequence of elements to represent a table
XSLTRANSFORM - convert XML document into other formats
XQuery has these functions: *
db2-fn:xmlcolumn()
db2-fn:sqlquery()
* These are just two of the nearly 100 functions available in DB2 for XQuery
SELECT COL1, XMLQUERY
('$ColName/state/cust[@id= 10" ]' passing info as " ColName" )
FROM XMLCUSTOMER;
XQUERY db2-fn:sqlquery( SELECT INFO FROM
XMLCUSTOMER );
SQL / XML Example
XQuery Example
97
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
XSD example
An XML Schema Definition
(XSD) describes your XML document
schemas in order to type your element
and attributes.
An XSD can also control whether or
not these elements and attributes
are required or optional.
Most XML editors can create
XSDs from your XML
documents.
98
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
XML Schema Repositories (XSR)
A DB2 XML Schema Repository
Is for all XML artifacts
Is required to validate & process XML instance documents stored in pure native XML columns
Stores copies of XML schemas (XSDs), DTDs & external entities referenced in your XML documents
Allows management of XML document dependencies without requiring changes to the XML documents
themselves
Is a registered entity within the database
Uses an SQL 2-part name
Uses a URL that the schema is externally known as
Used by shred process (if shredding needed)
Stores annotated schema
Has internal formats to make shredding efficient
XSRs are implemented
By storing them in the DB2 catalog
With binary representation of the schema
For fast validation
With the REGISTER SCHEMA command
Optional: ADD XMLSCHEMA DOCUMENT command
Optional: COMPLETE XMLSCHEMA command
XSRs are updatable
Evolve current schemas without having to validate all existing XML documents
Use XSR_UPDATE stored procedure
REGISTER XMLSCHEMA http://custinfo_schema.xsd
FROM file://s:/shared/custinfo.xsd
AS BURT.CUSTINFO_SCHEMA;
ADD XMLSCHEMA DOCUMENT BURT.CUSTINFO_SCHEMA
ADD http://custinfo_schema.xsd
FROM file://s:/shared/custinfo_2.xsd;
99
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
XML shredding in DB2
Shredding: The process of taking XML documents & parsing them into relational tables
Shredding is preferable when there is a need
To co-exist with legacy applications
To use analytics and cubes
To perform at the highest levels as relational processing is faster than XML processing
Steps to shred your XML documents
CREATE TABLE CUSTOMER_INFO_SHRED
CREATE TABLE CUSTOMER_KEY_SHRED
1. Create your target relational tables
REGISTER XMLSCHEMA
(see previous slide for details on XSR)
3. Register the XML schemas
4b. Decompose the XML using stored procedures
DECOMPOSE XML DOCUMENT ./xmldocs/cust1doc.xml
XMLSCHEMA http://custinfo_schema.xsd;
DECOMPOSE XML DOCUMENTS IN SELECT .
XMLSCHEMA schema1.xsd1
4a. Decompose the XML using the CLP command
CALL XDBDECOMPXML(,BURT,:cust1doc);
CALL XDB_DECOMP_XML_FROM_QUERY (
schema1,xsd1,SELECT.);
OR
<xsd:element name=" phone" type=" xsd:string
db2-xdb:rowSet=" employee_tab"
db2-xdb:column=" phone_col" />
2. Annotate the XML schema
100
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
Other capabilities
DB2 XML capability highlights:
For TABLES (first class data type)
DPF (Database partitioning / Data warehousing feature)
XML fully supported
MDC (Multidimensional Cluster Tables)
MDCs can have XML columns
DGTT (Declared Global Temporary Tables)
DGTTs can have XML columns
Compression
XML fully compressed whether inline or XDA stored
For UDFS (first class data type)
XML can accept XML as a SQL bodied UDF input
For ADMINISTRATION
Query in-lining of XML and LOBS
ADMIN_IS_INLINED
ADMIN_EST_INLINE_LENGTH
DB2 XML new capabilities:
Functional indexes on XML data
Indexes types: integer and decimal
Binary XML format (for efficient transfer
between client and server)
pureScale support
Improved XMLCAST and many other
performance improvements
101
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 pureXML
Oracle XML DB comparison
Oracles XMLType data type has three storage options:
CLOB (AKA Unstructured)
XML document is a text string - default XML type & comparable to the old method used by DB2
Object Relational (AKA Structured)
XML shredded into relational tables
XML Binary (AKA Post-parsed binary)
XML parsed into a tokenized binary stream -This is not in a tree format like DB2 pureXML
None of these options:
Are able to register industry standard XML schemas - Accord, FIXML, FpML, HL7, etc.
Support XQuery through APIs (e.g. JDBC usage) - only supported through SQL*Plus
Have a published performance benchmark - see DB2 pureXML benchmark at: http://tpox.sourceforge.net/
Other things to think about:
Newest XML Binary storage NOT touted by Oracle as the best over all method to use - they say it all depends
So, which storage option do you choose? If you choose wrong or the environment changes, then what?
XMLType stores the text of the document three times thus inefficient space usage:
1) XML document, 2) path table, 3) value index for path table
XMLIndex is not defined with an XQuery expression limited in real-world usage
Bottom Line:
Only DB2 provides powerful pure native XML support to provide ease of use, flexibility
and proven performance in any scenario with one efficient storage approach
102
2012 IBM Corporation
An IBM Proof of Technology
DB2 Multidimensional Clusters
Lab 12 MDC
Thanks to Paulo Pereira & Daniel Graham for the source of some of the slides for this topic
18 slides
Burt Vialpando
If you are doing the lab exercises, start the MDC01.sh
setup script now to run during the lecture!
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters *
Overview
Multidimensional clusters (MDCs) are a special way of co-locating data, like a clustered
index table, but with more than one dimension
CREATE TABLE TABLE_MDC (COL1 CHAR(1), COL2 CHAR(1), COL3 CHAR(1), COL4 CHAR(1) )
ORGANIZE BY DIMENSIONS (COL1, COL2, COL3);
* Enterprise Server Editions only
Clustered Index MDC
Data is clustered in 1 dimension. Data is clustered by 1 or more dimensions.
Data starts with rows co-located by defined
columns, but this can degrade over time.
Data always co-located (organized) by defined
columns; it never goes out of grouping
organization.
REORG eventually necessary to restore row co-
location order (clustering).
REORG not necessary; clustering always
maintained.
PCTFREE can help influence data co-location, but
if free space is used up this stops having affect.
PCTFREE is not needed and has no affect on data
co-location.
Uses traditional row index (RID) pointing to rows in
pages in the table space.
Uses special block index (BID) pointing to entire
extents (blocks) in the table space.
Clustered columns can have higher cardinality and
still be effective. Design for consideration of use
less important because it can be easily altered
later.
Clustered columns required lower cardinality to be
most effective. Design consideration for use is
highly important as this cannot easily be altered
later.
104
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Terminology: Dimension
Dimension: An axis along which data is physically organized in an MDC table
2002,
Corvette,
blue
2002,
Ferrari,
yellow
2002,
Ferrari,
blue
2002,
Corvette,
yellow
2001,
Ferrari,
yellow
2002,
Ferrari,
yellow
2001,
Corvette,
yellow 2002,
Corvette,
yellow
year
dimension
color
dimension
carname
dimension
105
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Terminology: Slice
Slice: A portion of the table containing data having a certain key value of one of the
dimensions
2002, 2002,
blue blue
2002, 2002,
Ferrari, Ferrari,
yellow yellow
2002, 2002,
Ferrari, Ferrari,
blue blue
2002, 2002,
yellow yellow
2001, 2001,
Ferrari, Ferrari,
yellow yellow
2002, 2002,
Ferrari, Ferrari,
yellow yellow
2001, 2001,
yellow yellow 2002, 2002,
yellow yellow
year
dimension
color
dimension
carname
dimension
Corvette
slice Corvette,
Corvette, Corvette,
Corvette,
106
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Terminology: Slice (example 2)
Corvette, Corvette,
Corvette,
Yellow
slice
2002,
Ferrari,
yellow
2002,
Ferrari,
blue
2002,
Corvette,
yellow
2001,
Ferrari,
yellow
2002,
Ferrari,
yellow
2001,
Corvette,
yellow 2002,
Corvette,
yellow
year
dimension
color
dimension
2002,
Corvette,
blue
carname
dimension
107
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Terminology: Slice (example 3)
2002,
Corvette,
blue
2002,
Ferrari,
yellow
2002,
Ferrari,
blue
2002,
Corvette,
yellow
1998,
Corvette,
yellow
2002,
Ferrari,
yellow
1998,
Ferrari,
yellow
2002,
Corvette,
yellow
year
dimension
color
dimension
carname
dimension
2002
slice
2001,
Corvette,
yellow
2001,
Ferrari,
yellow
108
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Terminology: Cell
Cell: A portion of the table containing data having unique set of dimension values
The intersection formed by taking a slice from each dimension
Cells * are the KEY to defining and managing MDCs
Yellow 2002 Corvettes
Cell * for
2002, 2002,
Corvette, Corvette,
blue blue
2002, 2002,
Ferrari, Ferrari,
yellow yellow
2002, 2002,
Ferrari, Ferrari,
blue blue
2002,
2002,
Corvette,
Corvette,
yellow
yellow
1998,
Corvette,
yellow
2002, 2002,
Ferrari, Ferrari,
yellow yellow
1998,
yellow
2002,
2002,
Corvette,
Corvette,
yellow
yellow
year
dimension
color
dimension
2001,
Corvette,
yellow
2001,
Ferrari,
yellow
carname
dimension
* MDC cells are placed into DB2 blocks, which are allocated as table space extents
109
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Clustering rows via dimensions
Co-locates rows with same key values (cell) in the same data block
Insertion or load does this transparent to applications and end user tools
car color year qty cost
vette blue 2002 1 44,000
vette blue 2002 2 45,500
vette red 2002 1 50,000
vette black 2002 3 47,000
Data blocks - without MDC Data blocks - with MDC
car color year qty cost
vette red 2002 1 49,000
vette blue 2002 2 47,500
vette black 2002 1 42,000
car color year qty cost
vette blue 2002 1 44,000
vette blue 2002 2 45,500
vette blue 2002 2 47,500
car color year qty cost
vette red 2002 1 50,000
vette red 2002 1 49,000
car color year qty cost
vette black 2002 3 47,000
vette black 2002 1 42,000
110
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Row Indexes (RIDs) and Block Indexes (BIDs)
= Row
Non MDC Indexing MDC Indexing
Row Indexes (RIDs)
1 index entry per row
Block Indexes (BIDs)
1 index entry per block
111
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Dynamic bitmap ANDing description
Rows are grouped by dimension values
Each dimension has its own index
Indexes are small because they point to blocks of rows (not rids)
Smaller by a factor of block size * avg # records in page where block size = # pages
in an extent (2-256)
May be kept completely in memory
Insert into index only for 1st row in a block
Delete index entry when last row in block deleted
Dynamic bit map ANDing to select rows
Fetches or prefetches the relevant blocks only
Ad hoc requests via subset or out-of-order dimension keys is fast
Dynamic bit map ANDing is the same regardless
Queries against dimensions A-B-C-D-E (cluster key order) will be fast.
Queries against dimensions D-C-E achieve same speed benefits from MDC
01000101011000101100100100
01101100101000110110110000
00001011001011001101001101
112
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Dynamic bitmap ANDing example
SELECT SUM(AVAILABLE) FROM CARS_MDC
WHERE YEAR BETWEEN 2001 AND 2004
AND COLOR = YELLOW
AND CARNAME = CORVETTE ;
113
Year Block IDs
2001 15,20,22,29,
52
2002 32
2003 8,9,10,44
2004 10,11, 21
Color Block IDs
Yellow
9,15,21,23,
32,44
Blue 63
Black 10,11,43,45
Green 22,32
CarnameBlock IDs
Miata 18,29,31
VW Bug 23,24
Corvette
10,11,15,21,
45
Ferrari
9,22
block index on Year & block index on Carname block index on Color &
01000101011000101100100100
01101100101000110110110000
00001011001011001101001101
blocks selected = 15 & 21
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Index ANDing of bid and rid Indexes
MDC tables can work with indexes on other columns
Index ANDing result is only those rows belonging to qualifying blocks
Index ANDing can combine multiple bid and rid indexes
= +
Key from
dimension
block index
Rids from
rid index
Resulting
rids to fetch
SELECT SUM(AVAILABLE)
FROM CARS_MDC
WHERE YEAR BETWEEN 2001 AND 2004 AND
AVAILABLE BETWEEN 1 AND 3;
114
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Index ORing of bid and rid Indexes
Index ORing result is only those rows belonging to qualifying blocks, plus
additional rids outside those blocks
Index ORing can combine multiple bid and/or rid indexes
SELECT SUM(AVAILABLE)
FROM CARS_MDC
WHERE YEAR BETWEEN 2001 AND 2004 OR
AVAILABLE BETWEEN 1 AND 3;
+
=
Key from
dimension
block index
Rids from
rid index
Resulting
blocks and
rids to fetch
115
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Database and table partitioning compatible
HYBRID_TABLE
D2
Range R1
MDC MDC MDC
D1
Database Partition 2
TS1
Table
Partition 1
TS2
Table
Partition 2
TS3
Table
Partition 3
Hash H1
D2
Range R1
MDC MDC MDC
D1
Database Partition 1
TS1
Table
Partition 1
TS2
Table
Partition 2
TS3
Table
Partition 3
Hash H1
CREATE TABLE HYBRID_TABLE (A INT, B CHAR, C INT, D CHAR )
IN TS1, TS2, TS3 INDEX IN TS4
DISTRIBUTE BY HASH (H1)
PARTITION BY RANGE (R1) (STARTING FROM (10) ENDING (30) EVERY (10))
ORGANIZE BY DIMENSIONS (D1, D2);
116
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Usage considerations
MDCs do not always make every query situation perform better
Good design choices are still required
Incorrect choices could result in
Underutilized space
Poor performance
Factors in correct design
Block size (which is the extent size with MDCs)
Page size
Correct dimension choices
Good granularity of MDC dimensions
Good number of MDC dimensions
Coarsification can be used to help (reducing cardinality by using a function on a
value, like turning a date into its year & quarter)
Consider compression on dimension columns carefully
Remember: The DB2 Design Advisor can help you!
117
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Conclusion: benefits you can achieve using DB2 MDCs
Faster Query Speed
Access the data pages you need with less searching
Better prefetching
Get all data in fewer accesses vs. many page reads
Reduced CPU and disk I/O
Simple intuitive design
Star schema friendly joins
OLAP analysis improvements
Reduced index size
Index entry covers entire block, not one row
Reduced need for REORG
Row clustering managed by the DB2 engine
Faster Deletes
Drops blocks at a time
Use special register CURRENT ROLLOUT MODE or registry
variable DB2_MDC_ROLLOUT registry variable to change
index cleanup behavior
POSSIBLE MDC BENEFITS
118
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Insert Time Clustering Tables
A variation of MDCs based on a single time dimension
119
Insert Time Clustering Tables (ITCs) are similar to MDCs
They use the ORGANIZE BY syntax
They use block allocation
They use block based indexing
They can have indexing on any columns
They have similar performance advantages
They have similar maintenance advantages
ITCs are unique in that they
Always have only one dimension
Use a virtual, time-based column to cluster rows
Have that column populated by DB2 during an insert, import or load
The generated time-based column data is all a similar time
CREATE TABLE ITC_TB (COL1 CHAR(100), COL2 INT )
ORGANIZE BY INSERT TIME ;
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Multidimensional Clusters
Oracle offering comparison
Oracle Index Organized Tables (IOTs)
IOTs:
Are tables that have a primary key, physically sorted by that key, providing physical co-location benefits
Contain the rest of the columns within its b-tree structure
Are like creating an index with a contains clause of all other columns in a table without the actual table
IOTs dont compare to MDCs because they:
Work very much like a clustered index table
Have only one dimension
Require maintenance to keep data in order
Oracle Cubes
Cubes:
Are logical representation of star schemas
Are OLAP metadata structures to which measures are assigned
Use measures to represent data stored in normal relational tables
Cubes dont compare to MDCs because they:
Rely on traditional physical storage characteristics, which doesnt get any actual physical co-location
benefits
Bottom Line:
Only DB2 has Multidimensional Clusters!
120
2012 IBM Corporation
An IBM Proof of Technology
DB2 Data Movement Utilities
(core engine)
Lab 13 DATA
33 slides
Burt Vialpando
Load
Target
Table
ASC/DEL
/IXF Files
ASC/DEL
/IXF Files
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 LUW Core Engine Data Movement Utilities
High level summary part 1
* Signifies that the utility can be used between z/OS, Linux, UNIX and Windows platforms interchangeably
Utility Purpose
Cross
Platform *
Load
Efficient movement of large quantities of data from an external
file into a table.
Key use point: Performance, statistics gathering.
Yes
Import
Insert data from an external file into a table, view, hierarchy or
nickname.
Key use points: Table has constraints or triggers you wish to
exploit, target is not a table, logging is desired.
Yes
Ingest
Insert, update, delete, replace or merge external files into a table
Key use point: Continuous data ingest with DML flexibility
No
Export
Store data to an external file.
Key use point: To process table data externally at the OS.
Yes
db2move
Mass use of Export followed by mass Import or Load.
Key use point: To move an entire database, schema or other
defined set of tables from one database to another. Can also
copy other schema objects between databases.
Yes
122
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 LUW Core Engine Data Movement Utilities
High level summary part 2
* Only between different UNIX versions using the same endian
Utility Purpose
Cross
Platform *
ADMIN_COPY_SCHEMA
(stored procedure)
To copy objects in one schema to another in the same DB.
Key use points: Can move most objects in a schema, not
just tables avoids OS file usage.
N/A
ADMIN_MOVE_TABLE
(stored procedure)
To move data in an active table into a new table object.
Key use point: Data stays online and available can
convert from one table type to another.
N/A
db2relocatedb
To rename a DB or relocate an entire or part of a DB (like a
data file) to the same or different system.
Key use point: faster database cloning than a backup &
restore, less expensive and more flexible than a split mirror.
Limited *
Restore from backup
(with redirect)
Create a database from a backup copy of another.
Key use point: Using a backup image to clone a DB.
Limited *
Split mirror
To create a clone, standby or backup DB.
Key use point: Extreme backup or clone speed.
No
123
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Load Utility
The fastest way to get data into your database
Cross
Platform
DB2 Load Main Characteristics
Efficient in moving large quantities of data quickly
Writes formatted pages directly in database
Does not fire triggers
Does not perform constraint checking
Does not perform logging
Online load ability
Existing table data can be queried during load
Uses four different phases
Load, Build, Delete and Index Copy
Exploits server hardware fully
Self tuning
Can be throttled
Can generate statistics
Can copy exception data to separate table
Can use PIPE and CURSOR as input
Can handle XML, LOBs and UDTs
Uses ASC, DEL or IXF file types
Load Target
Table
ASC/DEL
/IXF Files
ASC/DEL
/IXF Files
LOAD FROM [filename] OF [file-type]
INSERT INTO [table-name];
LOAD QUERY TABLE [table-name];
Oracle note:
DB2 Load utility is analogous to the Oracle
SQL*Loader utility using Direct Path mode, e.g.:
SQLLDR CONTROL=sample.ctl DIRECT=true
124
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Load Utility
Self tuning characteristics
Disk 3
I/O Sub-agent
Disk 2
I/O Sub-agent
Disk 1
I/O Sub-agent
125
DB2 Load Automatically selects
I/O sub-agents
Based on table space containers, CPUs, etc.
Formatting sub-agents
Based on active CPUs, table and load
characteristics
Index maintenance mode
Incremental versus Rebuild
Use INDEXING MODE AUTOSELECT
Memory consumption
Based on free space in UTIL_HEAP_SZ
Server resource usage
Use SET UTIL_IMPACT_PRIORITY command
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Import Utility
The mass insert method
DB2 Import Main Characteristics
Inserts records to database
Fires triggers
Performs constraint checking
Performs logging
Target can be views, nicknames and hierarchies
If IXF is source, table does not have to exist
Can handle XML, LOBs and UDTs
Uses ASC, DEL or IXF* file types
* Integration Exchange Format
ASC/DEL
/IXF Files
Import
Target
Table/View
IMPORT FROM [file-name] OF [file-type]
INSERT INTO [table-name];
Oracle note:
DB2 Import utility is analogous to the Oracle
SQL*Loader utility using Conventional Path mode, e.g. :
SQLLDR CONTROL=sample.ctl DIRECT=false
Cross
Platform
126
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Load vs. DB2 Import
Load pros vs. Import cons
DB2 Load Pros DB2 Import Cons
Faster than the Import utility for large data
sources
Slower than Load for large data sources
Minimal logging is performed so log space
not required
All rows logged
Statistics can be gathered during the load
operation
RUNSTATS utility must be run after import
Intra partition parallelism always exploited Limited exploitation of intra partition
parallelism
Summary table load supported Summary table import not supported
BINARYNUMERICS, PACKEDDECIMAL,
ZONEDDECIMAL supported
BINARYNUMERICS, PACKEDDECIMAL,
ZONEDDECIMAL not supported
GENERATED ALWAYS columns can be
overridden
GENERATED ALWAYS columns cannot be
overridden
127
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Load vs. DB2 Import
Load cons vs. Import pros
DB2 Load Cons DB2 Import Pros
Table loads supported only Table, view & nickname imports supported
Triggers not supported Triggers supported
Hierarchical data not supported Hierarchical data supported
Target tables and indexes must exist
regardless of input file format
Tables, hierarchies, and indexes can be
built automatically if input file format is IXF
Uniqueness is verified during load, all other
constraints checked using SET INTEGRITY
All constraints are validated during the
import
The key values are sorted and the index is
built after the data has been loaded which can
be interrupted
The key values are inserted into the index
one at a time during the import operation,
always kept up-to-date
Cannot Load into a z/OS database Can Import into a z/OS database through
DB2 Connect
128
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Load vs. Oracle SQL*Loader
Load command file vs. SQL*Loader control file
(1) LOAD
(2) FROM 'INPUT_FILE1.DAT'
(3) OF ASC
(4) MODIFIED BY DUMPFILE='INPUT_FILE1.BAD
(5) METHOD L (1 5, 6 15, 16 20)
(6) INSERT INTO PROD.TB_TABLE1
(7) (COL1, COL2, COL3 )
(8) FOR EXCEPTION PROD.TB_TABLE1_DSC ;
DB2 INSERT fixed data
(1) LOAD
(2) FROM 'INPUT_FILE2.DAT'
(3) OF DEL
(4) MODIFIED BY DUMPFILE='INPUT_FILE2.BAD'
(3) COLDEL| CHARDEL"
(5) METHOD P (1, 2, 3)
(6) REPLACE INTO PROD.TB_TABLE2
(7) (COL1, COL2, COL3 )
(8) FOR EXCEPTION PROD.TB_TABLE2_DSC ;
DB2 REPLACE variable data Oracle REPLACE variable data
(1) LOAD DATA
(2) INFILE 'INPUT_FILE2.DAT'
(4) BADFILE 'INPUT_FILE2.BAD'
(8) DISCARDFILE 'INPUT_FILE2.DSC
(6) REPLACE INTO TABLE PROD.TB_TABLE2
(3) FIELDS TERMINATED BY '|'
(3) OPTIONALLY ENCLOSED BY '"'
(5)(7) ( COL1, COL2, COL3 ) ;
For details on comparing DB2 Load and the Oracle SQL*Loader, see article at:
http://www.ibm.com/developerworks/db2/library/techarticle/dm-0808khatri/
(1) LOAD DATA
(2) INFILE 'INPUT_FILE1.DAT'
(4) BADFILE 'INPUT_FILE1.BAD'
(8) DISCARDFILE 'INPUT_FILE1.DSC'
(6) APPEND INTO TABLE PROD.TB_TABLE1
(5)(7) (COL1 POSITION(01:05),
COL2 POSITION(06:15),
COL3 POSITION(16:20) ) ;
Oracle INSERT fixed data
129
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle SQL*Loader Utility Direct Path Mode
Analogous to DB2 Load basic similarities
Feature DB2 LOAD Oracle SQL*Loader
Direct Path Mode
Invoking DB2 command call from a SQL
script or through a programAPI
Stand alone utility call from command line
or through a programAPI
Monitoring From another connection, run
LOAD QUERY or LIST
UTILITIES commands
Review LOG file
Constraints & triggers Ignored Ignored
Parallelism support Highly optimized to use multiple
CPUs using multiple processes
and threads
Parallelized using multi-threading
Exception data support To an exception table and/or
dump file
To an exception table
LOAD from PIPE Yes Yes
BLOBS/CLOBS support Yes Yes
XML Document support Yes Yes
Compression support Yes Yes
130
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle SQL*Loader Utility Direct Path Mode
Analogous to DB2 Load key differences
Feature DB2 Load Oracle SQL*Loader
Direct Path Mode
Generate statistics with load Yes with data REPLACE No
Recoverable Yes with COPY YES
option
No not with Direct Path, must make
copy of data yourself
Logging None Yes but can optionally be turned off
Value defaults Yes usage available No not available with Direct Path
Online (shared) loading Yes can access pre-
existing data
No not with Direct Path
Modify data during load Yes through a user exit No not with Direct Path
Throttling support Yes is default behavior Only with creation of Resource Plans
(Oracles workload manager)
Load in multiple DB
partitions
Yes has auto splitting
capability
N/A in Oracle
(no DB partitioning available)
Load from DBs of different
versions
Yes all supported except
XML data type
No cannot always load to older DBs
from output from newer DBs
131
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Ingest Utility
High-speed, client side Continuous Data Ingest (CDI)
132
DB2 Ingest Main Characteristics
All DML operations supported
Insert, update, delete, replace and merge
Moves large amounts of data in real-time
Can process a continuous data stream
Availability and concurrency of data is preserved
With low latency, row lock approach
Supports the following table types:
Regular tables, nicknames, MDCs, ITCs, RCTs,
MQTs, Range partitioned, temporal and
updatable views
Input types:
Delimited, positional and binary files or pipes
Commit by time or row count
Uses three different phases
Transport, format, flush
Monitor with LIST and GET STATS options
Show ingest jobs being run by connected ID
Ingest
Target
Table
DEL/positional/binary
files and pipes
INGEST LIST;
INGEST FROM FILE [file-name]
FORMAT DELIMITED
RESTART NEW [Job-ID]
INSERT INTO [table-name] ;
The RESTART NEW option
gives the ability to restart an
ingest job and uniquely identifies
it with an ID
INGEST GET STATS FOR [ALL/Job-ID]
EVERY [number] SECONDS;
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Ingest Utility
Architecture
133
v
DB2 server code
DB2 client code
Client-side Utility
A Client-side utility with DPF
or non-DPF capability
Server hosting
DB2 client
Servers hosting
DB2 database
Server hosting DB2 client and database
Target
DB
INGEST utility
Remote client
Local client
INGEST utility
Target
DB
OR
Transporter
Transporter
Multiple
files
Multiple
pipes
Formatter
Formatter
Formatter
Flusher
[Array Insert]
Flusher
[Array Insert]
Flusher
[Array Insert]
Flusher
[Array Insert]
DB
partition 2
Hash by DB
partition
DB
partition 1
Multiple threads in a single client process
INGEST utility
SQL
SQL
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Ingest Utility
Examples
134
INGEST SET commit_count 1000;
INGEST FROM FILE my_file.txt
FORMAT DELIMITED
( $key1 INTEGER EXTERNAL,
$key2 INTEGER EXTERNAL,
$data1 CHAR(8),
$data2 CHAR(32),
$data3 DECIMAL(5,2) EXTERNAL )
EXCEPTION TABLE except_tb
MESSAGES ICD_msg.txt
RESTART NEW ICDJob001
UPDATE my_table
SET (data1, data2, data3) =
($data1, $data2, $data3)
WHERE (key1 = $key1) AND (key2 = $key2);
Delimited with UPDATE, commit count
INGEST FROM FILE my_file1.txt, my_file2.txt
FORMAT POSITIONAL
( $key_fld POSITION(1:10) INTEGER EXTERNAL,
$data_fld POSITION(11:20) INTEGER EXTERNAL )
MERGE INTO my_table
ON (key1 = $key_fld)
WHEN MATCHED AND (action = 'U')
THEN UPDATE SET data = $data_fld
WHEN MATCHED AND (action = 'D')
THEN DELETE;
Positional with MERGE, multiple files
INGEST SET pipe_timeout 600;
INGEST SET commit_period 300;
INGEST FROM PIPE DataWarehousePipe1
FORMAT DELIMITED
( $key1 INTEGER EXTERNAL,
$key2 INTEGER EXTERNAL )
DELETE FROM my_table
WHERE (key1 = $key1) AND (key2 = $key2);
Pipe input with DELETE, commit period
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Ingest Utility
Parameters
135
Parameter Range Default Description
commit_count
0 to max 0 Number of rows each flusher writes in a
single transaction before issuing a commit
commit_period
0 to 2,678,400
seconds
1 second Number of seconds between committed
transactions
num_flushers_per_
partition
0 to system
resources
Max(1,((no logical
cpus)/2) / no
partitions))
Number of flushers to allocate for each
database partition (0 means 1 flusher for all
partitions)
num_formatters
1 to max no
threads
Max(1,(no logical
cpus)/2)
The number of formatter threads
pipe_timeout
0 to 2,678,400
seconds
600 seconds The maximum number of seconds to wait
for data when the input source is a pipe (0
means wait indefinitely). If no data arrives
within the specified period, the INGEST
command ends and an error is returned
retry_count
0 to 1,000 0 The number of times to retry a failed (but
recoverable) transaction
retry_period
0 to 2,678,400
seconds
0 The number of seconds to wait before
retrying a failed (but recoverable)
transaction
shm_max_size
1 to available
memory
1 GB Maximum size of IPC shared memory in
bytes (allocated on the client where
INGEST is run)
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Ingest vs. DB2 Load
Usage scenarios
136
Use Ingest When Use Load When
Other applications must update the table
while the ingest is occurring
Your table contains XML or LOBS
You require MERGE, UPDATE or DELETE
operations to be performed
You need to load from a cursor or a device
You require a SQL expression to populate a
column during the ingest
You need to load from an IXF source file
You require automatic recoverability (of a
failed ingest)
Your table contains a GENERATED ALWAYS
column and you wish to override it
Your table contains a SYSTEM TIME
column and you wish to override it
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Export & db2look Utilities
Extract data and DDL from a DB2 database
EXPORT TO [filename] OF [file-type]
SELECT * FROM [table-name];
db2look -d [database] -a e -l -x -m f;
db2look Characteristics
Reengineers an entire database
Creates DDL for tables
Creates DDL for all other objects
Extracts statistics
Can generate parameters and registry variables
Export Characteristics
Source support of
Complete or partial tables
Typed tables
LOBs and XML data types
Output can be:
DEL and IXF formats
DDL
Export
db2look
Import /
Load
Export Import
/IXF Files
Target
Database
Source
Database
Text Files
Cross
Platform
137
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
db2move Utility
Mass movement of tables and other objects
db2move database movement tool
From and to any platform
Ideal for movements of large number of tables
Uses Export to get data out and then either Import or Load to get data in
Has a Copy mode for moving tables and other schema objects from one database to another in PARRALLEL mode
db2move
(Export)
db2move
(Import or Load)
PC / IXF Files Target
Database
Source
Database
Cross
Platform
This will export all tables in the SAMPLE database
This will export all tables created by "userid1" or user IDs
LIKE "us%rid2", and with the name "tbname1" or table
names LIKE "%tbname2".
This command will import all tables in the SAMPLE
database LOB paths "D:\LOBPATH1" and "C:\LOBPATH2"
are to be searched for LOB files.
This command will load all tables in the SAMPLE database;
both the /home/userid/lobpath subdirectory and the /tmp
subdirectory are to be searched for LOB files.
db2move sample export ;
db2move sample export -tc userid1,
us*rid2 -tn tbname1, *tbname2 ;
db2move sample import -l
D:\LOBPATH1, C:\LOBPATH2 ;
db2move sample load -l
/home/userid/lobpath, /tmp ;
138
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Data Pump Export Utility
Analogous to DB2 Export, db2look, db2move
Oracle Export
Feature
Oracle Option Comment DB2 Option Comment
Export output format Proprietary .dmp file can only be
read by Oracle import utilities
IXF is proprietary, but DEL is not
Mode=full Exports entire database, all
schemas and all objects
db2move with no options does this
Mode=schemas Exports only objects from selected
schemas
db2move sn or -tc options do
this (schema vs. owner)
Mode=tables Exports only selected tables,
regardless of schema or location
db2move tn option does this
Mode=tablespaces Exports only objects in selected
table spaces regardless of schema
db2move ts option does this
Content=data only Produces only table data Export to DEL does this
Content=metadata only Produces DDL only db2look does this
Content=all Produces tables, data and all other
objects
Export to IXF along with db2look
does this
139
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
ADMIN_COPY_SCHEMA Stored Procedure
Copy an entire schema of objects within the same DB
ADMIN_COPY_SCHEMA(
SOURCESCHEMA,
TARGETSCHEMA,
COPYMODE,
OBJECTOWNER,
SOURCETBSP,
TARGETTBSP,
ERRORTABSCHEMA,
ERRORTAB)
Schema where objects will be copied from
Schema where objects will be copied to
Authorization ID as owner of copied
objects
Source objects table spaces list
(NULL uses the same names for target as
source used)
Target objects table spaces list
(SYS_ANY will default table space usage)
Resides in SYSPROC schema
Mode of copy:
DDL: create empty copies only
COPY: create and load data in
nonrecoverable mode
COPYNO: create and load data in
copyno mode
Name of schema and table where
errors for objects not copied are
recorded
Field Data type Usage
Object_schema varchar(128) Source object schema that failed copy
Object_name varchar(128) Source object name that failed copy
Object_type varchar(30) Source object type that failed copy
SQLCODE integer The error SQLCODE
SQLSTATE char(5) The error SQLSTATE
Error_timestamp timestamp Time the error occurred
Statement clob(2M) DDL for failing object
Diagtext clob(2K) Error message for failed operation
Object_schema varchar(128) Source object schema that failed copy
Object_name varchar(128) Source object name that failed copy
DB2 note:
A key feature of this
stored procedure is no
OS files usage
Error
Table
Format
140
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Copy Schema Comparison
A couple of options - all use OS files
Data pump Export / Import using REMAP_SCHEMA
However, this uses OS files
Original Export / Import using FROMUSER TOUSER
This also uses OS files
DBMS_METADATA.GET_DDL
Uses OS file to store output
Only gets the DDL, not the data
DDL must be run manually to create objects in another schema
RMAN backup / restore is possible
But only if you have separated schemas into table spaces
This also uses OS files
Only handles data, not other DDL objects
141
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
ADMIN_MOVE_TABLE Stored Procedure
Move tables to any table space or type, online or offline
ADMIN_MOVE_TABLE(
TABSCHEMA,
TABNAME,
DATA_TBSP,
INDEX_TBSP,
LOB_TBSP,
MDC_COLS,
PARTKEY_COLS,
DATA_PART,
COL_DEF,
TARGET_TABNAME,
OPTIONS,
OPERATION)
TARGET
Name of new target data table space
MDC cols moving to an MDC
Name of new target index table space
Name of new target lob table space
Hash partitioning keys moving to DPF
Range partitioning keys moving to table
partitioning
Redefine column data types
Use your own existing table as target
DB2 note:
Key features of this stored procedure are:
Online can be done during DML operations
No index or constraint cleanup needed
SOURCE
Resides in SYSPROC schema
Schema where table will be copied
from
Name of table to move
KEEP, REORG, FORCE, CLEANUP,
COPY_USE_LOAD, etc.
MOVE (performs entire table move)
..or indicate individual steps:
INIT, COPY, REPLAY & SWAP
142
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
ADMIN_MOVE_TABLE Stored Procedure
Move data flow processing to keep it all online
Tabschema Tabname Key Value
Control Table
SYSTOOLS.ADMIN_MOVE_TABLE
C1 C2 Cn
Source Table
C1 C2 Cn
Staging Table
Shadow Copy Table
C1 C2 Cn
Phase 1 INIT
Verify table move can
take place & prepare
the environment
Phase 2a - COPY
Copy source to
shadow copy
Phase 2b - COPY
Capture insert, update &
delete keys with triggers
Phase 4 - SWAP
Shadow copy
becomes source
Phase 3 - REPLAY
Rows re-copied from
source table by key
143
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
ADMIN_MOVE_TABLE Stored Procedure
Simple approach
Used for simple operations, e.g.:
1. Move data, index and lobs to a different set of table spaces
2. Let the procedure create the target table for you
call SYSPROC.ADMIN_MOVE_TABLE(
MYSCHEMA,
MYTABLE,
NEW_DATA_TABLESPACE,
NEW_INDEX_TABLESPACE,
NEW_LOB_TABLESPACE,
, , , ,
COPY_USE_LOAD,
MOVE);
Performs the entire table move in one
step. Creates the target table for you.
This option uses the non-recoverable
db2Load API to copy the data from the
source table to the target table
144
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
ADMIN_MOVE_TABLE Stored Procedure
Controlled approach
Used when target table needs to be created beforehand
Used to control each stage more specifically
call SYSPROC.ADMIN_MOVE_TABLE(
MYSCHEMA,
MYTABLE,
, , , , ,
C1 INT(5), C2 CHAR(5),
TARGETTABLE,
KEEP,
MOVE);
Define the column changes.
Use in place of ALTER TABLE.
Keep the source table
call SYSPROC.ADMIN_MOVE_TABLE(MYSCHEMA, MYTABLE, , , , , , , , , INIT);
call SYSPROC.ADMIN_MOVE_TABLE(MYSCHEMA, MYTABLE, , , , , , , , , COPY);
call SYSPROC.ADMIN_MOVE_TABLE(MYSCHEMA, MYTABLE, , , , , , , , , REPLAY);
call SYSPROC.ADMIN_MOVE_TABLE(MYSCHEMA, MYTABLE, , , , , , , , , SWAP);
145
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Oracle Move Table Comparison
A couple of options
DBMS_REDEFINITION package the online option
This requires multiple steps that must be specified individually and in
the correct order
Does not have the one-line simple option of ADMIN_MOVE_TABLE
OFFLINE OPTIONS
ALTER TABLE [tb-name] MOVE [tbsp-name]
Moves the table to a different table space, but is offline
Indexes are marked unusable - must be rebuilt manually
Data pump Export / Import
Import must be changed to redirect to new table space
CREATE TABLE AS SELECT into new table space
Requires manual renaming of the table
Requires manual index and constraint cleanup
146
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
db2relocatedb
The DB2 fast, physical clone database method
db2relocatedb Main Characteristics
Physically copies an entire database to another instance
Physically moves or renames data files within a database
Uses data file copy not backup & restore
Must be performed off-line
Must be done in the same operating system family
Can change the following:
Instance name
Database name
Log path
Path-drive name
Table space container and path name
To relocate a database to a new server, 3 steps:
#1. Manually copy files, e.g. the DB directory, to new location
[inst1home]/NODE0000/SQL00001
will be copied to
[inst2home]/NODE0000/SQL00001
#2. Run db2relocatedb command on new server like this:
CATALOG DATABASE
#3.
db2.cfg
DB_NAME=TESTDB, PRODDB
DB_PATH=/inst1home, /inst2home
INSTANCE=inst1, inst2
DB : TESTDB
Path : /inst1home
Instance : inst1
Before
Instance : inst2
DB : PRODDB
Path : /inst2home
Instance : inst2
After
#2.
db2relocatedb f db2.cfg
147
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
RMAN CONVERT DATABASE
AKA an Oracle transportable database
Oracle RMAN CONVERT DATABASE Characteristics
Physically copies an entire database to another server
Physically moves or renames data files within a database
Uses data file copy not backup & restore
Must be performed off-line
Must be done in the same operating system family
Can change table space data file and path name
Cannot migrate BFILE or external tables
Use the following 10 steps to do this:
#1. Use DBMS_TDB.CHECK_DB package to
check DB to see if this can be done.
#2. Use DBMS_TDB.CHECK_EXTERNAL for
possible external file issues
#3. Run RMAN CONVERT DATABASE command
#4. Copy all OS files to appropriate destination
#5. Edit transport script that came from the
CONVERT DATABASE command for any file
location changes
#6. Edit the PFILE to change any settings for
the destination database.
#7. Execute the transport script in SQL*Plus to
create the new database on the
destination host.
#8. Open the database using ALTER
DATABASE OPEN RESETLOGS;
#9. Change the internal database identifier
using DBNEWID Utility
#10. Create TNSNAMES entry for new database
148
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
db2relocatedb
The DB2 rename table space container method
To rename a table space container:
Manually rename file on the OS
/mystorage/OLDcontainer.dat to
/mystorage/NEWcontainer.dat
Run db2relocatedb command on new server like this:
Oracle note:
Manually rename file on the OS.
Then use either of these commands:
ALTER DATABASE RENAME FILE or
ALTER TABLESPACE RENAME DATAFILE
Both DB2 and Oracle are limited by the operating
system family endianness, as shown below:
Platform Endianness
AIX Big endian
HP-UX Big endian
HP on IPF Big endian
Solaris Big endian
Linux on zSeries Big endian
Linux on Power PC Big endian
Linux on IA-64 Little endian
Linux on AMD-64 Little endian
Linux on Intel EMT64T Little endian
32-bit Linux on x86 Little endian
db2.cfg
CONT_PATH=
/mystorage/OLDconainer.dat ,
/mystorage/NEWcontainer.dat
db2relocatedb f db2.cfg
149
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Restore From Backup With Redirect
An easy, logical clone database method
#1 - Redirected Restore creates a new database from a backup image
Can be done on the same server or a different server
New database can have a different name from database originally backed up
Must be done on the same operating system family with the same endianness
#2 - Redirected Restore renames or moves data files for a table space
Done within the same database
Use SET TABLESPACE CONTAINERS following this kind of restore
DB2 can build a redirected restore script for you:
Server 1 Server 2
Backup
Image
Target
Database
Source
Database
Backup Restore
RESTORE DB FROM [directory] TAKEN AT [timestamp]
REDIRECT GENERATE SCRIPT [script-name];
150
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 DB Restore New vs. Oracle DB Restore New
Step by step comparison
Oracle Step Oracle Command DB2 Command
#1. Backup database & logs backup database plus archive log backup database include logs
#2. Copy required files to new loc 1) backup file, 2) pfile, 3) control files backup file only
#3. Edit pfile vi [pfile-name] N/A (parms part of database)
#4. Set environment variables 1) Oracle home, 2) sid, 3) path DB2INSTANCE only
#5. Restore control file from backup restore control file from N/A (part of database)
#6. Mount database alter database mount N/A
#7. Catalog backup pieces catalog backuppiece N/A
#8. Find last sequence number list backup of archivelog all N/A (automatically handled)
#9. Rename redo log files alter database rename file N/A (automatically handled)
#10. Restore datafiles to new loc until sequence set newname for set tablespace container
for
#11. Restore/recover database restore database; switch datafile
all; recover database; alter
database open resetlogs;
restore db [db-name]
redirect without prompting;
rollforward;
151
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Split Mirror
Clone a database as a snapshot
* DB2 note:
The mirror copy should be of the
entire database directory, including
the volume directory, log directory
and container directories.
Use administration view DBPATHS
which shows all the files you need
to perform a proper split mirror.
Oracle note:
To suspend/resume writing in Oracle, use the
following commands:
ALTER SYSTEM SUSPEND
ALTER SYSTEM RESUME
** DB2 note:
DB2INITDB has three options:
1. SNAPSHOT to use as a clone
2. MIRROR to use to restore the primary
3. STANDBY to use for HADR
DB2 integrated use of split mirror to clone a database:
To use the mirror, do the following **:
CATALOG DATABASE DB1_mirror;
DB2START;
DB2INITDB DB1_mirror AS SNAPSHOT;
Server 2 Server 1
Operating system command
to split the mirror *
DB1
DB1_mirror
SET WRITE SUSPEND FOR DATABASE;
SET WRITE RESUME FOR DATABASE;
152
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Optim High Performance Unload
Goes beyond core engine utilities
Perform very quick sequential unloads from a
Table space
Backup image
10 to 12 times faster than EXPORT (minimum)
Minimal impact on unloading production tables
SQL-like extraction syntax support
Autonomic data type conversions
Multiple output formats supported
PC/IXF
Delimited
ASCII
DSNTIAUL
Built-in splitter for DPF databases
Unload and split in a single operation
DB2 authorization checking
and more
Ask us about how to
get more information
on this product!
153
2012 IBM Corporation
An IBM Proof of Technology
DB2 Backup, Restore & Recovery
(Core engine)
Lab 14 BACKUP
26 slides
Vikram Khatri & Burt Vialpando
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Architectural Comparison of Backup and Recovery
Basic components overview
Oracle
Data Files
(Data Blocks)
Redo Logs
Control Files,
List Backup
Archived
Redo Logs
RMAN
Parameter
Files
Enterprise
Manager
Database
Control
DB2
Data Files
(Data Pages)
Recovery
History File
Recovery
(Transaction)
Logs
Backup /
Restore
Parameter
Settings
Archived
Recovery
Logs
IBM Data
Studio
Task
Assistants
155
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Architectural Comparison of Backup and Recovery
IBM Data Studio configure logging task assistant
156
Excellent learning tool
Perform and generate all
of the logging config
command lines shown
in these slides with this
GUI tool
No need to learn config.
parameters for DB2
logging up front
Screens walk
you through
logging setup
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Architectural Comparison of Backup and Recovery
IBM Data Studio backup, recover, restore & roll forward assistants
157
Launch all from
IBM Data Studio
Excellent learning tools
Do all of your backups,
restores and even roll-
forward recovery this way
Perform and generate
most of the command
lines shown in these
slides with these GUI
wizards
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Architectural Comparison of Backup and Recovery
Logging options
Redo logs apply to instance
NoArchivelog Mode
- Full instance recovery
- Limited roll-forward available
Archivelog Mode
- Recover DB, TS, DF
- Dual logging & mirrored logging
- Redo log states:
1 - Current
2 - Active
3 - Inactive
4 - Archived
Defined at database level
Circular
- Full "crash" recovery,
- No roll-forward recovery
Archive Log (aka Log Retain)
- Fully recoverable, DB, TS
- Dual logging & mirrored logging
- Recovery log states:
1 - Active
2 - Online archived
3 - Off-line archived
Oracle
Logging Options & Components
DB2
Logging Options & Components
158
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Architectural Comparison of Backup and Recovery
Archive logging
159
DB2 Archive Log
Recovery
Log
Files
DB Shared Memory
Buffer
Pool
Package
Cache,
DB Heap,
etc.
Data Base Level
Log
Buffer
db2pgclnr
[softmax]
db2logger
logarch
method1
Data
Files
Log
Control
File
Archive
Log
Files
Active Log
Non-Committed or Non-Externalized
Transactions crash recovery
Online Archive Log
Committed & Externalized Transactions
yet to be archived
Off-line Archive Log
Files moved from active log subdirectory to another
media (recovery log files are not reused)
Oracle Archive Log
Redo
Log
Files
SGA
Database
Buffer
Cache
Large &
Shared
Pools, etc.
Instance Level
Redo
Log
Buffer
dbwn
ckpt
lgwr
arcn
Data
Files
Control
Files
Archive
Log
Files
Current Redo log
LGWR is currently writing to
Inactive Redo Log
No longer required for instance recovery
Archived Log
Files copied from redo log file to another media
(redo log files are reused in a circular way)
copied
moved
Active Redo log
Required for instance recovery
BV
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Architectural Comparison of Backup and Recovery
Recovery history information
DB2
Recovery History File updated during
Database backup, merge backup, restore,
roll-forward or recovery
Table space backup, merge backup,
restore or roll-forward
Table space is created, dropped, altered,
renamed or quiesced
Table is loaded, dropped or reorganized
Log file is archived
New log file is written to
select * from table(sysproc.admin_list_hist())
as history;
Oracle
For user-managed backups, use the
following views to know which files to
manage:
V$DATAFILE
V$CONTROLFILE
V$LOGFILE
spfile copy (optional)
For server-managed backups:
View & manage backup repository info in
the control file using RMAN:
list history backup all for sample;
rman target /
list backup of database;
list backup of archivelog all;
report need backup;
report obsolete;
delete expired;
delete obsolete;
160
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Architectural Comparison of Backup and Recovery
Automated management of recovery artifacts
DB2
To automatically prune recovery history
information for a specific timeframe, set DB
CFG:
REC_HIS_RETENTN
To manually prune your recovery history
file, use this command:
To automate the cleanup of backup images,
log files & load copy images to coincide
with the recovery history file, set DB CFG:
AUTO_DEL_REC_OBJ
To keep a specific number of backups, set
DB CFG:
NUM_DB_BACKUPS
prune history 200412 and delete;
Format YYYYMM
Oracle
The Control File size is managed
by a number of parameters:
MAXLOGFILES
MAXLOGMEMBERS
MAXLOGHISTORY
MAXDATAFILES
MAXINSTANCES
CONTROL_FILE_RECORD_
KEEP_TIME
161
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Offline Backup (aka Cold Backup)
The simplest backup
DB2
For circular log mode (usually)
except to make a base backup for an
archive logged database
Quiesce or deactivate database
Use Backup command
At database or table space level
SYSADM, SYSCTRL or SYSMAINT
authority needed
Some consider a manual copy of data files
to be a cold backup (AKA user
managed ) and you can do this with DB2
also, but this is not considered a DB2
backup , its just an OS backup
Oracle
Used mostly for NOARCHIVELOG
Shutdown in normal ( consistent
mode)
#1. Whole backup: Use OS cp,
cpio, tar, pkzip, etc. to manually
copy:
data files
control files
redo logs
#2. Or use RMAN in mount mode :
run {
shutdown immediate;
startup mount;
allocate channel d1 type disk;
backup as backupset database
format /oraback/offline_full.bus;
alter database open;
}
QUIESCE DATABASE IMMEDIATE;
BACKUP DATABASE SAMPLE TO
/db2backup;
162
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Offline Restore
Oracle
Shutdown Normal (or consistent
mode)
Use appropriate correctly name
backup image
Copy data files, control files, redo
logs and undo logs files manually
from backup
Can relocate data files during
manual copy using:
Can restore to a new database
but requires many steps
ALTER DATABASE RENAME FILENAME
[old-path] TO [new-path];
DB2
Stop or quiesce database
Use TIMESTAMP from history file of
backup desired
(easy to use)
Use Restore command:
(no roll-forward necessary)
Can relocate containers during restore
(redirected restore)
DB2 can generate a script for you to do
this
Can restore to a new database in one easy
command
RESTORE DATABASE SAMPLE
FROM /db2backup" TAKE AT
20040901144022 WITHOUT PROMPTING;
163
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Online Backup (aka Hot Backup)
Archive logging configuration required
Oracle
Change init.ora parameters
LOG_BUFFER
LOG_ARCHIVE_DEST
LOG_ARCHIVE_DUPLEX_DEST
LOG_ARCHIVE_CONFIG
Other optional parameters
Now backup the database and logs
(Note: Oracle does not require you to
make a backup after switching
to archivelog mode
but you better!)
SHUTDOWN [IMMEDIATE];
STARTUP MOUNT;
ALTER DATABASE ARCHIVELOG;
ALTER DATABASE OPEN;
ARCHIVE LOG LIST;
ALTER SYSTEM ARCHIVE LOG CURRENT;
DB2
Set LOGARCHMETH1 to enable archive
logging
Set required logging parameters
LOGFILSZ
LOGBUFSZ
LOGPRIMARY
LOGSECOND
Set optional logging parameters
NEWLOGPATH
MIRRORLOGPATH
BLK_LOG_DSK_FULL
OVERFLOWLOGPATH
Take a complete offline database backup
(required by DB2 when switching to
archive log mode)
quiesce database
backup database
unquiesce database
Dont forget the Data Studio logging task
assistant can help you do all of this!
164
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Logging Parameters
Function Parameter Usage Default
Archive Retry Delay archretrydelay Wait in second between archive log failure attempts. 0 means no retry. 20
Block on Log Disk Full blk_log_dsk_ful Prevent disk full errors from being generated. NO
Failover Archive Path failarchpath Alternate directory for the archive log files if the log archive method specified fails. NULL
Log Archive Methods 1 & 2 logarchmeth1
logarchmeth2
Cause the database manager to archive log files to locations that are not the
active log path. Values are OFF, DISK, TSM, VENDOR
OFF
Log Archive Options 1 & 2 logarchopt1
logarchopt2
Works with logarchmeth1 & 2 for vendor options if using TSM or VENDOR values. NULL
Log Archive Compression
1 & 2
logarchcompr1
logarchcompr2
Enables archive log compression for each log archive method NULL
Log Buffer logbufsz Amount of memory to use as a buffer for log records in 4-KB pages. 8
Log File Size logfilsiz The size of each configured log, in number of 4-KB pages. 1000
Max Logs per Transaction max_log Percentage of primary log space that can be consumed by one transaction.
0 means no limit.
0
Mirror Log Path mirrorlogpath Location where an identical copy of the logs will be kept. NULL
New Log Path newlogpath Location to change for log path away from default SQLOGDIR. NULL
Number of Archive Retries numarchretry Number of attempts that will be made to archive log files using the specified log
archive method before they are archived to the path specified by the failarchpath.
5
Number of Log Span num_log_span Number of active log files that an active transaction can span. 0 means no limit. 0
Overflow Log Path overflowlogpath Multi-function parameter used for roll forward and archived log retrieval operations. NULL
Primary Logs logprimary Number of primary logs. Also determines number of logs in active log path. 3
Secondary Logs logsecond Number of secondary logs allocated if needed. -1 is unlimited active logs. 2
165
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Online Backup
Operation & scope
Oracle
RMAN enabled with backup
command
Control parallelization with channels
Output can be to any media
Compression option
Control file and spfile are included
Requires sysdba
run {
allocate channel t1 type disk;
allocate channel t2 type disk;
BACKUP AS COMPRESSED
BACKUPSET FILES PERSET 8
DATABASE;
BACKUP AS COMPRESSED
BACKUPSET ARCHIVELOG ALL
DELETE ALL INPUT;
}
DB2
BACKUP command enabled
Database or table space driven
Logs hold changed pages for committed
transactions
Very first full backup done offline
Contains
Changed data pages
Unchanged data pages
System files
History files
Control files
Can include logs
Can be throttled
Still, minimum activity usually desired
during online backup
Parallelization is automatic but can be
overridden if desired
Requires sysadmin, sysctrl or sysmaint
166
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Online Backup
DB2 examples
DB2
Online Database backup
Online table space backup including logs
Online database backup compressed & throttled
BACKUP DATABASE SAMPLE ONLINE TO /db2backup;
BACKUP DATABASE SAMPLE TABLESPACE userspace1
ONLINE TO /db2backup INCLUDE LOGS;
BACKUP DATABASE SAMPLE ONLINE TO /db2backup
COMPRESS UTIL IMPACT PRIORITY 50;
167
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Online Restore / Recover
Database considerations
Oracle
Restore & recover strategies are
different based upon what is lost
(Examples, see paper on Oracle Recovery
Scenarios)
Oracle RESTORE: to bring a database
back from a backup
Oracle RECOVER: to apply redo logs
to database to roll-forward
Database level recovery
Mount the database
Online all data files
Copy back lost data files
Apply redo logs (inactive and archived)
Recover database can be to
End of logs
Point in time
DB2
Database restore/recover done offline from
online backup or merge backup
Full restore/recover brings up & applies all
crucial files automatically
DB2 RESTORE: used with roll-forward for more
control
DB2 RECOVER: for ease of use
or
RECOVER & ROLLFORWARD have two
types:
End of logs
Point in time
RECOVER DB SAMPLE TO END OF LOGS;
RESTORE DATABASE SAMPLE FROM
/db2backup TAKEN AT 20041201194626
WITHOUT PROMPTING;
ROLLFORWARD DATABASE SAMPLE TO END
OF LOGS AND COMPLETE;
168
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Online Restore
Table space considerations
Oracle
Table space level recovery
Offline table space
Copy back lost data files
Apply redo logs
(online and archived)
Recovery Scenarios
Depending upon severity of media
failure and backup strategy
deployed, restoring to a consistent
database can sometimes be tedious
Examples, see paper on Oracle
Recovery Scenarios
DB2
Table space restore can be performed
online like this:
Roll-forward has two types:
End of logs
Point in time
You can also rebuild an entire database
from table space backups!
RESTORE DATABASE SAMPLE
TABLESPACE(userspace1) ONLINE
FROM /db2backup
TAKEN AT 20040901201428
WITHOUT PROMPTING;
ROLLFORWARD DATABASE SAMPLE
TO END OF LOGS AND COMPLETE
TABLESPACE(userspace1)
ONLINE;
169
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Incremental Backups
Description comparison
Oracle
Cumulative Incremental Backup
Level 0 is a baseline
Level 1 backs up all blocks
changed after the most recent
incremental backup at level 0
only
Differential Incremental Backup
(default)
Level 0 is a baseline
Level 1 backs up all blocks
changed after the most recent
incremental backup at level
0 or 1
DB2
Incremental Backup
Backup all pages changed since the last
full backup
Delta Backup
Backup all pages changed since the most
recent full, incremental or delta back up
Similar
Similar
170
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Incremental Backups
DB2 incremental & delta
171
Sunday Mon. Tue. Wed. Thu. Fri. Sat. Sunday
Full
Backup
Full
Backup
Incremental Backups
Full
Backup
Full
Backup
Delta Backups
Sunday Mon. Tue. Wed. Thu. Fri. Sat. Sunday
Full
Backup
Full
Backup
Full
Backup
Full
Backup
BV
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Incremental Backups
Using
Oracle
RMAN is used for partial backup
RMAN uses a file to track the
blocks that have changed since last
backup
Enable tracking mechanism using
Disable tracking mechanism
Perform the backup
ALTER DATABASE ENABLE BLOCK
CHANGE TRACKING USING FILE
/backups/change.log;
UPDATE DB CFG FOR SAMPLE USING
TRACKMOD YES;
DB2
Enable database tracking by setting
database parameter TRACKMOD to YES
Full, then incremental database backups:
ALTER DATABASE DISABLE BLOCK
CHANGE TRACKING;
rman target /
BACKUP INCREMENTAL LEVEL 1
TABLESPACE SYSTEM;
exit
UPDATE DB CFG FOR SAMPLE USING
TRACKMOD YES;
BACKUP DATABASE SAMPLE ONLINE
INCREMENTAL TO /db2backup;
BACKUP DATABASE SAMPLE TO
/db2backup;
BACKUP DATABASE SAMPLE ONLINE
INCREMENTAL DELTA TO /db2backup;
172
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Incremental Restore
Using
Oracle
RMAN is used for incremental
restore
RMAN can do the incremental
merge from the incremental
backups
DB2
To restore without loss of data
Apply full backup
Use AUTOMATIC keyword to
automatically restore from the full backup
and apply incremental backup images
Roll-forward
(Examples next slide)
Dont forget the IBM Data Studio Restore
task assistant can help you!
173
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Incremental Restore
DB2 examples
DB2 Incremental Restore Steps
Restore using automatic keyword to apply incremental or delta
backups
Roll-forward
RESTORE DATABASE SAMPLE INCREMENTAL AUTOMATIC
FROM /db2backup
TAKEN AT 20040901230402 WITHOUT PROMPTING;
For automatic restore, the timestamp is of
the most recent incremental or delta backup
ROLLFORWARD DATABASE SAMPLE TO END OF LOGS
AND COMPLETE;
174
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Recover Dropped Table
Process compared
Oracle
If FLASHBACK option is enabled, it
is simple:
To permanently delete a table:
To recover from permanent delete
of a table tedious process...
(next slide)
DB2
Dropped table history is maintained
(if DROPPED TABLE RECOVERY is on)
Restore table space from previous
backup
FLASHBACK TABLE RECYCLETEST
TO BEFORE DROP;
DROP TABLE RECYCLETEST PURGE;
DB2
Dropped table history is maintained
(if DROPPED TABLE RECOVERY is on)
Restore table space from previous
backup
LIST HISTORY DROPPED TABLE ALL
FOR SAMPLE;
RESTORE DB SAMPLE
TABLESPACE(userspace1) FROM
/db2backup TAKEN AT 20040902100931
WITHOUT ROLLING FORWARD WITHOUT
PROMPTING;
175
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Recover Dropped Table
Process compared (continued)
Oracle
To recover from permanent
delete of a table
Restore database to another
server
Perform point-in-time recovery
just before table was dropped
Export dropped table
Import into your primary
database
DB2
Unload dropped Table data
Recreate table using DDL from recovery
history file
Load the data
ROLLFORWARD DB SAMPLE TO END
OF LOGS AND COMPLETE RECOVER
DROPPED TABLE
00000000000002010002000d TO
/db2backup;
LOAD FROM
/db2backup/node0000/data OF DEL
METHOD p(1) INSERT INTO recoverme;
176
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Backup & Restore
Supporting utilities
Advanced Copy Services (ACS)
Enables you to use the fast copying technology of a storage device to perform the data
copying part of backup (often called a snapshot backup) and restore operations
db2ckbkp (check backup)
Checks for completeness of backup images (which also may contain logs)
db2cklog
Check validity of archive log files before using them in a roll forward recovery operation
db2ckrst (check incremental restore image)
Helps manage log chains to make sure they are complete for any given incremental
restore
db2adutl (Tivoli Storage Manager object management)
Allows users to query, extract, verify, and delete backup images, logs, and load copy
images saved using Tivoli Storage Manager
db2tapemgr
Stores archived log files to tape
db2pd (problem determination)
-LOGS option gives current information on all logs
177
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Recovery Expert for LUW
Go beyond core backup/restore functionality
Recover dropped tables
With point and click ease of use
To any Point in Time
With all related objects automatically
Recover of other object types
Stored procedures
UDFs
Triggers
UDTs
Grants
Monitors
Indexes
and more
Automatic multiple recovery path options
Batch interface for scheduling things like log analysis reports or repository
updates
Row level recovery
Undo or redo any row or set of rows
Detailed log analysis activity reports
Saved Sessions
Repeatable recovery scenarios
Backup and Log access
Disk, tape, TSM
Table space support
SMS, DMS, automatic storage
DB2 9.1 and above support
Linux, AIX, Solaris, HP-UX & Windows
Browser based or command line interfaces
Easy lightweight install
Supports DPF, MDC and range partitioned tables
Ask us about how to
get more information
on this product!
178
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Merge Backup for LUW
Make backup scenarios faster, more efficient and more cost effective
Eliminates the need to take full DB2 backups
Merge multiple online or offline database or table space backups to
build a cumulative single offline database or table space backup
Modes supported:
Normal: Merge backups on the DB2 server where the backups were
created
Stand alone: Merge backups on the server that is different from the
server where the backups were created to avoid impact on
production
Backup source locations supported:
Disk, TSM, XBSA, Vendor Library
Target locations supported:
Disk, TSM, XBSA, Vendor Library
Ask us about how to
get more information
on this product!
179
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
We appreciate your feedback.
Please fill out the survey in order to improve this educational event.
SIMPLIFIED CHINESE HINDI JAPANESE
ARABIC RUSSIAN TRADITIONAL CHINESE TAMIL THAI
FRENCH
GERMAN
ITALIAN
SPANISH
BRAZILIAN PORTUGUESE
Thank you
180
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
End of Elective Topics
Presentation by:
Burt Vialpando
IBM Executive IT Specialist, The Open Group Distinguished IT Specialist, IBM IT Certification Board
IBM Certified Database Administrator for DB2 10.1 for Linux, UNIX and Windows
IBM Certified Advanced Database Administrator for DB2 V9.7 for Linux, UNIX and Windows
IBM Certified Solutions Developer DB2 9.7 SQL Procedures
IBM Certified Application Developer DB2 9
IBM Certified Solutions Designer for DB2 Business Intelligence V8
IBM Certified Solutions Expert for DB2 UDB V7.1 Database Administration for IBM OS/390
Oracle 11g Database Administrator Certified Associate
IBM Plateau Level 1 Inventor
burt.vialpando@us.ibm.com
Vikram Khatri
IBM Senior Certified IT Specialist for DB2 Migrations
IBM Advanced Technical Expert DB2 for Clusters
IBM Certified Database Administrator for DB2 UDB V8.1 for Linux UNIX and Windows
IBM Certified Solutions Expert for DB2 UDB V8.1 Family Application Development
Project Management Professional Certified
IBM Plateau Level 1 Inventor
vikram.khatri@us.ibm.com
181
2012 IBM Corporation
An IBM Proof of Technology
IBM DB2 10.1 Administration
For the Experienced Oracle DBA
Part 3 Elective Topics Additional Miscellaneous
Temporal Data Management and Time Travel Query
Multi-Temperature Storage Support
Federation
DB2 Cloud Computing
DB2 locking
Version 7.0 December 7, 2012
Burt Vialpando
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management and Time Travel Query
Historical data automatically captured and easily queried
2
Temporal Data Management gives you:
Time Travel Query capability without the burden of changing the application
or creatingcomplextrigger/function/procedure solutions
Optimized environments for meeting audit and compliance inquiries
Standardized support for temporal INSERT, UPDATE and DELETE operations
Reduced risks, lower costs and DBA time savings
EMPLOYEES_TB
EMPLOYEES_HISTORY_TB
EmpID Dept System_start System_end
12345 M15 05/31/2000 12/30/9999
History automatically
maintained by DB2
Temporal Data Management
SELECT Dept FROM employees_tb
WHERE EmpID=12345;
SELECT Dept FROM employees_tb
FOR SYSTEM_TIME
AS OF 12/01/1997
WHERE EmpID = 12345;
See data
as it is
right now
See data
as it was
in the past
Time Travel Query
EmpID Dept System_start System_end
67890 K25 11/15/1995 03/31/2000
12345 J 13 11/15/1995 12/31/1998
12345 M24 12/31/1998 05/31/2000
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
Temporal data: the basic concepts
3
System Time
Also knownas TransactionTime
Tracks whenchanges are made to the state of the table itself
e.g. when an insurance policy is modified or a when a loan is created
Timestamps assignedby DB2
Business Time
Also knownas Valid Time
Tracks the effective dates of business conditions
e.g. the term dates of an insurance policy or duration period of a loan
Timestamps assignedby the application
Bitemporal
When bothSystemTime andBusiness Time are trackedin a single table
Temporal tables use an inclusive / exclusive approach
Start times include the dates
End times exclude the dates
System temporal tables consist of a base table with a matching history table
The historytable is automaticallyupdatedby DB2 duringDML operations to the base table
Business temporal tables only consist of a base table
DB2 does rowsplitsduringDML operations to maintainthe business versions of data
System Time is needed to see:
DB2s physical view of time
Systems validity
Past to present view of the data
Business Time is needed to see:
The applications view of time
Business validity
Past, present or future view of the data
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
When is it needed?
4
Industry Typical business cases for temporal data Type
Healthcare A pending lawsuit requires a hospital to reassess its
awareness of a patients medical condition just before a new
treatment was ordered.
System
Time
Financial An internal audit requires a financial institution to report on all
changes made to a clients records during the past 7 years.
System
Time
Insurance A client challenges an insurance firms resolution of a claim
involving a car accident. The insurance firm needs to
determine the policys terms in effect for that client when the
accident occurred.
Business
Time
Retail A retailer needs to ensure that no more than one discount is
offered for a given product during any period of time.
Business
Time
Banking A client inquiry reveals a data entry error involving the
three-month introductory interest rate on a credit card. The
bank needs to retroactively correct the error and compute a
new balance.
Bitemporal
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
System Time: Three easy steps to implement
5
1. Create the System Time base table
2. Create the System Time history table
3. Alter base table to enable versioning and identify history table
CREATE TABLE EMPLOYEES _TB (
EmpID INT primary key not null,
Dept CHAR(3),
Sys_start TIMESTAMP(12) GENERATED ALWAYS AS ROW BEGIN NOT NULL,
Sys_end TIMESTAMP(12) GENERATED ALWAYS AS ROW END NOT NULL,
Trans_start TIMESTAMP(12) GENERATED ALWAYS
AS TRANSACTION START ID IMPLICITLY HIDDEN,
PERIOD SYSTEM_TIME (Sys_start, Sys_end)
);
CREATE TABLE EMPLOYEES_HISTORY_TB LIKE EMPLOYEES_TB
WITH RESTRICT ON DROP;
ALTER TABLE EMPLOYEES_TB ADD VERSIONING
USE HISTORY TABLE EMPLOYEES_HISTORY_TB;
Tracks when a
transaction begins a
change to the table
Links base
table to history
table
Makes this a System
Time table
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
System Time DML operations temporal ramifications
6
INSERT
Base table systemtimes automaticallymaintained
UPDATE
Automaticallyaffect bothbase andhistorytables
DELETE
Automaticallyaffect bothbase andhistorytables
EMPLOYEES_TB
EMPLOYEES_HISTORY_TB
EmpID Dept System_start System_end
12345 J 13 01/31/2011 12/30/9999
EmpID Dept System_start System_end
12345 J 13 01/31/2011 05/15/2012
EMPLOYEES_TB
EmpID Dept System_start System_end
12345 M15 05/15/2012 12/30/9999
EMPLOYEES_HISTORY_TB
EmpID Dept System_start System_end
12345 J 13 01/31/2011 05/15/2012
12345 M15 05/15/2012 06/12/2012
EMPLOYEES_TB
EmpID Dept System_start System_end
INSERT INTO EMPLOYEES_TB (EmpID, Dept),
VALUES (12345, J13);
UPDATE EMPLOYEES_TB
SET Dept = M15
WHERE EmpID = 12345;
Done on
01/31/2011
Done on
05/15/2012
DELETE FROM EMPLOYEES_TB
WHERE EmpID = 12345;
Done on
06/12/2012
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
Business Time: One easy step to implement
7
1. Create a Business Time table
CREATE TABLE EMPLOYEES_TB (
EmpID INT NOT NULL,
Dept CHAR(3),
salary DOUBLE,
Bus_start DATE NOT NULL,
Bus_end DATE NOT NULL,
PERIOD BUSINESS_TIME (Bus_start, Bus_end),
PRIMARY KEY(EmpID, BUSINESS_TIME WITHOUT OVERLAPS)
);
Prevents overlapping periods.
e.g. Only one salary figure is valid for
any time period for any given employee.
This can be any date
or time expression
Makes this a
Business Time table
Note:
Business Time tables do not require a history table.
All data is current information about the past,
present or even future state of business.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
Business Time DML operations temporal ramifications
8
INSERT
Business dates required, can be close ended
INSERT
Business dates canalso be openended
UPDATE
Updates (or deletes) cause automatic rowsplitsthat tracks appropriate business periods
EMPLOYEES_TB
EmpID Dept Salary Business_start Business_end
12345 J 13 5000 01/01/2011 01/01/2012
INSERT INTO EMPLOYEES_TB VALUES
(12345, J13, 5000, '01-01-2011', '01-01-2012');
EMPLOYEES_TB
EmpID Dept Salary Business_start Business_end
12345 J 13 5000 01/01/2011 01/01/2012
67890 M15 7000 01/01/2011 12/30/9999
INSERT INTO EMPLOYEES_TB VALUES
(67890, M15, 7000, '01-01-2011', 12-30-9999');
EmpID Dept Salary Business_start Business_end
12345 J 13 5000 01/01/2011 01/01/2012
67890 M15 7000 01/01/2011 06/01/2011
67890 M15 7500 06/01/2011 12/30/9999
UPDATE EMPLOYEES_TB
FOR PORTION OF BUSINESS_TIME
FROM '06-01-2011' TO '12-30-9999'
SET salary = Salary + 500
WHERE EmpID = 67890;
EMPLOYEES_TB
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
Business Time DML operations temporal ramifications continued
9
UPDATE
Multiple rowsplitscan occur dependinguponthe impliedbusiness time periods
Here an employee remains employed, but takes an unpaidleave of absence
DELETE
Deletes can cause rowsplits too
Here an employee is suspendedfor 1 year with no pay andno other vestingaccruingeither
EmpID Dept Salary Business_start Business_end
12345 J 13 5000 01/01/2011 07/01/2011
12345 J 13 0 07/01/2011 09/01/2011
12345 J 13 5000 09/01/2011 01/01/2012
67890 M15 7000 01/01/2011 06/01/2011
67890 M15 7500 06/01/2011 12/30/9999
UPDATE EMPLOYEES_TB
FOR PORTION OF BUSINESS_TIME
FROM '07-01-2011' TO '09-01-2011'
SET Salary = 0
WHERE EmpID = 12345;
DELETE EMPLOYEES_TB
FOR PORTION OF BUSINESS_TIME
FROM '01-01-2012' TO '01-01-2013'
WHERE EmpID = 67890;
EmpID Dept Salary Business_start Business_end
12345 J 13 5000 01/01/2011 07/01/2011
12345 J 13 0 07/01/2011 09/01/2011
12345 J 13 5000 09/01/2011 01/01/2012
67890 M15 7000 01/01/2011 06/01/2011
67890 M15 7500 06/01/2011 01/01/2012
67890 M15 7500 01/01/2013 12/30/9999
Notice the gap of
one year here.
EMPLOYEES_TB
EMPLOYEES_TB
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
Time Travel Query capabilities System Time examples *
10
FOR [time-type] AS OF
Queryfor data at a certainpoint in time
FOR [time-type] FROM TO
Querydata froma certaintime to a certaintime
Uses an INCLUSIVE, EXCLUSIVE approach
FOR [time-type] BETWEEN AND
Querydata froma certaintime througha certaintime
Uses an INCLUSIVE, INCLUSIVE approach
SELECT Dept FROM employees_tb
FOR SYSTEM_TIME
AS OF TIMESTAMP(12/15/1997)
WHERE EmpID = 12345;
SELECT Dept FROM employees_tb
FOR SYSTEM_TIME
FROM TIMESTAMP(12/01/1997)
TO TIMESTAMP(12/31/1997)
WHERE EmpID = 12345;
SELECT Dept FROM employees_tb
FOR SYSTEM_TIME
BETWEEN TIMESTAMP(12/01/1997)
AND TIMESTAMP(12/31/1997)
WHERE EmpID = 12345;
12/31/1997 rows
NOT returned
12/31/1997 rows
returned
* Business Time uses the same syntax.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
Time Travel Query additional capabilities
11
Views on temporal tables
If theycontaina clause: FOR SYSTEM_TIME or FOR BUSINESS_TIME
Data is restricted to just the rows constrained by that clause
Regular queries on the view should not contain that clause
If theydo not containa clause: FOR SYSTEM_TIME or FOR BUSINESS_TIME
Data is un-constrained and all rows are exposed to the view
Queries on the view therefore require that clause
Registers for temporal time
You can set special registers to constrainqueries that do not containtemporal clauses
Allows youto use regular queries without the clause to runin a temporal mode.
SET CURRENT TEMPORAL BUSINESS_TIME = '2011-01-01 10:00:00';
SET CURRENT TEMPORAL SYSTEM_TIME= CURRENT TIMESTAMP 1 MONTH;
The same as adding
FOR BUSINESS_TIME AS OF
to all queries in the session
The same as adding
FOR SYSTEM_TIME AS OF
to all queries in the session
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
Performance tips and best practices
12
System Time history table performance tips
APPEND ON shouldbe considered
Since mostly SELECT and INSERT are used, rarely UPDATE or DELETE
Range partitioningshouldbe considered
Which could be a good way to detach partitions to easily prune older data
A primarykey indexof the base table primarykey plus temporal dates shouldbe considered
This can often improve the FOR SYSTEM TIME AS OF queries
In lieu of this, consider a non-unique key that is similar to the primary key of the base table
Other best practices
Define privileges on the historytable with care, it does not require access for normal use
Users or applications doing all DML to the base table require only DML access to it
Keep regular users from doing any DML directly to the history table to keep its integrity
Consider usinga global variable for minimumdates or maximumdate values
Creating these once will ensure a consistency of use from every user or application
e.g. CREATE VARIABLE MYCONSTANTS.MAX_DATE DATE('9999-12-31');
Consider using RESTRICT ON DROP for the historytable to avoidaccidentallylosingit
Otherwise, dropping the base table will also drop the history table
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Temporal Data Management
IBM study of benefits for using the DB2 solution
13
Lines of code required to implement Business Time
Homegrown
solution using SQL
Stored Procedures
16x
DB2 Temporal Data
Management
1x
Homegrown
solution in Java
45x
Note: This does not take into considerationthe development cost of creatingSQL statements for the final solution.
In this study it took only hours to create and test themin Time Travel Query syntax, where it took weeks to
create and test themin the home grown solution.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
14
DB2 Multi-Temperature Storage Support *
Use storage groups to maximize data placement on disk with ease
Maximize your newest and fastest storage for your most important data
e.g. keep only the data you need for instant access on your solid state storage
Extend the life of your older storage
e.g. keep infrequently used data on it
Utilize storage groups in the automatic storage pool to manage this with ease
Administrative commands make moving data between storage systems easy
Prioritize data by what it is and where it resides
Integrates fully with DB2 Workload Manager and InfoSphere Optim Data Growth solutions
Sto_Grp_Hot
SSD RAID
(Very Fast)
Fibre Channel / SAS RAID
(Fast)
SATA RAID
(Medium)
2012 Q1 2011 Q4 2011 Q3 2011 Q2 2011 Q1 2010 Q4 2010 Q1
DB2 Range Partitioned Table
Sto_Grp_Warm Sto_Grp_Cold
tbspc9 tbspc8 tbspc7 tbspc6 tbspc5 tbspc4 tbspc1

14
* Enterprise Server
Editions only
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
15
DB2 Multi-Temperature Storage Support
Two easy steps to implement
Step #1 - Create storage groups (this is all in automatic storage):
15
Create stogroup Sto_Grp_Hot on /prodpath1/ssddisk overhead 0.75 device read rate 500;
Create stogroup Sto_Grp_Warm on /prodpath2/sasdisk overhead 6.73 device read rate 100;
Create stogroup Sto_Grp_Cold on /prodpath3/satadisk overhead 12.75 device read rate 50;
Step #2a Alter (or create) automatic storage table spaces to use the storage
groups:
Create tablespace tbspc9 using stogroup Sto_Grp_Hot;
Alter tablespace tbspc8 using stogroup Sto_Grp_Warm;
Alter tablespace tbspc5 using stogroup Sto_Grp_Cold;
Step #2b or alter non-automatic storage table spaces this way:
Alter tablespace tbspc_dms managed by automatic storage using stogroup Sto_Grp_Hot;
Alter tablespace tbspc_dms rebalance;
The table space will inherit
overhead and transfer rates
from the storage groups
overhead and device read
rates respectively.
Table spaces already in automatic storage will
rebalance to the new storage automatically.
Table spaces not in automatic storage still
require you to rebalance when moving there.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Multi-Temperature Storage Support
Rebalance considerations
Automatic rebalance occurs by default when altering storage groups
MON_GET_REBALANCE_STATUS table function shows status
Suspend or resume the rebalance this way:
16
Alter tablespace SALES_Q1_2011 rebalance suspend;
[let your system run until a better time for the rebalance]
Alter tablespace SALES_Q1_2011 rebalance resume;
select char(tbsp_name, 20) as tbsp_name,
rebalancer_status as status,
rebalancer_extents_remaining as extents_remaining,
rebalancer_extents_processed as extents_processed
from table (MON_GET_REBALANCE_STATUS(NULL, -1)) ;
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Multi-Temperature Storage Support
Other DB2 Storage Group capabilities
17
DB2 Storage Group Capability Description
SYSCAT.STOGROUPS
SYSIBM.SYSSTOGROUPS
SYSIBM.SYSTABLESPACES (SGID column)
System catalog views to get storage group information in the
database
ADMIN_GET_STORAGE_PATHS Table function to get storage group information in the database
ADMIN_LIST_DB_PATHS
MON_GET_TABLESPACE
MON_GET_CONTAINER
Other table functions to help manage storage
db2pd -storagegroup Utility option for seeing storage group information in the database
SET STOGROUP PATHS FOR command Use when performing a redirected restore of a database that
uses storage groups
Use in the same way you would for setting table space paths
DATA TAG [numeric-value] Create or alter a storage group (or table space) to contain this
optional characteristic
A table space can inherit its storage group DATA TAG value if
not specified
This value is used by the Workload Manager to influence how
queries will run, to give priority by the location of the data
(See the WLM topic for more details)
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Federation *
Definition and benefits
Federation is the concept of setting up DB2 as a distributed database source
that allows you to do the following:
Combine local and remote data from disparate sources into a single view
e.g. DB2, Oracle and SQL Server
Access, join, and manipulate data of different formats from the same interface
e.g. LUW relational, z/OS hierarchical and XML
Incorporate data from multiple sources with a single query
e.g. inventory, sales, and customer information
Insert, update or delete multiple data sources simultaneously regardless of location
Implement security policies throughout a unified view of your enterprise
Interface with standard SQL tools, development environments, web services and
other standard IT infrastructure components
Compensate for SQL limitations at the data source by processing parts of a
distributed request at the federated server
18
Note:
* The DB2 Advanced Enterprise Server Edition can perform federation to many sources, but in order to exploit
Federation to the greatest extent, ask your IBM representative about the InfoSphere Federation Server
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Federation
Overview
19
Components of a Federated System
DB2 family
Informix
SQL Server
Oracle
Sybase
Teradata
ODBC
J DBC
Relational sources
Non-relational sources
Text XML Excel
spreadsheet
WebSphere
MQ
Web
Services
Script Life sciences
URL
DB2 z/OS
VSAM
Adabas
IMS
CA-Datacom
CA-IDMS
z/OS sources
Unified SQL View
SQL, SQL/XML, XQuery
Federation Engine
Global catalog
Wrappers and functions
O
D
B
C
J
D
B
C
Federation Server
Classic
Federation
BV
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Federation
Basic components
A federated database has the following basic components
Wrapper
Mechanism (connector) by which the federated database interacts with data sources
The federated database uses routines stored in a library called a wrapper module
e.g. Net8 for Oracle or DRDA for DB2
Server definition
The definitions that point to the specific data source itself
Specifies the type and version of the data source and the database name if it is a
relational data source
e.g. a specific Oracle instance (which has only one database) or a specific DB2
database
User mapping
An association between an authorization ID on the federated server and the
information that is required to connect to the remote data source.
Nickname
An identifier of the specific data source object to be accessed.
e.g. a specific table in a specific schema in a SQL Server database
20
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Federation
Other objects and capabilities
A federated database can optionally have the following:
Alternate data type mapping
For relational data sources, wrapper default data type mapping can be overridden
For non-relational sources, data type mapping may not be done in the wrapper
Index specifications
Store information about the columns of remote indexes in the global catalog and to
ensure optimal performance
Federated Stored Procedure
Object that points to a procedure on the data source so it can be called there
Federated Materialized Query Tables
An MQT that is created locally on the federated server that is refreshed by one or more
remote objects serviced by nicknames
Federated function mapping
If the data source has the corresponding function available, processing of this function
can be pushed down, and it will help to improve performance
Federated two-phase commit
Enables data integrity and accuracy to be maintained by allowing the update of multiple
data sources simultaneously within a federated (distributed) system
21
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Cloud Offerings
Database as a Service (DBaaS)
22
Provisioning and management of a database
For simplicity and better control by
application developers and administrators
Less need to worry about:
Operating systems and hardware
Day-to-day maintenance
Version upgrades and fix packs
Security upgrades, backup strategies,
HA strategies
Escalating costs
DB2 Cloud offerings:
IBM Workload Deployer
IBM SmartCloud Enterprise
Amazon EC2 (w/ RightScale)
OS Image OS Image
HADR
2 Operating systems
OS configuration
OS maintenance
2 DB2 installations
DB2 configuration
DB2 maintenance
HA topology
Backup strategy
Security patches
DB2 and OS
Failure recovery
Usage based on DBA
skills
Traditional data base
environment
vs.
DBaaS
Using Automated Best Practices
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Cloud Offerings
IBM Workload Deployer The appliance to build your own private cloud
23
Overview of capabilities:
Provides access to IBM middleware virtual images and workload patterns
Easily, quickly and repeatedly create application environments that can be securely deployed and managed in a
private cloud
Capability to use multiple virtual images in a single pattern
Speeds application deployment and dramatically reduces setup time for WebSphere environments from weeks to
minutes with pre-defined patterns and virtual images
Enhanced deployment profile customization
Ensures security in a shared environment serving as a secured, tamper-resistant vault for images and credentials
Integration features:
Embeds Plug-in Development Kit (PDK) to enable customers to create custom plug-ins and patterns to be used by
virtual applications
Utilizes custom images created by IBM Image Construction and Composition tool, as part of virtual system patterns.
Broadens programming model support with J EE 6, OSGi, J PA, and other WebSphere Application Server v8
supported models
Integrates fully with development and service management tools from IBM Rational

and Tivoli

for end-to-end
support
Availability of WebSphere Application Server Hypervisor Edition - Intelligent Management Pack
Hardware support features:
Broadens the Virtual Application deployment to AIX on PowerVM
Provides reliability with added appliance failover POWER7 support
Support for WebSphere Application Server Hypervisor Edition on ESX, Power and System z
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Cloud Offerings
IBM SmartCloud Enterprise Infrastructure as a Service (IaaS)
24
Highlights:
An agile cloud computing IaaS designed to provide rapid access to security-rich, enterprise-
class virtual server environments
Well suited for development and test activities and other dynamic workloads.
Ideal for both IT and application development teams
Delivers cloud-based web services, systems and software to meet the needs of your
business
Use DB2 Enterprise or Express Editions for DBaaS
Licensing:
BYOL: Bring your own
Use your previously purchased IBM software license. You own a license and can apply it to the pre-built
image in the catalog.
PAYG: Pay as you go
Pay by the hour to use an IBM-owned license. You choose the software, accept the license terms online,
and receive a monthly usage bill.
DUO: Development use only
Use the software for development at no charge as an eligible Independent Solution Vendor or Systems
Integrator.
Pre-release:
Use on a temporary basis for test use only, at no charge.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 Cloud Offerings
Amazon Elastic Compute Cloud (EC2) with RightScale
25
Amazon EC2 is a web service that provides resizable compute capacity in the cloud, designed to
make web-scale computing easier for developers
Amazon EC2 is a true virtual computing environment, allowing you to use web service interfaces
to launch instances with a variety of operating systems, load them with your custom application
environment, manage your networks access permissions, and run your image using as many or
few systems as you desire
Select a pre-configured, template based image to get up and running immediately or create an Amazon
Machine Image (AMI) containing your applications, libraries, data, and associated configuration settings
Configure security and network access on your Amazon EC2 instance
Choose which instance type(s) and operating system you want, then start, terminate, and monitor as many
instances of your AMI as needed, using the web service APIs or the variety of management tools provided
Determine whether you want to run in multiple locations, utilize static IP endpoints, or attach persistent
block storage to your instances
Pay only for the resources that you actually consume, like instance-hours or data transfer
RightScale is a Cloud Management solution for all of your clouds public, private and hybrid
Cloud-specific differences are abstracted so you can focus on running your applications
All of your resources are in one place and are organized for ease with logical groups of servers called
deployments
Provision, configure, and automate individual servers or entire deployments in minute
All of your resources are accessible on your terms from a RightScale Dashboard or via the RightScale API
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Locking
Factors that affect locking
26
Factor Examples
The type of processing
being performed
Read only
Includes all SELECT statements that are intrinsically read-only, have an explicit
FOR READ ONLY clause, or are ambiguous, but the query compiler assumes that
they are read-only because of the BLOCKING option value that the PREP or BIND
command specifies.
Intent to change
Includes all SELECT statements that have a FOR UPDATE clause, a USE AND
KEEP UPDATE LOCKS clause, a USE AND KEEP EXCLUSIVE LOCKS clause, or
are ambiguous, but the query compiler assumes that change is intended.
Change
Includes UPDATE, INSERT, and DELETE statements, but not UPDATE WHERE
CURRENT OF or DELETE WHERE CURRENT OF.
Cursor Controlled
Includes UPDATE WHERE CURRENT OF and DELETE WHERE CURRENT OF.
Data access method Index Scan
If an index scan is used to locate a specific row, the optimizer will usually choose
row-level locking (IS) for the table.
Table Scan
If an index is not used, the entire table must be scanned in sequence to find the
required rows, and the optimizer will likely choose a single table-level lock.
Parameters locktimeout
DB cfg: specifies number of seconds an application will wait for a lock
locklist
DB cfg: memory in KB for maintaining all current locks
maxlocks
DB cfg: percent of locklist requiredused to cause lock escalation
cur_commit
DB cfg: determines whether isolation level CS will use the log buffer to get data as it
is currently committed without a lock wait for the outcome of an update transaction
Various registry
variables
db2_evaluncommitted, db2_skipdeleted, db2_skipinserted, db2_keeptablelock
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Locking
Lock Mode summary
27
Lock Mode Applicable Object Type Description
IN (Intent None) Table spaces, blocks,
tables, data partitions
The lock owner can read any data in the object, including uncommitted data, but
cannot update any of it. Other concurrent applications can read or update the table.
IS (Intent Share) Table spaces, blocks,
tables, data partitions
The lock owner can read data in the locked table, but cannot update this data.
Other applications can read or update the table.
IX (Intent Exclusive) Table spaces, blocks,
tables, data partitions
The lock owner and concurrent applications can read and update data. Other
concurrent applications can both read and update the table.
NS (Scan Share) Rows The lock owner and all concurrent applications can read, but not update, the locked
row. This lock is acquired on rows of a table, instead of an S lock, where the
isolation level of the application is either RS or CS.
NW (Next Key Weak
Exclusive)
Rows When a row is inserted into an index, an NW lock is acquired on the next row. This
occurs only if the next row is currently locked by an RR scan. The lock owner can
read but not update the locked row. This lock mode is similar to an X lock, except
that it is also compatible with NS locks.
S (Share) Rows, blocks, tables,
data partitions
The lock owner and all concurrent applications can read, but not update, the locked
data.
SIX (Share with Intent
Exclusive)
Tables, blocks, data
partitions
The lock owner can read and update data. Other concurrent applications can read
the table.
U (Update) Rows, blocks, tables,
data partitions
The lock owner can update data. Other units of work can read the data in the
locked object, but cannot update it.
X (Exclusive) Rows, blocks, tables,
buffer pools, data
partitions
The lock owner can both read and update data in the locked object. Only
uncommitted read (UR) applications can access the locked object.
Z (Super Exclusive) Table spaces, tables,
data partitions, blocks
This lock is acquired on a table under certain conditions, such as when the table is
altered or dropped, an index on the table is created or dropped, or for some types
of table reorganization. No other concurrent application can read or update the
table.
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Locking
Lock Type compatibility
28
State of Held Resource
State Being Requested None IN IS NS S IX SIX U X Z NW
None yes yes yes yes yes yes yes yes yes yes yes
IN (Intent None) yes yes yes yes yes yes yes yes yes no yes
IS (Intent Share) yes yes yes yes yes yes yes yes no no no
NS (Scan Share) yes yes yes yes yes no no yes no no yes
S (Share) yes yes yes yes yes no no yes no no no
IX (Intent Exclusive) yes yes yes no no yes no no no no no
SIX (Share with Intent
Exclusive)
yes yes yes no no no no no no no no
U (Update) yes yes yes yes yes no no no no no no
X (Exclusive) yes yes no no no no no no no no no
Z (Super Exclusive) yes no no no no no no no no no no
NW (Next Key Weak
Exclusive)
yes yes no yes no no no no no no no
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
DB2 10.1 Fundamentals Test
Overview of Sections
29
Section Description Topic Review
#1 Planning (10%) Knowledge of DB2 products
Knowledge of database workloads
Knowledge of non-relational data concepts: XML, LOBs
Introduction and Overview
Introduction and Overview, Oracle DBA knowledge
XML topic and lab, Oracle DBA knowledge
#2 Security (15%) Knowledge of restricting data access
Knowledge of different privileges and authorities
Knowledge of DCL results from grants and revokes
Security topic and lab
Security topic and lab
Security topic and lab, Oracle DBA knowledge
#3 Working with DB
objects (20%)
Ability to create and connect to DBs
Ability to identify DB2 objects
Knowledge of characteristics / properties of DB2 objects
Knowledge of DDL
Knowledge of Temporal tables
Database topic and lab, many other labs
Database lab and many other labs
Many of the labs
Many of the labs, Oracle DBA knowledge
Additional Misc. Topics (Temporal Data Mgmt.)
#4 Working with
DB2 using SQL (20%)
Ability to use SQL to SELECT, SORT and GROUP data
Ability to use SQL to UPDATE, DELETE and INSERT data
Knowledge of transactions
Ability to create and call a stored procedure
Ability to use XQuery
Ability to use Time Travel queries
Many of the labs, Oracle DBA knowledge
Many of the labs, Oracle DBA knowledge
Many of the labs, Oracle DBA knowledge
Explain, MDC and Compression labs
XML lab
Additional Misc. Topics (Temporal Data Mgmt.)
#5 Working with
tables, views and
indexes (22%)
Ability to identify data types including XML and Oracle
Create a temporary table
Use Referential Integrity and other data constraints
Identify characteristics of tables, views and indexes
Knowledge of use of triggers
Knowledge of schemas
XML lab and the Oracle compatible topic
Oracle DBA knowledge
Oracle DBA knowledge
Many of the labs, Oracle DBA knowledge
Oracle DBA knowledge
Security topic and lab
#6 Data
Concurrency (13%)
Knowledge of factors that influence locking
Knowledge of which objects locks can be obtained on
Knowledge of lock types and characteristics of locks
Knowledge of isolation levels / Currently Committed
Additional Misc. Topics (Locking)
Additional Misc. Topics (Locking)
Additional Misc. Topics (Locking)
Oracle Compatibility topic and lab
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
We appreciate your feedback.
Please fill out the survey in order to improve this educational event.
SIMPLIFIED CHINESE HINDI J APANESE
ARABIC RUSSIAN TRADITIONAL CHINESE TAMIL THAI
FRENCH
GERMAN
ITALIAN
SPANISH
BRAZILIAN PORTUGUESE
Thank you
30
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
End of Elective Additional Misc. Topics
Presentation by:
Burt Vialpando
IBM Executive IT Specialist, The Open Group Distinguished IT Specialist, IBM IT Certification Board
IBM Certified Database Administrator for DB2 10.1 for Linux, UNIX and Windows
IBM Certified Advanced Database Administrator for DB2 V9.7 for Linux, UNIX and Windows
IBM Certified Solutions Developer DB2 9.7 SQL Procedures
IBM Certified Application Developer DB2 9
IBM Certified Solutions Designer for DB2 Business Intelligence V8
IBM Certified Solutions Expert for DB2 UDB V7.1 Database Administration for IBM OS/390
Oracle 11g Database Administrator Certified Associate
IBM Plateau Level 1 Inventor
burt.vialpando@us.ibm.com
9L =.`-L
IBM Certified IT Specialist for DB2 Migrations
IBM Advanced Technical Expert DB2 for Clusters
IBM Certified Database Administrator for DB2 UDB V8.1 for Linux UNIX and Windows
IBM Certified Solutions Expert for DB2 UDB V8.1 Family Application Development
Project Management Professional Certified
IBM Plateau Level 1 Inventor
vikram.khatri@us.ibm.com
31
2012 IBM Corporation
IBM Software
DB2 10.1 Administration for the Experienced Oracle DBA - Proof of Technology
Notices and Legal
Copyright IBM Corporation 2012. All rights reserved.
The information contained in these materials is provided for informational purposes only, and is provided AS IS without warranty of any kind, express or implied. IBM shall not be
responsible for any damages arising out of the use of, or otherwise related to, these materials. Nothing contained in these materials is intended to, nor shall have the effect of, creating
any warranties or representations fromIBM or its suppliers or licensors, or altering the terms and conditions of the applicable license agreement governing the use of IBM software.
References in these materials to IBM products, programs, or services do not imply that they will be available in all countries in which IBM operates. This information is based on current
IBM product plans and strategy, which are subject to change by IBM without notice. Product release dates and/or capabilities referenced in these materials may change at any time at
IBMs sole discretion based on market opportunities or other factors, and are not intended to be a commitment to future product or feature availability in any way.
IBM, IBM logo, AIX, Cube Views, DB2, DB2 OLAP Server, Informix, OmniFind, pureXML, WebSphere, z/OS, zSeries, and other IBM products and services are trademarks of the
International Business Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others.
FileNet is a registered trademark of FileNet Corporation, in the United States, other countries, or both.
ALPHABLOX is a registered trademark of Alphablox Corporation in the United States, other countries, or both.
J ava is a trademark of Sun Microsystems in the United States and other countries.
Windows is a trademark of Microsoft corporation in the United States and other countries.
UNIX is a trademark of The Open Group in the United States and other countries.
Linux is a trademark of Linus Torvalds in the United States and other countries.
32
NOTES















































NOTES


















































Copyright IBM Corporation 2012.
The information contained in these materials is provided for
informational purposes only, and is provided AS IS without warranty
of any kind, express or implied. IBM shall not be responsible for any
damages arising out of the use of, or otherwise related to, these
materials. Nothing contained in these materials is intended to, nor
shall have the effect of, creating any warranties or representations
fromIBM or its suppliers or licensors, or altering the terms and
conditions of the applicable license agreement governing the use of
IBM software. References in these materials to IBM products,
programs, or services do not imply that they will be available in all
countries in which IBM operates. This information is based on
current IBM product plans and strategy, which are subject to change
by IBM without notice. Product release dates and/or capabilities
referenced in these materials may change at any time at IBMs sole
discretion based on market opportunities or other factors, and are not
intended to be a commitment to future product or feature availability
in any way.
IBM, the IBM logo and ibm.comare trademarks of International
Business Machines Corp., registered in many jurisdictions
worldwide. Other product and service names might be trademarks of
IBM or other companies. A current list of IBM trademarks is
available on the Web at Copyright and trademark information at
www.ibm.com/legal/copytrade.shtml.

También podría gustarte