Share via


Deletecontentdb: Stsadm operation (Windows SharePoint Services)

Applies To: Windows SharePoint Services 3.0

 

Topic Last Modified: 2008-06-26

Operation name: Deletecontentdb

Description

Detaches a content database when the Web application, database name, and database server are specified. For more information, see the Notes section of this article.

Syntax

stsadm.exe -o deletecontentdb

-url <URL name>

-databasename <database name>

[-databaseserver] <database server name>

Parameters

Parameter name and short form Value Required? Description

url

A valid URL, such as http://server_name

Yes

Specifies the Web application from which the content database will be detached.

databasename (dn)

A valid database name, such as "DB1"

Yes

Specifies the name of content database to be detached.

databaseserver (ds)

A valid database server, such as "DS1"

No

Database server name to be detached.

Note

If your database server and SharePoint Products and Technologies are hosted on separate servers, you need to use the databaseserver parameter to specify the database server name.

Notes

When a content database is detached from a Microsoft SQL Server database server, it is recommended to first detach the content database from the Web application in Windows SharePoint Services 3.0. To detach a content database from SQL Server, use the following steps:

Detach a content database from Microsoft SQL Server

  1. From SQL Server 2005 Management Studio, connect to the server instance and click to expand the Databases node.

  2. Right-click the content database to be detached, point to Tasks, and then click Detach.

  3. From the Detach Database dialog box, select the database name you want to detach.

  4. Click OK.

Important

If you detach and reattach a content database, be aware that the next time the content within that content database is crawled a full crawl will occur even if an incremental crawl has been requested. Because a full crawl re-crawls all content that the crawler encounters, regardless of whether that content has been previously crawled, full crawls can take significantly more time to complete than incremental crawls.

Active connections must be closed before the content database can be deleted. This operation removes the data file or files and transaction log or logs from the file system of the SQL database server. To avoid interrupting user requests or closing pending requests resulting in possible data loss, content databases should only be detached during a maintenance window or when users are not actively accessing its data. To close active connections in SQL Server 2005, use the following steps:

Close an active connection from Microsoft SQL Server

  1. From SQL Server 2005 Management Studio, connect to the server instance and click to expand the Databases node.

  2. Right-click the content database to be detached, point to Tasks, and then click Detach.

  3. From the Detach Database dialog box, click to select the Drop Connections checkbox.

  4. To commit the change, click OK.

Note

The newly detached database remains visible in the Databases node of Object Explorer until the view is refreshed. To refresh the view at any time, from the Object Explorer pane, click Refresh from the View menu.

If you are running the Infrastructure Update for Windows SharePoint Services 3.0, the identifier (ID) of each content database is retained when you restore or reattach the database by using built-in tools. Default change log retention behavior when using built-in tools is as follows:

  • The change logs for all databases are retained when you restore a farm.

  • The change log for a content database is retained when you reattach the database.

  • The change log for a content database is NOT retained when you restore just the content database.

When a database ID and change log are retained, Search continues crawling based on the regular schedule defined by crawl rules. When a change log is not retained, Search performs a full crawl during the next scheduled crawl. For more information, see Move content databases (Windows SharePoint Services 3.0), Back up and restore the entire farm (Windows SharePoint Services 3.0 technology), and Addcontentdb: Stsadm operation (Windows SharePoint Services).