cancel
Showing results for 
Search instead for 
Did you mean: 

sql anywhere backup to mapped drive

Former Member
0 Kudos

Using sqlanywhere 12, we are trying to set up a scheduled daily backup to a networked drive. The command string we are using is:

create event DailyBackup
schedule DailyBackup
start time '03:00 pm' every 24 hours
Handler
Begin
DECLARE Backup_Stmt long VARCHAR;
Set backup_stmt = 'BACKUP DATABASE DIRECTORY '|| '''P:\WinIATS\winiats71\WINIATSBACK'' '|| 'TRANSACTION LOG TRUNCATE ';
EXECUTE IMMEDIATE backup_stmt;
end;

where P is a mapped drive to at windows2012 server. The auto backup fails to backup the database,but running the DBBACKUP command manually succeeds. How can we sucessfully run a event driven backup to a mapped drive?

Accepted Solutions (0)

Answers (1)

Answers (1)

chris_keating
Advisor
Advisor
0 Kudos
  • Is SQL Anywhere running as a Windows Service?
  • What account is that service associated?
  • Does that account have the drive you wish to use mapped to P:?

By default, services run under a System account which is very restricted as to what resources it can access. This is a good approach from a security perspective. More so given that Windows continues to improve security with the System account. If you have a network resource requirement such as a mapped drive, you will not be able to use the System account - you will need to define an user account and use it as the service account.

Or you may want to consider backing up to storage on the machine hosting the database engine and moving it to the desired location as a separate process.