Sql Server 2008 new features Compression, FILESTREAM and TDE compatibility with with all High Availability (HA) options
Some of the new features in Sql Server 2008 are very useful (and long over due). Features like
My Experience with SQL Server:
DBA Useful Keys: DBA Scripts for SQL & DBA Scripts for SQLServer & DB2 Performance Scripts & SQL Server Performance Scripts & General Useful Commands for Windows & General Useful Commands for UNIX
For DBAKeys(DB2)Visit My DB2 Blog: http://db2key.blogspot.com
Compression
|
FileStream
|
TDE
| |
FailOver Clustering
|
Y
|
Y
|
Y
|
Database Mirroring
|
Y
|
No
|
Y
|
Replication
|
Y
|
Y
|
Y
|
Log Shipping
|
Y
|
Y
|
Y
|
| Property \ Feature | FailoverClustering | DB Mirroring | Replication | Log Shipping |
| Server Level | Yes | No | No | No |
| Database Level | No | Yes | Yes | Yes |
| Automatic Failover | Yes | Yes (Only HA Option) | No | No |
| Automatic Failure Detection | Yes | Yes (Only in HA option) | No | No |
| Hot, Warm or Cold standby | Hot | Hot and Warm Options | Warm | Warm |
| Server Level Objects Failover | Yes (Automatic) | Manual | Manual | Manual |
| Is data on Failover available for queries while the Primary server is running? | No | Yes (use Database Snapshots) | Yes | Yes (Standby Mode) |
| Are changes allowed at Failover location? | No | No | Yes (Merge and TRN Replication with updating subscribers) | No |
| Is Main and Failover server in a 1-1 relationship? | Yes | Yes | Not Required | Not Required |
| Is 1-Many relationship possible between the Main and Failover servers? | No | No | Yes | Yes |
| Is Many-1 relationship possible between Main and Failover server? | No | No | Yes | No |
| Is Automatic Application redirection possible after failover? | Yes | Yes | No | No |
| Recovery model required for the participating databases? | Any | FULL | ANY | FULL & BULK |
| Can you filter what data is sent to the Failover server? | No | No | Yes | No |
| Where does the logic HA reside? | OS + Sql | Sql | Replication Agents (they run outside Sql Server | Sql Agents (Run outside Sql Server) |
| If you want a reports server, what is the best solution? | Not Possible | Works, but needs constant refresh of the Snapshot database for latest data. | Best Option. | Works, but users connections need to be kicked out, when new log is applied. |
| Best solution if the Main and Failover server are separated by long distance? | Not good. | Works, but not recommended. | Works, but with high latency | Best Option. (Log compression reduces latency significantly. |
Initial Instance Role
|
Domain Service Account
|
Server Name
|
Principal
|
AD\sql1
|
SalesDB.AD.com
|
Mirror
|
AD\sql1
|
SalesDBFailOver.AD.com
|
Witness
|
AD\sqlWitness
|
WitnessDB.AD.com
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
| -- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *-- Step 01: CREATE Principal Database.-- Run on Principal Server-- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *CREATE DATABASE DBMirONPRIMARY(NAME = N'DBMir_PRIMARY_Data', FILENAME = N'E:\MS SQL\MSSQL_2K8\Play1\MDF\DBMir_Primary_Data.MDF', SIZE = 1024 MB, MAXSIZE = 2 GB, FILEGROWTH = 10)LOG ON(NAME = N'DBMir_Log', FILENAME = N'E:\MS SQL\MSSQL_2K8\Play1\LDF\DBMir_Log.LDF', SIZE = 1024 MB, MAXSIZE = 2048 MB, FILEGROWTH = 10)GO-- SET recovery model to FULLALTER DATABASE [DBMir]SET RECOVERY FULLGO |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| -- sample server level objectUSE MASTERGOCREATE LOGIN [test] WITH PASSWORD = 'test'WITH DEFAULT_DATABASE = [DBMir], DEFAULT_LANGUAGE = [us_english]GOUSE [DBMir]GOCREATE USER [test] FOR LOGIN [test]GO-- Sample tableCREATE TABLE dbo.Test(ID INT NOT NULL PRIMARY KEY IDENTITY(1,1), Name VARCHAR(40) NULL, Age INT NULL, Blob VARCHAR(MAX) NULL)GO-- Insert a few records, before setting up Mirroring.INSERT INTO dbo.Test (Name, Age, Blob) VALUES('Name1', 10, REPLICATE(CONVERT(VARCHAR(MAX), 'ac'),10000))GO 10 |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
| -- Create endpoint on PrincipalCREATE ENDPOINT DBMirror_PrincipalSTATE = STARTEDASTCP (LISTENER_PORT = 7022) -- Do not use port 7022 on prod. serverFOR DATABASE_MIRRORING (ROLE = PARTNER)GO-- Create endpoint on MirrorCREATE ENDPOINT DBMirror_MirrorSTATE = STARTEDASTCP (LISTENER_PORT = 7023)FOR DATABASE_MIRRORING (ROLE = PARTNER)GO-- Create endpoint on WitnessCREATE ENDPOINT DBMirror_WitnessSTATE = STARTEDASTCP (LISTENER_PORT = 7024)FOR DATABASE_MIRRORING (ROLE = WITNESS)GO |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
| -- CREATE LOGIN for Witness (service account) on Principal-- and GRANT CONNECT permission on Principal's EndPointCREATE LOGIN [AD\sqlWitness] FROM WINDOWS;GOGRANT CONNECT ON ENDPOINT::DBMirror_Principal TO [AD\sqlWitness]GO-- CREATE LOGIN for Witness (service account) on Mirror-- and GRANT CONNECT permission on Mirror's EndPointCREATE USER [AD\sqlWitness] FROM WINDOWS;GOGRANT CONNECT ON ENDPOINT::DBMirror_Mirror TO [AD\sqlWitness]GO-- CREATE LOGIN for Principal/Mirror(same service account on both) on Witness-- and GRANT CONNECT permission on Witness's EndPointCREATE LOGIN [AD\sql1] FROM WINDOWS;GOGRANT CONNECT ON ENDPOINT::DBMirror_Witness TO [AD\sql1]GO |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| -- Run on PrincipalBACKUP DATABASE DBMir TO DISK = N'E:\MS SQL\MSSQL_2K8\Play1\Backup\DBMir_Principal.BAK'GOBACKUP LOG DBMir TO DISK = N'E:\MS SQL\MSSQL_2K8\Play1\Backup\DBMir_Principal.TRN'GO-- Copy the database files over to Mirror Instance-- Run on MirrorRESTORE DATABASE DBMir FROM DISK = N'E:\MS SQL\MSSQL_2K8\Play2\Backup\DBMir_Principal.BAK'WITH MOVE 'DBMir_Principal_Data' TO 'E:\MS SQL\MSSQL_2K8\Play2\MDF\DBMir_Mirror.MDF', MOVE 'DBMir_Log' TO 'E:\MS SQL\MSSQL_2K8\Play2\LDF\DBMir_Mirror_Log.LDF', NORECOVERY, REPLACEGORESTORE LOG DBMir FROM DISK = N'E:\MS SQL\MSSQL_2K8\Play2\Backup\DBMir_Principal.TRN'WITH NORECOVERYGO |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| -- Run on Mirror: Inform Mirror about Principal (first step)ALTER DATABASE DBMirSET PARTNER = 'TCP://SalesDB.AD.com:7022'GO-- Run on Principal: Inform Principal about MirrorALTER DATABASE DBMirSET PARTNER = 'TCP://SalesDBFailOver.AD.com:7023'GO-- Run on Principal: Inform Principal about WitnessALTER DATABASE DBMirSET WITNESS = 'TCP://WitnessDB.AD.com:7024'GO |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| -- Create snapshot on Mirror to run sample queriesUSE MASTERGOCREATE DATABASE DBMir_SnapShotON(NAME = 'DBMir_Primary_Data', FILENAME = 'E:\MS SQL\MSSQL_2K8\Play2\MDF\DBMir_SnapShot2.DS')AS SNAPSHOT OF DBMirGOSELECT COUNT(*) FROM dbo.TestGO |
1
2
3
4
5
6
| -- To test FailOver, run the following query on Principal-- Smooth failover happens. If there are any SQL Logins,-- To map orphan users, run sp_change_users_login on MirrorALTER DATABASE DBMirSET PARTNER FAILOVERGO |
1
2
3
4
5
| -- To force failover, when the Principal is unavailable, run this on Mirror-- Pre-requisite: Principal must be unavailableALTER DATABASE DBMirSET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSSGO |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
| -- To drop DB MirroringALTER DATABASE DBMirSET PARTNER OFF -- to DROP DB MirroringGO-- To re-establish DB MirroringALTER DATABASE DBMirSET PARTNER ONGO-- To temporarily suspend mirrorringALTER DATABASE DBMirSET PARTNER SUSPENDGO-- To resume, suspended mirroringALTER DATABASE DBMirSET PARTNER RESUMEGO |