By Gennady Vanin Геннадий Ванин


2013-10-14 08:30:44 8 Comments

MS SQL Server 2012... with nightly databases backups to the same/local as SQL Server machine...

I am trying to add another SQL Server Agent Job to copy the .bak files to remote (non-windows, i.e. Linux) share with non-Windows (non-AD) user/password credentials. I do not have any access to configuring or changing that access which is under control of other, quite remote people.

For this (copying) I created local user with the same user name and password, gave it permissions to the (source or local) backup-folders upon which all perfecly works from command line (Win + К or cmd) if to enter the command manually:

RUNAS /user:UserName /savecred "robocopy d:\SQLBACKUP  \\10.195.xx.yyy\backup /S /purge /MAXAGE:7 /MT:1 /Z"   

but fails to run as SQL Server Agent job (type of step is "Operating System(CmdExec)". SQL Service Agent (with standard configuration of running under [NT Service/SQLServiceAgent] account, the job is owned by SA SQL Server superuser).

Can anybody explain me why it is failing and how to correctly make it running (taking into account that I do not have access to domain users configuration)?

2 comments

@Oleg Strutinskii 2016-02-08 07:37:15

Another way to copy files to the networked computer is to use source computer domain credentials - https://dba.stackexchange.com/a/128282/51798

@RubberChickenLeader 2013-10-14 19:01:33

To answer the specific question of why it is failing is that the service account on your server does not have the correct permissions to access the share.

I have an environment where I have 2 servers not on a domain. Using SQL Server Agent proxies is the way I solved this.

I have a special account I use for the 2 machines (Your accounts with the same name and password) which I had to add to the instance level credentials (under security in SSMS Object explorer) (see MSDN article "Create a Credential" ) and add an agent proxy under the Operating System (CmdExec) .

Once those are created you can select the account to run as (the name you gave your proxy) and it will work. However this is on 2008 and I have not played with the 2012 agent that much.
Should still work the same though.

You would then use your robocopy line "robocopy d:\SQLBACKUP \10.195.xx.yyy\backup /S /purge /MAXAGE:7 /MT:1 /Z" as your command (I use xcopy but it works the same).

@RubberChickenLeader 2013-10-15 18:43:18

Thanks for the edit. Ill use this style in my future postings.

@Gennady Vanin Геннадий Ванин 2013-10-16 04:23:48

I just wanted to insert the space between source and destination directory in copy-pasted from my answer robocopy command (which originally was with an error) but the edit with less than 6 symbols changed was not accepted. So, I had to expand my editing...

Related Questions

Sponsored Content

1 Answered Questions

[SOLVED] Backup SQL Server 2017 to remote directory

2 Answered Questions

[SOLVED] SQL Server agent job question

1 Answered Questions

1 Answered Questions

1 Answered Questions

1 Answered Questions

[SOLVED] SQL Server log shipping: How to give SQL Agent the needed rights to remote share?

  • 2015-02-09 05:47:14
  • Jonesome Reinstate Monica
  • 11126 View
  • 3 Score
  • 1 Answer
  • Tags:   sql-server

5 Answered Questions

Sponsored Content