SQL Server 2000
- Open SQL Server Enterprise Manager
- Register your server
- Right-click the node Management > Backup, then select menu Add backup devices... We create devices "DBName Mondays.bak" to "DBName Sundays.bak" corresponding to each day of the week but you can use your own naming convention. We have assumed that DBName is the name of the database to backup.
- Right-click the node Databases > DBName, then select menu option All Tasks > Backup database...
- The SQL Server Backup – DBName dialog box is displayed.
- On the General tab, rename the backup "DBName Mondays", click the Remove button if an item appears in the backup to list, then click Add...
- In the Select Backup Destination backup select Backup Device and "DBName Mondays" then click OK.
- Make sure Database - complete and Overwrite existing media are selected.
- Check schedule and click ... to edit. Rename the schedule "DBName Mondays" and schedule to occur weekly on Mondays. Click OK.
- On the Options tab, click Verify backup upon completion and Remove inactive entries from transaction log. Keep other options unchecked.
- Go through steps 4 to 10 with "DBName Tuesdays" to "DBName Sundays".
- Go to the Management > SQL Server Agent > Jobs node, refresh the list and check the 7 backup jobs which you have just created.
SQL Server 2005
This is slightly more complicated in SQL Server 2005 because you cannot use the backup dialog which has no scheduling option. You need to use a maintenance plan. A maintenance plan is an SSIS package, which means you either need SSIS or SP2 installed, because SP2 includes a limited version of SSIS for maintenance tasks including backups.
- Open SQL Server Management Studio (Run as Administrator on Windows Vista).
- Right-click the node Server Objects > Backup Devices and select menu "Add Backup Device...".
- Name your backup device "DBName Mondays" and make it a file named "DBName Mondays.bak".
- Repeat steps 2 and 3 for "DBName Tuesdays" to "DBName Sundays".
- Start and configure SQL Server Agent which is a requirement for maintenance plans.
- Right click the node Management > Maintenance Plans and select menu "New Maintenance Plan..."
- Rename your plan "DBName Plan".
- Double-click "Subplan_1" to edit its properties.
- Name it "DBName Mondays" and create a schedule of the same name recurring weekly every Monday.
- Drop a "Back Up Database Task" from the toolbox onto the light yellow design surface.
- Right-click the task on the design surface and select menu "Edit...".
- Select the database(s) you want to back up, check option "Back up databases across one or more files", then click button "Add..." and select the backup device called DBName Mondays.
- Select "Overwrite" if backup file exists, check "Verify backup integrity" and click OK.
- On top of the list of subplans of "DBName Plan", click "Add Subplan".
- Go through steps 9 to 14 with "DBName Tuesdays" to "DBName Sundays".
- Go to the SQL Server Agent > Jobs , refresh the list and check the 7 backup jobs which you have just created.
For both SQL Server 2000 and SQL Server 2005, you can consider adding tasks to shrink databases, rebuild indexes, check database integrity in the scheduled jobs, but this goes beyond the scope of this article. In a following article, we will show you how to schedule FTP transfers to push and/or pull the backup files.
No comments:
Post a Comment