What is the best powershell script to restore an SQL Database?
Posted
by
EtienneT
on Server Fault
See other posts from Server Fault
or by EtienneT
Published on 2011-02-25T15:15:50Z
Indexed on
2012/12/19
5:04 UTC
Read the original article
Hit count: 526
sql-server
|powershell
To restore an SQL Server 2008 database, I would lile to be able to just do something like this in powershell:
./restore.ps1 DatabaseName.bak
Then the powershell script would by convention restore it to a database with name "DatabaseName". It would disconnect any user connected to this database so that it can restore the DB. It would store the mdf and ldf in the default location.
This would mainly be while developing on my personal machine. Just a quick way to restore a DB.
Anyone has such a script?
Thanks
© Server Fault or respective owner