SlideShare a Scribd company logo
IBM Software Group
© 2005 IBM Corporation
DB2 UDB Fundamentals
Day1
IBM Software Group
© 2005 IBM Corporation
 DB2 Overview
 Instance
 Database
 DB2 Architecture
2
IBM Software Group
© 2005 IBM Corporation3
DB2 Overview
 DB2 is a database product from IBM.
 Initially DB2 product is developed for Mainframe ,
Since 1990’s It is decided to develop a UDB which
can run on any Platform(Unix, Linux, Windows)
 Latest version of db2 is 10.5 (added feature of BLU
acceleration).
 3.4 (Code web), 8.1,8.2 (Stinger) , 9.1 (Viper), 9.5
(Viper2) , 9.7 (Cobra), 9.8 (added feature with pure
scale) , 10.1 (Galileo), 10.5 (Capler)
IBM Software Group
© 2005 IBM Corporation4
Products
DB2 Personal Edition (Remote
feature NA)
DB2 Workgroup Server Edition
DB2 Enterprise Server Edition
DB2 Workgroup Server Unlimited Edition
DB2 UDB Express Edition(lowest
price fully functional)
IBM Software Group
© 2005 IBM Corporation
DB2 Installation
 Download the software from IBM site.
 gunzip v9.7fp10_linuxia32_server.tar.gz
 tar -xvf v9.7fp10_linuxia32_server.tar
 After extraction of file Server folder will be displayed.
 In server folder , You will find db2_install script
 U have to invoke that script using ./
 DB2 installation will start.
5
IBM Software Group
© 2005 IBM Corporation
Installation Process
6
IBM Software Group
© 2005 IBM Corporation
Creation of Group and User
 This is very important concept as We can not directly use the DB2
commands after installation of DB2.
 We have to create a group and allocate it to users.
 groupadd –g 999 db2iadm1, groupadd –g 998 db2fadm1, groupadd
–g 997 dasadm1
 useradd -g db2iadm -m -d /home/db2inst1 db2inst1 , useradd -g
db2fadm -m -d /home/db2fenc1 db2fenc1 .
7
IBM Software Group
© 2005 IBM Corporation8
Instance
 Manages one or more databases
 Must have root or Administrator Authority to create
 db2icrt is used to create an instance
 db2idrop is used to drop an instance
 db2iupdt is used to update the instance
db2icrt -u fencedusr instance_name
db2start will start an instance
db2stop will stop an instance
./db2icrt –u db2fenc1 db2inst1
IBM Software Group
© 2005 IBM Corporation
Configuration Parameters
 When a DB2 database instance or a database is
created, a corresponding configuration file is created
with default parameter values.
 There are two types of configuration files:
 The database manager configuration file for each DB2
instance (dbm cfg)
 The database configuration file for each individual
database.(db cfg)
9
IBM Software Group
© 2005 IBM Corporation10
IBM Software Group
© 2005 IBM Corporation
Instance Level Parameter
 db2 get dbm cfg
 db2 update dbm cfg using parm
 db2 get dbm cfg | grep –i SVCENAME
 db2 get dbm cfg > dbm_instance.cfg
 db2 get dbm cfg | grep -i agent
 (AGENT_STACK_SZ), (MAX_CONNECTIONS),
 (CPUSPEED) = 3.975564e-07,
11
IBM Software Group
© 2005 IBM Corporation
Instance Level Parameters
db2 get dbm cfg | grep –i diag
This parameter specifies the type of diagnostic errors that will be
recorded in the db2diag.log file.
 Diagnostic data directory path (DIAGPATH) =
/home/db2inst2/sqllib/db2dump/
 Diagnostic error capture level (DIAGLEVEL) = 3
db2 get dbm cfg | grep –i notify
This parameter specifies the type of administration notification messages
that are written to the administration notification log.
• Notify Level (NOTIFYLEVEL) = 3
12
IBM Software Group
© 2005 IBM Corporation
Valid Values of Diag level
 0 – Only critical errors, event messages, and administration notification
messages are captured on the server side. You cannot set the value of
this parameter to 0 on the client side.
 1 – Only severe errors, critical errors, event messages, and
administration notification messages are captured.
 2 – All errors, event messages, and administration notification messages
are captured.
 3 – All errors, warnings, event messages, and administration notification
messages are captured.
 4 – All errors, warnings, informational messages, event messages, and
administration notification messages are captured.
13
IBM Software Group
© 2005 IBM Corporation
Valid Values of Notify Level
Valid values for this parameter are:0 - No administration notification messages
captured. (This setting is not recommended.)
 1 - Fatal or unrecoverable errors. Only fatal and unrecoverable errors are logged. To
recover from some of these conditions, you might need assistance from DB2 service.
 2 - Immediate action required. Conditions are logged that require immediate attention
from the system administrator or the database administrator. If the condition is not
resolved, it could lead to a fatal error. Notification of very significant, non-error
activities (for example, recovery) might also be logged at this level. This level will
capture Health Monitor alarms. Informational messages will be shown at this level.
 3 - Important information, no immediate action required. Conditions are logged that are
non-threatening and do not require immediate action but might indicate a non-optimal
system. This level will capture Health Monitor alarms, Health Monitor warnings, and
Health Monitor attentions.
 4 - Informational messages.
14
IBM Software Group
© 2005 IBM Corporation15
Creating the Database
 Create db database-name
 Creates three table spaces
 Creates System Catalog Tables
 There are two types of database
(i) Local (ii) Remote
Local Database : db2 create db Sales
 Remote Database : db2 catalog tcpip node mynode1 remote
aries.myacme.com server 50000
 db2 catalog db rmtdb as myrmtdb at node mynode1
IBM Software Group
© 2005 IBM Corporation
Local Database and Remote Database
If entry type = Indirect ie Local Database
If entry type = Remote i.e Remote Database
Db2 list db directory
Database alias = MYRMTDB
Database name = RMTDB
Node name = NODE1
Database release level = d.00
Comment =
Directory entry type = Remote
Catalog database partition number = -1
16
IBM Software Group
© 2005 IBM Corporation17
Create Database Command
 db2 get db cfg
 db2 update db cfg using parm
 db2 get db cfg | grep –i reorg
 db2 get db cfg > db_instance.cfg
 db2 get db cfg | grep -i log
db2 connect to Localdb
[db2inst2@localhost ~]$ db2 connect to PRANAV
Database Connection Information
Database server = DB2/LINUX 9.7.10
SQL authorization ID = DB2INST2
Local database alias = PRANAV
IBM Software Group
© 2005 IBM Corporation
Db2 get db cfg example
 Db2 get db cfg | grep –i auto
Automatic maintenance (AUTO_MAINT) = ON
Automatic database backup (AUTO_DB_BACKUP) = OFF
Automatic table maintenance (AUTO_TBL_MAINT) = ON
Automatic runstats (AUTO_RUNSTATS) = ON
Automatic statement statistics (AUTO_STMT_STATS) = ON
Automatic statistics profiling (AUTO_STATS_PROF) = OFF
Automatic profile updates (AUTO_PROF_UPD) = OFF
Automatic reorganization (AUTO_REORG) = OFF
18
IBM Software Group
© 2005 IBM Corporation
DB2 Architecture
19
IBM Software Group
© 2005 IBM Corporation
System Database Directory
the system database directory is like a table of contents: it shows
you all the databases you can connect to from your system. The
system database directory is stored in a binary file with name
SQLDBDIR and is in the following location:
• DB2_instance_home/sqllib/sqldbdir on Linux and UNIX systems.
db2 list db directory
Type = Indirect , Type = Remote
20
IBM Software Group
© 2005 IBM Corporation
Node Directory
 The node directory stores information about how to communicate
to a remote instance where a given database resides. It is stored in
a file called SQLNODIR and is in:
 DB2_instance_home/sqllib/sqlnodir
21
IBM Software Group
© 2005 IBM Corporation
Data Connection Services
 The DCS directory is required only when connecting to a host
server like DB2 for OS/390, z/OS, and i5/OS.
 Db2 list dcs directory
22
IBM Software Group
© 2005 IBM Corporation23
Table Space
Logical layer between Hardware and Database
Comprised of one or more containers
A container is a file or a directory
REGULAR
CREATE TABLESPACE name
LARGE
SYSTEM
TEMPORARY
USER
MANAGED BY SYSTEM system-containers
DATABASE database-containers
IBM Software Group
© 2005 IBM Corporation24
System Containers
SMS Containers
USING (‘container string’)
DMS Containers
USING (FILE ‘container string’ number of pages)
(DEVICE ‘container string’ number of pages)
IBM Software Group
© 2005 IBM Corporation25
Table Space Example
CREATE TABLESPACE TS1 MANAGED BY SYSTEM
USING (‘/home/inst01/database/ts1’)
CREATE TABLESPACE DMS01D MANAGED BY DATABASE
USING (FILE ‘C:DMSDATABASEDMS01D’ 1000)
IBM Software Group
© 2005 IBM Corporation26
Create Tables
Command Line
db2 create table ARTISTS (
ARTNO SMALLINT NOT NULL,
NAME VARCHAR(40),
COMPANY CHAR(20), BIO CLOB (10K) NOT LOGGED,
PICTURE BLOB (2700K) NOT LOGGED )
IN DMS01D INDEX IN DMS01I LONG IN DMS01L
IBM Software Group
© 2005 IBM Corporation27
Create Table Script File
create table warehouse
(itemno smallint,
warehousename char(20),
qty integer )
in dms03d;
The script file cr_warehouse contains the above info
db2 –tvf cr_warehouse
IBM Software Group
© 2005 IBM Corporation28
Table Characteristics
Describe command
db2 describe table ARTISTS
Column Type Type
name schema name Length Scale Nulls
--------------- --------- ------------------ -------- ----- ------
ARTNO SYSIBM SMALLINT 2 0 No
NAME SYSIBM VARCHAR 40 0 Yes
COMPANY SYSIBM CHARACTER 20 0 Yes
BIO SYSIBM CLOB 20480 0 Yes
PICTURE SYSIBM BLOB 2764800 0 Yes
IBM Software Group
© 2005 IBM Corporation29
Describe Indexes
IBM Software Group
© 2005 IBM Corporation
Moving Data
IBM Software Group
© 2005 IBM Corporation31
Moving Data
 IMPORT
 EXPORT
 LOAD
 db2move
