I'm attempting to restore a SQL Server 2008 R2 backup into a SQL Server 2014 database WITH MOVE but am encountering the following error:
The operating system returned the error '32(The process cannot access the file because it is being used by another process.)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'E:\Intuitive8.7Data\iERP87_Data.mdf'.
Following is the code I'm using attempting to accomplish this:
USE Master
GO
ALTER DATABASE iERP87 SET OFFLINE WITH ROLLBACK IMMEDIATE;
RESTORE DATABASE [iERP87]
FROM DISK = N'E:\Temp\iERP81_2008.bak'
WITH
MOVE N'Production70_Data' TO N'E:\Intuitive8.7Data\iERP87_Data.mdf',
MOVE N'Production70_Log' TO N'E:\Intuitive8.7Log\iERP87_Log.ldf',
NOUNLOAD, REPLACE, STATS = 10
ALTER DATABASE iERP87 SET ONLINE WITH ROLLBACK IMMEDIATE;
As a result of searching on-line for help I have user "Process Explorer" to look for processes using the mdf file without finding any and have rebooted the server to ensure there are no other open connections.
I've run out of ideas on this one. Any help would be most appreciated.