11 Restore

 

In the previous chapter, we talked about how important backups are, but we’d argue that restores are equally important. When there’s a disaster, you need to quickly and (hopefully) easily restore your databases. PowerShell is the perfect solution, because it simplifies bulk actions.

Restores are fundamental for migrations, disaster recovery, continuous integration/continuous deployment (CI/CD), and even testing to ensure restores comply with governmental regulations. This chapter will cover the multitude of ways to effectively use our restore commands both for simplified restores and advanced ones as well. You’ll learn how to do the following:

  • Restore an entire instance
  • Create scripts that ease disaster recovery
  • Quickly recover from database corruption
  • Restore from Azure

By the end of this chapter, you’ll feel more relaxed knowing you can easily restore an entire instance’s worth of database backups with a single command. And you’ll be ready to save the organization in the event of a disaster or unexpected event.

11.1 Limitations and considerations

11.2 Restore scenarios

11.2.1 File

11.2.2 Directory

11.2.3 Output T-SQL restore scripts

11.3 Restoring to custom data and log directories

11.3.1 No recovery

11.3.2 Renaming a database

11.3.3 Point-in-time restores

11.3.4 Restoring to a marked transaction

11.3.5 Recovering a corrupt database

11.4 Azure

11.4.1 Shared access signatures

11.4.2 Access keys