Error when restoring database (Windows 7 test environment)

15,646

Solution 1

'32(failed to retrieve text for this error. Reason: 15105)'

Based on a little searching this seems to be SQL Server's way of not correctly reporting an OS (Win32 API) error.

Error 32 is ERROR_SHARING_VIOLATION "The process cannot access the file because it is being used by another process."

Something else has the file open, this could be some other connection, or even the one being used to do the restore, has AdventureWorks open.

Solution 2

In my case was a very silly thing. After checking many times I didn't realize that the begining date from the SAS was incorrect "in the future". In México we use dd/mm/yyyy and the problem was that the captured date was "mm/dd/yyyy" and that date was in the future. After updating that date, the restore worked.

Share:
15,646

Related videos on Youtube

Admin
Author by

Admin

Updated on September 17, 2022

Comments

  • Admin
    Admin over 1 year

    I have a windows 7 operating system as a test environment. I have SQL Server EE installed with two instances, named as test and production. I took a full backup from AdventureWorks database from test instance and I tried to restore it into the production instance:

    RESTORE DATABASE [testikanta] FROM  DISK = N'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008TESTI\MSSQL\Backup\AdventureWorks.bak' WITH  FILE = 1,  NOUNLOAD,  REPLACE,  STATS = 10
    GO
    

    I got an error saying:

    Msg 3634, Level 16, State 1, Line 1
    The operating system returned the error '32(failed to retrieve text for this error. Reason: 15105)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008TESTI\MSSQL\DATA\AdventureWorks_Data.mdf'.
    Msg 3156, Level 16, State 8, Line 1
    File 'AdventureWorks_Data' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008TESTI\MSSQL\DATA\AdventureWorks_Data.mdf'. Use WITH MOVE to identify a valid location for the file.
    Msg 3634, Level 16, State 1, Line 1
    The operating system returned the error '32(failed to retrieve text for this error. Reason: 15105)' while attempting 'RestoreContainer::ValidateTargetForCreation' on 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008TESTI\MSSQL\DATA\AdventureWorks_Log.ldf'.
    Msg 3156, Level 16, State 8, Line 1
    File 'AdventureWorks_Log' cannot be restored to 'C:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008TESTI\MSSQL\DATA\AdventureWorks_Log.ldf'. Use WITH MOVE to identify a valid location for the file.
    Msg 3119, Level 16, State 1, Line 1
    Problems were identified while planning for the RESTORE statement. Previous messages provide details.
    Msg 3013, Level 16, State 1, Line 1
    RESTORE DATABASE is terminating abnormally.
    

    Where's the problem? I'm running these instances as on local machine adminstrator (SQL Server services are running with the same account).