Online Training in IBM DB2 LUW UDB DBA in Hyderabad

20
DB2 for Linux, Unix, and Windows - Ravi

Transcript of Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Page 1: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

DB2 for Linux, Unix, and Windows

- Ravi

Page 2: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

What is a Database Manager?

AGENDA!

Installation pre-requisites

CREATE/DROP

START/STOP

DBM Configuration

db2set command

db2 CLP history

Q&A

Page 3: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Logical database manager environment where we catalog databases and set configuration parameters

Definition: DBM/Instance

Page 4: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Instance = Database(s) + Processes/Threads

Page 5: Online Training in IBM DB2 LUW UDB DBA in Hyderabad
Page 6: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Operating system: - Red Hat Enterprise Linux (RHEL) 5 Update 2.0.4- SUSE Linux Enterprise Server (SLES) 10 Service Pack 2- SUSE Linux Enterprise Server (SLES) 11- Ubuntu 8.0.4.1

Installation Pre-requisites (Linux!)

Disk space requirements: 500 to 1GB

Memory requirements: Minimum of 512 MB of RAM

Root (vs) Non-root installation

Users/Groups

Page 7: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Root (vs) Non-Root Installations

Page 8: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

USERS/GROUPS

Page 9: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Only one instance can be created under a user name

db2icrt - Create Instance

Syntax:

Location: DB2DIR/instance directory.

Page 10: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Example: db2icrt -u db2fenc1 db2inst1

Page 11: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Removes a DB2 instance that was created by db2icrt.

db2idrop - Drop Instance

Syntax:

You can only drop instances that are listed by db2ilist command

Example: db2idrop db2inst1

Page 12: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Lists all the instances that are created using the db2icrt command

db2ilist - List Instances

Syntax:

$ db2ilist -h

$ db2ilistdb2inst1db2inst2

Gets data from /var/db2/global.reg

db2greg -dump

Page 13: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Login as the DB2 instance owner

db2start - Start Instance

. $DB2_HOME/db2profile

db2start

Page 14: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Login as the DB2 instance owner

db2stop - Stop Instance

Make sure you have all applications disconnected (db2 list applications)

$ db2stop

$ db2stop force (= db2 force application all + db2stop)

$ db2_kill

Page 15: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

$ db2 get instance

$ db2 ? get dbm cfgGET DATABASE MANAGER CONFIGURATION [SHOW DETAIL]

$ db2 get dbm cfg

$ db2 get dbm cfg | grep NUMDB

$ db2 update dbm cfg using NUMDB 10

$ db2 attach to db2inst1

$ db2 get dbm cfg show detail

$ db2 reset dbm cfg

DBM CONFIGURATION

Page 16: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

DB2SET

Page 17: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

IBM DB2 profile registry command

Allows for centralized control of environmental variables

4 Profile registries:- Instance level profile registry [i] (~/sqllib/profile.env)- Global level profile registry [g] (/var/db2/global.reg)- Instance node level profile registry [n] (~/sqllib/nodes/node_number.env)- Instance profile registry (/var/db2/global.reg)

db2set ?db2set -lrdb2setdb2set registry_variable_namedb2set registry_variable_name=db2set registry_variable_name=new_valuedb2set registry_variable_name=new_value -i instance_namedb2set registry_variable_name=new_value -gdb2set registry_variable_name=new_value -i instance_name node_numberdb2set -r registry_variable_namedb2set -r registry_variable_name node_number

Page 18: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Priority of DB2 Env/registry variables:- OS environment set with set/export- Node instance- Instance- Global

To read global profile: db2greg -dump

Detecting DB2 products installed: /usr/local/bin/db2ls *This internally checks global.reg file

SYSIBMADM.REG_VARIABLES admin view:select substr(REG_VAR_NAME,1,35) NAME, substr(REG_VAR_VALUE,1,35) VALUE, LEVEL from SYSIBMADM.REG_VARIABLES

REG_LIST_VARIABLES Table function:SELECT CHAR(REG_VAR_NAME,35) AS REGVAR, CHAR(REG_VAR_VALUE,35) AS VALUE,LEVEL FROM TABLE(REG_LIST_VARIABLES()) AS REG ORDER BY 3,1

Page 19: Online Training in IBM DB2 LUW UDB DBA in Hyderabad

Customizing DB2 CLP prompt:db2set DB2_CLPPROMPT="(Instance: %i, Database: %d):"

Setting history limit:db2set DB2_CLP_HISTSIZE=500

Page 20: Online Training in IBM DB2 LUW UDB DBA in Hyderabad