Bagikan melalui


How to: Delete a Database (SQL Server Management Studio)

This topic describes how to delete a user-defined database by using Object Explorer in SQL Server Management Studio. System databases cannot be deleted.

Prerequisites

  1. Consider taking a full backup of the database. A deleted database can be re-created only by restoring a backup.

  2. Delete any database snapshots that exist on the database. For more information, see How to: Drop a Database Snapshot (Transact-SQL).

  3. If the database is involved in log shipping, remove log shipping. For more information, see Log Shipping Administration.

  4. If the database is published for transactional replication, or published or subscribed to merge replication, remove replication from the database. For more information, see Removing Replication.

To delete a database

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance.

  2. Expand Databases, right-click the database to delete, and then click Delete.

  3. Confirm the correct database is selected, and then click OK.

    Note

    Back up the master database after you delete any database. If master must be restored, any database that has been deleted since the last backup of master will still have references in the system catalog views and may cause error messages to be raised.

See Also

Concepts