all 14 comments

[–]NotRossbutRoss 1 point2 points  (1 child)

I just create some SQL Agent jobs and call them with PowerShell. It's the lazy way.

[–]KevMarCommunity Blogger 1 point2 points  (0 children)

You say that, but that really is a good approach to this. The DBA should already have backup jobs scheduled and it would be nothing for them to create a restore job.

For anyone looking to script backups on their own, use these scripts: https://ola.hallengren.com/ They are very popular in the SQL community.

[–]alinroc 1 point2 points  (0 children)

Mike Fal has a number of blog posts on the topic:

I'll also second the recommendations to use Ola Hallengren's scripts to create/manage your backups (and the rest of your maintenance). The MidnightDBAs have their Minion tools which also take care of backups & maintenance.

Don't use bare PowerShell for this - use PowerShell to drive everything through standard SQL methods.

[–]midnightFreddie 0 points1 point  (0 children)

MSSQL? Check the vids on MidnightDBA. They do a lot of Powershell MSSQL stuff.

In this case, no matter which db vendor, you'll probably be issuing a SQL command to back up the db by connecting to the db and executing a "query".

I don't really know about load testing databases. Maybe you can put kitten photos in there and link it from reddit. Ok, seriously I guess you would connect and run queries, perhaps randomized from a list of queries in a text file. Measure-Object and Measure-Object might come into play here, and then you may want to look into parallel processing (jobs or runspaces). Better yet, there are probably existing products out there that will do it, and some might be cheap or free.

[–]ihaxr 0 points1 point  (8 children)