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

If you are on a Windows 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 a database.
    2. Right-click the instance, and click New Database.
    3. Select the connection profile information to use for the new database, and click OK.
    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.

    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, specify the instance location as /home/db2inst1/GSDB. In addition, change the Default buffer pool and table space page size to 32 KB.

  3. Click the Storage Paths tab. On the Storage Method tab within this tab, ensure that Manage storage automatically with DB2 is selected, and ensure that the check box for Use the database path for the storage path is selected.
  4. 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.
  5. Click the Locale tab. Accept the default values on this page for database locale and collating sequence.
  6. Click the Preview Command link above the set of tabs and scroll down to the Command section. The following commands are generated:
    CREATE DATABASE GSDBDEV AUTOMATIC STORAGE YES ON 'C:\GSDB' DBPATH 
    ON 'C:\GSDB' USING CODESET UTF-8 TERRITORY US 
    COLLATE USING System PAGESIZE 32 K ;
  7. 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.
  8. Click Run to create the database.
  9. In the Messages section, monitor the progress of running the commands, 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 on the newly created database in the Administration Explorer and click Manage Databases > Configure Automatic Maintenance.

Feedback