0% found this document useful (0 votes)
11 views8 pages

Backup SQL Server System Databases

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views8 pages

Backup SQL Server System Databases

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd

Backup System Databases Using Maintenance Plans

By : Ashish Kumar Mehta

Nov 17, 2008

System databases are an integral part of SQL Server, as SQL Server is dependant on the
System Databases for functionality. Database Administrators should make sure that all the
system databases are part of their day to day backups. Most importantly, database
administrators should take full backup of all the system databases immediately after they have
applied any Hotfixes or Service Packs. Backups of system databases will let you restore and
recover the SQL Server system in the event of system failure, such as the loss of hard disk,
database corruption, hardware/operating system crashes or any natural disaster. As a DBA you
need to make sure that the system databases are backed up regularly along with all the user
databases and the backup tapes are stored in a secure location. To know more about system
databases in SQL Server you can refer to my previous article titled “System Databases in SQL
Server”.

Permissions Required to Create & Manage Maintenance Plans


Maintenance Plans are only displayed to those users who are connected to the SQL Server
using Windows Authentication Mode. Moreover, you need to be a member of sysadmin fixed
server role to create and manage maintenance plans. The maintenance plans on the SQL
Server are visible only to those users who are member of sysadmin fixed server role.

Using Maintenance Plans to Backup System Databases


In this article we will be creating a Maintenance Plan using SQL Server Integration Services
(SSIS) Designer Surface to backup all the system databases in SQL Server. To know more
about different types of maintenance plan tasks that are available in SQL Server 2005 or SQL
Server 2008 and their usage you can refer to my previous article titled “Overview of
Maintenance Plans in SQL Server 2008”.

1. Connect to SQL Server 2008 Instance using SQL Server Management Studio.

2. In the Object Explorer, click on Management and right click Maintenance Plans to open up
the popup windows as shown in the below snippet. In the popup windows you need to click on
New Maintenance Plan….

3. In the New Maintenance Plan screen you need to provide the name of the Maintenance Plan.
In this example the name for the Maintenance Plan is “BackupSystemDatabases’. Click OK to
open up the SSIS Designer Surface as shown in the below snippet.
4. In the BackupSystemDatabases designer surface, you have the option to provide the
description for the Maintenance Plan, Name & Description for Subplan, Manage Connections,
and Configure Schedules.

5. Double click on Subplan_1 text which will open up Subplan Properties windows where you
can provide the Name and Description about the Subplan as shown in the below snippet.

6. Next step will be to configure schedule for the maintenance plan which can be done by
clicking calendar icon. In the Job Schedule Properties windows provide the details as shown in
the below snippet and click OK to save the Job Schedule Properties window.
7. Next step will be to create a connection to SQL Server where the Maintenance Plan needs to
execute. This can be done by clicking on Manage Connections…. and from the popup you need
to select Add new connection…. which will indeed open up Connection Properties window. In
the Connection Properties window you need to provide Connection Name, Server Name and
choose appropriate authentication mode. To save the connection properties click OK.

8. Next step will be to drag and drop Back up Database Task, History Cleanup Task and
Maintenance Cleanup Task on the Designer Surface to configure Maintenance Plan.
9. Double click on Backup Database Task or right click and select Edit…. Option to configure
the Backup Database Task. Provide Connection details, Select Backup type as Full from the
dropdownlist, For Databases select All system databases from the dropdownlist (if you have
reporting service and replication installed and configured then you need to choose reporting
services and replication related distribution databases using the specify choose database
option), provide the database backup location. If you are interested in verifying backup
integrity then you can select the Verify backup integrity option. In SQL Server 2008, Microsoft
introduced much awaited inbuilt database backup compression feature. If you want system
databases to be backed up using backup compression feature then you can choose
“Compressed Backup” option in the dropdownlist. To know more about database backup
compression feature of SQL Server 2008 you can refer to my previous article titled “How to
configure and Use Database Backup Compression in SQL Server 2008”. Finally click OK to save
the configuration changes done to Back Up Database Task.
10. Double click on History Cleanup Task to configure the task as shown in the below snippet.
To remove historical data you need to provide the history retention time and click OK to save
the configuration changes.

11. Double click on Maintenance Cleanup Task to open up the configuration screen and provide
the database backup folder location and also provide the extension of the files which needs to
be removed at the end of retention period.
12. Finally you need to connect the green arrow from the Back up Database Task to History
Cleanup Task and in the next step you need to connect the green arrow from the History
Cleanup Task to Maintenance Cleanup Task to complete Maintenance Plan configuration.
13. You could see that Maintenance Plan is currently configured to take full backup of master,
msdb and model databases. However, in SQL Server 2005 and higher versions there is a new
hidden read only system database named Resource database which was introduced by
Microsoft. To know more about Resource Database you can refer to my previous article titled
“Importance of the Resource Database”. Resource database basically contains copies of all
system objects that are shipped with SQL Server 2005 and SQL Server 2008. In order to take
the backup of Resource Database you need to perform a file based or a disk based backup of
[Link] and [Link] files, by treating the files as if they
were like any other binary files, instead of a database file.

14. In Maintenance Plan as there is no other task available which performs file copy of
Resource Database (MDF & LDF Files), the only option available with us is to add a new step
manually within the SQL Server Agent Job
“[Link]” which was created by the Maintenance
Plan. The command used for copying [Link] and [Link]
files is mentioned below.

Syntax
XCOPY "D:\Program Files\Microsoft SQL Server\MSSQL10.SQL2008\MSSQL\Binn\
mssqlsystemresource.*" "D:\DatabaseBackups" /Y

