Link to home
Start Free TrialLog in
Avatar of n_srikanth4
n_srikanth4Flag for India

asked on

Restore SSAS database using Windows PowerShell and SQL Server 2014 AMO

Hi Experts,

I am unable to restore the SSAS Cube 2014 database within the stipulated time (60 sec) and also the dialog box is not closed after the restoration is complete , not working as expected in SQL 2014 (using Power Shell)

Here is the link , I have used for the restoration of SSAS Cube 2008 , but the same is not working for SSAS 2014.

http://www.databasejournal.com/features/mssql/article.php/3799636/How-to-Restore-an-SSAS-database-using-Windows-PowerShell-and-SQL-Server-2008-AMO.htm


Thanks,

SRK
ASKER CERTIFIED SOLUTION
Avatar of Deepak Chauhan
Deepak Chauhan
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of n_srikanth4

ASKER

Thanks Deepak for quick reply, but how can I exit out of the power shell dialog window and ensure that the restoration is completed. Is there any timeout property set in power shell ?
Hi SRK, Sorry for the delay response, in this case you can use this code. Save this code as .PS1 and call the script with error output redirection

let says .PS1 file location and name is D:\Shared\SSAS_Restore_Script.PS1

now command is: D:\Shared\SSAS_Restore_Script.PS1 2>&1 > D:\Shared\SSAS.txt

but how can I exit out of the power shell dialog window

stop-process -Id $PID   --- For exit the window.

Write-output "Restore process started" >D:\Shared\Restore_Log.txt
[Reflection.Assembly]::LoadWithPartialName("Microsoft.AnalysisServices")
$servername=New-Object Microsoft.AnalysisServices.Server
$servername.connect("lap037")
$servername.restore("D:\SHAREd\Vendor2008_05262015.abf","Vendor2008",$true)
Type D:\Shared\SSAS.txt >>D:\Shared\Restore_Log.txt
Write-output "Restore process Completed" >>D:\Shared\Restore_Log.txt
stop-process -Id $PID

Open in new window



Please change the output file location and database name and file name accordingly.