I need to restore about 1000 backups with the latest diff (for about 1000 databases). Some data was deleted last night in one column of a table. So I need to run a script on each restored vs current database to repair the data loss.

I know how to get a restore script via the Sql Server Mgmt Studio GUI, but how can I get a restore script for all the databases on the server?

Perhaps, there is a SELECT statement I could run to get full backup file path and latest diff file path for every database on the server. If you know how to do this, let me know.

(And yes I know to just do restore a database one at at time, and then delete to conserve space, but I still need to automate because there are about 1000 databases).


I think this two articles might help you to build your own version

Auto generate SQL Server restore script from backup files in a directory

Auto generate SQL Server database restore scripts

Good Luck!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.