Have you ever encountered the error message “Operating system error 1326” while trying to backup your SQL Server database? This error is specific to a situation where SQL Server is installed on a machine in a Workgroup, while the backup destination is a server located in a domain.
When the backup is taken, the SQL Agent Service account is used. However, since SQL Server is in a Workgroup, the account used is “NT Service\SQLSERVERAGENT”, which is not a valid account for domain authentication.
To verify if you are experiencing the same issue, you can try querying the remote share using the xp_cmdshell command. If you receive a “Logon failure: unknown user name or bad password” error, then you are hitting the same issue.
The solution to this problem is to map a drive to SQL Server (not Windows). According to SQL Server Books-On-Line, “For a network share to be visible to SQL Server, the share must be mapped as a network drive in the session in which SQL Server is running.”
To map the drive, you can use the following command:
EXEC XP_CMDSHELL 'net use Z: \\192.168.3.55\backupShare password@123 /User:domain\user'
Once the drive is successfully mapped, you should be able to see the content on the Z drive by running the command:
EXEC XP_CMDSHELL 'dir Z:\'
After mapping the drive, you can now take a backup on the Z drive as it is mapped within SQL Server as a drive. For example:
Backup database master to disk = 'Z:\master.bak'
By following these steps, you should be able to fix the “Operating system error 1326” and successfully backup your SQL Server database.
Have you encountered this error before? Did you find this solution interesting? Please leave a comment and let me know.