## Creating and Configuring a Database Instance

### Use

There are various ways to create a new database instance.

The easiest way to create a new database instance is with the Installation Manager.

You can, however, also use the Database Manager CLI program. Using the Database Manager CLI, you can create a new database instance either by using the system default for the database parameter file or by importing the parameter file from another database instance.

This example describes how you can create a new database instance using the system default for the parameter file and subsequently adjust individual values to fit your requirements. In the Database Manager CLI, you can either execute the requisite sequence of DBM commands one after the other, or use a script to do this.

The following section describes the DBM commands to be executed in succession. If you want to use a script, proceed as described in Using a Script File.

You can create a database instance on the local computer or, using the option –n, on a remote computer. To create a database instance on a remote computer, you need to have an operating system user on that computer. On Microsoft Windows, this user must have the right "logon as batch job". To find out how you can assign this right to a user, see your operating system documentation.

To read the prerequisites, see Database Manager CLI, db_create, param_put, param_addvolume, db_activate, load_systab

See also:

Using the Parameter File from Another Database Instance

Installation Manual, Using the Installation Manager

Concepts of the Database System, Creating and Configuring a Database Instance

### Scenario

You want to create a new database instance with the name DEMODB on the local computer.

As the first DBM operator for this database instance, define operator DBM with password DBM.

As the database system administrator, define user DBADMIN with password SECRET.

You want to change the values for the database parameters SESSION_TIMEOUT, _UNICODE, CACHE_SIZE, _SERVERDB_FOR_SAP, MAXDATAVOLUMES and MAXUSERTASKS. (Note: You cannot change the database parameter _UNICODE after creating the database instance; see Unicode.)

You want to create a data volume named DISKD0001 of type File with 32768 pages and a log volume named DISKL0001 of type File with 6400 pages.

You also want the system to

● automatically update the statistics of the database instance

● automatically expand the data area when the fill level reaches 90% (default value)

● load the system tables

● load the demo data

● switch on overwrite mode for the log area

### Procedure

...

1. Call the Database Manager CLI, create the new database instance DEMODB, define the first DBM operator with user name DBM and password DBM.

>dbmcli db_create DEMODB DBM,DBM

OK

Alternative command lines:

○ If you have several versions of the database software installed on your computer, you need to enter additional information. Use the option -R <dependent_path> to specify the version for which you want to create the database instance:

>dbmcli -R "C:\Program Files\SDB\7.6.00" db_create DEMODB DBM,DBM

2. Call the Database Manager CLI in session mode, log on as operator DBM with the password DBM, connect to the database instance DEMODB:

>dbmcli –u DBM,DBM -d DEMODB

dbmcli on DEMODB>

3. Open a parameter session:

>param_startsession

OK

dbmcli on DEMODB>

4. Initialize the database parameters and define the database type OLTP (default value).

>param_init

OK

dbmcli on DEMODB>

5. Change the database parameter SESSION_TIMEOUT to the value 0.

dbmcli on DEMODB>param_put SESSION_TIMEOUT 0

OK

6. Change the database parameter _UNICODE to the value YES

dbmcli on DEMODB>param_put _UNICODE YES

OK

7. Change the database parameter _SERVERDB_FOR_SAP to the value 0.

dbmcli on DEMODB>param_put _SERVERDB_FOR_SAP NO

OK

8. Change the database parameter MAXDATAVOLUMES to the value 64:

dbmcli on DEMODB>param_put MAXDATAVOLUMES 64

OK

9. Change the database parameter MAXUSERTASKS to the value 10:

dbmcli on DEMODB>param_put MAXUSERTASKS 10

OK

10. Check all database parameters:

dbmcli on DEMODB>param_checkall

OK

11. Confirm changes to the database parameter file:

dbmcli on DEMODB>param_commitsession

OK

12. Create data and log volumes

a. Create data volume No. 1 with name DISKD0001, type FILE, size 32768 pages:

dbmcli on DEMODB>param_addvolume 1 DATA DISKD0001 F 32768

OK

b. Create log volume No. 1 with name DISKL0001, type FILE, size 6400 pages

dbmcli on DEMODB>param_addvolume 1 LOG DISKL0001 F 6400

OK

13. Transfer the database instance to the ADMIN operational state:

dbmcli on DEMODB>db_admin

OK

14. Initialize the new database instance and create the database system administrator with user name DBADMIN and password SECRET:

dbmcli on DEMODB>db_activate DBADMIN,SECRET

OK

15. Load the system tables:

dbmcli on DEMODB>load_systab

OK

0,OK: everything works fine

0,""c:\program files\sdb\maxdb1\bin\x_python" "c:\program files\sdb\maxdb1\env

\lsystab.py" -R "c:\program files\sdb\maxdb1" -d DEMODB -u dbadmin,*"

Removing obsolete objects

Installing Loader tables

...

...

==================================

Installation successfully finished

==================================

16. Switch on automatic update of optimizer statistics function:

dbmcli on DEMODB>auto_update_statistics ON

OK

17. Switch on automatic extension of data area function:

dbmcli on DEMODB>auto_extend ON

OK

18. Load the demo data:

dbmcli on DEMODB>load_tutorial

OK

0,OK: everything works fine

0,""c:\program files\sdb\maxdb1\bin\x_python" "c:\program files\sdb\maxdb1\env

\../demo/ltutorial.py" -R "c:\program files\sdb\maXdb1" -d DEMODB -u dbadmin,*"

HOTEL

==================================

Installation successfully finished

==================================

19. Switch on overwrite mode for the log area:

dbmcli on DEMODB>db_execute SET LOG AUTO OVERWRITE ON

OK

### Result

You have created the database instance DEMODB. It is in the ONLINE operational state. For this database instance, there is currently only the first DBM operator with user name DBM and password DBM and the database system administrator with user name DBADMIN and password SECRET.

We recommend that you now create an additional DBM operator with the name OLEG and password MONDAY, whose user data is used to create all the examples in this Database Administration Tutorial (see Creating a DBM Operator).

### Further Notes

Depending on what you want to test in the database instance DEMODB, proceed in one of the following ways:

● If you want to create additional database users, schemas and tables, fill these with data and execute further SQL statements, proceed as described in the SQL Tutorial.

● If you want to practice database instance administration using DEMODB, you can replicate the examples in this Database Administration Tutorial on your own.

For a detailed description of DBM commands and DBM options, see:

Database Manager CLI, Overview of all DBM Commands and DBM Options