Reputation: 4309
I need to restore the service master key from a server to my local database. This is working on SQL Server Express's (localdb)\msSqlLocalDB
database, but it's not working on the SQL Server Developer edition on the same machine.
I use this SQL statement to restore the key:
ALTER SERVICE MASTER KEY REGENERATE
GO
RESTORE SERVICE MASTER KEY
FROM FILE = N'\\exported_servicemasterkey'
DECRYPTION BY PASSWORD = 'my_password'
FORCE
GO
I get an error from the restore step:
Msg 15317, Level 16, State 2, Line 4
The master key file does not exist or has invalid format.
I am sure the file is there, and the format is correct. It's working on localDB.
Upvotes: 1
Views: 300
Reputation: 4309
The exported_servicemasterkey file in the original question is a network location. Apparently, the account running localDB (NT Service\MSSQL$SQLEXPRESS) has access to this location. The account running developer edition (NT Service\MSSQLSERVER) do not have access to the location. I coped the file from the network location to my drive. The restore worked after this.
Upvotes: 1