Home » DB2 Create Database

DB2 Create Database

by Online Tutorials Library

DB2 Create Database

CREATE DATABASE command is used to create a database in an instance. All databases are created with the default storage group “IBMSTOGROUP”, which is created at the time of creating an instance.

In DB2, all the database tables are stored in “tablespace”, which use their respective storage groups.


Create Non-restrictive Database

db2 create database command is used to create a non-restrictive database.

Syntax:

Example:

After installation, you have to switch to that user to have rights to create a new database. Depending on the version you installed, that username might be changed. But DB2 uses db2inst1 by default as administrator user.

Check your /home directory. You will see a new user(most probably db2inst1). Then switch to that user with:

then issue:

Create Database


Creating restrictive database

A restrictive database can be created by using the following command:

Let’s create a restrictive database named “XYZ2”

Create Database

Next TopicActivate Database

You may also like