SQL Server Database Mirroring Concept
SQL Server Database Mirroring Concept
SQL Server Database Mirroring Concept
Peter Gfader
Specializes in
C# and .NET (Java not anymore) Testing Automated tests Agile, Scrum Certified Scrum Trainer Technology aficionado
Silverlight ASP.NET Windows Forms
Course Website
http://sharepoint.ssw.com.au/Training/UTSSQL/Pages/
Course Overview
Session Date 1 Time 18:00 - 21:00 Topic SQL Server 2008 Management Studio
Tuesday 03-08-2010
Tuesday 10-08-2010
18:00 - 21:00
T-SQL Enhancements
3
4
Tuesday 17-08-2010
Tuesday 24-08-2010 Tuesday 31-08-2010
18:00 21:00
18:00 - 21:00
High Availability
CLR Integration
18:00 - 21:00
Full-Text Search
XML Queries
PIVOT/UNPIVOT
Homework?
CREATE LOGIN LOG_USER WITH PASSWORD=N'LOG_u$er_01', DEFAULT_DATABASE=SSW_Training GO CREATE USER LOG_USER FOR LOGIN LOG_USER GO
EXEC sp_addrolemember N'db_datareader', N'LOG_USER' GO EXEC sp_addrolemember N'db_datawriter', N'LOG_USER' GO
CREATE TABLE [ServerLogins]( ID bigint IDENTITY(1,1) NOT NULL , [DateTime] datetime , PostTime nvarchar(100) , LoginName nvarchar(100) , EventType nvarchar(100) , ClientHost nvarchar(100) , [EVENTDATA] xml ) ON [PRIMARY] GO
CREATE TRIGGER logon_trigger_login_log ON ALL SERVER WITH EXECUTE AS 'LOG_USER' FOR LOGON AS DECLARE @data xml SET @data = EventData() INSERT INTO SSW_Training.dbo.ServerLogins([DateTime], PostTime, LoginName, EventType, ClientHost, [EventData]) VALUES ( GETDATE() , CONVERT(nvarchar(100), @data.query('data(//PostTime)')) , CONVERT(nvarchar(100), @data.query('data(//LoginName)')) , CONVERT(nvarchar(100), @data.query('data(//EventType)')) , CONVERT(nvarchar(2000), @data.query('data(//ClientHost)')) , EVENTDATA() ) GO
Homework?
SELECT geometry::STGeomFromText('LINESTRING (0 0, 0 2, 1 3, 2 2, 2 0, 0 2, 2 2, 0 0, 2 0)', 0) Envelope;
Session 3
Agenda
What is High Availability? What can go wrong? What can we do about it?
Hardware
Software
Virus (and Virus Scanners) File locking issues Disk space Corrupted files Bad upgrades OS Upgrades poor tuning or design DB Maintenance
SQL
People (PEBKAC)
Acts of God
Lightning Cleaners
1. Hardware Solutions
UPS & Hardware Monitors RAID / Mirroring Off site server Firewall Physical Security
2. Software Solutions
Database Mirroring Log shipping
Partitioned Tables
SQL Agent Proxies Performing Online Index Operations
Mirrored Backups
Database Snapshots
Database Snapshots
Point-in-time reporting
Database Snapshots
Snapshots are NOT a substitute for your backup and recovery setup
Database Snapshots
Database Snapshots
Snapshot Only go back SELECT statements Backup Rollback and Forward possible Smaller Detach database and copy DB goes offline Closes all connections
Database mirror
No special hardware
No special hardware
Clients
Witness Server
Mirror Server
Clients
Witness Server
Principal Server
Clients
Witness Server
Principal Server
Principal
1. 2.
Take a full backup and a log backup as well Copy the full/log backups from Principal Instance to Mirror instance
2.
Mirror
1. 2.
Restore with NORECOVERY option the full backup Apply the log backup
Mirror is configured
What happens when something bad happens to our principal server You can make it failover to the mirror
This means that the two servers swap roles for the time being
Lets you view the status and history of your current mirrors
Thresholds
Put DB from "Recovering..." into available online mode RESTORE DATABASE myDatabase WITH RECOVERY
Partitioned tables
Partitioned Tables
Partitioned Tables
Administrative tasks
Mirrored Backups
Backup
Mirror 2
Mirror 1
Mirror 2
Mirror 1
Mirror 2
Session Summary
Partitioned Tables
SQL Agent Proxies Performing Online Index Operations
Mirrored Backups
Session 3 Lab
Download from Course Materials Site (to copy/paste scripts) or type manually: http://tinyurl.com/utssql2009
www.microsoft.com/technet/community
3 things
Thank You!
Gateway Court Suite 10 81 - 91 Military Road Neutral Bay, Sydney NSW 2089 AUSTRALIA ABN: 21 069 371 900