IBM Software Group
© 2005 IBM Corporation32
Import / Export
File
Import
Export
IBM Software Group
© 2005 IBM Corporation33
IMPORT utility
IMPORT FROM filename OF IXF
DEL
ASC
LOBS FROM lob-path MODIFIED BY options
MESSAGES
INSERT INTO table-name
INSERT_UPDATE
REPLACE
REPLACE_CREATE
IBM Software Group
© 2005 IBM Corporation34
Export
EXPORT TO file OF IXF MESSAGES message-file
DEL
WSF
select statement
IBM Software Group
© 2005 IBM Corporation35
LOAD
1) Load Loads data, collects index keys
2) Build creates the indexes
3) Delete Delete unique key violations place into
exception tables.
4) Index Copy – copy indexes from temp table space
IBM Software Group
© 2005 IBM Corporation36
LOAD Command
LOAD FROM filename OF IXF
ASC
DEL
LOBS FROM lob-path MODIFIED BY options
MESSAGES message-file
INSERT INTO table-name
REPLACE
RESTART
TERMINATE
IBM Software Group
© 2005 IBM Corporation37
LOAD from Cursor
Create nickname sales for
another database SAMPLE table SALES
Create nickname employee for
another database SAMPLE table EMPLOYEE
DECLARE C1 CURSOR FOR SELECT SALES.SALES_PERSON,
LASTNAME, FIRSTNME FROM SALES, EMPLOYEE
WHERE SALES_PERSON = EMPLOYEE.LASTNAME
LOAD FROM C1 OF CURSOR INSERT INTO LOCAL_SALES
IBM Software Group
© 2005 IBM Corporation38
db2move
db2move
Database
db2move.lst
table.ixf
DB2MOVE
IBM Software Group
© 2005 IBM Corporation39
db2move syntax
db2move database-name import
export
load
tc table-creators
tn table-name
sn schema-names
ts table space-names
IBM Software Group
© 2005 IBM Corporation
GUI Tools Using Graphical User Interface
IBM Software Group
© 2005 IBM Corporation41
Using the Control Center
IBM Software Group
© 2005 IBM Corporation42
Control Center – Create Database
IBM Software Group
© 2005 IBM Corporation43
Examples of Table Space
CREATE TABLESPACE TS1 MANAGED BY SYSTEM
USING (‘C:SMSMUSICKEGTS1’)
CREATE TABLESPACE DMS01D MANAGED BY DATABASE
USING (FILE ‘C:DMSMUSICKEGDMS01D’ 161)
EXTENTSIZE 8 PREFETECHSIZE 8
CREATE TABLESPACE DMS01I MANAGED BY DATABASE
USING (FILE ‘C:DMSMUSICKEGDMS01I’ 48)
EXTENTSIZE 4 PREFETCHSIZE 4
IBM Software Group
© 2005 IBM Corporation44
Table Space Using GUI
IBM Software Group
© 2005 IBM Corporation45
Table Space Using GUI (2)
IBM Software Group
© 2005 IBM Corporation46
Table Space Using GUI (3)
IBM Software Group
© 2005 IBM Corporation47
Table Space Using GUI (4)
IBM Software Group
© 2005 IBM Corporation48
Command Editor
IBM Software Group
© 2005 IBM Corporation49
Visual Explain
IBM Software Group
© 2005 IBM Corporation50
Visual Explain
IBM Software Group
© 2005 IBM Corporation51
Task Center
IBM Software Group
© 2005 IBM Corporation52
Journal
IBM Software Group
© 2005 IBM Corporation
RECOVERY
IBM Software Group
© 2005 IBM Corporation54
Recovery
Defining logs
Recovery of database
Recovery of a table space
Offline versus Online
IBM Software Group
© 2005 IBM Corporation55
Database Recovery LOGRETAIN = NO
Database
S0000000.log
S0000001.log
S00000002.log
S0000003.log(SecondaryLog)
S0000004.log(SecondaryLog)
IBM Software Group
© 2005 IBM Corporation56
Database Recovery LOGRETAIN = RECOVERY
Database
S0000000.log
S0000001.log
S00000002.log
S0000003.log
S0000004.log
IBM Software Group
© 2005 IBM Corporation57
Backup
 If LOGRETAIN = Recovery you may backup table space or
database
 If LOGRETAIN = NO you may only backup database
BACKUP DB database-name ONLINE to C:backup
INCLUDE LOGS
IBM Software Group
© 2005 IBM Corporation58
Recovery
 If LOGRETAIN = NO, you may only recover the database
 If LOGRETAIN = RECOVERY, you may recover a table space
or a database from a full database backup
IBM Software Group
© 2005 IBM Corporation59
Modes of Recovery
 Offline
 Online
RESTORE DB database-name FROM file TAKEN AT time
ROLLFORWARD DATABASE database-name
TO isotime AND STOP
END OF LOGS
IBM Software Group
© 2005 IBM Corporation60
HADR – High Availability Disaster Recovery
Database_standby
Database1
Laptopcomputer
IBM Software Group
© 2005 IBM Corporation
Performance and Tuning
IBM Software Group
© 2005 IBM Corporation62
Performance and Tuning
 Database Configuration parameters
 Database Structure
 SQL Statements
IBM Software Group
© 2005 IBM Corporation63
Database Configuration parameters
IBM Software Group
© 2005 IBM Corporation64
Configuration Parameters
IBM Software Group
© 2005 IBM Corporation65
Buffer Pool
Database
BufferPool
Select*fromStaff
IBM Software Group
© 2005 IBM Corporation66
Monitoring Buffer Pool Hit Ratio
 db2 get snapshot for bufferpools on database-name
Bufferpool name = IBMDEFAULTBP
Database name = MUSICKEG
Database path = C:DB2NODE0000SQL00002
Input database alias = MUSICKEG
Snapshot timestamp = 05/04/2005 13:11:37.329018
Buffer pool data logical reads = 336
Buffer pool data physical reads = 129
IBM Software Group
© 2005 IBM Corporation67
Sort Heap
 Sorts are done in sortheap
 If no space for sort data is moved to TEMPSPACEn
 GET SNAPSHOT FOR ALL ON database
IBM Software Group
© 2005 IBM Corporation68
Package Cache
 Dynamic SQL statements
PackageCache
Select*fromStaffwhereID=10
Select*fromStaffwhereID=10
UpdateStaffSetSalary=Salary+100whereID=10
Select*fromEMPLOYEE
IBM Software Group
© 2005 IBM Corporation69
LOCK
 Locks are held to prevent loss of data
 Lock Row / Table / Table Space
 LOCKLIST
 MAXLOCKS
 ALTER TABLE table-name LOCKSIZE TABLE
IBM Software Group
© 2005 IBM Corporation70
Show Locks
IBM Software Group
© 2005 IBM Corporation71
SQL Statements
 Determine which statement is causing the majority of
problems
 Determine what might be causing the problem
 Testing the solution
IBM Software Group
© 2005 IBM Corporation72
SQL Activity Monitor
IBM Software Group
© 2005 IBM Corporation73
Visual Explain
IBM Software Group
© 2005 IBM Corporation74
Table Statistics
IBM Software Group
© 2005 IBM Corporation75
Performance Summary
 Buffer pools
 Numerous Database Configuration parameters
 SQL Statement Tuning
IBM Software Group
© 2005 IBM Corporation
Security
IBM Software Group
© 2005 IBM Corporation77
Security
 Security is used at the operating system level
 Table access is through the database
IBM Software Group
© 2005 IBM Corporation78
Instance Level
 SYSADM_GROUP
 SYSCTRL_GROUP
 SYSMAINT_GROUP
 SYSMON_GROUP
IBM Software Group
© 2005 IBM Corporation79
GRANT / REVOKE
 GRANT access to an object/program
 REVOKE access to an object/program
 GRANT SELECT ON TABLE ARTISTS TO USER1
IBM Software Group
© 2005 IBM Corporation80
Summary
 The Relational Database can be simple or complex
 The database structure is simple, Table spaces, Tables, etc.
 Recovery is straight forward
 Database maintenance can be automated
 Tuning the database is a life long endeavor
IBM Software Group
© 2005 IBM Corporation81
DB2 UDB Proof of Technology
 July 12, 13 DB2 UDB Administration Proof of Technology
 IBM – McClean Tec
 8401 Greensboro Drive
 McClean, VA 22102
 Suite 120 First Floor
 WebSphere Information Integrator July 14, 2005
 Contact: Keith E. Gardenhire
 keithgar@us.ibm.com
