DB2 Database

Aditi Dosi
2 min readAug 26, 2022

--

Db2 is a family of data management products, including database servers, developed by IBM. They initially supported the relational model, but were extended to support object–relational features and non-relational structures like JSON and XML.

Database 2, is a set of relational database products built and offered by IBM. Relational databases enable enterprises to create declarative data models accessible via queries. For this purpose, IBM invented the popular and now standardized Structured Query Language (SQL).

Why DB2 is called DB2?

The name DB/2 originally referred to IBM’s shift from a hierarchical database model to the relational database model. IBM rebranded the line of database products Db2 in 2017.

Connecting to database

After creating a database, to put it into use, you need to connect or start database.

Syntax:

db2 connect to <database name>

Example: [To Connect Database one to current CLI]

db2 connect to one

Output:

Database Connection Information  
Database server = DB2/LINUXX8664 10.1.0
SQL authorization ID = DB2INST4
Local database alias = ONE

Verifying if database is restrictive

To check if this database is restrictive or not, here is the syntax:

Syntax: [In the following syntax, ‘db’ indicates Database, ‘cfg’ indicates configuration, ‘db_name’ indicates database name]

db2 get db cfg for <db_name> | grep -i restrict

Example: [To check if ‘one’ database is restricted or not]

db2 get db cfg for one | grep -i restrict

Output:

Restrict access                       = NO

Estimating space required for database

To estimate the size of a database, the contribution of the following factors must be considered:

  • System Catalog Tables
  • User Table Data
  • Long Field Data
  • Large Object (LOB) Data
  • Index Space
  • Temporary Work Space
  • XML data
  • Log file space
  • Local database directory
  • System files

--

--