January 7, 2014 at 8:27 am
Hello,
I am trying to help automate our nightly backups for our test SSAS servers with PowerShell. The code I am using enumerates through all of the databases on a specific SSAS instance and backs up the databases to a specified location. The script works great for some instances but it errors out for others. For the ones it works great for, it connects, backs up all of the databases, and write success messages to the console. However, for some other instances, the script connects, attempts to backup the database, and fails to backup with the following PowerShell error message:
"Exception calling "Backup" with "1" argument(s): "The following error occurred during a file operation: Access is denied.(\\Server\backup_test\test_01.07.2014.07.31.32.abf)."
The code I am using for the backups is as follows:
$server = New-Object Microsoft.AnalysisServices.Server
$server.Connect($server_instance)
$dbs = $server.Databases
foreach($db in $dbs){
try{
$dt = Get-Date -f _MM.dd.yyyy.HH.mm.ss
$fileName = $("$filePath\$db$dt.abf")
LogWrite $("----Backing up the file: "+$fileName)
$db.Backup($fileName)
}
catch{
LogWrite $("ERROR --> There was an error when attempting to backup the db: " + $db)
LogWrite $_
}
The script is being run through SQL Agent under an account that has full admin permission to all of the SSAS instances. What strikes me as odd is some instances work just fine while only a handful of instances receive these errors. Can anyone help me figure this out?
February 7, 2014 at 8:22 am
I'm not using powershell; but use the agent on the associated SQL Server with SQL Server Analysis command option. It executes under the SQL Server Agent Service Account as default... So just a thought in case the powershell operates in the same way. If you are not using the same account to manage all instances of SQL then confirm that each account has sufficient R\W permissions on the backup share.
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply