H3.3. Database Commands

Database Initialization

warning

For initialization, the database must be absent or empty.

drwcsd [<switches>] modexecdb database-init [<license_key> [<password>]]—database initialization.

<license_key>—path to Dr.Web license key file agent.key. If the license key is not specified, it must be added later from the Control Center or get from the neighbor Dr.Web Server via the interserver connection.

<password>—original password of the Dr.Web Server administrator (logged in as admin). The default password is root.

info

If you need to skip one or several parameters when writing the command, use the special value %nil instead of each skipped parameter.

%nil 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 modexecdb database-init@<response-file>

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

File format:

<full_license_key_filename>

<administrator_password>

info

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

If a string consists of only the %nil value, the default value is used (as in database-init).

Database Upgrading

drwcsd modexecdb database-upgrade [pretend=false]—run Dr.Web Server to upgrade the structure of the database to a new version using the internal scripts.

pretend=false — instructs to check that the database schema is up-to-date instead of the actual upgrade of its structure. false by default. If true, it will only make sure that the database schema is up-to-date.

Database Export

a)drwcsd modexecdb database-export <file>—export the database to a 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 modexecdb database-export "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 modexecdb database-export-xml <xml_file>—export the database to a 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 modexecdb database-export-xml 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 modexecdb database-export-xml database.gz

Example for UNIX system-based OS:

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

/etc/init.d/drwcsd modexecdb database-export-xml /test/database.db

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

/etc/init.d/drwcsd modexecdb database-export-xml /es/database.gz

Database Import

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

b)drwcsd modexecdb database-import-and-upgrade <file>—import and upgrade the database exported from Dr.Web Server of previous version (the previous content of the database is deleted).

warning

Before using the database-import-and-upgrade command, you are strongly advised to back up the database.

Any problems during execution of these commands may lead to deletion of all information from the database.

 

You can use the database-import-and-upgrade command to import and upgrade the version of the database only within the same DBMS.

Database Verification

drwcsd modexecdb database-verify [full=false [ignore-version=false]]—run Dr.Web Server to verify the database. In order to record the results into a log file, the command shall be followed by a -log key. Details on how to use the key are described in H3.8. The Description of Switches.

full=false — defines the verification type. By default (false) a quick check is made, if true—a full verification.

ignore-version=false — defines whether the database schema version needs to be ignored during verification. false by default. If true, verification will continue even if the schema version is wrong.

Database Speed Up

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

Database Restore

drwcsd repairdb—repair malformed disk image of SQLite3 embedded database or corrupted tables of MySQL external database.

SQLite3 may be also automatically recovered on the Dr.Web Server startup if in the SQLite3 database settings in the Control Center, the Restore corrupted image automatically flag is set (see Administrator Manual, p. Database Restore).

Database cleanup

drwcsd modexecdb database-clean—clean up the Dr.Web Server database by deleting all tables.

Administrator password reset

drwcsd modexecdb set-admin-password <login> <new_password>—set a new password for the specified administrator account.