Create Microsoft SQL Server Datastores Using Script Files

If a database does not exist at the point that it is required (for example, you attempt to upload a data file to a datastore that has not yet been created in the database instance), it is created on-the-fly; this can be slow for certain RDBMS types, and so we recommended that you create any required databases ahead of time, using SQL scripts.

  1. To create the database script file, on the command line, enter the following command:
    dbfhadmin -script -type:datastore -provider:ss -name:<datastore-name> [-db|existdb:<database-name>] [-file:<script-name.sql>] 

    where <datastore-name> is the name of the datastore to create; <database-name> is the name of a new database (-db) or existing database (-existdb) that can house multiple datastores\regions, and a cross-region database - if you omit either option, a new database called <datastore-name> will be created for the datastore; <script-name.sql> is the name of the script file to be created .

    Note: If you omit the -file option, the default name is create_datastore_<datastore-name>_ss.sql.
  2. Create further script files for any more required datastores.

    Once you have created the script files, use the dbfhadmin utility to run them, and create the required databases. Before you run the -createdb command, ensure that the sqlcmd command is on the PATH.

  3. To create the datastore(s) on the command line, enter the following command:
    dbfhadmin -createdb -usedb:<instance> -provider:ss -type:datastore -file:<script-name.sql> -user:<user> -password:<pass>

    where <instance> is the SQL server instance name, and <user> and <pass> are valid logon credentials for the database. If -user and -password are not specified, SQL Server SSPI authentication is used - see your SQL Server documentation for more details.

Note: If you do not use script files for datastore creation, you can also create them using the dbfhdeploy data create URL/<datastore-name> command.

Now that the datastores have been created, you can configure the database configuration file to use them.