7.4.4. Create infobase from (* .cf) configuration file
ibcmd server config init --database-path="D:\ss-data\file-db\db-data" --name=docsIB --http-base=/webAccess --out="D:\ss-data\file-db\file-db.yml" ibcmd infobase create --config="D:\ss-data\file-db\file-db.yml" --load="D:\Cfgs\MyApp\1Cv8.cf" --data="D:\ss-data\file-db"
This example consists of two steps:
- The first line generates a standalone server configuration file (ibcmd server config init).
- The second line creates an infobase and a database file based on the configuration file (ibcmd infobase create).
In general, the creation of the infobase based on the configuration file can be executed with one command. In this case, the choice of the solution method depends on several parameters, for example, the database parameters are set in one place of the information system, and the database is created in another, but using the configuration file created in the previous step. If you only need to create the infobase from the command line based on the configuration file, this action can be performed as follows:
ibcmd infobase create --data="D:\ss-data\fs-data" --database-path="D:\ss-data\file-db\db-data" --load="D:\Cfgs\MyApp\1Cv8.cf"
After you execute any of the examples mentioned above, an infobase is created in the D:\ss-data\fs-db\db-data directory, and system operations will be output to the standard output stream (stdout):
[ INFO] Creating infobase... [ INFO] Infobase created [ INFO] Loading configuration... [ INFO] Configuration loaded
If by the time of command execution, the database file 1Cv8.1CD is created, the command execution completes with an error.
Creation of an infobase in client/server mode does not fundamentally differ from creating an infobase in file mode. Obviously, in case of the infobase in client/server mode, a larger number of parameters will be required:
ibcmd infobase create --dbms=mssqlserver --database-server=dbServerName --db-user=dbUserName --database-password=dbUserPassword --database-name=my-db --name=docsIB --data="D:\ss-data\cs-data" --create-database --load="D:\Cfgs\MyApp\1Cv8.cf" --apply
As a result, the my-db database will be created in Microsoft SQL Server. The configuration from the D:\Cfgs\MyApp\1Cv8.cf file will be imported to this database. Repeated command execution will cause an error as the database will already exist.
It should also be remembered that the command to create the infobase from the configuration file does not lead to the creation of the database configuration. In order for the database structure to correspond to the configuration used (to create the information database), you should use a specific parameter that is responsible for updating the database configuration:
ibcmd infobase create --dbms=mssqlserver --database-server=dbServerName --db-user=dbUser --database-password=dbUserPassword --database-name=my-db --name=docsIB --data="D:\ss-data\cs-data" --create-database --load="D:\Cfgs\MyApp\1Cv8.cf" --apply --force
In this case, the output will contain information about updating the database configuration:
[INFO] Creating infobase... [INFO] Infobase created [INFO] Importing configuration... [INFO] Configuration is imported [INFO] Database configuration update... [INFO] Validating metadata... [INFO] Process database structure... [INFO] Processing data … [INFO] Collecting service information... … [INFO] Accepting changes... [INFO] Building help index... [INFO] Help index is built [INFO] Database configuration update completed.