Scenario: Creating a database

You work for a large enterprise company as a database administrator and you have been asked to create a new development database.

Before you begin

You must be creating a database on a DB2 for Linux, UNIX, and Windows server. If you are on a Windows operating system and want to specify a database location that is more than just a letter drive, the DB2® registry variable DB2_CREATE_DB_ON_PATH must be set to YES.

Procedure

To create a database, complete the following steps:

  1. Open the task assistant for creating a database:
    1. In the Administration Explorer, drill down to the instance in which you want to create the database.
    2. Right-click the instance, and click New Database.
    3. Enter the instance connection information as necessary, and click Finish.
    Tip: If you are creating the first database in an instance, complete the following steps to specify the instance details. After you specify the instance details, the task assistant for creating a database opens.
    1. On the toolbar of the Administration Explorer, click the drop-down button for New and click New Database. The New Database wizard starts.
    2. Verify that DB2 for Linux, UNIX, and Windows is selected, and click Next.
    3. Enter the details for the instance, and click Finish.
  2. On the Details tab, enter a name for the database. Specify GSDBDEV as the name. All of the other fields in the task assistant are optional or have default values.

    On Windows, the location must be a valid database path, which includes a drive letter and can be as simple as just a letter drive. On Linux or UNIX, the location must be a valid location, which can be a simple as the instance user's home directory. Specifying a location is optional. If you do not specify a location, the database is created on the default database path.

    For this scenario, if you are on Windows, specify the database path as c:\GSDB and ensure that the path already exists. If you are on Linux and assuming that the instance name is db2inst1, specify the instance location as /home/db2inst1/GSDB. In addition, change the value in the Default buffer pool and table space page size field to 32 KB.

  3. Specify storage settings:
    1. Click the Storage tab.
    2. On the Storage Method tab within this tab, ensure that Manage storage automatically with DB2 is selected. The check box for Use the database path for the storage path is automatically selected.
    3. Also on the Storage Paths tab, define how the storage should be managed for user tables, the system table catalog, and temporary tables by clicking each of the three other tabs at the top of the Storage Paths tab. For this scenario, accept the default to use automatic storage and the other defaults on each page.
  4. Preview the command that is generated:
    1. Click the Preview Command link above the set of tabs. The focus automatically shifts to and expands the Command section. The following command is generated:
      CREATE DATABASE GSDBDEV AUTOMATIC STORAGE YES ON 'C:\GSDB' DBPATH 
      ON 'C:\GSDB' PAGESIZE 32 K ;
    2. Review the commands that were generated based on the specified settings. If you want to change the commands, click back through the tabs. Review the commands again in the Command section. The commands are automatically refreshed after you make any changes.
  5. Click Run to create the database.
  6. In the Messages section, monitor the progress of running the command and review any messages that are issued.

What to do next

You can set up automatic maintenance activities on the database. To display the task assistant that guides you through setting up the automatic maintenance options, right-click the newly created database in the Administration Explorer and click Manage Databases > Configure Automatic Maintenance.

Feedback