Export a database using Powershell

28 November 2011

As a SQL developer, I always want access to more data. As a sometime DBA, I have to manage requests from people wants data. Most people are satisfied with query access to a mirror/standby/backup.

Some users need more. A common workaround is to provide a production backup. However, most users don't have hard drives large enough for a production backup and restore.

I found myself in a situation like this recently. My workaround is to use bcp.exe to query out the data into files, along with format files and CREATE TABLE statements. Then I can re-create the database one table at a time. To make this easy, I wrote a Powershell.aspx) script to do this, and used the SQLPX Powershell Extensions (these are free, community-written scripts that anyone can use).

My original script was just 14 lines of script. After I cleaned it up, it become ~60 lines of script:

Export-DbToBcp.ps1

Happy scripting!

Permalink

The Top 10 Ways To Break Your Deployments

24 October 2011

On October 12, 2011 I spoke at PASS Summit 2011. I presented a 5-minute "lightning talk" about the Top 10 Ways To Break Your Deployments.

The reason: we all have bad deployment practices.

By mockingly arguing that we all do the worst deployments possible, I can (hopefully) inspire people to change their bad habits.

Here are my notes and slide deck:

Permalink