+ All Categories
Home > Documents > DB2 LUW 9.7 a.k.a. Cobradugi.molaro.be/wp-content/uploads/2009/10/DB2-9.7-Overview.pdf · DB2 LUW...

DB2 LUW 9.7 a.k.a. Cobradugi.molaro.be/wp-content/uploads/2009/10/DB2-9.7-Overview.pdf · DB2 LUW...

Date post: 23-Mar-2020
Category:
Upload: others
View: 24 times
Download: 1 times
Share this document with a friend
17
1 P.O. Box 200, 5520 AE Eersel, The Netherlands Tel.:(+31) 497-530190, Fax: (+31) 497-530191 E-mail: [email protected] DB2 LUW 9.7 a.k.a. Cobra An overview Copyright © 1998-2009 KBCE b.v. DB2 Academy 2 Disclaimer and Trademarks… Please be aware that the actual programming techniques, algorithms and all parameters used in examples given in this presentation are subject to change at some future date either by a new version of DB2, a new release, a Small Programming Enhancement (SPE) or a Programming Temporary Fix (PTF). The information contained in this presentation is provided for informational purposes only. While efforts were made to verify the completeness and accuracy of the information contained in this presentation, it is provided “as is”, without warranty of any kind, express or implied. In addition, this information is based on IBM‟s current product plans, strategy and documentation, which are subject to change by IBM without notice. KBCE shall not be responsible for any damages arising out of the use of, or otherwise related to, this presentation or any other provided documentation. The use of this information or the implementation of any of these techniques is a customer responsibility and depends on the customer‟s ability to evaluate and integrate them into the customer‟s operational environment. While each item may have been reviewed for accuracy in a specific situation, there is no guarantee that the same or similar results will be obtained elsewhere. Customers attempting to adapt these techniques to their own environments do so at their own risk. DB2 is a trademark of International Business Machine corporation. This presentation uses many terms that are trademarks. Wherever we are aware of trademarks the name has been spelled in capitals.
Transcript

1

P.O. Box 200, 5520 AE Eersel, The Netherlands

Tel.:(+31) 497-530190, Fax: (+31) 497-530191

E-mail: [email protected]

DB2 LUW 9.7 a.k.a. CobraAn overview

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 2

Disclaimer and Trademarks…

Please be aware that the actual programming techniques, algorithms and all parameters used in

examples given in this presentation are subject to change at some future date either by a new

version of DB2, a new release, a Small Programming Enhancement (SPE) or a Programming

Temporary Fix (PTF).

The information contained in this presentation is provided for informational purposes only. While

efforts were made to verify the completeness and accuracy of the information contained in this

presentation, it is provided “as is”, without warranty of any kind, express or implied. In addition, this

information is based on IBM‟s current product plans, strategy and documentation, which are

subject to change by IBM without notice. KBCE shall not be responsible for any damages arising

out of the use of, or otherwise related to, this presentation or any other provided documentation.

The use of this information or the implementation of any of these techniques is a customer

responsibility and depends on the customer‟s ability to evaluate and integrate them into the

customer‟s operational environment. While each item may have been reviewed for accuracy in a

specific situation, there is no guarantee that the same or similar results will be obtained elsewhere.

Customers attempting to adapt these techniques to their own environments do so at their own risk.

DB2 is a trademark of International Business Machine corporation. This presentation uses many

terms that are trademarks. Wherever we are aware of trademarks the name has been spelled in

capitals.

2

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 3

Product packaging

IBM InfoSphere Warehouse(DPF Database partitioning)

supports clusters of Physical or

Virtual Servers

DB2 Workgroup Serverdata server of choice for deployment

in a departmental, workgroup, or

medium-sized business environment

DB2 Enterprise Servermeets data server needs of

mid-size to large-size businesses

DB2 Express-CFree, entry-level edition of the DB2 data server

for the developer and partner community

DB2 Express DB2 data server, entry-level

pricing, small and

medium business

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 4

IBM announces for 9.7

• Deprecated:

• Control Center tools

• DB2 administration server (DAS)

• DB2 Governor

• Query Patroller

• Health monitor

• LONG VARCHAR and LONG VARGRAPHIC data types

• Worksheet Format (WSF) for Export and Load utilities

• LIST TABLESPACES and LIST TABLESPACE CONTAINERS commands

• Removed / Unsupported

• Type-1 indexes

• Windows 32-bit partitioned databases

• Support for some older Linux distributions

• DRDA connectivity to some DB2 older database servers

• XML Extender

3

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 5

Use the fixpack!!

Fixpack 1 released on 24 Nov 2009

