Administering databases with task assistants

IBM® Data Studio provides dialogs that are called task assistants that help you create and run database administration commands for objects in DB2 for Linux, UNIX, and Windows databases. For example, you can use task assistants to start and stop databases and instances, configure database parameters, reorganize tables and indexes, back up and restore databases or table spaces, and import and export table data.

Before you begin

To run a database administration command for an object, you must have the appropriate permission or authorization for the object, and you must have a connection to the database that contains the object.
For Linux operating systems
Before users who do not have DB2 instance level privileges can use the DB2 client CLP to run commands, including commands for importing, loading, exporting, or unloading tables, the DB2INSTANCE system environment variable must be set.
Note: You must set the DB2INSTANCE system environment variable for each time that you log in or open a command terminal.
To set the DB2INSTANCE system environment variable:
  1. Ensure that the Data Studio client is closed and not running before you run the script.
  2. Set the environment variable at the instance level by running one of the following scripts:
    • For a Bourne or Korn shell, run: db2profile
    • For a C shell, run: db2cshrc
  3. Start IBM Data Studio client.

For detailed information about setting the system environment variable, see the Setting environment variables outside the profile registries on Linux and UNIX operating systems topic in the IBM DB2 online information for your version of the DB2 database.

Procedure

To open the task assistant for the command, specify additional settings for the command, and run the generated commands, complete the following steps:

  1. Find the object that you want to work with. You can find the object either in the Administration Explorer or the Object List.
    Table 1. Which view to use to find objects
    View and objects Example
    Administration Explorer

    Hosts
    Instances
    Databases

    From the Administration Explorer, you can open a task assistant for hosts, instances, and databases.
    Figure 1. Example of the Administration Explorer
    Partial picture of Administration Explorer that shows hosts, instances, and databases
    Object List

    Databases
    Table spaces
    Indexes
    Views
    Aliases
    Packages

    When you click a database or a data object folder in the Administration Explorer, the list of objects is displayed in the Object List.
    Figure 2. Example of selecting the Table Spaces folder to display the table spaces in the Object List
    Partial picture of the Administration Explorer with Table Spaces folder selected and the list of objects being displayed in the Object List.
    Tip: If the Object List is already open for the database, you can use the drop-down arrow that is displayed after the database name in navigation breadcrumb trail to display other objects in the Object List.
    Figure 3. Example of using a drop-down arrow in the Object List to select other objects to display
    Partial picture of Object List. From the database in the breadcrumb trail, the list of children objects in the database is displayed.
  2. Right-click the object and select the command to run from the context-sensitive menu.
    For example, the following figure shows how to back up the GSDB database.
    Figure 4. Example of the context-sensitive menu for databases and selecting to back up a database
    A graphic that shows right-clicking GSDB in the Administration Explorer, clicking Back Up and Restore in the first context menu, and clicking Back Up in the second context menu.
    The task assistant opens for the database administration task that you selected. Each task assistant has four sections: Connection, Settings, Command, and Messages. The following graphic shows how the Connection, Command, and Messages sections are expandable. The Settings section is always expanded.
    Figure 5. Example of a task assistant with its four sections
    A graphic of a task assistant with its four sections.
  3. In the Settings section, specify the options for the command:
    1. Click each of the tabs to step through the process of specifying the settings and options to use in the command.
    2. Click Preview Command to shift down to and expand the Command section, where the generated commands that are based on the options that you specified are displayed.

    For example, the following figure shows selecting the Backup Performance tab to specify options that improve the performance of the backup operation.

    Figure 6. Example of selecting a tab and specifying options on that tab
    A graphic that shows the Backup Performance tab for the Backup task assistant.
  4. In the Command section, review the commands that were generated and then run them.
    Figure 7. Example of the commands being displayed in the Command section
    Graphic of the Command section of a task assistant with the generated commands displayed.

    If you are satisfied with the displayed commands, click Run to run them.

    Tip: In some cases, you might want to edit the displayed commands. Click Edit to open the SQL and XQuery editor where you can edit and run the commands. You might also want to schedule a time to run the commands. For more information, see Scheduling command scripts.

    The focus of the task assistant shifts to the Messages section.

  5. In the Messages section, monitor the progress of the commands that are being run in the progress bar and review any messages that are issued.
    Figure 8. Example of the Messages section while the commands are being run
    A graphic of the Messages section while the commands are being run.

    To view detailed information about any command that does not run successfully, click the message number or SQL code that is displayed.

Results

The commands to perform your database administration task were run.

Feedback