Options

COPYTO Error: Failed to create folder

jalfanojalfano Posts: 24
edited October 16, 2007 5:42PM in SQL Backup Previous Versions
Our company recently purchased and started using Red-Gate's SQLBackup (v5.x). One of the features we've adopted is the use of the COPYTO command to create remote server copies. This is working fine.

One of our off-site hosting facilities offers Red-Gate's SQLBackup as part of the hosting package. The version offered is v4.6.0.815. When using the COPYTO command I'm consistently getting the following error message for every database being backed up:
Warning 145: COPYTO error: Failed to create folder: \\HostB\REMOTEBACKUP\Director
Warning 145: COPYTO error: Failed to create folder: \\HostB\REMOTEBACKUP\DirectorMaster
... etc ...

Where HostB is the server that contains the share called REMOTEBACKUP where we want to copy the files to. I checked that the SQL Server job scheduler is running as our SQL Service account. The SQL Service account has Change share permissions to the REMOTEBACKUP share and Modify NTFS permissions to the directory that the REMOTEBACKUP share is attached to. I also checked to make sure that those permissions are being applied to that directory and all subdirectories and files. I further tested by logging into the server as the service login and accessing the share: create directory / delete directory / ...etc...

The command I'm using in the job is as follows:
DECLARE @exitcode int
DECLARE @sqlerrorcode int
exec master..sqlbackup N'-SQL "BACKUP LOGS EXCLUDE [master, msdb, model, tempdb, ASPState] TO DISK = ''G:\MSSQL.1\MSSQL\Backup\<DATABASE>\<AUTO>'' WITH NAME = ''<AUTO>'', DESCRIPTION = ''<AUTO>'', ERASEFILES_ATSTART = 1, COMPRESSION = 1, THREADS = 1, FILEOPTIONS = 1, COPYTO = ''\\HostB\REMOTEBACKUP\<DATABASE>''"', @exitcode OUTPUT, @sqlerrorcode OUTPUT
IF (@exitcode <>0) OR (@sqlerrorcode <> 0)
BEGIN
  RAISERROR ('SQL Backup job failed with exitcode: %d  SQL error code: %d', 16, 1, @exitcode, @sqlerrorcode)
END

I am at a loss as to what is causing this error. Are there any known issues with using UNC paths when using the COPYTO command?

Thank you for your help,

John

Comments

  • Options
    PS: The full backup is experiencing the same issue as the log backup.
  • Options
    The hosting facility was able to upgrade us to version 5.2. This seems to have fixed the problem. I believe the root cause was that in 4.x you can't specify the software to run as a particular service account whereas in 5.x you can (through the SQL Red Gate Agent service). The service account I specified has the proper permissions. I'm thinking that the software in 4.x runs as some other system account that didn't have specific access to the share.
Sign In or Register to comment.