Académique Documents
Professionnel Documents
Culture Documents
Osnove DB2
na Linux, Unix, Windows operacijskih sistemih
klemen.kobilica@si.ibm.com
Agenda
Pregled IBM Information Management programske opreme
Arhitektura DB2 in objekti v bazi
Orodja za delo z DB2
Integracija informacij
Processes
Applications
Middleware
Lotus WebSphere DB2 Tivoli Rational
Environment
Database Servers
DB2
– Database management system that delivers a flexible and cost-effective database
platform to build robust on demand business applications.
Informix IDS
– Delivers superior application performance for transaction intensive environments.
Cloudscape
– Provides developers a small footprint, standards-based Java database that can be
tightly embedded into any Java based solution.
Multi-terabyte
Workgroup clustered
Edition data warehouses
s es
Express in es
s
Edition Bu
Personal
a rge
Edition , L
e ss
u sin & Cross Platform
Everyplace B t,
d i u m
l, te s s AIX, Solaris, HP/UX,
& Me enta ystem Linux & Windows
a ll
a rt m er s zSeries, iSeries,
S m de p el o p VSE and VM
v
de
$
DB2&&IDS
IDS Target: Entry-level 2-way systems,
DB2 Target: Entry-level 2-way systems,
requiring base database capability
Express requiring base database capability
Express
Product Flexibility
Increasing Capability, Performance, Scalability & Control
DB2 Fundamentals © 2005 IBM Corporation
DB2 Information Management Software
Analysis
Analysis
Transactions Applications
Applications
Legacy Warehouse
Systems Access &
Transformation Portals
Portals&&
Dashboards
Dashboards
Processes
Data Marts
Financials
Real-time Analysis
Analysis
Information Tools
Tools
+++
Orders,
Confirmations
Instant messages,
e-mail @
Customer/
Business
Supplier
Records Content Wireless
Business & PDA
Content
Customer Create
Correspondence, Search Kiosk
Reports Store
Manage
Distribute
Retain
Photos, Videos, Portal /
Audio (Phone Browser
Conversations)
Metadata Management
Agenda
Pregled IBM Information Management programske opreme
Arhitektura DB2 in objekti v bazi
Orodja za delo z DB2
Integracija informacij
DB2 Architecture
Hardware Server
DBMS Instance DBMS 2
DBM Cfg
DBM Cfg
Bufferpools
Tablespaces
SMS Tablespace
Create regular tablespace TS00003
U managed by system
using ('c:\U\Databases\F1DB\SMS\’)
extentsize 16
Databases
prefetchsize 16
F1DB
SQL00001.DAT 4KB
SMS SQL00002.DAT 56KB
SQL00002.INX 16KB
SQL00003.DAT 4KB
DMS Tablespace
Create regular tablespace TS00004
managed by database
using (file
U ‘c:\U\Databases\F1DB\Dev1\TS00004A’ 2048
,file
Databases ‘c:\U\Databases\F1DB\Dev2\TS00004B’ 2048)
extentsize 16
prefetchsize 16
F1DB bufferpool BP4KLG1
Tables
F1TEAM
TEAM_
TEAM_ HQ_
TEAM_ID PRINCIPAL COUNTRY
NAME CITY
_ID
Indexes
Indexes provide more efficient access to rows in a table
Constructed using columns from the related table
Index keys are maintained in order
– The index may be used to influence order within the data pages
Indexes can be used to enforce uniqueness
CREATE INDEX DRIVERPKI
ON DRIVER
(DRIVER_ID ASC)
Columns
Atomic unit of data
Datatype specified at this level
Constraints can be applied to restrict values
Nullability specified for columns
Data values can be supplied, generated internally or specified
defaults
Datatype Minimum Value Maximum Value Example
Database Structure
Constraints
Triggers
Triggers
Example:
– We want to maintain the driver_standing table as results are
posted for each race
RACE DRIVER
RESULT STANDING
• Season • Season
• Race identifier • Driver identifier
• Driver identifier • Points total
• Position
• Points
Triggers
Sample Code
We are interested in
capturing the event
CREATE TRIGGER POINTSUMI when a race result is
AFTER INSERT ON RACE_RESULT posted to the database
REFERENCING NEW AS N
FOR EACH ROW MODE DB2SQL
UPDATE DRIVER_STANDING D
SET POINTS_TOTAL = POINTS_TOTAL + N.POINTS
WHERE D.SEASON = N.SEASON
AND D.DRIVER_ID = N.DRIVER_ID
;
Stored Procedures
Business logic can be encapsulated in Stored Procedures (SP)
SPs can be written in C, Java, COBOL, OLE, and SQL
Execute on the DB2 server -> reducing network traffic
Effective way of modularising code
Centralized administration and maintenance
Registered in the System Catalog and manipulated using SQL
commands
UDF
Sample:
values multiply(2,3);
UDF
Sample:
XML
Agenda
Pregled IBM Information Management programske opreme
Arhitektura DB2 in objekti v bazi
Orodja za delo z DB2
Integracija informacij
Information
Command Line Control Center APIs
Center
Processor
Command Editor Embedded SQL
Help
Task Center Call Level Interface
Journal Java
GUI Tools
Control Center
Control Center
Command Editor
Run SQL statements interactively and review output
Scrollable results area allows simple analysis of results
Command history maintained automatically
Options to enable ‘auto commit’
Alternative to CLP
Command Editor
Task Center
Uses DB2’s notification ability to run other tasks, send
a pager or email
Task can be run on any partition regardless of the
current partition you are connected to
Tasks can be chained and grouped
Manages execution of pre-written UDB scripts
Allows scripts to be run now or scheduled to run at
pre-determined time
Links into Journal to view results
Can be useful for managing frequently used queries
Task Center
Journal
Information Center
Online or local HTML manuals for DB2
Extended search capabilities
Presents books in a browser window
Includes task-oriented guidance and command-level
shortcuts
Links direct to web resources
Information Center
Development Center
Development Center
MQSeries table function Wizard
– Creates table functions that allow you to read or write from a
MQSeries Queue using regular SQL. This function is invoked
from the stored procedure builder.
Development Center
OLE DB table function Wizard
Creates table functions that allow you interact with OLE DB
providers. This function is invoked from the stored procedure
builder.
DB2 Wizards
Based on
– Amount of outstanding updates / log data
– Costed and/or historical rollforward speed
– Available storage resources
Policy specifies
– Backup location
– Criteria for determining when a backup is required
– Maximum time between backups
– Maximum log space used between backups
Configuration Advisor
Design Advisor
Design Advisor
Goals
–Select a database design that provides the best workload average
response time.
–Ease of use
Given
–A workload (user provided or system detected)
–System detected database characteristics
–System detected system characteristics
–Disk constraints (optional)
Design Advisor includes
–Index selection
–Materialized Query Tables selection (MQT)
–Multidimensional Clustering selection (MDC)
–Partitioning selection (Partitioning Advisor)
–Industry leading sampling (statistics, column correlations)
Application Tuning
Activity Monitor
Real-time application monitoring based on application performance issues
Uses snapshot monitor to provide sorted reports on applications (eg.
Highest CPU usage, Longest time spent on locks)
Agenda
Pregled IBM Information Management programske opreme
Arhitektura DB2 in objekti v bazi
Orodja za delo z DB2
Integracija informacij
Metadata Management
Information Integration
Federation
featuring WebSphere Information Integrator Content Edition for
unstructured content and WebSphere Information Integrator
Standard Edition for structured data accesses and integrates
diverse and distributed stores in real time, regardless of where
they reside.
Replication
distributes, consolidates, and synchronizes information across
complex, mulit-platform, multi-vendor IT environments.
Enterprise Search
featuring WebSphere Information Integrator OmniFind Edition,
finds the most relevant corporate information with sub-second
response from vast enterprise data sources.
Event Publishing
captures database changes, formats them into XML messages,
and publishes them for application integration.
Federation
Access diverse and distributed information as if it were in one system
SQL Content
Metadata-driven means:
– No mainframe programming required DB2 Information Integrator
– Fast installation & configuration Classic Federation for z/OS
– Ease of maintenance
– Toolsets
SQL Content
IMS VSAM DB2 UDB WebSphere BI OLE DB Lotus Notes DB2 CM WebSphere
Adabas Sequential Informix Adaptors Excel Microsoft Index Family FileNet
CA-Datacom Oracle SAP Flat files Server Domino.doc
CA-IDMS Sybase PeopleSoft IBM Lotus IBM Lotus Documentum
Teradata Siebel Extended Extended FileNet
Microsoft Search Search Open Text
SQL Server Web Sametime Stellent
ODBC search QuickPlace Interwoven
LDAP Microsoft Hummingbird
Custom-built Exchange
Plus partner tools and custom-built connectors extend access to more sources
Replication
Manage placement for performance and availability
Microsoft Microsoft
DB2
SQL Replication
Admin
IMS DB2
DB2
Log based Staging tables
CD
Control
Sybase Control
CD
Oracle SQL Sybase
Server
Capture CD Apply
Federation Oracle SQL
Informix Engine
Server
Informix
Trigger based Teradata
Control
Control
Log based
WebSphere MQ
Usage Function
High availability Low latency, replica management
Workload distribution Each message represents a transaction
Application integration XML format option for publishing
Highly parallel apply process
Differentiated conflict detection and resolution
Staged availability of heterogeneous support
Next versions will bring hererogenous Q Replication
Usage Function
Application to application messaging Publish events to a message queue
Event streaming XML self-describing format
Source for ETL tool Wizard-driven configuration
DB2 UDB
Log-based WebSphere
capture Business Integration
IMS WebSphere MQ
DB2 II User Application
Integrator Broker
Capture
Enterprise Search
IBM DB2 II OmniFind Edition
Power intranets, extranets, and corporate portals
HTTP/HTTPS, News groups (NNTP), File systems, DB2 UDB, Informix, Oracle,
Domino databases, Microsoft Exchange, DB2 Content Manager,
Documentum and FileNet via integrated WebSphere II Content Edition
DB2 Fundamentals © 2005 IBM Corporation
DB2 Information Management Software
Enterprise-wide Access
SQL, Content, or Search APIs
DB2 UDB
II Event
Information Integrator Sybase
VSAM Publishing
O SQL, SQL/XML
IMS II Classic D
B Federation Engine Informix
Federation
C Wrappers and functions
Software AG
Adabas
SQL Server
II Content
CA-Datacom
Edition
Oracle
CA-IDMS
IBM Extended
Search
WebSphere
DB2 Content Text XML Excel WWW, email,…
Stellent FileNet MQ ODBC
Manager
DB2 Fundamentals © 2005 IBM Corporation
DB2 Information Management Software
Vprašanja?
Hvala!
www.ibm.com/db2
klemen.kobilica@si.ibm.com
DB2 Fundamentals © 2005 IBM Corporation