Remove a Database Using AppFabric Cmdlets

This topic describes how to remove a monitoring or persistence store by using AppFabric cmdlets. This is the only way to remove a monitoring or persistence store through AppFabric because IIS Manager extensions in AppFabric cannot be used to accomplish this task. While these cmdlets will remove a database schema, and also remove a store if it is empty, they will not remove any related connection strings from IIS.

Remove a Monitoring or Persistence Database by Using Cmdlets

To remove a monitoring or persistence database you must use the AppFabric cmdlets interface. This section describes the Remove-ASMonitoringSqlDatabase and Remove-ASPersistenceSqlDatabase cmdlets.

Remove a Monitoring Store

Remove-ASMonitoringSqlDatabase

This cmdlet will delete the monitoring database schema. If the store is a dedicated monitoring database (there are no other schemas or objects collocated with the monitoring schema objects) the cmdlet will also delete (drop) the database.

Syntax 1:

Remove-ASMonitoringSqlDatabase -Database <String> [-Confirm] [-Server <String>] [-WhatIf] [<CommonParameters>]

Syntax 2:

Remove-ASMonitoringSqlDatabase -ConnectionString <String> [-Confirm] [-WhatIf] [<CommonParameters>]
Parameter Description

Database

Name of the monitoring database to delete. Optional only if ConnectionString is specified.

ConnectionString

Connection string that specifies the database to remove.

Confirm

Optional, requires the user to confirm the operation.

Server

Name of the server that hosts the store to be dropped. Optional; if not specified defaults to the local server unless ConnectionString is specified.

WhatIf

If specified, a connection is made to the database. However, its artifacts are not actually deleted.

Note

Any common parameter descriptions for this cmdlet apply to all other cmdlets in this document. For the sake of conciseness they are not needlessly duplicated.

Example

Example 1: Remove a monitoring database.

Remove-ASMonitoringSqlDatabase –Database “MonitoringDB1” –Server “contosoDBserver” 

Example 2: Remove a monitoring database without user confirmation.

Remove-ASMonitoringSqlDatabase –Database “MonitoringDB1” –Server “contosoDBserver” -force

Example 3: Remove a monitoring database for a named connection string without user confirmation. This example also shows how to use Get-ASConnectionString, and then pipes that output to Remove-ASMonitoringSqlDatabase.

Get-ASConnectionString –Root –ConnectionStringName “monitoringConnectionString1” | Remove-ASMonitoringSqlDatabase -force

Remove a Persistence Store

This cmdlet will delete a persistence store schema from a database. Unlike the Remove-ASMonitoringSqlDatabase cmdlet, this cmdlet will never drop the database.

Remove-ASPersistenceSqlDatabase

Syntax 1:

Remove-ASPersistenceSqlDatabase -Database <String> [-Force] [-Server <String>] [<CommonParameters>]

Syntax 2:

Remove-ASPersistenceSqlDatabase -ConnectionString <String> [-Force] [<CommonParameters>]
Parameter Description

Database

Name of the persistence store to be removed. Optional only if ConnectionString is specified.

ConnectionString

Connection string to the persistence store to be used.

Force

Forces removal of the persistence store without confirmation by the user. Optional.

Server

Name of the SQL Server that hosts the persistence store to be deleted. Optional; if not specified, defaults to the local server.

Example

Example 1: Remove a persistence store.

Remove-ASPersistenceSqlDatabase –Database “PersistenceDB1” –Server “contosoDBserver” 

Example 2: Remove a persistence store without user confirmation.

Remove-ASPersistenceSqlDatabase –Database “PersistenceDB1” –Server “contosoDBserver” -force

  2012-09-12