IBM Software Group
© 2005 IBM Corporation82
DB2 UDB Proof of Technology Con’t

More Related Content

What's hot

Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSPractical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Cuneyt Goksu
 
Ibm db2
Ibm db2Ibm db2
Ibm db2
aditi212
 
online training for IBM DB2 LUW UDB DBA
online training for IBM DB2 LUW UDB DBAonline training for IBM DB2 LUW UDB DBA
online training for IBM DB2 LUW UDB DBA
Ravikumar Nandigam
 
DB2 and storage management
DB2 and storage managementDB2 and storage management
DB2 and storage management
Craig Mullins
 
Db2
Db2Db2
Db2
yboren
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
ReKruiTIn.com
 
Solving the DB2 LUW Administration Dilemma
Solving the DB2 LUW Administration DilemmaSolving the DB2 LUW Administration Dilemma
Solving the DB2 LUW Administration Dilemma
Randy Goering
 
Db2 Important questions to read
Db2 Important questions to readDb2 Important questions to read
Db2 Important questions to read
Prasanth Dusi
 
IBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration BasicsIBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration Basics
IBM
 
IBM DB2
IBM DB2IBM DB2
An Introduction To Oracle Database
An Introduction To Oracle DatabaseAn Introduction To Oracle Database
An Introduction To Oracle Database
Meysam Javadi
 
Sql Server Basics
Sql Server BasicsSql Server Basics
Sql Server Basics
rainynovember12
 
ALL ABOUT DB2 DSNZPARM
ALL ABOUT DB2 DSNZPARMALL ABOUT DB2 DSNZPARM
ALL ABOUT DB2 DSNZPARM
IBM
 
Fast Start Failover DataGuard
Fast Start Failover DataGuardFast Start Failover DataGuard
Fast Start Failover DataGuard
Borsaniya Vaibhav
 
A First Look at the DB2 10 DSNZPARM Changes
A First Look at the DB2 10 DSNZPARM ChangesA First Look at the DB2 10 DSNZPARM Changes
A First Look at the DB2 10 DSNZPARM Changes
Willie Favero
 
DB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in NutshellDB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in Nutshell
Cuneyt Goksu
 
I Didn't Know You Could Do That with zOS.pdf
I Didn't Know You Could Do That with zOS.pdfI Didn't Know You Could Do That with zOS.pdf
I Didn't Know You Could Do That with zOS.pdf
Marna Walle
 
DB2 Security Model
DB2 Security ModelDB2 Security Model
DB2 Security Model
uniqueYGB
 
db2dart and inspect
db2dart and inspectdb2dart and inspect
db2dart and inspect
dbawork
 
2 db2 instance creation
2 db2 instance creation2 db2 instance creation
2 db2 instance creation
Ravikumar Nandigam
 

What's hot (20)

Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OSPractical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
Practical Recipes for Daily DBA Activities using DB2 9 and 10 for z/OS
 
Ibm db2
Ibm db2Ibm db2
Ibm db2
 
online training for IBM DB2 LUW UDB DBA
online training for IBM DB2 LUW UDB DBAonline training for IBM DB2 LUW UDB DBA
online training for IBM DB2 LUW UDB DBA
 
DB2 and storage management
DB2 and storage managementDB2 and storage management
DB2 and storage management
 
Db2
Db2Db2
Db2
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
 
Solving the DB2 LUW Administration Dilemma
Solving the DB2 LUW Administration DilemmaSolving the DB2 LUW Administration Dilemma
Solving the DB2 LUW Administration Dilemma
 
Db2 Important questions to read
Db2 Important questions to readDb2 Important questions to read
Db2 Important questions to read
 
IBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration BasicsIBM DB2 for z/OS Administration Basics
IBM DB2 for z/OS Administration Basics
 
IBM DB2
IBM DB2IBM DB2
IBM DB2
 
An Introduction To Oracle Database
An Introduction To Oracle DatabaseAn Introduction To Oracle Database
An Introduction To Oracle Database
 
Sql Server Basics
Sql Server BasicsSql Server Basics
Sql Server Basics
 
ALL ABOUT DB2 DSNZPARM
ALL ABOUT DB2 DSNZPARMALL ABOUT DB2 DSNZPARM
ALL ABOUT DB2 DSNZPARM
 
Fast Start Failover DataGuard
Fast Start Failover DataGuardFast Start Failover DataGuard
Fast Start Failover DataGuard
 
A First Look at the DB2 10 DSNZPARM Changes
A First Look at the DB2 10 DSNZPARM ChangesA First Look at the DB2 10 DSNZPARM Changes
A First Look at the DB2 10 DSNZPARM Changes
 
DB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in NutshellDB2 for z/OS Architecture in Nutshell
DB2 for z/OS Architecture in Nutshell
 
I Didn't Know You Could Do That with zOS.pdf
I Didn't Know You Could Do That with zOS.pdfI Didn't Know You Could Do That with zOS.pdf
I Didn't Know You Could Do That with zOS.pdf
 
DB2 Security Model
DB2 Security ModelDB2 Security Model
DB2 Security Model
 
db2dart and inspect
db2dart and inspectdb2dart and inspect
db2dart and inspect
 
2 db2 instance creation
2 db2 instance creation2 db2 instance creation
2 db2 instance creation
 

Similar to DB2UDB_the_Basics

Online Training in IBM DB2 LUW/UDB DBA in Hyderabad
Online Training in IBM DB2 LUW/UDB DBA in HyderabadOnline Training in IBM DB2 LUW/UDB DBA in Hyderabad
Online Training in IBM DB2 LUW/UDB DBA in Hyderabad
Ravikumar Nandigam
 
2 db2 instance creation
2 db2 instance creation2 db2 instance creation
2 db2 instance creation
Ravikumar Nandigam
 
Online Training in IBM DB2 LUW/UDB DBA in Hyderabad
Online Training in IBM DB2 LUW/UDB DBA in HyderabadOnline Training in IBM DB2 LUW/UDB DBA in Hyderabad
Online Training in IBM DB2 LUW/UDB DBA in Hyderabad
Ravikumar Nandigam
 
Episode 2 DB2 pureScale Installation, Instance Management & Monitoring
Episode 2 DB2 pureScale Installation, Instance Management & MonitoringEpisode 2 DB2 pureScale Installation, Instance Management & Monitoring
Episode 2 DB2 pureScale Installation, Instance Management & Monitoring
Laura Hood
 
DB2UDB_the_Basics Day 5
DB2UDB_the_Basics Day 5DB2UDB_the_Basics Day 5
DB2UDB_the_Basics Day 5
Pranav Prakash
 
DBA Basics guide
DBA Basics guideDBA Basics guide
DBA Basics guide
azoznasser1
 
UGIF 12 2010 - features11.70
UGIF 12 2010 - features11.70UGIF 12 2010 - features11.70
UGIF 12 2010 - features11.70
UGIF
 
Informix User Group France - 30/11/2010 - Fonctionalités IDS 11.7
Informix User Group France - 30/11/2010 - Fonctionalités IDS 11.7Informix User Group France - 30/11/2010 - Fonctionalités IDS 11.7
Informix User Group France - 30/11/2010 - Fonctionalités IDS 11.7
Nicolas Desachy
 
DB2UDB_the_Basics Day 6
DB2UDB_the_Basics Day 6DB2UDB_the_Basics Day 6
DB2UDB_the_Basics Day 6
Pranav Prakash
 
DB2UDB_the_Basics Day 7
DB2UDB_the_Basics Day 7DB2UDB_the_Basics Day 7
DB2UDB_the_Basics Day 7
Pranav Prakash
 
2) security
2) security2) security
2) security
guptavikki99
 
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Laura Hood
 
DB2 Upgrade instructions
DB2 Upgrade instructionsDB2 Upgrade instructions
DB2 Upgrade instructions
The Vision and Insight Corner
 
Ibm db2 10.5 for linux, unix, and windows getting started with db2 installa...
Ibm db2 10.5 for linux, unix, and windows   getting started with db2 installa...Ibm db2 10.5 for linux, unix, and windows   getting started with db2 installa...
Ibm db2 10.5 for linux, unix, and windows getting started with db2 installa...
bupbechanhgmail
 
Upgrading AD from Windows Server 2003 to Windows Server 2008 R2
Upgrading AD from Windows Server 2003 to Windows Server 2008 R2Upgrading AD from Windows Server 2003 to Windows Server 2008 R2
Upgrading AD from Windows Server 2003 to Windows Server 2008 R2
Amit Gatenyo
 
Must Read HP Data Protector Interview Questions
Must Read HP Data Protector Interview QuestionsMust Read HP Data Protector Interview Questions
Must Read HP Data Protector Interview Questions
Laxman J
 
DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4
Pranav Prakash
 
L203326 intro-maria db-techu2020-v9
L203326 intro-maria db-techu2020-v9L203326 intro-maria db-techu2020-v9
L203326 intro-maria db-techu2020-v9
Tony Pearson
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
Mark Leith
 
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Sharon James
 

Similar to DB2UDB_the_Basics (20)

Online Training in IBM DB2 LUW/UDB DBA in Hyderabad
Online Training in IBM DB2 LUW/UDB DBA in HyderabadOnline Training in IBM DB2 LUW/UDB DBA in Hyderabad
Online Training in IBM DB2 LUW/UDB DBA in Hyderabad
 
2 db2 instance creation
2 db2 instance creation2 db2 instance creation
2 db2 instance creation
 
