sp_tempdb_markdrop

Description

(In cluster environments) Places a local system temporary database in the drop state.

Syntax

sp_tempdb_markdrop database_name [, {'mark' | 'unmark'}]

Parameters

database_name

is the name of the local system temporary database you are dropping

mark

marks the specified database for dropping.

unmark

clears the mark from the database.

Examples

Example 1

Marks a local system temporary database named “old_cluster_tempdb1” to be dropped:

sp_tempdb_markdrop 'old_cluster_tempdb1', 'mark'

Example 2

Removes the mark from the local system temporary database “old_cluster_tempdb1”:

sp_tempdb_markdrop 'old_cluster_tempdb1, 'unmark'

Usage

To delete the last local temporary database:

  1. Use sp_tempdb_markdrop to place the local system temporary database in the drop state.

  2. Shut down and restart the instance that owns the last local temporary database.

    NoteAfter you mark the local system temporary database to be dropped, the owner instance restarts if there are no other active instances. This instance does not use the marked local system temporary database when it starts.

  3. Use drop database to delete the last local system temporary database.

Permissions

The permission checks for sp_tempdb_markup differ based on your granular permissions settings.

Granular permissions enabled

With granular permissions enabled, you must be a user with the own database privilegeon the specified database or the manage cluster privilege.

Granular permissions disabled

With granular permissions disabled, you must be the database owner or a user with sa_role.