15. Before saving the SQL Server Agent Job you need to make sure that the jobs success and
failure criteria for each steps are modified and it resembles as shown in the above snippet.

Executing the Newly Created Maintenance Plan


Once the “Basic Maintenance Plan for AdventureWorks databases” is created successfully you
can execute the same either by right clicking the plan and then clicking Execute under the
Maintenance Plans. Or you can expand the Jobs under SQL Server Agent node and execute the
following SQL Server Agent Job [Link].

Conclusion
Database Administrators should make sure that all the system databases are part of the day to
day backups. If you have applied any Hotfixes or Service Packs then immediately you should
take a backup of all the system databases including the hidden read only Resource Database.
If you have proper backups of system databases then you will be able to restore and recover a
SQL Server system in the event of system failure. In this article we have seen how to leverage
Maintenance Plans to take a backup of all the system databases.

Common questions

Powered by AI

Backing up system databases in SQL Server is crucial because these databases are essential for the SQL Server's functionality. They allow restoration and recovery of the SQL Server system in cases of system failures such as hard disk loss, database corruption, crashes, or natural disasters. Regular backups ensure that these databases can be quickly restored, maintaining system continuity. Additionally, after applying any Hotfixes or Service Packs, a full backup of all system databases should be taken immediately to capture the latest stable state of the server .

To create and manage Maintenance Plans in SQL Server, a user must be connected using Windows Authentication Mode and be a member of the sysadmin fixed server role. This level of permission is required because Maintenance Plans can affect significant changes to the database environment, and thus require administrative access to ensure they are managed securely and properly .

The integration of Backup Compression in SQL Server 2008 significantly enhances backup strategies by reducing the size of backups, which optimizes storage space and reduces I/O load during backup operations. This feature allows organizations to store more backup data on existing hardware infrastructure, potentially reducing costs associated with storage expansion. Furthermore, compressed backups can be transmitted over networks more efficiently, speeding up remote backup processes. However, the CPU overhead should be considered, as it may impact server performance during compression operations, suggesting that this feature should be used judiciously based on server load and capacity .

The Resource Database is unique because it is a hidden, read-only system database introduced in SQL Server 2005. It contains copies of all system objects shipped with SQL Server. Unlike other system databases, it requires a file-based or disk-based backup by copying the mssqlsystemresource.mdf and mssqlsystemresource.ldf files as if they were regular binary files. This backup process is unique because there isn't a direct task available in Maintenance Plans for backing up these files; instead, administrators must manually schedule a file copy operation within the SQL Server Agent Job associated with a backup maintenance plan .

Creating a Maintenance Plan using SQL Server Integration Services (SSIS) Designer Surface involves several steps: 1) Connect to the SQL Server instance using SQL Server Management Studio, 2) Navigate to 'Management' in the Object Explorer and right-click 'Maintenance Plans' to select 'New Maintenance Plan', 3) Name the Maintenance Plan and set descriptions, 4) Configure the maintenance schedule, 5) Manage connections by adding a new connection with required server and authentication details, 6) Drag necessary tasks (e.g., Backup Database Task, History Cleanup Task) onto the Designer Surface, 7) Configure each task with the required parameters like database types and backup options, 8) Ensure correct task sequencing via connectors on the Designer Surface. This structured approach helps systematically automate backups .

The Verify Backup Integrity option is significant because it assures that the backup has been successfully created and that it is readable. This verification step is crucial in scenarios where data consistency and reliability are critical, such as after major updates, before deploying a high-risk patch, or prior to database migration. Using this option helps to identify any potential issues with the backup files early, thereby ensuring that a valid, restorable backup is available, which is essential for effective disaster recovery planning .

Configuring schedules for SQL Server Maintenance Plans is vital to ensure that backup tasks are performed regularly and at optimal times. Consistent scheduling guarantees that system databases are backed up frequently enough to minimize data loss risks during recovery. When setting up schedules, considerations should include the usual activity load on the server to avoid performance degradation, the frequency of updates or transactions that necessitate backups, and the organization's recovery point objectives. A well-thought-out scheduling approach aligns the backup cycle with business operations to maximize both data protection and system efficiency .

Storing backup tapes in a secure location is critical because these tapes contain sensitive data that can be exploited if accessed by unauthorized individuals. Best practices for ensuring their security include using offsite storage solutions to mitigate risks from onsite disasters, employing encryption on backup data to protect against unauthorized access, and maintaining a catalog of all backup tapes, including their storage locations and backup sets. Regular audits and inventory checks are also advisable to ensure compliance with data protection policies. These practices help safeguard the data integrity and confidentiality outlined by organizational and regulatory standards .

SQL Server Agent Jobs play a critical role in executing Maintenance Plans as they facilitate the automation of backup tasks. For a Maintenance Plan to be successfully executed, it must have a corresponding SQL Server Agent Job that is properly configured. Administrators need to ensure that success and failure criteria for each step of the job are well-defined. This can involve setting up conditions under which a step should succeed or initiate failure recovery actions. These configurations ensure the smooth execution of backup operations and help manage errors effectively, minimizing potential disruptions .

When configuring a Backup Database Task within a Maintenance Plan in SQL Server, the following steps must be completed: provide connection details to the SQL Server, select 'Full' as the backup type, choose 'All system databases' from the database selection dropdown, specify the backup location, and decide whether to verify backup integrity. Additionally, with SQL Server 2008, administrators have the option to use the database backup compression feature by selecting 'Compressed Backup' from the dropdown. These configurations ensure that the backup is comprehensive and efficient in terms of storage space .

You might also like