SSMs is somewhat convenient for us to do some common things. But sometimes it's not so impersonal. In particular, error messages.
Today, I encountered an error while doing a database restore: The specified conversion is not valid. (Sqlmanagerui)
Specified cast is not valid. (Sqlmanagerui)
No way, have to hit the code:
RESTORE from DISK = N'D:\XXDB. BAK'GO
What you see is this:
It turns out that it was encrypted when it was backed up. Encryption is encrypted, actually reported the conversion invalid error .....
Restore success with script after finding the password:
RESTOREFilelistonly from DISK =N'D:\XXDB. BAK' withPASSWORD= 'MyPassword'RESTORE DATABASE [XXDB2] from DISK =N'D:\XXDB. BAK' with FILE = 1, MOVE N'Xxdb' toN'D:\MSSQL\DATA\XXDB2.mdf', MOVE N'Xxdata' toN'D:\MSSQL\DATA\XXDB2_1.NDF', MOVE N'Xxdb_log' toN'D:\MSSQL\DATA\XXDB2_2.ldf', Norecovery,stats= Ten, PASSWORD= 'MyPassword'GO
--recover the database:
RESTORE DATABASE [XXDB2] with RECOVERY;
GO
Database restore error: The specified conversion is not valid. (Sqlmanagerui)