Download - DB2 UNIT 2
-
7/27/2019 DB2 UNIT 2
1/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 1 of 33
DB2
TRANSPARENCIES
(Unit 2)
-
7/27/2019 DB2 UNIT 2
2/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 2 of 33 2
DB2
IBM DATABASE2 (DB2) is IBM's RelationalData Base Product.
Runs under MVS.
DB2 can be accessed through threeenvironments : TSO, CICS, MVS.
Employs TSO for both interactive and batch
processing.
DB2 may be accessed by IMS and CICS
Transaction Managers concurrently.
DB2 provides a language interface through
SQL for data definition, manipulation,
access and authorization operations.
-
7/27/2019 DB2 UNIT 2
3/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 3 of 33 3
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
4/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 4 of 33 4
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
5/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 5 of 33 5
Benefits of DB2 Ease of use.
Non-procedural. (Specify what data you
want, not how to get it)
DB2 uses Optimizer for selecting the
access path to the required data.
Provides interactive facilities for :
Testing
Debugging Program preparation and execution
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
6/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 6 of 33 6
Benefits of DB2 (Contd..)
Provides full data protection including
data security, data integrity and data
recovery.
Reduces application design and
development efforts.
Provides a language interface.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
7/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 7 of 33 7
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
8/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 8 of 33 8
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
9/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 9 of 33 9
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
10/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 10 of 33 10
Components of DB2
Locking Services : IRLM (IMS Resource
Lock Manager)
DB2 treats data as a shared recourse
Any number of users can access the
same data simultaneously
A concurrency control mechanism is
required to isolate the users from one
another
IRLM provides this mechanism which
is called Locking
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
11/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 11 of 33 11
Components of DB2 (Contd..)
System Services
Controls the overall DB2 executionenvironment
Manages log datasets
Gathers statistics for performance
monitoring
Handles system startup & shutdown.
Controls attachment to other MVS
subsystems such as CICS, TSO etc.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
12/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 12 of 33 12
Components of DB2 (Contd..)
System Services (Contd..)
Performs commit, rollback,
checkpoint and recovery.
Supports operator communication
and logging functions
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
13/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 13 of 33 13
Components of DB2 (Contd..)
Database Services
Supports the functions of SQL i.e.definition, access control,
manipulation of user & system data.
Supervises access to the physicaldatabase.
Uses buffering to control the actual
transfer of data between secondary
storage and virtual storage buffers.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
14/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 14 of 33 14
Other DB2 Features
DB2 Subsystem
A copy of DB2 that runs on a CPU
One CPU can have more than one
DB2 subsystems running on it
Information about DB2 subsystem is
maintained in DB2s Directory and
Catalog.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
15/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 15 of 33 15
Other DB2 Features
Directory
Solely for DB2s internal use.
Catalog
It is a set of system tables.
Contains approximately thirty tables.
Contains descriptive information about
DB2 objects.
DB2 users can only query the Catalogtables but not modify them.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
16/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 16 of 33 16
DB2 Features (Contd..)
DB2 Catalog tables for security
__________________________________
Table Name DESCRIPTION
_________________________________________
Records privileges
held by auth-ids
over:
SYSIBM.SYSCOLAUTH Specific columns in
tables and views
SYSIBM.SYSTABAUTH Tables and views.
SYSIBM.SYSDBAUTH Databases.
SYSIBM.SYSPLANAUTH Application plans.
SYSIBM.SYSUSERAUTH The DB2 subsystem.
SYSIBM.SYSTESAUTH Tablespaces, storage
groups and
bufferpools.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
17/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 17 of 33 17
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
18/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 18 of 33 18
DB2 as Perceived by an Individual
User
There will be many users, all operating
on the same data at the same time.Users are protected from one another.
Tables are of two types
Base Tables Views
A base table is a real table that exists
physically.
A View is a virtual table that does not
actually exist in the physical storage but
looks to the user as if it did.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
19/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 19 of 33 19
Database Services
Supports the definition, retrieval and
update of user & system data.
Subcomponents are:
Precompiler (PRECOM)
Bind (BIND)
Runtime Supervisor (RS)
Data Manager (DM)
Buffer Manager (BM)
These together allow: Preparation of application programs
for execution.
Subsequent execution of these
programs
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
20/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 20 of 33 20
Database Services (Contd..)
Precompiler
Preprocessor for the host language
Function
Analyze a host language source
module.
Check for syntax errors.
Replace all the SQL statements with
CALLs in the host language, to give a
modified source module.
Construct a Data Base Request
Module from the SQL statements it
encountered.
Timestamp the modified source
module and the DBRM.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
21/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 21 of 33 21
Database Services (Contd..)
Precompiler (Contd..)
The DBRM becomes input to the
BIND component.
Does not access the DB2 Catalog.
Can add code from Libraries.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
22/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 22 of 33 22
Database Services (Contd..)
Bind
Compiles one or more DBRMs toproduce an application plan or a
package
The plan represents compiled form of
the original SQL statements form
which the DBRMs were built. It includes calls on the Data Manager
component of Database Services.
Checks for errors, using the DB2
Catalog.
Checks for authorization.
Selects optimized access path.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
23/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 23 of 33 23
Package
Single bound DBRM with optimized
access path.
If one DBRM used in the plan is changed
only that Package needs to be rebound.
New packages can be bound to thepackage collection without binding the
plan.
Each package is assigned to exactly one
collection when it is bound.
Collections are essentially just a means
of giving a name to a logically related set
of packages.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
24/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 24 of 33 24
Plan
Executable module containing access
path logic produced by DB2 optimizer.
Consists of names of packages and/or
directly bound DBRM(s).
Bind produces such a plan by bindingtogether the specified packages and
DBRMs.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
25/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 25 of 33 25
Packages and Plans:
Previously all of the DBRMs for a given
application were simultaneously
compiled into optimized code and bound
together into the required application
plan.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
26/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 26 of 33 26
The disadvantages were :
If an individual DBRM needed to be
recompiled, the entire plan had to be
recompiled and rebound.
If multiple plans involved the same
DBRM, the same DBRM had to be
recompiled multiple times.
If that DBRM ever needed to be
recompiled, then all the relevant plans
had to be recompiled.
Adding a new DBRM to the existing plan
required again a recompilation and
rebind of the entire plan.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
27/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 27 of 33 27
The package concept was introducedas a remedy.
If a given DBRM needs to be recompiled,
all that has do be done is an appropriate
package bind.
If multiple plans involve the same DBRM,
that DBRM can now be compiled once,and the corresponding package
referenced multiple times in multiple plan
binds.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
28/33
-
7/27/2019 DB2 UNIT 2
29/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 29 of 33 29
-
7/27/2019 DB2 UNIT 2
30/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 30 of 33 30
Precompiler
Source
Module
DBRMModified
Source
Module
Compiler Bind
Object
Module
Package
List of
Packages
and/or
DBRMs
Other
object
modulesLinkage
Editor
Bind
(Load Module)
(Application Plan / Packages)
Runtime Supervisor
Data Manager
Buffer Manager
(Other)
Application
Plan
DB
Load
Module
Main Memory
(One per
Source
module)
(Logically
Part of
Collection)
-
7/27/2019 DB2 UNIT 2
31/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 31 of 33 31
Parsing, Syntax Checking
Optimization
(Access Path Selection)
Authorization Checking
Plan
Bind
DBRM Catalog
Application
Plan
Package
Package
Bind
List ofPackages
Listing
Diagnosticsetc.
Listing
Diagnostics
etc.
Plan Generation
Authorization
Checking
Stored in Directory
Stored in Directory
-
7/27/2019 DB2 UNIT 2
32/33
DB2_Tr Ver. 1.0.0 04/12/1998 Page 32 of 33 32
Database Services (Contd..)
Runtime Supervisor (RS)
RS is resident in main storage whenthe application program is executing.
Its job is to oversee the program
execution.
When the application program
requests some DB operation:
Control goes first to the RS
The RS uses the control information
in the plan to request the appropriate
operations on the part of the Data
Manager.
DB2 (Contd..)
-
7/27/2019 DB2 UNIT 2
33/33
Database Services (Contd..)
Data Manager
It performs all of the normal access
method functions
i.e. search, retri eval, update, and so
on.
In short, this component manages the
physical database(s)
Buffer Manager
Physically transfer data between the
external medium and virtual storage;in effect, it performs the actual I/O
operations.
DB2 (Contd..)