SlideShare a Scribd company logo
1 of 20
DB2 for Linux, Unix, and
Windows
- Ravi
What is a Database Manager?
AGENDA!
Installation pre-requisites
CREATE/DROP
START/STOP
DBM Configuration
db2set command
db2 CLP history
Q&A
Logical database manager environment where we catalog databases and set configuration
parameters
Definition: DBM/Instance
Instance = Database(s) + Processes/Threads
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
Root (vs) Non-Root Installations
USERS/GROUPS
Only one instance can be created under a user name
db2icrt - Create Instance
Syntax:
Location: DB2DIR/instance directory.
Example: db2icrt -u db2fenc1 db2inst1
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
Lists all the instances that are created using the db2icrt command
db2ilist - List Instances
Syntax:
$ db2ilist -h
$ db2ilist
db2inst1
db2inst2
Gets data from /var/db2/global.reg
db2greg -dump
Login as the DB2 instance owner
db2start - Start Instance
. $DB2_HOME/db2profile
db2start
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
$ db2 get instance
$ db2 ? get dbm cfg
GET 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
DB2SET
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 -lr
db2set
db2set registry_variable_name
db2set registry_variable_name=
db2set registry_variable_name=new_value
db2set registry_variable_name=new_value -i instance_name
db2set registry_variable_name=new_value -g
db2set registry_variable_name=new_value -i instance_name node_number
db2set -r registry_variable_name
db2set -r registry_variable_name node_number
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
Customizing DB2 CLP prompt:
db2set DB2_CLPPROMPT="(Instance: %i, Database: %d):"
Setting history limit:
db2set DB2_CLP_HISTSIZE=500
2 db2 instance creation

More Related Content

What's hot

Less04 database instance
Less04 database instanceLess04 database instance
Less04 database instance
Amit Bhalla
 

What's hot (20)

A DBA’s guide to using TSA
A DBA’s guide to using TSAA DBA’s guide to using TSA
A DBA’s guide to using TSA
 
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
 
DB2 and storage management
DB2 and storage managementDB2 and storage management
DB2 and storage management
 
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
 
Ibm db2
Ibm db2Ibm db2
Ibm db2
 
Introduction of ISPF
Introduction of ISPFIntroduction of ISPF
Introduction of ISPF
 
Building Your Data Warehouse with Amazon Redshift
Building Your Data Warehouse with Amazon RedshiftBuilding Your Data Warehouse with Amazon Redshift
Building Your Data Warehouse with Amazon Redshift
 
Ms sql-server
Ms sql-serverMs sql-server
Ms sql-server
 
DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1DB2 Interview Questions - Part 1
DB2 Interview Questions - Part 1
 
DB2 for z/OS Bufferpool Tuning win by Divide and Conquer or Lose by Multiply ...
DB2 for z/OS Bufferpool Tuning win by Divide and Conquer or Lose by Multiply ...DB2 for z/OS Bufferpool Tuning win by Divide and Conquer or Lose by Multiply ...
DB2 for z/OS Bufferpool Tuning win by Divide and Conquer or Lose by Multiply ...
 
MariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and OptimizationMariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and Optimization
 
SKILLWISE-DB2 DBA
SKILLWISE-DB2 DBASKILLWISE-DB2 DBA
SKILLWISE-DB2 DBA
 
Db2 Important questions to read
Db2 Important questions to readDb2 Important questions to read
Db2 Important questions to read
 
Que es MongoDB
Que es MongoDBQue es MongoDB
Que es MongoDB
 
MongoDB: la BBDD NoSQL más popular del mercado
MongoDB: la BBDD NoSQL más popular del mercadoMongoDB: la BBDD NoSQL más popular del mercado
MongoDB: la BBDD NoSQL más popular del mercado
 
Best practices for DB2 for z/OS log based recovery
Best practices for DB2 for z/OS log based recoveryBest practices for DB2 for z/OS log based recovery
Best practices for DB2 for z/OS log based recovery
 
Less04 database instance
Less04 database instanceLess04 database instance
Less04 database instance
 
Physical architecture of sql server
Physical architecture of sql serverPhysical architecture of sql server
Physical architecture of sql server
 
Vsam
VsamVsam
Vsam
 
NoSQL
NoSQLNoSQL
NoSQL
 

Similar to 2 db2 instance creation

NEDb2UG_Db2 13 for zOS install and migration using zOSMF workflows_032223.ppt
NEDb2UG_Db2 13 for zOS install and migration using zOSMF workflows_032223.pptNEDb2UG_Db2 13 for zOS install and migration using zOSMF workflows_032223.ppt
NEDb2UG_Db2 13 for zOS install and migration using zOSMF workflows_032223.ppt
MuraleedharanTV2
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
Deepti Singh
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
Deepti Singh
 
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
 

Similar to 2 db2 instance creation (20)

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
 
Herd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration managementHerd your chickens: Ansible for DB2 configuration management
Herd your chickens: Ansible for DB2 configuration management
 
