There is SQL Server instance with 4 DBs. There is remote directory '\u12160.your-backup.com\backup\SQL' which can be accessed ONLY with User/Password (no user auth or anything other).

I want to backup DBs on schedule with SQL Server Agent job like this

EXEC sp_BackupDatabases @backupLocation='\\u12160.your-backup.com\backup\SQL', @backupType='F'

but it throws error

Operating system error 1326(The user name or password is incorrect.).
Msg 3013, Level 16, State 1, Line 1

Is it possible somehow to pass username/password? Or are there any other ways to backup straight into remote directory&

Thank you.

  • 1
    The account that you are using to run SQL Agent doesn't have access to that location. You need to give that user access. You can see what this is by running select * from sys.dm_server_services – scsimon Oct 24 '19 at 13:00
  • @scsimon I do not own that location and admin won't give any privileges to SQLServer user, everything I have is login\password, I should user only credentials – Takito Isumoro Oct 24 '19 at 13:07
  • If you are running that proc via Agent the Agent account is going to need access. You could use sqlcmd and run that as a dedicated user if you'd like. Personally, I'd back this up to a local drive (for speed) and then schedule a windows job to move it (or even better, just COPY it) to your remote location. That windows job can run as whatever user you want as long as it has access to that file location. – scsimon Oct 24 '19 at 13:42

Can you turn the network path into a drive letter using windows explorer or workplace

This allows to "use different user credentials" - and "remember the settings" + "automatically connect upon startup"(or similarly named) - so it should automatically connect to the network path using the username+password combo you got... Then use your database backup with the created drive letter from the above step

  • I think you need to add more details to this. Specifically how mounting the drive so not only windows sees it, but SQL Server as well. – scsimon Oct 24 '19 at 13:43
  • Thank you. It works! – Takito Isumoro Oct 24 '19 at 14:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.