Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Working with Database Objects » Working with databases

Stopping a database Next Page

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. You need to connect to a database to access this wizard, but the Erase Database wizard lets you specify any database for erasing. To erase a non-running database, a database server must be running.

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 on connecting to the utility database, see Connecting to the utility database.

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

To erase a database (Sybase Central)
  1. From the Tools menu, choose SQL Anywhere 10 > Erase Database.

  2. Follow the instructions in the wizard.

  3. 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 Erase Database from the File menu.

    • Right-clicking a server, and choosing Erase Database from the popup menu.

    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';
    3. For more information, see DROP statement.

      To erase a database (command line)

    For more information, see Erase utility (dberase).