Many features in this presentation

are in this fixpack!!

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 6

Deep Compression further enhanced

• Table with XML columns can be compressed

• Temporary tables

• Needs Storage Optimization Feature license

• Enough storage in Buffer Pools

• Enough data

• Indexes

• Only use this in case of index scans (DW)

• Data replication source tables

• Rows will be send decompressed

• Inline LOB files

• New DDL syntax "inline length" gives limit

• Larger objects stored in LOB storage object

4

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 7

Manageability enhancements

• Automatic Storage further enhanced

• Convert existing DMS table spaces to automatic storage

• Single table space using:

• ALTER TABLESPACE ... MANAGED BY AUTOMATIC STORAGE

• ALTER TABLESPACE REBALANCE

• Multiple tablespaces using redirected restore

• Table space rebalancing when you add or remove storage paths

• A new ALTER DATABASE statement option for dropping storage paths

• New monitoring elements for storage paths and a new administrative view,

SNAPSTORAGE_PATHS

• Reclaim unused storage extents

• DMS or automatic storage table spaces

• Table space must be created in V9.7

• Does not work for tempspace

• Multidimensional clustering (MDC) tables

• REORG with RECLAIM EXTENTS ONLY

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 8

Manageability enhancements

• Numerous new administrative views and table functions

• The ability to move table data online

• ADMIN_MOVE_TABLE moves table real-time!

• Increased capacity for large and temporary table spaces

• Upper limit is now 64 TB

• DPF: Support for extreme Data Warehouses

• Enhanced distribution maps allow for more than 200 partitions

• DPF: Reduced downtime when adding database partition servers

• Additional index information from the DESCRIBE command

• Now also shows XML indexes and text search indexes

• REORG for a specific data partition of a data partitioned table

• Other partitions are in full RW

• Easier to relocate databases

• New command db2relocatedb to change name, instance and much more!

5

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 9

pureXML enhancements

• PureXML support for more objects

• Partitioned tables

• Multidimensional clustering (MDC) tables

• Declared temporary tables

• User-defined functions

• Partitioned database environments

• PureXML extended

• The ALTER TABLE statement supports REORG-recommended operations containing XML data.

• Predicate pushdown is available for SQL/XML and XQuery statements.

• XML parsing and validation can return more detailed messages.

• New functions display base table row storage information for inlined XML documents.

• Four new XQuery functions return current date and time values.

• PureXML enhancements

• Multiple XML documents in a column can be decomposed at the same time.

• Optimization profiles support guidelines for XML data.

• Write access is supported while you are creating or reorganizing indexes over XML data.

• Distribution statistics are collected for indexes over XML data.

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 10

Monitoring enhancements

• New table functions and event monitors

• New MON_GET table function give access to:

• System (connections, WLM, UOW)

• Activity (applications, package and statement cache)

• Objects (bufferpool, containers, rebalancer, table, table space, index)

• New event monitors

• Deadlocks, lock timeout, and lock waits

• Detailed monitoring of unit of work and total CPU usage

• Catalog now holds LASTUSED

• Has date the object was last used (including select!!)

• Tables, Table data partitions, Indexes, Packages, MQT's

6

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 11

Monitoring enhancements

• New monitoring features:

• New monitoring elements for XML (e.g. wait info)

• New monitoring elements for better waiting time analysis

• Explain enhancements

• SQL activity events: db2expln from activity / section

• Show access path for section actuals

• Table functions for row-based formatting of monitoring information

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 12

Performance enhancements

• Optimizer can use statement concentrator support

• SQL which is identical except for the values of literals share plan

• Controlled by stmt_conc in db config

• Great value for many system that do not use :hostvars

• Cursor stability (CS) isolation can be currently committed

• Controlled by cur_commit in db config

• Scan sharing

• If another scan is already run then share the data

7

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 13

Partition Table Enhancement

• Availability on partitioned tables

All indexes now partitioned unless unique constraint

DP1 DP2 DP12

Jan 2007 Feb 2007 … Dec 2007 Jan 2008

ATTACH

Global Index

DP1 DP2 DP12

Jan 2007 Feb 2007 … Dec 2007 Jan 2008

ATTACH

Index

DP1Index

DP2

Index

DP12

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 14

Workload Manager enhancements

• WLM enhanced and simplified

• Activity-based thresholds

• Wild card and IP addresses support

• Workload-level aggregate activity data collection and new high watermarks

• Controlling the relative priority for work with service enhancement

• Work action sets can be defined at workload level

• Buffer pool I/O priority control for service classes

• Integration with Linux workload management

• WLM fine-tuning

