Command Line Parameters

BATCH MODE

Database Utilities can be run from the command line using parameters. This is useful for putting commands into batch file or for executing functions on a schedule.

General notes

    • All commands are case-insensitive.
    • Whenever a file name is required, it is recommended to give the entire path enclosed in quotes, i.e. “c:\data\backup.bak”.
    • All commands will target the eshadata repository.

RUN SCRIPT

    • Format
      dbutil -script file
    • Parameters
      file: the location of the script to be executed.
    • Explanation
      This command loads and executes a file containing SQL commands. The file must contain a sequence of valid SQL commands. The entire file will be loaded, and then executed as a long sequence of commands.
    • Notes
      A comment in the file is indicated by “--”. Whenever these characters are found, the rest of that line will be ignored by the program. The use of the keyword “GO” between sets of operations is supported. Whenever “GO” is found, the program will execute all instructions read so far, and then begin reading commands again.

BACKUP DATABASE

    • Format
      dbutil -backup file
    • Parameters
      file: (optional) the database backup will be written to this file.
    • Explanation
      This command performs a backup on the entire eshadata database.
    • Notes
      The file parameter is optional; if it is not provided, the program will create a default name for the file, in the format Eshadata_date-time.bak. If the file named already exists, it will be deleted before the backup begins. The file named must physically reside on the same computer that contains the SQL Server instance. It cannot be a shared network drive.

RESTORE DATABASE

    • Format
      dbutil -restore file
    • Parameters
      file: the database backup file to be restored.
    • Explanation
      This command performs a restore of the eshadata database using the backup file named. The database will return to the previous state of the backup file, and all data entered since the backup was made will be lost forever.
    • Notes
      Unlike previous versions of the Database Utilities, there are no naming conventions required on the file.

SHRINK DATABASE

    • Format
      dbutil -shrink
    • Parameters
      None.
    • Explanation
      This command cleans up unused logs and compresses the database to improve performance and save disk space.
    • Notes
      None.