CreateDatabase
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 are also the following optional properties:
-
LogicalOnly (1 or 0) – When set to 1, and during the merge on the current primary, this adds a preexisting database to the mirror defined in MirrorSetName by modifying it using the SYS.Mirror.AddDatabase()Opens in a new tab method. During the merge on a nonprimary mirror member, the LogicalOnly property is ignored and a new empty physical database is created to receive download from the primary mirror member using the automatic database download feature. When set to 0, this creates a new mirrored database.
If the preexisting database exists on all mirror members at the same location, specified in CreateDatabase, creation of this new or empty mirrored database will fail.
-
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. When adding a preexisting database to a mirror, the copy operation will only be carried out on the current primary mirror member. This property can be used copy an existing database to a new location before adding it to a mirror to avoid failure of creating the new database discussed above. During the merge on a nonprimary mirror member Seed is ignored.
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.