Online Training in IBM DB2 LUW/UDB DBA in Hyderabad
Online Training in IBM DB2 LUW/UDB DBA in HyderabadOnline Training in IBM DB2 LUW/UDB DBA in Hyderabad
Online Training in IBM DB2 LUW/UDB DBA in Hyderabad
 
Episode 2 DB2 pureScale Installation, Instance Management & Monitoring
Episode 2 DB2 pureScale Installation, Instance Management & MonitoringEpisode 2 DB2 pureScale Installation, Instance Management & Monitoring
Episode 2 DB2 pureScale Installation, Instance Management & Monitoring
 
DB2UDB_the_Basics Day 5
DB2UDB_the_Basics Day 5DB2UDB_the_Basics Day 5
DB2UDB_the_Basics Day 5
 
DBA Basics guide
DBA Basics guideDBA Basics guide
DBA Basics guide
 
UGIF 12 2010 - features11.70
UGIF 12 2010 - features11.70UGIF 12 2010 - features11.70
UGIF 12 2010 - features11.70
 
Informix User Group France - 30/11/2010 - Fonctionalités IDS 11.7
Informix User Group France - 30/11/2010 - Fonctionalités IDS 11.7Informix User Group France - 30/11/2010 - Fonctionalités IDS 11.7
Informix User Group France - 30/11/2010 - Fonctionalités IDS 11.7
 
DB2UDB_the_Basics Day 6
DB2UDB_the_Basics Day 6DB2UDB_the_Basics Day 6
DB2UDB_the_Basics Day 6
 
DB2UDB_the_Basics Day 7
DB2UDB_the_Basics Day 7DB2UDB_the_Basics Day 7
DB2UDB_the_Basics Day 7
 
