SQL Server: DROP All But A Few Tables With PowerShell (or DROP ALL)

Recently, I received a request to backup a dozen tables or so tables out of 12 thousand tables. I had to retain all the indexes, statistics etc. The goal was to hand this over to the vendor for analysis as a database backup. I could have copied the selected tables over to a new database … Continue reading SQL Server: DROP All But A Few Tables With PowerShell (or DROP ALL)

Advertisements

SSAS: Automate SSAS Backups With PowerShell

I was looking for a solution to automate SSAS backups using PowerShell. By "automate", I mean the following: Backup one or more SSAS databases in an SSAS instance to a network location Automatically cleanup backups that are older than [x] days Schedule the backups via SQL Server Agent with minimal overhead Backup multiple host instances/databases … Continue reading SSAS: Automate SSAS Backups With PowerShell

PowerShell: SQL Server Services Startup Mode Change

This is one of those extremely simple posts where everyone who does PowerShell knows how ridiculously simple it is to do and you will too today. You will look like a magician to the uninitiated. Today, I had about 5 hosts running 4 instances of SQL Server each and I had to Stop all SQL … Continue reading PowerShell: SQL Server Services Startup Mode Change

SQL Server: Detach/Attach Gotchas!

Please checkout my post on "Moving Datafiles" which is very related to this method but is preferred more. One would think that detaching and attaching databases is one of the simplest things to do. It is. However, there are so many things that can break by that simple operation by itself and nothing more. Recently, … Continue reading SQL Server: Detach/Attach Gotchas!