Am trying to test a restore script for a SQL Anywhere 11 database on our staging server. Here is my batch file:
EECHO restore db started >>db_restore_log.txt ATTRIB -R D:\DonorCentral\DB\dctemp.db >>db_restore_log.txt RENAME D:\DonorCentral\DB\dctemp.db old_dctemp.db >>db_restore_log.txt COPY C:\DonorCentral\DB\dctemp.log C:\DonorCentral\DB\old_dctemp.log >>db_restore_log.txt COPY D:\DonorCentral\Backup\dctemp.db D:\DonorCentral\DB\dctemp.db >>db_restore_log.txt "%SQLANY11%\bin32\dbsrv11.exe" -o db_restore_log.txt D:\DonorCentral\DB\dctemp.db -a D:\DonorCentral\Backup\dctemp.log "%SQLANY11%\bin32\dbsrv11.exe" -o db_restore_log.txt D:\DonorCentral\DB\dctemp.db -a C:\DonorCentral\DB\dctemp.log
Running this successfully does the file operations (i.e. ATTRIB, RENAME, COPY) and opens the database server console. However, it fails when trying to restore the transaction log from the backup. The message is "Cannot open transaction log file -- access is denied". The log from the backup is not read-only. Any ideas on problem and resolution?
Thanks for the replies. I resolved this by running the batch file as an administrator.
answered 16 May '16, 17:17