PowerShell script exchange
Post Reply
rscale
Novice
Posts: 6
Liked: never
Joined: Feb 13, 2018 6:39 pm
Full Name: Mike Richter
Contact:

restore-vesqldatabase DB refresh question

Post by rscale » Jul 19, 2019 5:20 pm

I'm writing a script to perform a nightly refresh of a test DB from the Production backup. Everything looks like it's going fine and then I get:

Restore-VESQLDatabase : The specified file already exists on the target server.

I'm using -Force switch which should allow the job to overwrite the file, but it doesn't seem to be working. I've verified that the account running the job has full access to the DB and Log files so they should be able to overwrite them at the file system level. I could write to a different file, but since it is a nightly task, the issue would occur the second time it ran. Any ideas?? His is my Restore-VESQLDatabase line:

Restore-VESQLDatabase -Database $clDatabase -ServerName $destDBsrv -InstanceName $destDBInst -Force

I've verified the variables are all being populated correctly by DB objects and server/instance names... Any Ideas?

Mike

veremin
Product Manager
Posts: 16666
Liked: 1390 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: restore-vesqldatabase DB refresh question

Post by veremin » Jul 19, 2019 6:09 pm

Should work fine, is it the whole line or you've ejected parameter or few? Thanks!

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests