Freigeben über


How do I clear my AppFabric Databases?

Once you start to develop apps with Windows Server App Fabric you will quickly find that your AppFabric monitoring and persistence databases become cluttered with stuff.  From time to time you will want to clear out these databases.

Here is the PowerShell script I use to get the job done.  Just copy these into a file like AppFabricReset.ps1

(Watch out for line breaks)

 # Bring in the App Fabric module
 import-module applicationserver
 $ConfirmPreference = "None"
 # Remove the persistence db
 Remove-ASPersistenceDatabase -Force -Server ".\SQLExpress" -Database "ApplicationServerExtensions" -Confirm:$false
 # Create the persistence DB
 Initialize-ASPersistenceDatabase -Admins $env:computername\AS_Administrators -Readers $env:computername\AS_Observers -Users "BUILTIN\IIS_IUSRS" -Database "ApplicationServerExtensions" -Server ".\SQLExpress" -Confirm:$false
 # Clear the monitoring DB
 Clear-ASMonitoringDatabase -Database "ApplicationServerExtensions" -Server ".\SQLExpress" -Confirm:$false