Drop database command

The database drop command removes an existing VCDB instance.

  • Use this command with caution. It deletes the VCDB schema and all its data permanently.

  • The drop process starts immediately. There is no 'Are you sure?' prompt.

  • Dropping a VCDB instance is irreversible. Make sure to create a backup if you want to retain the data.

Synopsis

vcdb database drop [OPTIONS] COMMAND

Options

The database drop command inherits global options from the main vcdb command and script options from its parent database command. Additionally, it provides options for dropping an existing VCDB instance.

Global options

Option Description Default value

[@<filename>…​]

One or more argument files containing options.

-h, --help

Show a help message and exit.

-V, --version

Print version information and exit.

--config-file=<file>

Load configuration from this file.

-L, --log-level=<level>

Log level: fatal, error, warn, info, debug, trace.

info

--log-file=<file>

Write log messages to this file.

--quiet

Disable console log messages.

--pid-file=<file>

Create a file containing the process ID.

--plugins=<dir>

Load plugins from this directory.

--use-plugin=<plugin[=true|false]>
[,<plugin[=true|false]>…​]

Enable or disable plugins with a matching fully qualified class name.

true

For more details on the global options and usage hints, see here.

Script options

Option Description Default value

-c, --client=<file>

Path to the database client executable.

Client found in your PATH

--timeout=<seconds>

Time in seconds to wait for the operation to complete.

60

For more details on the script options and usage hints, see here.

Database connection options

Option Description Default value

-H, --db-host=<host>

Name of the host on which the VCDB is running.

-P, --db-port=<port>

Port of the VCDB server.

5432

-d, --db-name=<database>

Name of the VCDB database to connect to.

-u, --db-username=<user>

Username to use when connecting to the VCDB.

-p, --db-password
[=<password>]

Password to use when connecting to the VCDB. Leave empty to be prompted.

--db-property=<property=value>
[,<property=value>…​]

Database-specific connection properties.

For more details on the database connection options and usage hints, see here.

Unlike other commands, the --db-schema option is not available for database drop.

Usage

Dropping a VCDB instance

Dropping a VCDB instance requires running the drop command with the connection details of the target VCDB instance. As described here, the connection details can be supplied using the CLI options listed above, or via alternative methods such as a JSON configuration file or environment variables. The following options are mandatory:

  • --db-name: The target database that contains the VCDB instance to drop.

  • --db-username: The owner of the VCDB instance or a user with sufficient privileges to perform the drop.

The example below illustrates how to drop a VCDB instance.

  • Linux

  • Windows CMD

./vcdb database drop \
    -H localhost \
    -d citydb \
    -u citydb_user \
    -p mySecret
vcdb database drop ^
    -H localhost ^
    -d citydb ^
    -u citydb_user ^
    -p mySecret

When the drop command is executed, log messages are printed to the console showing the progress of the operation. The command indicates whether the VCDB instance was successfully dropped or if an error occurred. On error, the log shows the corresponding message to help identify the cause.

When setting the --log-level to debug, the log also includes the output of the database client executing the SQL scripts.