05-30-2012 10:41 PM - edited 05-30-2012 10:43 PM
Does anyone know if it is possible to detach a database using a script (DOS like commands or otherwise, something that can be made into a batch file preferrably), as it seems whenever my backup sync software runs, it fails to always backup the adf and alf file as they are locked by being attached.
I've had to manually go into actdiag, detach, run the backup job, and re-attached the database, which is really annoying... I want to automate the process.
My idea is to run a script using Windows Task scheduler to detach, run the backup software to sync, then use task scheduler to re-attach (with proper timings between the three steps of course) so all is well.
Is this a bad way to go about it, any other idea's to resolve my issue... I am willing to hear them out.
05-30-2012 11:21 PM
05-30-2012 11:30 PM
I'd be inclinded to use a script like Mike's that stops and starts the ACT7 SQL service.
Although... with the new ACTDiag that comes with 2012, it now supports command line options, one of which is DETACH and antoher is ATTACH. I think however that it'll be easier using net stop and net start.
I've got more than few sites that use the ACT! Scheduler to do a 'regular' backup and a script to stop/start the SQL service and do a second more customised backup.