I think this post belongs to the SQL Database Engine Forum since we are focusing on what the Restore Command is doing. Here is the situation I am in.
I have a ssis package which restores database from a backup file. the command is:
USE [master]
RESTORE DATABASE [HMX_TEST]
FROM DISK = N'L:\dwbi\STAGE\unzipped\Main_agk.BAK'
WITH FILE = 1
,MOVE N'Main_Data' TO N'J:\dwbi\data\HMX_TEST.mdf'
,MOVE N'Main_Log' TO N'K:\dwbi\logs\HMX_TEST.ldf'
,NOUNLOAD
,REPLACE
,STATS = 10
GO
two days ago the job was run successfully. but for the past two days, we are getting error messages below, and the jobs failed:
Message
Executed as user: JHA\sqlsrvc. Microsoft (R) SQL Server Execute Package Utility Version 10.0.5500.0 for 64-bit Copyright (C) Microsoft Corp 1984-2005. All rights reserved. Started: 10:10:15 AM Error: 2013-07-18 10:10:36.14
Code: 0x00000000 Source: Restore HMX_TEST Description: Exclusive access could not be obtained because the database is in use. End Error Error: 2013-07-18 10:10:36.14
Code: 0xC002F210 Source: Restore HMX_TEST Execute SQL Task Description: Executing the query " USE [master] RESTORE DATABASE [HMX_TEST] ..."
failed with the following error: "RESTORE DATABASE is terminating abnormally.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.
End Error DTExec: The package execution returned DTSER_FAILURE (1). Started: 10:10:15 AM Finished: 10:10:36 AM Elapsed: 20.672 seconds. The package execution failed. The step failed.
Nothing was changed. Can someone help me identify what the issue might be? thanks !
Thank You Warmest Fanny Pied