Asian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On UblAsian Spirit 3 Day Dba On Ubl
Asian Spirit 3 Day Dba On Ubl
 
S3 l3 db2 environment - instances
S3 l3   db2 environment - instancesS3 l3   db2 environment - instances
S3 l3 db2 environment - instances
 
Setup oracle golden gate 11g replication
Setup oracle golden gate 11g replicationSetup oracle golden gate 11g replication
Setup oracle golden gate 11g replication
 
MySQL for Oracle DBAs
MySQL for Oracle DBAsMySQL for Oracle DBAs
MySQL for Oracle DBAs
 
DBA Basics guide
DBA Basics guideDBA Basics guide
DBA Basics guide
 
Oracle data guard configuration in 12c
Oracle data guard configuration in 12cOracle data guard configuration in 12c
Oracle data guard configuration in 12c
 
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...
OSMC 2019 | Use Cloud services & features in your redundant Icinga2 Environme...
 
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
Analyze corefile and backtraces with GDB for Mysql/MariaDB on Linux - Nilanda...
 
NEDb2UG_Db2 13 for zOS install and migration using zOSMF workflows_032223.ppt
NEDb2UG_Db2 13 for zOS install and migration using zOSMF workflows_032223.pptNEDb2UG_Db2 13 for zOS install and migration using zOSMF workflows_032223.ppt
NEDb2UG_Db2 13 for zOS install and migration using zOSMF workflows_032223.ppt
 
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
 
FOSDEM'17: Disaster Recovery Management with ReaR (relax-and-recover) & DRLM ...
FOSDEM'17: Disaster Recovery Management with ReaR (relax-and-recover) & DRLM ...FOSDEM'17: Disaster Recovery Management with ReaR (relax-and-recover) & DRLM ...
FOSDEM'17: Disaster Recovery Management with ReaR (relax-and-recover) & DRLM ...
 
Windows Server 2008 (Active Directory Yenilikleri)
Windows Server 2008 (Active Directory Yenilikleri)Windows Server 2008 (Active Directory Yenilikleri)
Windows Server 2008 (Active Directory Yenilikleri)
 
Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
 
MariaDB training
MariaDB trainingMariaDB training
MariaDB training
 
Oracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid cloneOracle applications 11i hot backup cloning with rapid clone
Oracle applications 11i hot backup cloning with rapid clone
 
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
 

More from Ravikumar Nandigam

Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in HyderabadOnline Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
Ravikumar Nandigam
 

More from Ravikumar Nandigam (11)

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
 
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
 
Online Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in HyderabadOnline Training in Unix Linux Shell Scripting in Hyderabad
Online Training in Unix Linux Shell Scripting in Hyderabad
 
2 db2 instance creation
2 db2 instance creation2 db2 instance creation
2 db2 instance creation
 
Managing user Online Training in IBM Netezza DBA Development by www.etraining...
Managing user Online Training in IBM Netezza DBA Development by www.etraining...Managing user Online Training in IBM Netezza DBA Development by www.etraining...
Managing user Online Training in IBM Netezza DBA Development by www.etraining...
 
IBM DB2 LUW UDB DBA Training by www.etraining.guru
IBM DB2 LUW UDB DBA Training by www.etraining.guruIBM DB2 LUW UDB DBA Training by www.etraining.guru
IBM DB2 LUW UDB DBA Training by www.etraining.guru
 
Course content (netezza dba)
Course content (netezza dba)Course content (netezza dba)
Course content (netezza dba)
 
IBM DB2 LUW UDB DBA Online Training by Etraining Guru In Hyderabad
IBM DB2 LUW UDB DBA Online Training by Etraining Guru In HyderabadIBM DB2 LUW UDB DBA Online Training by Etraining Guru In Hyderabad
IBM DB2 LUW UDB DBA Online Training by Etraining Guru In Hyderabad
 
IBM DB2 LUW/UDB DBA Training by www.etraining.guru
IBM DB2 LUW/UDB DBA Training by www.etraining.guruIBM DB2 LUW/UDB DBA Training by www.etraining.guru
IBM DB2 LUW/UDB DBA Training by www.etraining.guru
 
data loading and unloading in IBM Netezza by www.etraining.guru
data loading and unloading in IBM Netezza by www.etraining.gurudata loading and unloading in IBM Netezza by www.etraining.guru
data loading and unloading in IBM Netezza by www.etraining.guru
 
Netezza Online Training by www.etraining.guru in India
Netezza Online Training by www.etraining.guru in IndiaNetezza Online Training by www.etraining.guru in India
Netezza Online Training by www.etraining.guru in India
 