2) security
2) security2) security
2) security
 
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...Episode 3  DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
Episode 3 DB2 pureScale Availability And Recovery [Read Only] [Compatibility...
 
DB2 Upgrade instructions
DB2 Upgrade instructionsDB2 Upgrade instructions
DB2 Upgrade instructions
 
Ibm db2 10.5 for linux, unix, and windows getting started with db2 installa...
Ibm db2 10.5 for linux, unix, and windows   getting started with db2 installa...Ibm db2 10.5 for linux, unix, and windows   getting started with db2 installa...
Ibm db2 10.5 for linux, unix, and windows getting started with db2 installa...
 
Upgrading AD from Windows Server 2003 to Windows Server 2008 R2
Upgrading AD from Windows Server 2003 to Windows Server 2008 R2Upgrading AD from Windows Server 2003 to Windows Server 2008 R2
Upgrading AD from Windows Server 2003 to Windows Server 2008 R2
 
Must Read HP Data Protector Interview Questions
Must Read HP Data Protector Interview QuestionsMust Read HP Data Protector Interview Questions
Must Read HP Data Protector Interview Questions
 
DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4DB2UDB_the_Basics Day 4
DB2UDB_the_Basics Day 4
 
L203326 intro-maria db-techu2020-v9
L203326 intro-maria db-techu2020-v9L203326 intro-maria db-techu2020-v9
L203326 intro-maria db-techu2020-v9
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
Bp307 Practical Solutions for Connections Administrators, tips and scrips for...
 

DB2UDB_the_Basics

  • 1. IBM Software Group © 2005 IBM Corporation DB2 UDB Fundamentals Day1
  • 2. IBM Software Group © 2005 IBM Corporation  DB2 Overview  Instance  Database  DB2 Architecture 2
  • 3. IBM Software Group © 2005 IBM Corporation3 DB2 Overview  DB2 is a database product from IBM.  Initially DB2 product is developed for Mainframe , Since 1990’s It is decided to develop a UDB which can run on any Platform(Unix, Linux, Windows)  Latest version of db2 is 10.5 (added feature of BLU acceleration).  3.4 (Code web), 8.1,8.2 (Stinger) , 9.1 (Viper), 9.5 (Viper2) , 9.7 (Cobra), 9.8 (added feature with pure scale) , 10.1 (Galileo), 10.5 (Capler)
  • 4. IBM Software Group © 2005 IBM Corporation4 Products DB2 Personal Edition (Remote feature NA) DB2 Workgroup Server Edition DB2 Enterprise Server Edition DB2 Workgroup Server Unlimited Edition DB2 UDB Express Edition(lowest price fully functional)
  • 5. IBM Software Group © 2005 IBM Corporation DB2 Installation  Download the software from IBM site.  gunzip v9.7fp10_linuxia32_server.tar.gz  tar -xvf v9.7fp10_linuxia32_server.tar  After extraction of file Server folder will be displayed.  In server folder , You will find db2_install script  U have to invoke that script using ./  DB2 installation will start. 5
  • 6. IBM Software Group © 2005 IBM Corporation Installation Process 6
  • 7. IBM Software Group © 2005 IBM Corporation Creation of Group and User  This is very important concept as We can not directly use the DB2 commands after installation of DB2.  We have to create a group and allocate it to users.  groupadd –g 999 db2iadm1, groupadd –g 998 db2fadm1, groupadd –g 997 dasadm1  useradd -g db2iadm -m -d /home/db2inst1 db2inst1 , useradd -g db2fadm -m -d /home/db2fenc1 db2fenc1 . 7
  • 8. IBM Software Group © 2005 IBM Corporation8 Instance  Manages one or more databases  Must have root or Administrator Authority to create  db2icrt is used to create an instance  db2idrop is used to drop an instance  db2iupdt is used to update the instance db2icrt -u fencedusr instance_name db2start will start an instance db2stop will stop an instance ./db2icrt –u db2fenc1 db2inst1
  • 9. IBM Software Group © 2005 IBM Corporation Configuration Parameters  When a DB2 database instance or a database is created, a corresponding configuration file is created with default parameter values.  There are two types of configuration files:  The database manager configuration file for each DB2 instance (dbm cfg)  The database configuration file for each individual database.(db cfg) 9
  • 10. IBM Software Group © 2005 IBM Corporation10
  • 11. IBM Software Group © 2005 IBM Corporation Instance Level Parameter  db2 get dbm cfg  db2 update dbm cfg using parm  db2 get dbm cfg | grep –i SVCENAME  db2 get dbm cfg > dbm_instance.cfg  db2 get dbm cfg | grep -i agent  (AGENT_STACK_SZ), (MAX_CONNECTIONS),  (CPUSPEED) = 3.975564e-07, 11
  • 12. IBM Software Group © 2005 IBM Corporation Instance Level Parameters db2 get dbm cfg | grep –i diag This parameter specifies the type of diagnostic errors that will be recorded in the db2diag.log file.  Diagnostic data directory path (DIAGPATH) = /home/db2inst2/sqllib/db2dump/  Diagnostic error capture level (DIAGLEVEL) = 3 db2 get dbm cfg | grep –i notify This parameter specifies the type of administration notification messages that are written to the administration notification log. • Notify Level (NOTIFYLEVEL) = 3 12
  • 13. IBM Software Group © 2005 IBM Corporation Valid Values of Diag level  0 – Only critical errors, event messages, and administration notification messages are captured on the server side. You cannot set the value of this parameter to 0 on the client side.  1 – Only severe errors, critical errors, event messages, and administration notification messages are captured.  2 – All errors, event messages, and administration notification messages are captured.  3 – All errors, warnings, event messages, and administration notification messages are captured.  4 – All errors, warnings, informational messages, event messages, and administration notification messages are captured. 13
  • 14. IBM Software Group © 2005 IBM Corporation Valid Values of Notify Level Valid values for this parameter are:0 - No administration notification messages captured. (This setting is not recommended.)  1 - Fatal or unrecoverable errors. Only fatal and unrecoverable errors are logged. To recover from some of these conditions, you might need assistance from DB2 service.  2 - Immediate action required. Conditions are logged that require immediate attention from the system administrator or the database administrator. If the condition is not resolved, it could lead to a fatal error. Notification of very significant, non-error activities (for example, recovery) might also be logged at this level. This level will capture Health Monitor alarms. Informational messages will be shown at this level.  3 - Important information, no immediate action required. Conditions are logged that are non-threatening and do not require immediate action but might indicate a non-optimal system. This level will capture Health Monitor alarms, Health Monitor warnings, and Health Monitor attentions.  4 - Informational messages. 14
  • 15. IBM Software Group © 2005 IBM Corporation15 Creating the Database  Create db database-name  Creates three table spaces  Creates System Catalog Tables  There are two types of database (i) Local (ii) Remote Local Database : db2 create db Sales  Remote Database : db2 catalog tcpip node mynode1 remote aries.myacme.com server 50000  db2 catalog db rmtdb as myrmtdb at node mynode1
  • 16. IBM Software Group © 2005 IBM Corporation Local Database and Remote Database If entry type = Indirect ie Local Database If entry type = Remote i.e Remote Database Db2 list db directory Database alias = MYRMTDB Database name = RMTDB Node name = NODE1 Database release level = d.00 Comment = Directory entry type = Remote Catalog database partition number = -1 16
  • 17. IBM Software Group © 2005 IBM Corporation17 Create Database Command  db2 get db cfg  db2 update db cfg using parm  db2 get db cfg | grep –i reorg  db2 get db cfg > db_instance.cfg  db2 get db cfg | grep -i log db2 connect to Localdb [db2inst2@localhost ~]$ db2 connect to PRANAV Database Connection Information Database server = DB2/LINUX 9.7.10 SQL authorization ID = DB2INST2 Local database alias = PRANAV
  • 18. IBM Software Group © 2005 IBM Corporation Db2 get db cfg example  Db2 get db cfg | grep –i auto Automatic maintenance (AUTO_MAINT) = ON Automatic database backup (AUTO_DB_BACKUP) = OFF Automatic table maintenance (AUTO_TBL_MAINT) = ON Automatic runstats (AUTO_RUNSTATS) = ON Automatic statement statistics (AUTO_STMT_STATS) = ON Automatic statistics profiling (AUTO_STATS_PROF) = OFF Automatic profile updates (AUTO_PROF_UPD) = OFF Automatic reorganization (AUTO_REORG) = OFF 18
  • 19. IBM Software Group © 2005 IBM Corporation DB2 Architecture 19
  • 20. IBM Software Group © 2005 IBM Corporation System Database Directory the system database directory is like a table of contents: it shows you all the databases you can connect to from your system. The system database directory is stored in a binary file with name SQLDBDIR and is in the following location: • DB2_instance_home/sqllib/sqldbdir on Linux and UNIX systems. db2 list db directory Type = Indirect , Type = Remote 20
  • 21. IBM Software Group © 2005 IBM Corporation Node Directory  The node directory stores information about how to communicate to a remote instance where a given database resides. It is stored in a file called SQLNODIR and is in:  DB2_instance_home/sqllib/sqlnodir 21
  • 22. IBM Software Group © 2005 IBM Corporation Data Connection Services  The DCS directory is required only when connecting to a host server like DB2 for OS/390, z/OS, and i5/OS.  Db2 list dcs directory 22
  • 23. IBM Software Group © 2005 IBM Corporation23 Table Space Logical layer between Hardware and Database Comprised of one or more containers A container is a file or a directory REGULAR CREATE TABLESPACE name LARGE SYSTEM TEMPORARY USER MANAGED BY SYSTEM system-containers DATABASE database-containers
  • 24. IBM Software Group © 2005 IBM Corporation24 System Containers SMS Containers USING (‘container string’) DMS Containers USING (FILE ‘container string’ number of pages) (DEVICE ‘container string’ number of pages)
  • 25. IBM Software Group © 2005 IBM Corporation25 Table Space Example CREATE TABLESPACE TS1 MANAGED BY SYSTEM USING (‘/home/inst01/database/ts1’) CREATE TABLESPACE DMS01D MANAGED BY DATABASE USING (FILE ‘C:DMSDATABASEDMS01D’ 1000)
  • 26. IBM Software Group © 2005 IBM Corporation26 Create Tables Command Line db2 create table ARTISTS ( ARTNO SMALLINT NOT NULL, NAME VARCHAR(40), COMPANY CHAR(20), BIO CLOB (10K) NOT LOGGED, PICTURE BLOB (2700K) NOT LOGGED ) IN DMS01D INDEX IN DMS01I LONG IN DMS01L
  • 27. IBM Software Group © 2005 IBM Corporation27 Create Table Script File create table warehouse (itemno smallint, warehousename char(20), qty integer ) in dms03d; The script file cr_warehouse contains the above info db2 –tvf cr_warehouse
  • 28. IBM Software Group © 2005 IBM Corporation28 Table Characteristics Describe command db2 describe table ARTISTS Column Type Type name schema name Length Scale Nulls --------------- --------- ------------------ -------- ----- ------ ARTNO SYSIBM SMALLINT 2 0 No NAME SYSIBM VARCHAR 40 0 Yes COMPANY SYSIBM CHARACTER 20 0 Yes BIO SYSIBM CLOB 20480 0 Yes PICTURE SYSIBM BLOB 2764800 0 Yes
  • 29. IBM Software Group © 2005 IBM Corporation29 Describe Indexes
  • 30. IBM Software Group © 2005 IBM Corporation Moving Data
  • 31. IBM Software Group © 2005 IBM Corporation31 Moving Data  IMPORT  EXPORT  LOAD  db2move
  • 32. IBM Software Group © 2005 IBM Corporation32 Import / Export File Import Export
  • 33. IBM Software Group © 2005 IBM Corporation33 IMPORT utility IMPORT FROM filename OF IXF DEL ASC LOBS FROM lob-path MODIFIED BY options MESSAGES INSERT INTO table-name INSERT_UPDATE REPLACE REPLACE_CREATE
  • 34. IBM Software Group © 2005 IBM Corporation34 Export EXPORT TO file OF IXF MESSAGES message-file DEL WSF select statement
  • 35. IBM Software Group © 2005 IBM Corporation35 LOAD 1) Load Loads data, collects index keys 2) Build creates the indexes 3) Delete Delete unique key violations place into exception tables. 4) Index Copy – copy indexes from temp table space
  • 36. IBM Software Group © 2005 IBM Corporation36 LOAD Command LOAD FROM filename OF IXF ASC DEL LOBS FROM lob-path MODIFIED BY options MESSAGES message-file INSERT INTO table-name REPLACE RESTART TERMINATE
  • 37. IBM Software Group © 2005 IBM Corporation37 LOAD from Cursor Create nickname sales for another database SAMPLE table SALES Create nickname employee for another database SAMPLE table EMPLOYEE DECLARE C1 CURSOR FOR SELECT SALES.SALES_PERSON, LASTNAME, FIRSTNME FROM SALES, EMPLOYEE WHERE SALES_PERSON = EMPLOYEE.LASTNAME LOAD FROM C1 OF CURSOR INSERT INTO LOCAL_SALES
  • 38. IBM Software Group © 2005 IBM Corporation38 db2move db2move Database db2move.lst table.ixf DB2MOVE
  • 39. IBM Software Group © 2005 IBM Corporation39 db2move syntax db2move database-name import export load tc table-creators tn table-name sn schema-names ts table space-names
  • 40. IBM Software Group © 2005 IBM Corporation GUI Tools Using Graphical User Interface
  • 41. IBM Software Group © 2005 IBM Corporation41 Using the Control Center
  • 42. IBM Software Group © 2005 IBM Corporation42 Control Center – Create Database
  • 43. IBM Software Group © 2005 IBM Corporation43 Examples of Table Space CREATE TABLESPACE TS1 MANAGED BY SYSTEM USING (‘C:SMSMUSICKEGTS1’) CREATE TABLESPACE DMS01D MANAGED BY DATABASE USING (FILE ‘C:DMSMUSICKEGDMS01D’ 161) EXTENTSIZE 8 PREFETECHSIZE 8 CREATE TABLESPACE DMS01I MANAGED BY DATABASE USING (FILE ‘C:DMSMUSICKEGDMS01I’ 48) EXTENTSIZE 4 PREFETCHSIZE 4
  • 44. IBM Software Group © 2005 IBM Corporation44 Table Space Using GUI
  • 45. IBM Software Group © 2005 IBM Corporation45 Table Space Using GUI (2)
  • 46. IBM Software Group © 2005 IBM Corporation46 Table Space Using GUI (3)
  • 47. IBM Software Group © 2005 IBM Corporation47 Table Space Using GUI (4)
  • 48. IBM Software Group © 2005 IBM Corporation48 Command Editor
  • 49. IBM Software Group © 2005 IBM Corporation49 Visual Explain
  • 50. IBM Software Group © 2005 IBM Corporation50 Visual Explain
  • 51. IBM Software Group © 2005 IBM Corporation51 Task Center
  • 52. IBM Software Group © 2005 IBM Corporation52 Journal
  • 53. IBM Software Group © 2005 IBM Corporation RECOVERY
  • 54. IBM Software Group © 2005 IBM Corporation54 Recovery Defining logs Recovery of database Recovery of a table space Offline versus Online
  • 55. IBM Software Group © 2005 IBM Corporation55 Database Recovery LOGRETAIN = NO Database S0000000.log S0000001.log S00000002.log S0000003.log(SecondaryLog) S0000004.log(SecondaryLog)
  • 56. IBM Software Group © 2005 IBM Corporation56 Database Recovery LOGRETAIN = RECOVERY Database S0000000.log S0000001.log S00000002.log S0000003.log S0000004.log
  • 57. IBM Software Group © 2005 IBM Corporation57 Backup  If LOGRETAIN = Recovery you may backup table space or database  If LOGRETAIN = NO you may only backup database BACKUP DB database-name ONLINE to C:backup INCLUDE LOGS
  • 58. IBM Software Group © 2005 IBM Corporation58 Recovery  If LOGRETAIN = NO, you may only recover the database  If LOGRETAIN = RECOVERY, you may recover a table space or a database from a full database backup
  • 59. IBM Software Group © 2005 IBM Corporation59 Modes of Recovery  Offline  Online RESTORE DB database-name FROM file TAKEN AT time ROLLFORWARD DATABASE database-name TO isotime AND STOP END OF LOGS
  • 60. IBM Software Group © 2005 IBM Corporation60 HADR – High Availability Disaster Recovery Database_standby Database1 Laptopcomputer
  • 61. IBM Software Group © 2005 IBM Corporation Performance and Tuning
  • 62. IBM Software Group © 2005 IBM Corporation62 Performance and Tuning  Database Configuration parameters  Database Structure  SQL Statements
  • 63. IBM Software Group © 2005 IBM Corporation63 Database Configuration parameters
  • 64. IBM Software Group © 2005 IBM Corporation64 Configuration Parameters
  • 65. IBM Software Group © 2005 IBM Corporation65 Buffer Pool Database BufferPool Select*fromStaff
  • 66. IBM Software Group © 2005 IBM Corporation66 Monitoring Buffer Pool Hit Ratio  db2 get snapshot for bufferpools on database-name Bufferpool name = IBMDEFAULTBP Database name = MUSICKEG Database path = C:DB2NODE0000SQL00002 Input database alias = MUSICKEG Snapshot timestamp = 05/04/2005 13:11:37.329018 Buffer pool data logical reads = 336 Buffer pool data physical reads = 129
  • 67. IBM Software Group © 2005 IBM Corporation67 Sort Heap  Sorts are done in sortheap  If no space for sort data is moved to TEMPSPACEn  GET SNAPSHOT FOR ALL ON database
  • 68. IBM Software Group © 2005 IBM Corporation68 Package Cache  Dynamic SQL statements PackageCache Select*fromStaffwhereID=10 Select*fromStaffwhereID=10 UpdateStaffSetSalary=Salary+100whereID=10 Select*fromEMPLOYEE
  • 69. IBM Software Group © 2005 IBM Corporation69 LOCK  Locks are held to prevent loss of data  Lock Row / Table / Table Space  LOCKLIST  MAXLOCKS  ALTER TABLE table-name LOCKSIZE TABLE
  • 70. IBM Software Group © 2005 IBM Corporation70 Show Locks
  • 71. IBM Software Group © 2005 IBM Corporation71 SQL Statements  Determine which statement is causing the majority of problems  Determine what might be causing the problem  Testing the solution
  • 72. IBM Software Group © 2005 IBM Corporation72 SQL Activity Monitor
  • 73. IBM Software Group © 2005 IBM Corporation73 Visual Explain
  • 74. IBM Software Group © 2005 IBM Corporation74 Table Statistics
  • 75. IBM Software Group © 2005 IBM Corporation75 Performance Summary  Buffer pools  Numerous Database Configuration parameters  SQL Statement Tuning
  • 76. IBM Software Group © 2005 IBM Corporation Security
  • 77. IBM Software Group © 2005 IBM Corporation77 Security  Security is used at the operating system level  Table access is through the database
  • 78. IBM Software Group © 2005 IBM Corporation78 Instance Level  SYSADM_GROUP  SYSCTRL_GROUP  SYSMAINT_GROUP  SYSMON_GROUP
  • 79. IBM Software Group © 2005 IBM Corporation79 GRANT / REVOKE  GRANT access to an object/program  REVOKE access to an object/program  GRANT SELECT ON TABLE ARTISTS TO USER1
  • 80. IBM Software Group © 2005 IBM Corporation80 Summary  The Relational Database can be simple or complex  The database structure is simple, Table spaces, Tables, etc.  Recovery is straight forward  Database maintenance can be automated  Tuning the database is a life long endeavor
  • 81. IBM Software Group © 2005 IBM Corporation81 DB2 UDB Proof of Technology  July 12, 13 DB2 UDB Administration Proof of Technology  IBM – McClean Tec  8401 Greensboro Drive  McClean, VA 22102  Suite 120 First Floor  WebSphere Information Integrator July 14, 2005  Contact: Keith E. Gardenhire  keithgar@us.ibm.com
  • 82. IBM Software Group © 2005 IBM Corporation82 DB2 UDB Proof of Technology Con’t

