How can I automate may database backup using query analyser?
My routine goes this way:
1. Every 5:00pm check Enterprise manager who is currenlty logged on to sql server.
2. If there are no currently logged on, edit the date sql script (back-up, both full and incremental). Be sure there are folders created at the main server.
3. Open Query analyser: log as backup operator
4. Open the SQL File, >Run>Close
This routine will take me 15 to 30 minutes a day because of the large file size.
Is there an easier way?I would recommend using SQL Agent for scheduling the job. You may need to make your query more robust depending on the reason you check for users in the database. If you are implying that you only perform a backup if there are no users connected, then your procedure would need to loop until that condition occurs -- SQL Server can successfully backup a database with active connections, so I'm not sure why you check for that.
No comments:
Post a Comment