• New thresholds for controlling specific resources

• Time threshold limits unit of work duration

• 1-minute check interval support for a subset of time-based thresholds

8

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 15

SQL Enhancements

• The TRUNCATE statement

• Quickly deletes all rows

• Many new scalar functions additions (many ORACLE alike)

• Implicit casting

• Automatically converts the data of one data type to another

• Setting the precision of the fractional seconds of the TIMESTAMP data type

• LOB-type columns in temporary tables support

• Public aliases (public synonyms) support

• Global variable assignments in nested contexts support

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 16

Stored procedure enhancements

• Default values for parameters

• Argument assignment by parameter name when you call procedures

• Autonomous transactions

• commit work even if the invoking transaction itself is rolled back

CREATE PROCEDURE

FOO(parm1 INT DEFAULT -1, parm2 INT DEFAULT -2, parm3 INT DEFAULT -3)

CALL FOO (40, parm3=>10)

9

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 17

SQL/PL Enhancements

• Related database objects can be grouped in modules (named sets)

• Compiled compound statements support

• Between BEGIN – END

• Can be executed in CLPPlus

• Use of SQL/PL is extended

• User-defined functions support

• Triggers support

• New data types support in SQL PL applications

• Anchored data type

• Boolean data type

• Associative array data type

• Cursor data type

• Row data type

• Global variable assignments in nested contexts support

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 18

Online Schema Changes

• New CREATE OR REPLACE syntax

• Privileges not lost when object is replaced!

• New Anchoring

• Objects stay in sync with changes to tables

• Automatic revalidation

• Objects are automatically recompiled when objects they depend on change

• Database CFG Option AUTO_REVAL can be set to:

• DEFERRED Dependent objects are revalidated at next access (Default)

• IMMEDIATE Dependent objects are revalidated immediately

• DISABLED Same as in the previous releases (setting after migration)

• If enabled it allows creation of object that depend on objects that do not exist

10

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 19

Replace or Create

create or replace view fulltime_employee as

select full_name(employeeid) as full_name, salary from employee

where type = 'full time';

create or replace full_name(p_employee_id integer) returns varchar(60)

return select first_name || ' ' || last_name from employee

where employee_id = p_employee_id;

create table employee (

employee_id integer not null generated as indentity,

first_name varchar(30) not null,

last_name varchar(30) not null,

type varchar(10) not null,

salary integer not null,

constraint pk_name primary key(employee_id));

select * from employee; Validates all invalid dependent objects!

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 20

Online Schema Changes

Renaming columns and changing datatypes

• Table in RO

• Special admin_revalidate_db_objects make it RW again

alter table employee rename column salari to salary;

alter table employee alter column employee_id set data type integer;

call sysproc.admin_revalidate_db_objects(null,null,null);

11

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 21

Created Global Temporary Table

• DB2 V7 – DB2 V9.7: Declare Global Temporary Table (DGTT)

• DGTT must be declared in every session

• You CANNOT build other database objects on top of DGTT

• Referred to as SESSION.<tablename>

• Not defined in DB2 Catalog (can cause problems e.g. ODBC)

• New in DB2 V9.7: Create Global Temporary Table (CGTT)

• Like normal table but data is local to a single connection

• Empty object(s) create when referenced, destroyed at session end

• These can have any user-defined schema (not always SESSION)

• CGTT ARE defined in the catalogs

• CGTT are under normal authorization control

• Views, indexes, and triggers can be defined on CGTT!

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 22

Created Global Temporary Table

• The DBA creates:

• A USER Temporary Table Space (both DGTT and CGTT need this)

• Creates global temporary table and optional other objects (e.g. indexes)

• The application uses SQL statements to reference the temporary table

• no DECLARE is needed, simply reference them…

CREATE USER TEMPORARY TABLESPACE "USR_TEMP_TS2" PAGESIZE 4 K

MANAGED BY AUTOMATIC STORAGE ;

CREATE GLOBAL TEMPORARY TABLE APP1.DEPARTMENTLIKE

PROD.DEPARTMENTON COMMIT DELETE ROWSNOT LOGGED IN USR_TEMP_TS2;

CREATE INDEX APP1.DEPTIX1 ON APP1.DEPARTMENT (DEPTNO);

INSERT INTO APP1.DEPARTMENT

SELECT * FROM PROD.DEPARTMENT WHERE DEPTNO=:mydept;

SELECT * FROM APP1.DEPARTMENT WHERE LASTNAME = „STOPFER‟;

12

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 23

ORACLE compatibility

• Done at the instance level using a registry setting

• DB2_COMPATIBILITY_VECTOR =ORA (or a bit-string)

