Wednesday, March 25, 2009

Operating system error 1330(error not found) on RESTORE DATABASE in SQLcmd

A colleague of mine had this problem today (and found a solution!):

While trying to restore a database from a UNC path that’s not in the same domain as your database server, you might get the following error:

1> RESTORE DATABASE DatabaseName FROM DISK = '\\Server\Dump\DatabaseName.bak' WITH REPLACE

2> go

Msg 3201, Level 16, State 2, Server ServerName, Line 1

Cannot open backup device '\\Server\Dump\DatabaseName.bak'. Operating system error 1330(error not found).

Msg 3013, Level 16, State 1, Server ServerName, Line 1

RESTORE DATABASE is terminating abnormally.

Error not found, quite handy.

Note that on that network share “Everyone” has read rights (also on NTFS). So the file can be read from explorer. SQLcmd tries to use the domain user, and only that user for some reason.

The solution lies in the creation of a user account on the non-domain machine, with the same name as the domain user. (Never mind the domain prefix). Set the password, and you’re off!

No comments: