H4.3. Database Commands |
Database Initialization
drwcsd [<switches>] initdb [<license_key>|- [<sql_script>|- [<ini_file>|- [<password> [<lua_script>|-]]]]]—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 Server via the interserver connection. •<sql_script>—path to the sql script for initialization of the DB physical structure. •<ini_file>—previously formed file in the drweb32.ini format, to set the initial configuration of Dr.Web software components (i.e. for the group). •<password>—original password of the Server administrator (the name is ). Default password is . •<lua-lua_script>—path to the lua script for the DB initialization (filling the base with defaults).
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:
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 or LUA script from the specified file. Database Upgrading drwcsd upgradedb [<folder>]—run the Server to upgrade the structure of the database to a new version from the specified folder (see the update-db folder) or using the internal scripts. Database Export a)drwcsd exportdb <file>—export the database to the specified file. :
Under system-based OS, the action is performed on behalf of the drwcs:drwcs user to the $DRWCS_VAR directory (except 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. : •To export the database into the xml file with no compression:
•To export the database into the xml file compressed to an archive:
: •To export the database into the xml file with no compression:
•To export the database into the xml file compressed to an archive:
Database Import a)drwcsd importdb <file>—import the database from the specified file (the previous content of the database is deleted). b)drwcsd upimportdb <file> [<folder>]—import and upgrade the database exported from the Server of previous version (the previous content of the database is deleted). Also you can specify the path to the folder with scripts to upgrade the structure of the database to a new version (same as in the upgradedb command). c)drwcsd xmlimportdb <xml_file>—import the database from the specified xml file. d)drwcsd xmlupimportdb <xml_file>—import and upgrade the database exported in xml from the Server of previous version. Also you can specify the path to the folder with scripts to upgrade the structure of the database to a new version (same as in the upgradedb command). e)drwcsd xmlimportdbnh <xml_file>—import the database from the specified xml file not considering the hash. Can be used e.g., if the database xml file has been edited manually and the file hash that is written automatically during the export, is no longer valid.
Database dump export drwcsd [<switches>] dumpimportdb <DB_file> [<SQL_file> [<tables_filter>]]—write to the Server log file or to the SQL file detailed information on embedded or external database.
•<DB_file>—export file of the database, information on which will be written to the Server log file or to the <SQL_file>. Export file can be get via the exportdb command; also you can use the file from the backup copy of the database. XML file after the xmlexportdb command is not allowed. •<SQL_file>—file to write all SQL queries that will be executed during the database import from the file specified in the <DB_file>. If SQL file is not specified, the data will be written to the Server log file (as a list of tables and their fields). If the file is specified, only the queries to the SQL file will be written. •<tables_filter>—the list of database tables, information on which will be written into the <SQL_file>. The tables in the list must be separated with comma. The names must correspond the names of the database tables. For example: admins,groups,stations. Tables filter is applied for SQL file output only. If the tables list is not specified, all tables are written. 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 Restore drwcsd repairdb—repair malformed disk image of embedded database or corrupted tables of external database. may be also automatically recovered on the Server startup if in the database settings in the Control Center, the flag is set (see , p. Database Restore). drwcsd cleandb—cleanup database of the Server by deleting all database tables. |