• Is a instance switch so remember all databases are affected

• Not available in Express-C

• Enables:

• PL/SQL (native in DB2, but not 100% all syntax)

• ORACLE data types (including casting and arithmetic)

• Creates ORACLE data dictionary-compatible views

• Typical ORACLE things in SQL

• ROWID, + syntax for outer join, dual table, hierarchical queries etc.

PL/SQL

COMPILER+

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 24

PL/SQL supported

All language logic supported like IF, WHILE := etc

EXCEPTION - Try/catch handling

User Defined Exceptions - Define conditions with or without SQLCODEs

Constant variables - Variables that cannot be set

FOR over range - Step through numbers

FOR over SELECT - Step through result set of query

FOR over cursor - Step through result set of cursor

%TYPE - Anchored scalar data types

%ROWTYPE - Anchored row types

BULK COLLECT/FETCH - Aggregate result set into array

FORALL - Pipe array into SQL statement

AUTOMONOUS transaction - Executes a procedure in an independent TX

Anonymous block

Scalar function

Procedure

Package

Trigger

SYNONYM ON PACKAGE

DB2 Server

PL/SQL

Compiler

SQL PL

Compiler

SURE

(SQL Unified Runtime Engine)

Data base

Data Studio

Debugger

Profiler

Editor

13

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 25

PL/SQL in DB2

• List of DBMS packages supported by DB2:

• DBMS_OUTPUT

• UTL_FILE

• DBMS_ALERT

• DBMS_PIPE

• DBMS_JOB

• DBMS_LOB

• DBMS_SQL

• DBMS_UTILITY

• UTL_MAIL

• UTL_SMTP

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 26

ORACLE alike Datatypes

• NUMBER

• VARCHAR2 - NULL = '', trailing blank sensitive collation

• TIMESTAMP(n) - 0 (date + time) <= N <= 12 (date + time + picoseconds)

• DATE - Year to seconds, SYSDATE

• In procedural code

• BOOLEAN

• INDEX BY

• VARRAY

• Row Type

14

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 27

ORACLE alike functions

TO_CHAR

TO_DATE

TO_TIMESTAMP

TO_NUMBER

TO_CLOB

EXTRACT

ADD_MONTHS

INITCAP

RPAD

LPAD

INSTR

REVERSE, ...

DECODE

NVL

LEAST

GREATEST

BITAND

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 28

ORACLE SQL syntax

• CONNECT BY

• (+)-join

• DUAL

• ROWNUM

• NEXTVAL/CURRVAL

• MINUS

• Unnamed inline views

• TRUNCATE table

• Public synonym

• CREATEd temp table

15

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 29

CLPPLUS

• CLPPLUS command processor (see youtube for intro video)

• Modeled after ORACLE SQL*Plus

• Connect to DB2 without having the database cataloged

• Variable substitution

• Column formatting

• Simple reporting

• Control variables

• SQL Buffers

• And much more….

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 30

SSL Connection in DB2

• DB2 allows to use SSL connection between a client and server

• Server and client configurations are required

• Server Configuration

• Create a certificate database (a.k.a KeyStore file using IBM GSKit)

• Import the certificate you purchased from a Certificate Authority (CA) into the

certificate database

• Update DBM configuration parameters

• Enable SSL communication for the instance

• db2set DB2COMM=SSL or db2set DB2COMM=SSL,TCPIP

• Configure client to use SSL

16

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 31

Separation of duties

• Remove implicit DBADM from SYSADM

• Remove ability to grant DBADM and SECADM from SYSADM

• Allow SECADM to be granted to groups and roles

• Allow SECADM to GRANT/REVOKE database and object auth

• Setup up a DBADM that does not have the capability to grant and revoke privileges or access data

GRANT DBADM ON DATABASE WITHOUT ACCESSCTRL TO USER JOE

GRANT DBADM ON DATABASE WITHOUT DATAACCESS TO USER JOE

• Remove secondary grants implicitly done when DBADM granted• BINDADD, CONNECT, CREATETAB, IMPLICIT_SCHEMA, LOAD,…

• Introduce new authorities• EXPLAIN, DATAACCESS, ACCESSCTRL, SQLADM, WLMADM authorities

• SQLADM authority can perform event monitor commands, holds EXPLAIN privilege, and can execute RUNSTATS

Copyrig

ht ©

1998-2

009 K

BC

E b

.v.

DB2 Academy 32

Pure Scale

17

20 – 22 April 2010

DB2 LUW Version 9 Overview

one-day seminar packed with many new

features of DB2 9.1 – 9.7


Recommended