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
Exception calling “KillAllProcesses” with “1” argument(s): "Drop all active
database connections failed for Server ‘myserverName’. "
+ CategoryInfo : NotSpecified: ( , ParentContainsErrorRecordE
+ FullyQualifiedErrorId : FailedOperationException
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
PowerShell exit code: 1
PowerShell script returned a non-zero exit code: 1
Tentacle version 184.108.40.2060
restore.ps (5 KB)