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.

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 Utility database connections.

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

 Erase a database (Sybase Central)

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 dbeng12/dbsrv12 server option.

  1. Connect as a user with DBA authority to a database other than the one you want to erase. For example, connect to the utility database.

  2. Click Tools » SQL Anywhere 12 » Erase Database.

  3. 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 clicking File » Erase Database.

  • Right-clicking a server, and clicking Erase Database.

 Erase a database (SQL)

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 dbeng12/dbsrv12 server option.

  1. Connect as a user with DBA authority 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 DATABASE statement.

 Erase a database (command line)

By default, you need DBA authority to erase a database. You can change the required permissions by using the database server -gu option.

You can 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.

  • Run the dberase utility.

    For example, the following command removes the temp database.

    dberase c:\temp\temp.db
 See also