The steps for generating a database are as follows:
This involves tasks such as creating views, granting access to DB2 Server for VSE facilities, and acquiring dbspaces for system use.
Once the database is generated, you can do the following:
These steps are all described in detail below.
Update your DBNAME directory to add the new database. See Setting Up the DBNAME Directory.
To define the VSAM data sets for the new database, run the VSAM utility program IDCAMS. The specific DEFINEs will depend on your requirements. At a minimum, however, you must define data sets for:
The ARIS71CD procedure shown in Figure 87 provides an example of the job control statements to define a VSAM user catalog and data sets for a database. This database has one directory, one log, and one dbextent. In the example, they will reside on an IBM 3380 DASD device.
Note: | The VSAM keywords shown here are only the basic ones that the database manager requires. Other keywords and options that you can use are described in the Using VSE/VSAM Commands and Macros manual. |
Figure 87. Job ARIS71CD (Defining VSAM Data Sets for the Database)
Notes:
We recommend that you use a VSAM user catalog for the new database. If you choose not to, you must do the following:
You may also wish to password-protect your database with the VSAM password protection facility. See Protecting VSAM Data Sets.
The directory for the database is defined as part of a VSAM services job that creates the initial set of database data sets. Figure 88 shows another example of defining a directory data set. Figure 87 shows the complete job.
Figure 88. Defining the Directory Data Set
DEFINE CLUSTER (NAME (SQL.BDISK.DBNAME01.DB) - CNVSZ (512) - CYL (6) - NONINDEXED - VOL (volid1) - RECSZ (505 505) - REUSE - SHR (2) ) - CAT (SQLCAT01) |
Notes:
Each time the database manager (program ARISQLDS) is run, the following job controls are needed:
During the initial installation of the database manager, two procedures are defined that contain the needed LIBDEF statements:
It is recommended that you also use catalogued procedures for the other job controls, to avoid having to maintain multiple copies of them. Because procedures for the libraries are cataloged during installation, you only need to catalog the DLBL statements that identify the new database. You also should catalog the job control statements needed for the trace, database archive, log archive, and accounting facilities.
Database archiving and log archiving can be directed only to tape, so for these activities, you must use TLBL statements. Trace output and accounting output can be directed to either DASD or tape. For information on specifying job control statements for the trace output file, see the DB2 Server for VSE & VM Operation manual; for information on accounting job control statements, see Setting Up a Job Control for the Accounting Files.
Figure 89 shows an example of the job control statements needed for cataloging the database.
Figure 89. Job for Cataloging Database Job Control
Notes:
It is recommended that you do not specify any VOLID parameter on the TLBL statements for log archiving. Because multiple files can be created or read during the same run of the database manager, you would want different VOLIDs for the different files.
To generate a database, modify and run the job control shown in Figure 90 in single user mode (SYSMODE=S). This will run IBM-supplied procedures to do the following:
Figure 90. Example of a Job Control for Generating Your Own Database
Notes:
The member ARISDBU enables you to perform the following:
Note: | You should not drop the dbspaces or tables that are acquired and created above, even if you are not installing the corresponding facilities. Certain database maintenance operations assume that these tables and dbspaces exist in the database. |
The input (SYSIPT) control statements for the database generation program are divided into three sets of input records, separated by END delimiter control statements. These specify:
You must also specify the internal dbspaces for the database. You can change the specification of internal dbspaces on any ADD DBSPACE operation. For information, see Adding Dbspaces to the Database.
The details of specifying these database generation control statements are described below.
The format for specifying the database generation keyword control statements is:
>>-CUREXTNT=nnn---+--------------+---+--------------+-----------> '-MAXPOOLS=nnn-' '-MAXEXTNT=nnn-' >-----+--------------+--END------------------------------------>< '-MAXDBSPC=nnn-' |
CUREXTNT specifies the number of dbextents being defined in the database generation. You must specify it; it has no default value. Its value can be from 1 to 999, and must match the number of dbextent definition control statements. You must also have DLBL statements for all the dbextents being defined (in your DBNAME01 procedure). In the example shown in Figure 90, CUREXTNT=2 indicates that two dbextents are being defined.
MAXPOOLS specifies the maximum number of storage pools that can ever be defined for the database. Its value can range from 1 to 999. The default is 32. In the example in Figure 90, the default is used.
MAXEXTNT specifies the maximum number of dbextents that can ever be defined for the database. Its value can range from 1 to 999. The default is 64. In the example in Figure 90, it is set to 200.
MAXDBSPC specifies the maximum number of dbspaces that can ever be defined for the database. Its value can range from the number you specify in your database generation control statements to 32000. The default is 1000. In the example in Figure 90, it is explicitly set to 1000.
The keyword control statements must be coded in columns 1-71. Column 72 is a continuation column, and columns 73-80 are ignored. If you specify more than one keyword control statement on a single input record, separate them with blanks.
The control statement format for specifying the initial storage pools and dbextents is:
.-,------------------------------------. V | >>----+--------------------------------+--+---------------------> | .-LOG---. | '-POOL-pool_number----+-------+--' '-NOLOG-' .-.--------------------------------. V | >--------extent_number-+-------------+---+--END---------------->< '-pool_number-' |
Include the POOL control statement only for those storage pools you want to define as nonrecoverable: if you omit it, the pool will be defined as recoverable. You can specify as many nonrecoverable storage pools as you want, up to the MAXPOOLS value. For more information, see Nonrecoverable Storage Pools.
pool_number
The value for pool_number is the number of the storage pool. You cannot specify 1 because storage pool 1 is the default storage pool for dbspaces, so it cannot be defined as nonrecoverable.
LOG
The LOG option, which indicates that the storage pool is to be recoverable, is the default. Specify the NOLOG option if the storage pool is to be nonrecoverable.
extent_number/pool_number
The dbextent definition control statements follow the POOL statements. They define an initial set of dbextents (by number), and the storage pool assignment for each.
The first number in the pair is the extent number, which corresponds to the suffix number in the file name of the dbextent data sets (DDSKn). You must use stylized file names on the DLBL statements describing the dbextents. The file name is DDSKn, where n is the extent number used in the dbextent definition record. You must define the dbextents in consecutive (numeric) order by extent number.
The second number, which must be separated from the first by at least one blank, is the storage pool number. If you do not specify the storage pool number, it defaults to 1.
Note: | You cannot assign a dbspace to a storage pool until a dbextent has been assigned to it. |
Each extent number/storage pool number pair must be entered on a separate input record. You can put comments on the dbextent control statements, by specifying the storage pool number and separating the comment from the number by at least one blank. A comment must be contained in the one input record for the dbextent: it cannot be continued on the next input record, which is interpreted as the next dbextent definition.
In the example in Figure 90, dbextent number 1 (DDSK1) is assigned to storage pool number 1, and dbextent number 2 (DDSK2) is assigned to storage pool number 2.
The format is:
.-1-------------------. >>-+-PUBLIC-------+--number_of_pages----+---------------------+->< '-+---------+--' '-storage_pool_number-' '-PRIVATE-' |
The number_of_pages value is the number of logical pages in the dbspace, rounded up to the next higher multiple of 128. The storage_pool_number value must correspond to a pool that already has a dbextent defined for it, as defined by the dbextent control statements.
You must define five public dbspaces for system use: the catalog dbspace, package, HELP text, ISQL tables, and sample tables dbspaces. In the example shown in Figure 90, all are assigned to storage pool 1, but you can assign them elsewhere. The catalog and package dbspaces must always be assigned to a recoverable storage pool. In the example in Figure 90, the first five dbspace control statements specify:
The general format for specifying the initial internal dbspace control statement is:
>>-INTERNAL--number_of_dbspaces--number_of_pages----------------> .-1-------------------. >-----+---------------------+---------------------------------->< '-storage_pool_number-' |
This statement specifies the number (number_of_dbspaces) of equal size (number_of_pages) temporary dbspaces that the database manager can use for internal sorting and index creation. The storage_pool_number must correspond to a pool that already has a dbextent in it, as defined by the dbextent control statements. You must not delete the last dbextent from the storage pool that contains the internal dbspaces. The storage pool to which you assign the internal dbspaces can be either recoverable or nonrecoverable: if you do not specify the storage pool number, it defaults to 1.
This internal dbspace keyword control statement must be the last dbspace definition input record before the END delimiter control statement. Separate the values you specify in this statement by at least one blank.
In the example in Figure 90, 80 internal dbspaces of 1024 pages each are defined and assigned to storage pool 1.
Note: | Because the catalog and package dbspaces are assigned to storage pool 1, performance is improved if you assign the internal dbspaces to some other recoverable storage pool. In this example, they are assigned to storage pool 1, just to keep things simple. |
Generally speaking, your input records for initial dbspace definitions would follow this pattern:
Figure 91. Input Records for Initial Dbspace Definitions
The first two dbspaces are public dbspaces: PUBLIC.SYS0001 and PUBLIC.SYS0002, which are both defined and acquired by the generation process for the catalog tables and for the packages, respectively. You are advised to change these control statements only if you want to define and allocate a larger dbspace for the catalog tables or for the package dbspace, respectively. To do this, increase the number_of_pages value in the control statement.
The third, fourth, and fifth dbspaces are public dbspaces that are added by the generation process. They are later acquired when procedure ARIS050D calls the DBS utility to complete the generation of the database. As shown in Figure 90, procedure ARIS050D must be called whenever you generate a database.
Note: | The fifth dbspace, PUBLIC.SAMPLE, is also added by the generation process. It is used to hold the IBM-supplied sample data tables. These tables are created and loaded during the last run of the DBS utility, when the A-type members ARISAMDB and ARISAMPI are processed. Details of ARISAMDB and ARISAMPI are provided in the DB2 Server for VSE Program Directory manual. The data in the sample tables is manipulated by sample application programs, which are called by the IBM-supplied job control members. There is one sample program for each programming language that the database manager supports. Details of these programs are in the DB2 Server for VSE & VM Application Programming manual. |
You must specify database generation control statements for all five of these dbspaces. If you omit one, the database generation may fail.
Code the dbspace values in columns 1-71. Columns 72-80 are ignored. You can put comments on the dbspace statements by specifying the storage pool number and separating the comment from this number by at least one blank.
After the database is generated, you can install these three components into it:
All of these components are optional; which ones you should install depends on your usage environment. For example, in a query/report writing environment, you should install all three.
Regardless of whether you use these components, you can still install all of them into the database for possible future use. Figure 92 shows job control statements that install all the optional components into the DBNAME01 database. Modify the job control and run it to install the components into your database. (The database manager must be running in single user mode.)
Figure 92. Job Control to Install Optional Database Components
Notes:
HELP text is loaded from the Help Text Tape, which must be mounted on the tape drive identified by the value assigned to the cuu parameter.
HELP text is available in other languages as well. To load HELP text for a language other than American English, replace the value for the LANG parameter in the PROC ARIS380D with one of the following values.
Refer to the installation instructions in the DB2 Server for VSE Program Directory manual.
If the online support is not required for your database, omit the job control statements for procedures ARIS080D, ARIS110D, ARIS120D, and ARIS130D.
After making the necessary job control modifications, submit the job for processing. All steps should end with a return code of 0 or 4. If any step fails to run, remove the EXEC PROC statements for all job steps that completed, and rerun the job. However, do not remove the database identification procedure or the library definition procedure (DBNAME01 and ARIS71SL). For example, if the step EXEC PROC=ARIS130D did not complete successfully, you can rerun the step by running the job control shown in Figure 93:
Figure 93. Job Restart for Installing Optional Components
// JOB RESTART // EXEC PROC=DBNAME01 *--YOUR DATABASE IDENTIFICATION PROCEDURE // EXEC PROC=ARIS71SL *--SERVICE/PRODUCTION LIBRARY ID // EXEC PROC=ARIS130D *--INSTALL ISQL /& |
The database manager and online resource manager use CCSID-related phases for validating and folding characters in SQL statements. The programs used to create these phases depend on packages residing in the database. The job control in Figure 94 can be used to load the package in the new database.
Figure 94. Job Reload for Loading CCSID-Related Phases Package
The application server default CHARNAME value on a newly installed database manager is INTERNATIONAL (CCSID=500). On a migrated database manager, the default is ENGLISH (CCSID=37). To change the application server default CHARNAME (and with it the application server default CCSID, classification tables, and translation tables), specify the new CHARNAME initialization parameter.
For information on creating a new CHARNAME, CCSID, and character set, see Chapter 12, Choosing a National Language and Defining Character Sets.
If you use mixed character data (which contains DBCS and SBCS characters), you may want to change the application server default character subtype (CHARSUB) to mixed. The application server default character subtype is the value used for new columns when the character subtype is not explicitly defined by the CREATE TABLE or ALTER TABLE statements, or supplied as a package option. The character subtype value is also used to determine whether the results of the CHAR, DIGITS, and HEX scalar functions and the character representation of date, time, or timestamp values, or special registers should be interpreted either as mixed data or as SBCS data.
The application server default character subtype is initially set to SBCS.
For information on changing the default character subtype, see Setting the Application Server Default Character Subtype.
If you are using a double-byte character set (DBCS), you should enable the DBCS option, which allows the database manager to correctly interpret SQL statements that contain DBCS strings. As a default, the DBCS option is not enabled. For information, see Using Double-Byte Character Set (DBCS).
One final task you should not omit is to change the password for the authorization ID SQLDBA in your new database. The authorization ID SQLDBA is defined in all databases to have DBA authority. The password is set to SQLDBAPW during database generation. Because this default password for SQLDBA is common knowledge (it is in many product manuals), you should change it immediately after database generation. To do so, use ISQL, an application program, or the DBS utility to connect to the database manager as SQLDBA with the following statement:
CONNECT SQLDBA IDENTIFIED BY SQLDBAPW
Then change the password to one of your own choosing with the following statement:
GRANT CONNECT TO SQLDBA IDENTIFIED BY newpw
A DRDA environment provides the application server capability for remote unit of work access to data that is distributed across different installations. For more information on installing this code, see Chapter 14, Using a DRDA Environment.
The VSE shared virtual area (SVA) allows the DB2 Server for VSE code to be shared. This sharing can reduce the amount of storage required by the database partitions, and reduces the amount of paging done by the system. You can load the eligible phases into the shared virtual area.
Table 16 shows the phases that are eligible to be loaded into the
shared virtual area.
Table 16. Phases Eligible for SVA
Component | Phase |
---|---|
DBSS | ARISQLDS |
RDS | ARIXRDS |
DBSU | ARIDBS |
Batch Resource Adapter | ARIRBARM |
DBNAME Directory | ARICDIRD |
Assembler Preprocessor | ARIPRPA |
COBOL Preprocessor | ARIPRPC |
FORTRAN Preprocessor | ARIPRPF |
PL/I Preprocessor | ARIPRPP |
Notes:
The DRRM and WUM components are only applicable if the DRDA code is installed.
Phases can be loaded into the shared virtual area in the following ways:
The SET SDL command must always be issued from the background partition. Once the phases have been loaded, they cannot be purged until the next VSE system IPL.
The following is a sample job control to load both the DBSS and RDS phase into the shared virtual area:
// JOB LOADSVA // LIBDEF PHASE,SEARCH=(IJSYSRS.SYSLIB,PRD2.DB2710) SET SDL ARISQLDS,SVA ARIXRDS,SVA /* /&
For more information on the shared virtual area, see the IBM VSE/ESA System Control Statements manual.