Database Definition Operations

Use ttGridAdmin commands in this section to create, delete, export, or modify a database definition, or to display a list of existing database definitions.

A database definition specifies the characteristics of a database, consisting of settings for data store attributes (set at database creation) and first connect attributes.

Create a Database Definition (dbdefCreate)

The dbdefCreate command creates a database definition object in the model, defining characteristics of the database according to attribute settings in the specified file. It also creates a direct connectable object with the same name as the database, for direct connections.

ttGridAdmin dbdefCreate filepath

Once a database definition is added to the model, it can be used to create a database.

Options

The dbdefCreate command has the option:

Option Description

filepath

Path and name of the database definition file, which contains the attribute settings for the database definition.

The file name must be of the form dbname.dbdef, where dbmame defines the name of the database.

Examples

The example uses database definition file database1.dbdef:

DataStore=/disk/databases/database1
LogDir=/disk2/logs
DatabaseCharacterSet=AL32UTF8
ConnectionCharacterSet=AL32UTF8
PermSize=256
TempSize=128

Typical settings in a database definition file include the following, as shown in the example.

  • Data store attributes: DataStore (required) LogDir, and DatabaseCharacterSet (required)

    Directories are created on each host as necessary for the DataStore and LogDir locations.

  • First connection attributes: PermSize (required) and TempSize

  • General connection attribute: ConnectionCharacterSet

  • As necessary, PL/SQL first connection attributes and server connection attributes

Create the database definition object:

% ttGridAdmin dbdefCreate  /sw/tten/grid/dbdefs/database1.dbdef
Database Definition database1 created.

Data store attributes and first connection attributes go in the resulting database definition. From the example, this consists of DataStore, LogDir, DatabaseCharacterSet, PermSize, and TempSize. In addition, a default connections setting and a default durability setting are added to the definition automatically.

[database1]
DataStore=/disk/databases/database1
DatabaseCharacterSet=AL32UTF8
LogDir=/disk2/logs
PermSize=256
TempSize=128
connections=100
durability=0

General connection attributes go in the resulting connectable definition that is automatically created. In the example, this consists of ConnectionCharacterSet:

[database1]
ConnectionCharacterSet=AL32UTF8

For additional information, see Creating a Database Definition File in Oracle TimesTen In-Memory Database Scaleout User's Guide.

Notes

  • The database name cannot be the same as any existing database or connectable name.

  • The database definition file must be in odbc.ini format, as shown in the example, with attribute=value on each line.

  • A dbdef file supports the following substitution strings for DataStore and LogDir entries. They are replaced as appropriate when the model is applied:

    • !!HOST_NAME!! is replaced on each host by the host name as specified in the model.

    • !!INSTANCE_NAME!! is replaced in each instance by the instance name as specified in the model.

    A scenario for using !!HOST_NAME!! and !!INSTANCE_NAME!!, for example, would be if you use a Storage Area Network device shared between the hosts of the grid. Setting DataStore to /shared/datastores/!!HOST_NAME!!/!!INSTANCE_NAME!! gives each host its own data storage area.

  • It is best practice to specify LogDir and have it be on a different file system from DataStore. The DataStore and LogDir paths and directories will be created wherever necessary.

  • You can create additional connectables as described in Create a Connectable (connectableCreate).

  • Some connection attributes cannot be set in a dbdef file, although they could be set for additional connectables that you create. For example, because the initial connectable that is created during database definition must be usable by the instance administrator, the UID and PWD connection attributes cannot be specified in a dbdef file.

  • When you apply the model after creating a database definition, new versions of all necessary configuration files are written to each data instance, with an entry added according to the dbdef settings. (Never edit configuration files manually. They are overwritten each time the model is applied.)

Delete a Database Definition (dbdefDelete)

The dbdefDelete command removes a database definition object from the model.

ttGridAdmin dbdefDelete name
                        [-cascade|-nocascade]

Options

The dbdefDelete command has the options:

Option Description

name

The name of the database definition object to delete.

-cascade

Also remove any additional connectable objects that were created for this database. This is the default.

-nocascade

Do not remove connectable objects.

Examples

This example deletes the database definition object database2, showing database definition object listings before and after.

% ttGridAdmin dbdefList
database1
database2

% ttGridAdmin dbdefDelete database2
Database Definition database2 deleted.

