IT tutorials
 
Technology
 

SQL Server 2008 R2 : Database Snapshots - Setting Up Snapshots Against a Database Mirror

8/24/2013 9:35:01 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

If you are using database mirroring to improve your availability, you can also create a database snapshot against this mirrored database and expose the snapshot to your reporting users. Doing so further enhances the overall database availability to all end users (transactional and reporting users). In addition, it serves to isolate the reporting users from the transactional users. The reporting users are connected to the mirror server’s version of the database (via a database snapshot of the mirrored database), and their reporting queries do not impact the principal server in any way. Remember that the mirrored database is not usable for any access whatsoever (it is in constant restore mode). SQL Server allows a snapshot to be created against it . As mentioned previously, the only real issues arise when the principal server fails over to the mirror database. When the mirror server takes over for the principal, the database snapshot terminates its reporting user connections. The reporting users only need to reconnect to pick up where they left off. However, you now have both transactional and reporting users using the same database server instance, and performance of all is affected.

A possible solution to this situation would be to automatically (or manually) drop the database snapshot on the mirror server if it becomes the principal and create a new snapshot on the old principal server if it is available (it is now the mirror). You then just point all your reporting users to this new database snapshot. This process can be handled fairly easily in an application server layer. This is basically a reciprocal principal/mirror reporting configuration approach that always tries to get the database snapshot that is used for reporting to be on the server that is the mirror server. You would never really want to have active database snapshots on both the principal server and mirror server at the same time.

Reciprocal Principal/Mirror Reporting Configuration

The following steps outline the method to create the snapshot on the mirror, drop it when the mirror becomes the principal, and create a new snapshot against the old principal (now the mirror):

1.
Create the database snapshot on a mirrored database server for reporting on the mirror server (REM12374333\SQL08DE02):

Use [master]
go
CREATE DATABASE SNAP_AdventureWorks_REPORTING
ON ( NAME = AdventureWorks_Data, FILENAME= 'C:\Program Files\
Microsoft SQL Server\MSSQL10.SQL08DE02\MSSQL\DATA\
SNAP_AdventureWorks_data_REPORTING.snap')
AS SNAPSHOT OF AdventureWorks
Go

As you can see in Figure 1, this would be the live configuration of the principal server (REM12374333\SQL08DE01), the mirror server (REM12374333\SQL08DE02), and the reporting database snapshot (SNAP_AdventureWorks_REPORTING), as shown from SQL Server Management Studio.



Figure 1. SQL Server Management Studio, showing database mirroring with a database snapshot for reporting configuration.

If the principal fails over to the mirror, you would drop the database snapshot that is currently created off that database and create a new one on the old principal (now the mirror), as shown in the following steps.

2.
Drop the reporting database snapshot on the new principal server (the principal is now REM12374333\SQL08DE02):

Use [master]
go
DROP DATABASE SNAP_AdventureWorks_REPORTING
go

3.
Create the new reporting database snapshot on the new mirrored database server (the mirror is now REM12374333\SQL08DE01):

Use [master]
go
CREATE DATABASE SNAP_AdventureWorks_REPORTING
ON ( NAME = AdventureWorks_Data, FILENAME= 'C:\Program Files\
Microsoft SQL Server\ MSSQL10.SQL08DE01\MSSQL\DATA\
SNAP_AdventureWorks_data_REPORTING.snap')
AS SNAPSHOT OF AdventureWorks
Go

That’s it. You now have your reporting users completely isolated away from your principal server (and the transactional users) again. Life can return to normal very quickly.

 
Others
 
- SQL Server 2008 R2 : Query Versus Update Performance , Identifying Missing Indexes
- SQL Server 2008 R2 : Query Versus Update Performance , Identifying Missing Indexes
- Windows Server 2008 : Creating Basic Visual Basic Scripts - Using if Statements, Checking for a Value with a Message Box
- Windows Server 2008 : Creating Basic Visual Basic Scripts - Displaying a Message Box with a Visual Basic Script
- Windows Server 2008 : Creating Basic Visual Basic Scripts - Working with filesystemobject
- Windows 7 : Installing and Upgrading Programs - Common Installation Prompts (part 2) - Type of Installation
- Windows 7 : Installing and Upgrading Programs - Common Installation Prompts (part 1) - Compliance check , The End User License Agreement
- Windows 7 : Installing and Upgrading Programs - Installing and Upgrading from a Disk
- Windows Server 2012 : Using Capacity-Analysis Tools - Other Microsoft Assessment and Planning Tools, Third-Party Toolset
- Windows Server 2012 : Using Capacity-Analysis Tools - Windows Performance Monitor
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us