H4.3. Database Commands

Top  Previous  Next

Database Initialization

drwcsd [<keys>] initdb <license_key> [<DB_script> [<ini_file> [<password>]]]—database initialization.

<license_key>—path to Dr.Web license key file agent.key (must be specified).

<DB_script>—DB initialization script. The - (minus) special value means not to use such script.

<ini_file>—previously formed file in the drweb32.ini format, to set the initial configuration of Dr.Web software components (i.e. for the Everyone group). The - (minus) special value means not to use such file.

<password>—original password of the Server administrator (the name is admin). Default password is root.

A minus can be omitted, if the next parameters are not set.

Adjusting parameters of database initialization

If embedded database is used, initialization parameters can be set via an external file. The following command is used for this:

drwcsd.exe initdbex <response-file>

<response-file>—file with initialization parameters written line-by-line in the same order same as parameters of the initdb command.

File format:

<path_to_key_file>

<path_to_initdb.sql>

<path_to_drweb32.ini>

<administrator_password>

If using a response file under Windows OS, any symbols are allowed in the administrator password.

Any strings following the necessary parameter in a particular case are optional. If a string consists of only the minus symbol "-", the default value is used (as in initdb).

Database Updating

drwcsd [<switches>] updatedb <script>—perform any action with the database (for example, update to a new version) by executing  SQL instructions from the <script> file.

Database Upgrading

drwcsd upgradedb <folder>—run the Server to upgrade the structure of the database to a new version (see the update-db folder).

Database Export

a)drwcsd exportdb <file>—export the database to the specified file.

Example for Windows OS:

C:\Program Files\DrWeb Server\bin\drwcsd.exe -home="C:\Program Files\DrWeb Server" -var-root="C:\Program Files\DrWeb Server\var" -verbosity=all exportdb "C:\Program Files\DrWeb Server\esbase.es"

Under UNIX system-based OS, the action is performed on behalf of the drwcs:drwcs user to the $DRWCS_VAR directory (except FreeBSD OS, which by default saves the file to the directory from which the script was run; if the path is specified explicitly, then the directory should have the write access for the <user>:<group> that had been created at installation, by default it is drwcs:drwcs).

b)drwcsd xmlexportdb <xml_file>—export the database to the specified xml file.

If you specify the gz file extension, when during the export, database file will be packed into the gzip archive.

If you do not specify any extension or specify an extension other than gz, when export file will not be archived.

Example for Windows OS:

To export the database into the xml file with no compression:

"C:\Program Files\DrWeb Server\bin\drwcsd.exe" "-home=C:\Program Files\DrWeb Server" "-bin-root=C:\Program Files\DrWeb Server" "-var-root=C:\Program Files\DrWeb Server\var" -verbosity=ALL -rotate=10,10m -log=export.log xmlexportdb database.db

To export the database into the xml file compressed to an archive:

"C:\Program Files\DrWeb Server\bin\drwcsd.exe" "-home=C:\Program Files\DrWeb Server" "-bin-root=C:\Program Files\DrWeb Server" "-var-root=C:\Program Files\DrWeb Server\var" -verbosity=ALL -rotate=10,10m -log=export.log xmlexportdb database.gz

Example for UNIX system-based OS:

To export the database into the xml file with no compression:

/etc/init.d/drwcsd xmlexportdb /test/database.db

To export the database into the xml file compressed to an archive:

/etc/init.d/drwcsd xmlexportdb /es/database.gz

Database Import

a)drwcsd importdb <file>—import the database from the specified file (the previous content of the database is deleted).

b)drwcsd xmlimportdb <xml_file>—import the database from the specified xml file.

Database Verification

drwcsd verifydb—run the Server to check the database. After completion, the Server saves the verification results in the log file (drwcsd.log by default).

Database speed up

drwcsd [<switches>] speedupdb—execute the VACUUM, CLUSTER, ANALYZE commands to speed up the DB operation.

Database cleanup

drwcsd cleandb—cleanup database of the Server by deleting all database tables.