% ttGridAdmin dbdefList
database1

Notes

  • The database itself must have already been destroyed (or not yet been created).

  • When you apply the model after deleting a database definition, new versions of all necessary configuration files are written to each data instance, with the database definition removed. (Never edit configuration files manually. They are overwritten each time the model is applied.)

  • The connectable object that was automatically created when the database definition object was created is also removed, regardless of the -cascade/-nocascade setting.

Export a Database Definition (dbdefExport)

The dbdefExport command exports an existing database definition object from the model, typically to a specified file.

ttGridAdmin dbdefExport name 
                        [filepath]

Options

The dbdefExport command has the options:

Option Description

name

Name of the database definition to export.

filepath

Path and name of the database definition file to create, typically a .dbdef file for use with dbdefCreate or dbdefModify. If no file is specified, the export goes to stdout.

Important: If you specify an existing file, it will be overwritten.

Examples

This example exports the database definition created in the dbdefCreate example above to the file database1.dbdef.

% ttGridAdmin dbdefExport database1 /sw/tten/grid/dbdefs/database1.dbdef

Resulting contents of database1.dbdef:

# DbDef GUID BCC6AB97-FDC2-4453-AEBC-5BFCAA57EA52 Exported 2017-12-06 19:05:03
[database1]
DataStore=/disk/databases/database1
DatabaseCharacterSet=AL32UTF8
LogDir=/disk2/logs
PermSize=256
TempSize=128
connections=100
durability=0

Notes

  • The database definition is exported in odbc.ini format, as shown in the example, with attribute=value on each line.

  • A typical use case is if you want to modify a database definition, but the original database definition file is no longer available.

List Database Definitions (dbdefList)

The dbdefList command lists the database definition objects that exist in the specified version of the model.

ttGridAdmin dbdefList [-latest|-current|-version n]

Options

The dbdefList command has the options:

Option Description

-latest

Lists database definition objects in the latest model—the model being modified and not yet applied to the grid. This is the default.

-current

Lists database definition objects in the current model—the model most recently applied to the grid.

-version n

Lists database definition objects in the specified version number of the model.

Examples

List database definition objects in the latest model (default) after the database1 database definition object was created (as shown in Create a Database Definition (dbdefCreate)).

% ttGridAdmin dbdefList
database1

Modify a Database Definition (dbdefModify)

The dbdefModify command modifies an existing database definition object in the model, defining characteristics of the database according to attribute settings in the specified file.

ttGridAdmin dbdefModify filepath

Options

The dbdefModify command has the option:

Option Description

filepath

Path and name of the file containing the database definition that will modify the database definition object.

The file name must be of the form dbname.dbdef, where dbname is the name of the database.

Examples

This example modifies database1, created in Create a Database Definition (dbdefCreate). The database definition file database1.dbdef was updated to change the PermSize and TempSize:

% cd /sw/tten/grid/dbdefs
% more database1.dbdef
DataStore=/disk/databases/database1
LogDir=/disk2/logs
DatabaseCharacterSet=AL32UTF8
ConnectionCharacterSet=AL32UTF8
PermSize=512
TempSize=256

Modify the database definition object:

% ttGridAdmin dbdefModify  /sw/tten/grid/dbdefs/database1.dbdef
Database Definition database1 modified.

Notes

  • Database definition files are in odbc.ini format, as shown in the example, with attribute=value on each line. See Create a Database Definition (dbdefCreate) for additional discussion.

  • Data store attributes, as listed in List of Connection Attributes (for example, DataStore, DatabaseCharacterSet, LogDir, and Durability), are frozen once a database is created. Trying to change them using dbdefModify will have no effect on the database.

  • If the database exists and is loaded, changes by the dbdefModify command to first connection attributes do not take effect until you unload (dbUnload) and load (dbLoad) the database.

  • This command does not modify the database itself, only the database definition object.

  • The connectable object that was automatically created when the database definition object was created is also modified appropriately.

  • When you apply the model after modifying a database definition, new versions of all necessary configuration files are written to each data instance, with the applicable entry modified according to the dbdef settings. (Never edit configuration files manually. They are overwritten each time the model is applied.)

  • The specified definition completely replaces the previous definition, deleting previous attribute settings for the database definition and connectable definition. Attributes that were set previously but are not set in the new definition will take their default settings.