I am having issues with restore database. I am using the template from octopus library center, here is my issues
I am trying to restore a Dev database to Stage database, they databases have different names and located on same server
I changed the template to accept a file name, please find the script in attachments
Issue#1: the process kept failing saying “cannot find the file”, i made sure the printed path is correct and the file is exist. I changed the check of file existence to use .NET API, but still no luck. so I commented the check loop.
Issue#2: KillAllProcess was failing, as you see below.
The user i am connecting with has db_owner permissions. should it be systemadmin?
Tentacle script execution
Error 11:32:52
Exception calling “KillAllProcesses” with “1” argument(s): "Drop all active
Error 11:32:52
database connections failed for Server ‘myserverName’. "
Error 11:32:52
At C:\Windows\system32\config\systemprofile\AppData\Local\Tentacle\Temp\aeef247
Error 11:32:52
5-d418-4751-b9b6-7c5bcc3e1fa5.ps1:110 char:9
Error 11:32:52
-
$server.KillAllProcesses($dbName)
Error 11:32:52
-
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error 11:32:52
+ CategoryInfo : NotSpecified: ( [], ParentContainsErrorRecordE
Error 11:32:52
xception
Error 11:32:52
+ FullyQualifiedErrorId : FailedOperationException
Info 11:32:52
Connecting to server using SQL authentication as dbname_stg.
Attempting to restore database serverName.dbName_db from:
C:\Program Files\Microsoft SQL Server\MSSQL11.SS2012\MSSQL\Backup\dbName_1.0.4134.bak
Info 11:32:53
PowerShell exit code: 1
Fatal 11:32:53
PowerShell script returned a non-zero exit code: 1
Tentacle version 2.6.5.1010
restore.ps (5 KB)