Skip to main content

CreateDatabase

Create a new database.

Synopsis

[Actions]   CreateDatabase:Name=DatabaseName,Directory=DatabaseDirectory[,Additional Properties]

Description

CreateDatabase defines a database. InterSystems IRIS® creates that database when processing the [Actions] section during a configuration merge.

You can specify any possible database properties in the CreateDatabase definition. During the merge, InterSystems IRIS runs SYS.Database.CreateDatabase()Opens in a new tab and Config.Databases.Create()Opens in a new tab to create the database defined by CreateDatabase. Only the Name and Directory properties are required; the complete list of properties is available in the class reference.

When using CreateDatabase on an ECP client to add a remote database, there are two unique required properties. These are:

  • Server – This specifies the name of the ECP server where the remote database is located.

  • LogicalOnly (1 or 0) – When set to 1, this prevents CreateDatabase from creating a physical database on the ECP client. This suppresses the call of SYS.Database.CreateDatabase()Opens in a new tab during the merge.

When using CreateDatabase on a mirror member to add a mirrored database, the MirrorSetName and MirrorDBName properties are required for a mirrored database, there is also a unique optional property:

  • Seed – This specifies a file path to an existing database.

    During the merge on the primary mirror member and if Seed is specified, InterSystems IRIS copies the data from the existing database into the new mirrored database defined by CreateDatabase. This converts a preexisting nonmirrored database to a mirrored database on the primary mirror member.

    During the merge on a nonprimary mirror member, InterSystems IRIS creates a new empty mirrored database defined by CreateDatabase and applies the mirror journal files from the primary if the mirror journal files are available. By default, journal files are purged after two days, see DaysBeforePurge. Therefore, copying the data from the primary mirror member to the nonprimary mirror member.

    Seed may also be provided for a nonmirrored database to copy the data from the existing database into the new nonmirrored database.

The section below contains an example of using these properties to add a remote database and to add a mirrored database using the Seed property.

Example

Upon running a configuration merge, the following example creates the Customers database, specifying the initial size and maximum size:

[Actions]
CreateDatabase:Name=Customers,Directory=/IRIS/mgr/Customers,Size=5368,MaxSize=536871

If the Customers database is a remote database located on Node1, the [Actions] section would instead look like:

[Actions]
CreateDatabase:Name=Customers,Directory=/IRIS/mgr/Customers,Server=Node1,LogicalOnly=1

Upon running a configuration merge, the following example creates the mirorred Customers database, specifying the existing database to copy:

[Actions]
CreateDatabase:Name=Customers,Directory=/IRIS/mgr/Customers,MirrorSetName=CUSTOMERSMIRROR,MirrorDBName=Customers,Seed=/mnt/databases/ExistingDB

Changing This Operation

This operation is designed to be used during a configuration merge. You can change CreateDatabase by editing the merge file in a text editor (as described in Editing the Active CPF).

For information about creating and editing a database from the Management Portal, see Configuring Databases.

FeedbackOpens in a new tab