Editor's Notes

  1. This presentation will discuss DB2 UDB Fundamentals.
  2. The presentation will cover the DB2 UDB for the Distributed Platforms and basic database administration. From starting DB2 versions are listed below: 3.4 (Code web), 8.1,8.2 (Stinger) , 9.1 (Viper), 9.5 (Viper2) , 9.7 (Cobra), 9.8 (added feature with pure scale) , 10.1 (Galileo), 10.5 (Capler)
  3. DB2 Personal Edition is a standalone database system. A user can only connect to the database server, when on the server. It is a full function database. No one can connect remotely to the database. DB2 UDB Express Edition is IBM’s lowest price fully functional relational database. DB2 UDB Workgroup Server Edition is the relational database server of choice for deployment in a departmental or workgroup or medium-sized business environment that has a reasonable number of internal users. WSE is licensed on a per-user model, designed to provide an attractive price point for medium-size installations while providing a full-function relational database server. DB2 WSE can be deployed in Linux, UNIX, and Windows server environments on systems with up to four CPUs. DB2 Workgroup Server Unlimited Edition offers a per-processor licensing model for relational database deployment in a departmental or workgroup or medium-sized business environment that has Internet users or number of users that makes per-processor licensing more attractive than the WSE per-user licensing model. DB2 WSUE can be deployed in Linux, UNIX, and Windows environments on systems with up to four CPUs. DB2 UDB Enterprise Server Edition has the option of the Data Partitioning Feature. This the parallel edition feature. DB2 UDB Enterprise Server Edition may scale up to 999 processors. DB2 UDB Enterprise Server Edition for Linux may scale up to 1024 processors. DB2 UDB Personal Developer Edition enables a developer to be able to create applications. Includes DB2 Connect personal edition, DB2 Personal Edition, IBM Developer Kit (Java Technology),DB2 Net Search Extender, DB2 Spatial Extender.
  4. An instance manages one or more databases. Multiple instances may be place on a server. The normal reason for more than one instance is for performance and security. If running the Data Partition Feature (DPF), you should have one instance per database. When installing on Windows a database instance named DB2 will be created. On UNIX the db2setup –install will create a database instance. An instance may managed one or more databases. A database may only be associated with one instance. The command db2ilist will list all the instances on a server.
  5. CREATE DATABASE MUSICKEG is the command to create a DB2 UDB V8.2 database. A table space is the logical layer between the database and the disk drive. The table spaces created, when the database is created are: SYSCATSPACE, TEMPSPACE1 and USERSPACE1. System catalog tables are created in the table space SYSCATSPACE. TEMPSPACE is used for sorting (if the sorted data does not fit into sort heap). When a database is created, the system catalog tables with the schema name SYSIBM. The views of the system catalog tables will be created with the schema name SYSCAT. Certain system catalog table information may be updated. The views that may be updated have the schema name of SYSSTAT.
  6. If you specify the alias name, the user will use that alias name for the connect statement. The database configuration file is created when the database is created. The table spaces SYSCATSPACE, TEMPSPACE1 and USERSPACE1 are created. The system catalog tables are created.
  7. There are two types of table space management systems: Database and System. System managed table space is easier to maintain. Database managed space is slightly faster than System managed space when adding data to a table. The reason is that DMS table space will format data pages in advance. SMS managed space has significant performance improvements in DB2 UDB V8.1. SMS table space will acquire an extent at time on DB2 V8.1, where on previous release DB2 UDB obtained 1 page at a time. If you use SMS table space, the entire table must exist in the one table space. If you use DMS table space, the table may have the data portion in one table space, the index in a second table space and the large object portion in a third table space. Table space definition will set the page size. The default page size is 4K. Page sizes can be 4K, 8K, 16K and 32K. The maximum number of rows on a page is 255 rows. This is significant, if you have small row sizes. A table space may contain up to 64 GB of data, if the page size is 4K.
  8. Table spaces may be managed by System requires a directory. The directory will be created. Table spaces managed by Database requires a file or raw device.
  9. The table space named TS1 is an SMS table space. If the directory does not exist, it will be created. The table space named DMS01D is a DMS table space. Data will be placed in a file.
  10. From the DB2 Command Line Processor the create table command is preceded by “db2”. Notice that on the Large Object columns BIO and PICTURE the NOT LOGGED option is used. If the column is updated, the update is not logged. This will save space on the log file. The table is divided over three table spaces. The data portion of the table is placed in the table space DMS01D. The index portion of the table spaces is placed in the table space DMS01I. The Large Object portion of the table space is placed in the table space DMS01L. A table may only be place in multiple table spaces, if the table spaces are DMS (Database Managed Space). A table may only be a total size 128GB. If you use the page size of 8K. If table is placed into a table space with 4K page size, the maximum size of the table is 64GB. You may only have 255 rows per page.
  11. The script file will contain the create table statement. The option –tvf indicate –t terminate SQL statement when a semicolon is found. -v verbose echo the command to the terminal. -f use the following file If you need any other options, issue the command: db2 ? Options
  12. The describe command will display the table characteristics. The describe command is able to show the index characteristics. db2 describe indexes for table table-name.
  13. In this case there are two indexes. PK_ARTISTS is an index that was created for primary key definition and the index ARTISTS_COMPANY_IX, which allows for duplicate keys.
  14. Populating data into tables. IMPORT inserts data into tables. LOAD utility used for loading large amounts of data is faster than the IMPORT utility. Export utility moves data from a table to a flat file. db2move is a utility that may move many tables at the same time.
  15. The Import utility will take the data from a flat file and place it into table. Inserts will be used to place the data into the table. The inserts will be logged. Triggers, if they exist, will be executed. DB2 UDB V8.2 will allow Online IMPORT. This means that users may access the table, while the IMPORT utility is running.
  16. The IMPORT utility will insert data into a table. The format of the input file is IXF (PC/Integrated Exchange format) used by DB2 only. DEL indicates a delimited ASCII format. The columns will be delimited by a comma. Character columns will be delimited by a double quote mark. ASC indicates an ASCII file with a column beginning and ending position of the data. If you use the ASC file type the METHOD L must be used to state the beginning and ending position. Example: IMPORT FROM ARTISTS.DAT OF ASC LOBS FROM C:\LOBS\ MODIFIED BY LOBSINFILE METHOD L ( 40 43, 1 39, 50 69, 70 83, 84 98) MESSAGES IMPORT_ARTISTS.MSG INSERT INTO ARTISTS
  17. Export data from a table(s) and place data into file. With the Export utility you can take data from more than one table. Any valid SELECT statement may be used. The SELECT statement may even be JOIN.
  18. The 4 phases from load.
  19. The Load command is used for placing large amounts of data into the table. When using the load command, exception tables should be created. The exception tables are identical to the original table. The exception table may have two additional columns: TS (Timestamp) and MSG (CLOB 32K). If you do not have an exception table and a row violates referential integrity, the LOAD will fail. Note: If you are running the DPF (Data Partitioning Feature), the exception table must be in the same partitions as the original table.
  20. The LOAD utility supports using a cursor. This is a way to load data from tables that do not exist in the database. The nickname is a federated database concept. The nickname will refer to table in a separate database. The federated database concept allows access to non-IBM database stores.
  21. db2move is the Database Movement Tool. db2move is a tool that allows the DBA to copy a large number of tables using one command. Tables will be exported in the PC/IXF format. The tables can be imported and exported into another DB2 database. The db2move tool will create a db2move.lst file that will contain the table name resolution file. Each table will have an tab.ixf file associated with the table data.
  22. db2move can export only the tables with a specific schema name, table name, or who created the table. The db2move can also import the tables. If the table does not exist, the db2move utility is able to create the table if the import is done.
  23. The Control Center is the major GUI (Graphical User Interface). In this case create a database using the Control Center. All Databases -> Create Database -> Standard The Control Center can be used to managed a database server on a UNIX, LINUX, Windows and z/OS platforms.
  24. Decide what system to place the database. Give the database a name. Database name can be up to 8 characters.
  25. Table space TS1 is managed by the system so a directory “\sms\musickeg\ts1” will be created. Table space DMS01D is managed by the database so a file of 161 4K pages will be used. The table space DMS01I will be managed by the database and a file of 48 pages will be created.
  26. Creating a table space using the Control Center. Open the Control Center. Expand the tree for the database you want to create the table space. In this case let us use the database MUSICKEG. Select the “+” to left of the database.
  27. Create a new table space. Select the Table Space with the RMB (Right Mouse Button).
  28. Give the table space a name. The type of a table space will be chosen. A regular table space is used to contain data. A Large table space may be used to contain Large Objects and index data. System Temporary table space is used for maintaining sorting data or joined data. User Temporary table space for creating temporary tables.
  29. The creating of the table space allows you to either use SMS (System Managed Space) or DMS (Database Managed Space). SMS allows a pages to be allocated as needed. DMS has a specific predefined limit. If the DMS table space becomes full. no more pages can be allocated until the DBA (Database Administrator) increases the size of a table space. (This will be covered in detail later in the presentation.) At this point the size of the table space can be specified and the location of the table space containers.
  30. The Command Editor is used to issue interactive commands. The Command Editor can also be used to run the Visual Explain tool to see the access path.
  31. The Visual Explain tool may be invoked from the Command Editor, Control Center or Activity Monitor. Let’s take a simple query from the Command Editor. SELECT NAME, TITLE, TITLES.COMPANY, YEAR FROM ARTISTS, TITLES WHERE ARTISTS.ARTNO = TITLES.ARTNO AND NAME LIKE ‘Ra%’ ORDER BY NAME; In this particular case no indexes were used. Table scans were executed on the table TITLES and ARTISTS.
  32. Added an index on the NAME column of the ARTISTS table. Notice a diamond shows above the ARTISTS table. This indicates an index is being used on the ARTISTS table. The timeron cost has decreased from the previous query. Rectangles indicate a table. Diamond indicates an index is being used.
  33. Task Center is used to schedule tasks. This is very effective in setting up DBA tasks that require continuous running of the job. For example tasks that might be considered for the Task Center might be: REORGANIZATION of tables, running statistics for a table, online backup of a database.
  34. The Journal shows certain activities that have been run against the databases. From the Journal the DBA can see the status of jobs run from the Task Center.
  35. When the database is started, either by the first connect or using the “ACTIVATE DATABASE” command, the primary log files are allocated. The number of primary logs is defined by the database configuration parameter LOGPRIMARY. When LOGRETAIN = NO (Database Configuration parameter) and the primary log files are full, the secondary log files will be allocated. LOGPRIMARY indicates the number of log files that will be allocated when the database starts. LOGSECOND indicates the maximum number of secondary log files that can be allocated. If you set LOGSECOND to a -1, an infinite number of secondary log files can be allocated.
  36. When LOGRETAIN = RECOVERY, log files are maintained. When the primary log files are used, additional log files will be created.
  37. Backup in DB2 UDB V8.2 will allow the logs to backed up at the same time as the database. You may only include the logs only in an online backup. BACKUP DB database-name ONLINE to c:\backup INCLUDE LOGS This command will include the log files with the backup. If LOGRETAIN=NO, you may only do offline backups.
  38. Offline backup no one can access the database during a backup. Online backup will allow users to be accessing the database at the time the backup is executing. If LOGRETAIN=RECOVERY, a table space(s) may be recovered from a full database backup. When the restore is finished, the database is left in a roll forward pending state. If the database configuration parameter LOGRETAIN = RECOVERY, the DBA (database administrator) may recover the database to a point in time. The RECOVER DATABASE command combines both RESTORE DATABASE and ROLLFORWARD DATABASE commands.
  39. HADR allows for a standby database. The standby database is used, if the primary database is unavailable. The clients will be automatically rerouted to the standby database. To invoke the HADR feature update the database configuration. If the standby database does not hear from the primary database is 120 seconds (default), the standby database takes over. HADR is not available with the DPF (Data Partitioning Feature)
  40. Let us cover a few simple performance and tuning options of using DB2.
  41. The Configuration Advisor allows the DBA to answer several questions. DB2 UDB will then set the configuration parameters.
  42. As with any performance configuration parameters your performance improvement may vary. Each person has there own personal preferences.
  43. There is one default buffer pool. The buffer pool is named IBMDEFAULTBP and is 250 4K pages on a Windows operating system and 1000 4K pages on a UNIX operating system. When page is requested, DB2 will search the buffer pool first. If the page is not in the buffer pool, DB2 will issue a physical I/O request. Therefore it is imperative to keep pages, that are needed in the buffer pool. Suggestion: In an OLTP (Online Transaction Processing ) environment you would want high impact tables in a buffer pool by itself. For DSS (Decision Support Systems) one large buffer pool should suffice. The command “GET SNAPSHOT FOR TABLES ON database” will produce what tables are accessed the most. If you change page sizes from the default 4K page, make sure that a buffer pool is made with the same size.
  44. A logical read occurs when DB2 attempts to find a page in the buffer pool. A physical read occurs, when the page requested is not in the buffer pool.
  45. It is probably better to keep sort data in memory. Sort overflows indicate data to be sorted did not fit in memory. The command “GET SNAPSHOT FOR ALL ON database” will show how many sort overflows have occurred. The database configuration parameter SORTHEAP should be adjusted to eliminate a number of the sort heaps. If the SORTHEAP is not big enough, DB2 will overflow the sort into TEMPSPACE. Note: If you change a page size from the default size of 4K, you must also create TEMPORARY table space of that size.
  46. A dynamic SQL statement is executed. The database manager will verify if the statement is in package cache (package cache lookup). If the SQL statement is not in package cache, the statement is compiled and placed in package cache (package cache insert). If there are no sections available in package cache, a package cache overflow will occur. When package cache overflows, it expands dynamically. You may flush package cache with the command: FLUSH PACKAGE CACHE DYNAMIC Package cache is allocated at database start up time. Look for the database parameter PCKCACHESZ (it is a calculated value of MAXAPPLS * 8).
  47. By default a row is locked. The LOCKLIST is number of 4K pages, that will hold all the lock request blocks. MAXLOCKS determines the percentage of locklist that 1 user may hold. If this percentage is exceeded, the lock request blocks will updated into one table lock. Lock escalation normally indicates a problem. Changing the default row level locking for a table to table level, especially if the table is read only is a good idea.
  48. A LOCKWAIT occurs when a user is waiting on an object in the database. This slide shows two users, DBAPOT and ADMIN, waiting for a resource held by user KGARDEN. From the Control Center select the instance named “DB2” with the RMB (Right Mouse Button). From the pop-up menu select the Applications (menu item). Highlight the user holding the lock and select the command button Show Lock Chains.
  49. The Activity monitor (new to DB2 UDB V8.2) is able to assist in finding the high impact SQL statements. Visual Explain and the character explain tools are able to show the access path of a single SQL Statement. The Design Advisor is able to suggest indexes and MQT (Materialized Query Table), that may help in deciding what may improve performance of the SQL statement.
  50. To get to this point Open the Control Center -> Select the database with the RMB (Right Mouse Button) -> Activity Monitor Determine the SQL Statement that is causing the problem. In this example select the Report: Dynamic SQL statements in the cache with the longest average execution time. From here you can select the SQL Statement and execute Visual Explain.
  51. In this case an index was used for the table TITLES. Notice the diamond above the table DBAPOT.TITLES. This diamond indicates an index is being used. A table scan was run against the tables WAREHOUSE and ARTISTS. DB2 UDB has a cost based optimizer so it is important to have statistics up to date. If you double click on the tables (rectangle), the table statistics will be displayed.
  52. Notice the STATS_TIME row.
  53. There are many things that may affect performance. These are just a couple of tuning tips.
  54. All these groups should be defined to the operating system. If the group is defined in the operating systems security, any userid in that group has the authority. The SYSMON_GROUP is new for DB2 UDB V8.1. Users in this group will be able issue GET DATABASE MANAGER MONITOR SWITCHES, GET MONITOR SWITCHES, GET SNAPSHOT, LIST ACTIVE DATABASES, LIST APPLICATIONS, RESET MONITOR SWITCHES and UPDATE MONITOR SWITCHES.
  55. DB2 UDB Administration for the Oracle DBA For the Distributed Database on Linux, Windows, UNIX. Hands on Labs on Windows workstation. Date: July 12, 13, 2005 (Tuesday and Wednesday) Start Time: 09:00 A.M. End Time: 05:00 P.M. Location: IBM Technology Center 8401 Greensboro Drive McClean, VA 22102 Suite 120 (First Floor) Customers who would like to attend contact: Keith E. Gardenhire e-mail: [email_address] Phone: (301)803-1717 I am doing a 2 day class DB2 UDB V8.2 for the Oracle DBA. The class will cover Database Structure Discuss the differences between DB2 UDB and Oracle RDBMS data structures. Show what table spaces are created, when a DB2 UDB database is created. Discuss the database configuration parameters and the difference that Oracle uses for INIT.ORA file. Labs: Create the SAMPLE and a custom DB2 UDB database Lecture 1: Command Line Processor Lab: Using the DB2 Command Line Processor to examine instance and database configuration. List the tables that exist for a database Show the column characteristics for a table Use the Graphical User Interface (GUI) to display database manager configuration parameters and database configuration parameters. Lecture 2: Database Exploration Understand the database structure: Table Spaces, tables, indexes and system catalog tables. Discuss Referential Integrity constraints. Lab: Create the table spaces and tables using the DB2 Command Line Processor. Learn how to use script files to create database objects. Use the Task Center (GUI) to schedule a job to create the table spaces. If this job is successful, execute a second script to create tables. This exercise will demonstrate how to create and schedule jobs. Use the Journal to see the results of a previously executed task. Alter the tables and add the referential integrity. Lecture 3: Populate the Database Discussions on the Import and Load utilities. Discuss the differences between the two utilities. Lab: Populate the tables created in the previous exercise using the LOAD utility. Use the SET INTEGRITY command to correct the referential integrity constraint violations. Lecture 4: Security Discuss the basic security for DB2 UDB environment. Understand DB2 UDB uses group authority for SYSADM, SYSMAINT and SYSCTRL authority. A new group in DB2 UDB V8.2 SYSMON has been added. Discuss the reasons that this group is used. The students will discuss the GRANT and REVOKE authority commands. The implicit security will be discussed. Lecture 5: Explain Understand how to use the Visual and character explain tools to help in discovery of SQL statement performance problems. Lab: Take an SQL statement and determine what might be incorrect with the database structure (index, Materialized Query Tables, etc..), that is causing a performance problem. Lecture 6: Automatic maintenance DB2 UDB V8.2 allows for certain database maintenance be executed automatically. Learn how to have the RUNSTATS (update the table statistics), REORG (reorganization of a table), and database backups to run automatically. Lab: Using the Control Center (GUI) to set up a maintenance window and to have the REORG, RUNSTATS and database backup be executed during this maintenance window. Lecture 7: Recovery Discussions on the two types of logging: Circular and Archival modes Discussions on the two types of database backup: Offline and Online Recovery modes: Full database recovery, Partial database recovery (table space) and recovery to a point in time Database Configuration parameters that are used in recover will be discussed. Lab: Backup a database. Recover the database to a point in time. Lecture 8: Design Advisor The Design Advisor is a tool, that will assist the DBA (Database Administrator) in designing the proper database structure. Discuss how to capture SQL statements and run the SQL statements through the Design Advisor. Lab: Take 3 complex SQL statements and run through the Design Advisor. Take the results of the Design Advisor and place in the recommendations into the Task Center to run at a later time. Execute the Design Advisor using the DB2 Command Line Processor. Lecture 9: Health Center The Health Center is a new GUI tool for DB2 UDB V8. The Health Center captures alerts and is designed to send the alert to a user. Alerts can be set up by the DBA (Database Administrator) to be customize for a particular situation. Lab: Modify the alter configuration parameters to capture warnings when a table space gets to be 60 percent full. Modify the alter configuration parameters to capture errorss when a table space gets to be 70 percent full. Update the database manager configuration file to start the Health monitor. Lecture 10: Using the Activity Monitor The Activity Monitor, which is new for DB2 UDB V8.2, monitors the dynamic SQL Statements. The lecture will discuss dynamic versus static SQL statements. We will discuss how to capture SQL statements and generate reports. Lab: Execute 3 script files that will run 3 SQL statements. Use the Activity monitor to determine the slowest SQL statement. Use the Activity monitor to Explain the SQL statement. Run Statistics on the tables used by the SQL statement (SQL statement is a join) and Explain the SQL statement again and notice the differences in the total cost to run the SQL Statement. Create two new indexes and update the statistics on both tables. Run the Explain on the SQL statement and determine if the performance was improved. Lecture 11: Stored Procedures. Discuss the differences between Oracle PL/SQL and DB2 UDB SQL/Procedure Langauge. Show how to use the DB2 Development Center to create a simple stored procedure. Learn several SQL/Procedure Language statements. Discuss the structure of a Stored Procedure. Learn how to run Stored Procedure Debugger. Lab: Create a stored procedure, that will show how to build Basic Stored Procedure Structure Manage the SQLCODE and SQLSTATE variables Code the basic EXIT HANDLERS when a row is NOT FOUND. Define a CURSOR that will manage a result set. Code a nested FOR LOOP.
  56. Lecture 3: Populate the Database Discussions on the Import and Load utilities. Discuss the differences between the two utilities. Lab: Populate the tables created in the previous exercise using the LOAD utility. Use the SET INTEGRITY command to correct the referential integrity constraint violations. Lecture 4: Security Discuss the basic security for DB2 UDB environment. Understand DB2 UDB uses group authority for SYSADM, SYSMAINT and SYSCTRL authority. A new group in DB2 UDB V8.2 SYSMON has been added. Discuss the reasons that this group is used. The students will discuss the GRANT and REVOKE authority commands. The implicit security will be discussed. Lecture 5: Explain Understand how to use the Visual and character explain tools to help in discovery of SQL statement performance problems. Lab: Take an SQL statement and determine what might be incorrect with the database structure (index, Materialized Query Tables, etc..), that is causing a performance problem. Lecture 6: Automatic maintenance DB2 UDB V8.2 allows for certain database maintenance be executed automatically. Learn how to have the RUNSTATS (update the table statistics), REORG (reorganization of a table), and database backups to run automatically. Lab: Using the Control Center (GUI) to set up a maintenance window and to have the REORG, RUNSTATS and database backup be executed during this maintenance window. Lecture 7: Recovery Discussions on the two types of logging: Circular and Archival modes Discussions on the two types of database backup: Offline and Online Recovery modes: Full database recovery, Partial database recovery (table space) and recovery to a point in time Database Configuration parameters that are used in recover will be discussed. Lab: Backup a database. Recover the database to a point in time. Lecture 8: Design Advisor The Design Advisor is a tool, that will assist the DBA (Database Administrator) in designing the proper database structure. Discuss how to capture SQL statements and run the SQL statements through the Design Advisor. Lab: Take 3 complex SQL statements and run through the Design Advisor. Take the results of the Design Advisor and place in the recommendations into the Task Center to run at a later time. Execute the Design Advisor using the DB2 Command Line Processor. Lecture 9: Health Center The Health Center is a new GUI tool for DB2 UDB V8. The Health Center captures alerts and is designed to send the alert to a user. Alerts can be set up by the DBA (Database Administrator) to be customize for a particular situation. Lab: Modify the alter configuration parameters to capture warnings when a table space gets to be 60 percent full. Modify the alter configuration parameters to capture errorss when a table space gets to be 70 percent full. Update the database manager configuration file to start the Health monitor. Lecture 10: Using the Activity Monitor The Activity Monitor, which is new for DB2 UDB V8.2, monitors the dynamic SQL Statements. The lecture will discuss dynamic versus static SQL statements. We will discuss how to capture SQL statements and generate reports. Lab: Execute 3 script files that will run 3 SQL statements. Use the Activity monitor to determine the slowest SQL statement. Use the Activity monitor to Explain the SQL statement. Run Statistics on the tables used by the SQL statement (SQL statement is a join) and Explain the SQL statement again and notice the differences in the total cost to run the SQL Statement. Create two new indexes and update the statistics on both tables. Run the Explain on the SQL statement and determine if the performance was improved. Lecture 11: Stored Procedures. Discuss the differences between Oracle PL/SQL and DB2 UDB SQL/Procedure Langauge. Show how to use the DB2 Development Center to create a simple stored procedure. Learn several SQL/Procedure Language statements. Discuss the structure of a Stored Procedure. Learn how to run Stored Procedure Debugger. Lab: Create a stored procedure, that will show how to build Basic Stored Procedure Structure Manage the SQLCODE and SQLSTATE variables Code the basic EXIT HANDLERS when a row is NOT FOUND. Define a CURSOR that will manage a result set. Code a nested FOR LOOP.