DB2 Unit 2

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 33

DB2 TRANSPARENCIES (Unit 2)

DB2_Tr Ver. 1.0.0 04/12/1998

Page 1 of 33

DB2
IBM DATABASE2 (DB2) is IBM's Relational Data Base Product.

Runs under MVS.


DB2 can be accessed through three environments : 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.

DB2_Tr Ver. 1.0.0 04/12/1998

Page 2 of 33

DB2 (Contd..)

DB2_Tr Ver. 1.0.0 04/12/1998

Page 3 of 33

DB2 (Contd..)

DB2_Tr Ver. 1.0.0 04/12/1998

Page 4 of 33

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 5 of 33

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 6 of 33

DB2 (Contd..)

DB2_Tr Ver. 1.0.0 04/12/1998

Page 7 of 33

DB2 (Contd..)

DB2_Tr Ver. 1.0.0 04/12/1998

Page 8 of 33

DB2 (Contd..)

DB2_Tr Ver. 1.0.0 04/12/1998

Page 9 of 33

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 10 of 33

10

DB2 (Contd..)
Components of DB2 (Contd..)
System Services Controls the overall DB2 execution environment Manages log datasets Gathers statistics for performance monitoring Handles system startup & shutdown. Controls attachment to other MVS subsystems such as CICS, TSO etc.

DB2_Tr Ver. 1.0.0 04/12/1998

Page 11 of 33

11

DB2 (Contd..)
Components of DB2 (Contd..)
System Services (Contd..) Performs commit, rollback, checkpoint and recovery. Supports operator communication and logging functions

DB2_Tr Ver. 1.0.0 04/12/1998

Page 12 of 33

12

DB2 (Contd..)
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 physical database.


Uses buffering to control the actual transfer of data between secondary storage and virtual storage buffers.

DB2_Tr Ver. 1.0.0 04/12/1998

Page 13 of 33

13

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 14 of 33

14

DB2 (Contd..)
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 Catalog tables but not modify them.
DB2_Tr Ver. 1.0.0 04/12/1998 Page 15 of 33 15

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 16 of 33

16

DB2 (Contd..)

DB2_Tr Ver. 1.0.0 04/12/1998

Page 17 of 33

17

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 18 of 33

18

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 19 of 33

19

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998 Page 20 of 33 20

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 21 of 33

21

DB2 (Contd..)
Database Services (Contd..)
Bind

Compiles one or more DBRMs to produce 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_Tr Ver. 1.0.0 04/12/1998

Page 22 of 33

22

DB2 (Contd..)
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 the package 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_Tr Ver. 1.0.0 04/12/1998 Page 23 of 33 23

DB2 (Contd..)
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 binding together the specified packages and DBRMs.

DB2_Tr Ver. 1.0.0 04/12/1998

Page 24 of 33

24

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 25 of 33

25

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 26 of 33

26

DB2 (Contd..)
The package concept was introduced as 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_Tr Ver. 1.0.0 04/12/1998

Page 27 of 33

27

DB2_Tr Ver. 1.0.0 04/12/1998

Page 28 of 33

28

DB2_Tr Ver. 1.0.0 04/12/1998

Page 29 of 33

29

Source Module

Modified Source Module

DBRM Precompiler (One per Source module) Bind

Compiler

(Logically Part of Collection) Object Module List of Packages and/or DBRMs Package

Linkage Editor

Other object modules

Bind

(Load Module) Load Module Application Plan

(Application Plan / Packages)

Runtime Supervisor

Data Manager

Buffer Manager

DB

(Other)

Main Memory

DB2_Tr Ver. 1.0.0 04/12/1998

Page 30 of 33

30

DBRM

Catalog

Listing Diagnostics etc.

Package Bind

Parsing, Syntax Checking Optimization (Access Path Selection) Authorization Checking

List of Packages

Package

Stored in Directory

Listing Diagnostics etc.

Plan Bind

Plan Generation Authorization Checking

Application Plan

Stored in Directory

DB2_Tr Ver. 1.0.0 04/12/1998

Page 31 of 33

31

DB2 (Contd..)
Database Services (Contd..)
Runtime Supervisor (RS) RS is resident in main storage when the 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_Tr Ver. 1.0.0 04/12/1998 Page 32 of 33 32

DB2 (Contd..)
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_Tr Ver. 1.0.0 04/12/1998

Page 33 of 33

33

You might also like