0

SQL Version: Microsoft SQL Server 2016(SP3)(KB5003279) - 13.0.6300.2 (X64)

OS Version: Windows Server 2012 R2 Standard

I am trying to setup the backups and database maintenance jobs using Ola Hallengren's sripts. I have the following job setup:

sqlcmd -E -S $(ESCAPE_SQUOTE(SRVR)) -d master -Q "
    EXECUTE dbo.DatabaseBackup 
    @Databases = 'Lease',
    @Directory = N'\\wlsfs02\Shared05\DatabaseBackups',
    @BackupType = 'FULL',
    @Verify = 'Y',
    @CleanupTime = 360,
    @CleanupMode = 'AFTER_BACKUP',
    @Compress = 'Y',
    @ChangeBackupType= 'N',
    @CheckSum = 'Y',
    @LogToTable = 'Y'
" -b

When I run the job it errors out with:

enter image description here

The file path does exist and is correct. If I change the file path to a local drive it will run and successfully backup the database. The job is running as:

enter image description here

Looking at SQL Server Agent in SSCM it is using the Network Service account. If I try to change it to a domain account that has access to the network folder I get the following error:

enter image description here

I know for sure the password I provided was correct.

What am I doing wrong? How do I get the script above to backup to a network location?

0

1 Answer 1

4

The Agent service account is irrelevant.

You need to make sure that the database engine has relevant permissions. Either assign relevant permissions on the share to the Computer account in your domain, or change the service account for the database engine to a domain account and assign permissions to this account.

Use SQL Server Configuration Manager when you change service account. (Not using the right tool to change service account is why Agent didn't start for you.)

1
  • Assigning permissions on the share to the computer account worked. Thanks
    – Linger
    Jun 29, 2022 at 14:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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