chapter fourteen

14 Disaster Recovery

 

In this chapter, we’ll be learning about how dbatools can help ease recovering your SQL Server instance from a major disaster. Disasters can be caused by a variety of factors including data center fires, severe weather, human error or even intentional sabotage.

If a disaster occurs, your entire SQL Server instance may no longer be accessible and would need to rebuilt from from ground up. You would need to add everything back that existed prior to the disaster, including logins, credentials, agent jobs, schedules, linked servers, availability groups and more.

Fortunately, dbatools makes this once-daunting task easy. This chapter will introduce you to the commands that you can use to rebuild a SQL Server that is no longer available. Ultimately, this helps drastically reduce your Recovery Time Objective (RTO) or, the time that it takes to recover your environment.

14.1  Export-DbaInstance

14.1.1  Directory of instance T-SQL files

14.1.2  Scripting Options

14.1.3  Setting Scripting Options

14.1.4  Excluding objects

14.2  Granular Exports

14.2.1  Using Export-DbaScript

14.3  Special Commands

14.3.1  Exporting server configurations (sp_configure)

14.4  Hands-on Lab