2 db2 instance creation

  • 1. DB2 for Linux, Unix, and Windows - Ravi
  • 2. What is a Database Manager? AGENDA! Installation pre-requisites CREATE/DROP START/STOP DBM Configuration db2set command db2 CLP history Q&A
  • 3. Logical database manager environment where we catalog databases and set configuration parameters Definition: DBM/Instance
  • 4. Instance = Database(s) + Processes/Threads
  • 5.
  • 6. 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
  • 7. Root (vs) Non-Root Installations
  • 9. Only one instance can be created under a user name db2icrt - Create Instance Syntax: Location: DB2DIR/instance directory.
  • 10. Example: db2icrt -u db2fenc1 db2inst1
  • 11. 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
  • 12. Lists all the instances that are created using the db2icrt command db2ilist - List Instances Syntax: $ db2ilist -h $ db2ilist db2inst1 db2inst2 Gets data from /var/db2/global.reg db2greg -dump
  • 13. Login as the DB2 instance owner db2start - Start Instance . $DB2_HOME/db2profile db2start
  • 14. 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
  • 15. $ db2 get instance $ db2 ? get dbm cfg GET 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
  • 17. 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 -lr db2set db2set registry_variable_name db2set registry_variable_name= db2set registry_variable_name=new_value db2set registry_variable_name=new_value -i instance_name db2set registry_variable_name=new_value -g db2set registry_variable_name=new_value -i instance_name node_number db2set -r registry_variable_name db2set -r registry_variable_name node_number
  • 18. 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
  • 19. Customizing DB2 CLP prompt: db2set DB2_CLPPROMPT="(Instance: %i, Database: %d):" Setting history limit: db2set DB2_CLP_HISTSIZE=500

Editor's Notes

  1. http://www.ibm.com/developerworks/data/library/techarticle/dm-0509poon/
  2. Instance = Database(s) + Processes/Threads
  3. Instance view: A bit more detailed!
  4. Pre-requisites as of DB2 9.7!
  5. Instance IDs should not be root or have password expired.
  6. DB2DIR: DB2 installed location. You can find this using db2ls command http://www-01.ibm.com/support/knowledgecenter/SSEPGG_10.5.0/com.ibm.db2.luw.qb.server.doc/doc/c0050566.html The instance directory stores all information that pertains to a database instance. You cannot change the location of the instance directory once it is created. The directory contains: The database manager configuration file (db2systm) The system database directory The node directory The node configuration file (db2nodes.cfg) Any other files that contain debugging information, such as the exception or register dump or the call stack for the DB2 database processes. The installation process creates a default DB2 instance, which is defined by the DB2INSTANCE environment variable. However, instances can be created/dropped after installation.
  7. Auto starting Instances: db2iauto -on instance_name On LUW, an instance created by using db2icrt is set as a manual start.
  8. ps -ef | grep ^db2inst1 | egrep -v "bash|sshd|grep"
  9. ps -ef | grep ^db2inst1 | egrep -v "bash|sshd|grep“ reset dbm cfg: Resets the DBM configuration file to its default values Location of DBM CFG file: ./sqllib/db2systm Link: https://www.columbia.edu/sec/acis/db2/db2d0/db2d0160.htm
  10. Instance node level profile registry: For partitioned databases **** To display help information for the command, use: db2set ? To list the complete set of all supported registry variables, use: db2set -lr To list all currently defined registry variables for this session, use: db2set To show the current session value of a registry variable, use: db2set registry_variable_name To delete the current session value of a registry variable, use: db2set registry_variable_name= To change a registry variable for this session only, use: db2set registry_variable_name=new_value To change a registry variable default for all databases in the instance, use: db2set registry_variable_name=new_value -I instance_name To change a registry variable default for all instances in the system, use: db2set registry_variable_name=new_value -g Note:The two parameters "-I" and "-G" cannot be used at the same time in the same command. To change a registry variable default for a particular node in an instance, use: db2set registry_variable_name=new_value -i instance_name node_number To reset all registry variables for an instance back to the defaults found in the Global Profile Registry, use: db2set -r registry_variable_name To reset all registry variables for a node in an instance back to the defaults found in the Global Profile Registry, use: db2set -r registry_variable_name node_number ***
  11. Instance node level profile registry: For partitioned databases **** To display help information for the command, use: db2set ? To list the complete set of all supported registry variables, use: db2set -lr To list all currently defined registry variables for this session, use: db2set To show the current session value of a registry variable, use: db2set registry_variable_name To delete the current session value of a registry variable, use: db2set registry_variable_name= To change a registry variable for this session only, use: db2set registry_variable_name=new_value To change a registry variable default for all databases in the instance, use: db2set registry_variable_name=new_value -I instance_name To change a registry variable default for all instances in the system, use: db2set registry_variable_name=new_value -g Note:The two parameters "-I" and "-G" cannot be used at the same time in the same command. To change a registry variable default for a particular node in an instance, use: db2set registry_variable_name=new_value -i instance_name node_number To reset all registry variables for an instance back to the defaults found in the Global Profile Registry, use: db2set -r registry_variable_name To reset all registry variables for a node in an instance back to the defaults found in the Global Profile Registry, use: db2set -r registry_variable_name node_number ***
  12. %ia: If instance attachment exists, the authid of the current instance attachment; otherwise a null string %i: Local alias of instance %da: If database connection exists, the authid. Else, null string %d: Database aliase %n: New line character