Erasing a database

Erasing a database deletes all tables and data from disk, including the transaction log that records alterations to the database. All database files are read-only to prevent accidental modification or deletion of database files. By default, you need DBA authority to erase a database. You can change the required permissions by using the database server -gu option. See -gu server option.

In Sybase Central, you can erase a database using the Erase Database Wizard.

In Interactive SQL, you can erase a database using the DROP DATABASE statement.

You can also erase a database from a command line with the dberase utility. However, the dberase utility does not erase dbspaces. If you want to erase a dbspace, you can do so with the DROP DATABASE statement or using the Erase Database Wizard in Sybase Central.

The database to be erased must not be running when the dberase utility, the Erase Database Wizard, or DROP DATABASE statement is used. You must be connected to a database to drop another database.

For information about connecting to the utility database, see Connecting to the utility database.

Windows Mobile databases must be erased manually. See Erasing a Windows Mobile database.

To erase a database (Sybase Central)

  1. Choose Tools » SQL Anywhere 11 » Erase Database.

  2. Follow the instructions in the wizard.

Tip

You can also access the Erase Database Wizard from within Sybase Central by using any of the following methods:

  • Selecting a database server, and choosing File » Erase Database.
  • Right-clicking a server, and choosing Erase Database.

To erase a database (SQL)

  1. Connect to a database other than the one you want to erase. For example, connect to the utility database.

  2. Execute a DROP DATABASE statement.

    For example, the following DROP DATABASE statement erases a database named temp.

    DROP DATABASE 'c:\\temp\\temp.db';

See DROP statement.

To erase a database (command line)

  • Run the dberase utility.

    For example, the following command removes the temp database.

    dberase c:\temp\temp.db

See Erase utility (dberase).