Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By : Donabel Santos
Book Image

SQL Server 2014 with PowerShell v5 Cookbook

By: Donabel Santos

Overview of this book

Table of Contents (21 chapters)
SQL Server 2014 with PowerShell v5 Cookbook
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

Restoring an SSAS database


You will see how to restore an SSAS database in this recipe.

Getting ready

Locate your SSAS backup file, and replace the backup file parameter with the location of your file.

How to do it...

Let's explore the code required to restore an SSAS database:

  1. Open PowerShell ISE as an administrator.

  2. Import the SQLASCmdlets module as follows:

    #import SQLASCmdlets module
    Import-Module SQLASCmdlets -DisableNameChecking
  3. Add the following script and run it:

    $instanceName = "localhost"
    $backupfile = "C:\Temp\AWDW.abf"
    Restore-ASDatabase -RestoreFile $backupfile -Server $instanceName -Name "AWDW" -AllowOverwrite

How it works...

The Restore-ASDatabase allows multidimensional or tabular SSAS databases to be restored when provided with a backup file:

$instanceName = "localhost"
$backupfile = "C:\Temp\AWDW.abf"
Restore-ASDatabase -RestoreFile $backupfile -Server $instanceName -Name "AWDW" -AllowOverwrite

There's more...

To learn more about the Restore-ASDatabase cmdlet, visit http://msdn.microsoft...