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

Backing up an SSAS database


In this recipe, we will create an SSAS database backup.

Getting ready

Choose an SSAS database you want to back up, and replace the –Name parameter in the recipe. Ensure that you are running PowerShell with administrator privileges to the SSAS instance.

How to do it...

These are the steps required to create an SSAS database backup:

  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"
    Backup-ASDatabase -BackupFile $backupfile -Name "AWDW" -Server $instanceName -AllowOverwrite -ApplyCompression

How it works...

The Backup-ASDatabase cmdlet allows multidimensional or tabular SSAS databases to be backed up to a file. In this recipe, we chose to do a compressed backup for the AWDW SSAS database to an Analysis Services Backup file (.abf):

$instanceName = "localhost" 
$backupfile...