2. Peter Gfader Specializes in C# and .NET (Java not anymore) TestingAutomated tests Agile, ScrumCertified Scrum Trainer Technology aficionado Silverlight ASP.NET Windows Forms
5. What we did last week Basic T-SQL syntax New Data Types Inline variable assignment Table Value Parameters DDL (Data Definition Language) Triggers CTE (Common Table Expressions) TOP % WITH TIES XML Queries PIVOT/UNPIVOT
7. CREATE DATABASE SSW_Training GO USE SSW_Training GO 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_addrolememberN'db_datareader', N'LOG_USER' GO EXEC sp_addrolememberN'db_datawriter', N'LOG_USER' GO
8. CREATE TABLE [ServerLogins]( ID bigint IDENTITY(1,1) NOT NULL , [DateTime] datetime , PostTimenvarchar(100) , LoginNamenvarchar(100) , EventTypenvarchar(100) , ClientHostnvarchar(100) , [EVENTDATA] xml ) ON [PRIMARY] GO
9. 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
12. Agenda Agenda What is High Availability? What can go wrong? What can we do about it?
13. What is high availability? Different people have different definitions Perceived uptime Performance What can go wrong? How can we improve it?
14. What is high availability? Different people have different definitions Perceived uptime Performance Issues What can go wrong? How can we improve it?
15. What can go wrong? (continued) Hardware Disk failure Network failure Power Outages
16. What can go wrong? Software Virus (and Virus Scanners) – File locking issues Disk space Corrupted files Bad upgrades OS Upgrades SQL poor tuning or design DB Maintenance
17. What else can go wrong? People (PEBKAC) Administrators Users Bottlenecks & Concurrency Acts of God Lightning Cleaners
18.
19.
20.
21.
22. What Will We Cover? Implementing Database Snapshots Configuring a Database Mirror Partitioned Tables SQL Agent Proxies Performing Online Index Operations Mirrored Backups
26. Database Snapshots Snapshots are NOT a substitute for your backup and recovery setup You cannot roll forward If either the database or the database snapshot is corrupted, reverting from a snapshot is unlikely to correct the problem Query from snapshot current database
27. Database Snapshots CREATE DATABASE AdventureWorks_dbss1800 ON( NAME = AdventureWorks2008_Data, FILENAME = 'C:atadventureWorks_data_1800.ss' )AS SNAPSHOT OF AdventureWorks;GO
44. Before you mirror your database Principal Take a full backup and a log backup as well Copy the full/log backups from Principal Instance to Mirror instance Mirror Restore with NORECOVERY option the full backup Apply the log backup
55. Mirror Operating Modes High Performance (asynchronous) Commits are done on the principal and transferred to the mirror High Safety (synchronous) Commits are written to both databases
56.
57. Database Mirroring Failover 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
64. Might come in handy Disable MirroringALTER DATABASE myDatabase SET PARTNER OFF Put DB from "Recovering..." into available online modeRESTORE DATABASE myDatabase WITH RECOVERY
67. Partitioned Tables Allows for maximum concurrency Partitioned Table parallelism Improved a lot in SQL 2008 Archive older data into different filegroups
69. SQL Server Agent (recap) Windows Service Executes SQL Server jobs Administrative tasks
70. SQL Agent Proxies New credential system Sits on Active Directory Fine grained control of your jobs Jobs can be run by proxies instead of user loginsPreviously to run cmd shell type functionality you needed a user in the administrator group which opened up security problems
80. Session 3 Lab High Availability Features Database snapshots Mirrored backups Online Index Operations Download from Course Materials Site (to copy/paste scripts) or type manually: http://tinyurl.com/utssql2009
88. Thank You! Gateway Court Suite 10 81 - 91 Military Road Neutral Bay, Sydney NSW 2089 AUSTRALIA ABN: 21 069 371 900 Phone: + 61 2 9953 3000 Fax: + 61 2 9953 3105 info@ssw.com.auwww.ssw.com.au
Hinweis der Redaktion
Click to add notesPeter Gfader shows SQL Server
Java current version 1.6 Update 171.7 released next year 2010Dynamic languages Parallel computingMaybe closures
FilestreamSparse ColumnsSpatial DataHierarchyIDDATE and TIME data typesFiltered Indexes
USE masterGOCREATE DATABASE SSW_TrainingGOUSE SSW_TrainingGOCREATE LOGIN LOG_USER WITH PASSWORD=N'LOG_u$er_01', DEFAULT_DATABASE=SSW_TrainingGOCREATE USER LOG_USER FOR LOGIN LOG_USERGOEXEC sp_addrolememberN'db_datareader', N'LOG_USER'GOEXEC sp_addrolememberN'db_datawriter', N'LOG_USER'GOCREATE TABLE [ServerLogins]( ID bigint IDENTITY(1,1) NOT NULL , [DateTime] datetime , PostTimenvarchar(100) , LoginNamenvarchar(100) , EventTypenvarchar(100) , ClientHostnvarchar(100) , [EVENTDATA] xml) ON [PRIMARY]GOCREATE TRIGGER logon_trigger_login_logON ALL SERVER WITH EXECUTE AS 'LOG_USER'FOR LOGONAS 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--LOGIN IN AS SOMEONE TO GENERATE DATA.SELECT *FROM SSW_Training.dbo.ServerLogins
Session 3 will cover High Availability Features SQL Server 2008
Big difference about numbers99.999 = single 99.9999Loss of data?
Big difference about numbers99.999 = single 99.9999Loss of data?
Uninterruptible power supplyRedundant Array of Inexpensive Disks
Easy to setup --> see in demoNeed only 1 sql server licenseLog shipping automatically done by SQL ServerJob that listenes for certain error numbers fires actionSQL SERVER 2008: Policy Management
USE Master;GO--- Step 1 : Create New Test Database with two different filegroups.IF EXISTS (SELECT nameFROM sys.databasesWHERE name = N'TestDB')DROP DATABASE TestDB;GOCREATE DATABASE TestDBON PRIMARY(NAME='TestDB_Part1',FILENAME='C:DataPrimaryTestDB_Part1.mdf',SIZE=3,MAXSIZE=100,FILEGROWTH=1 ),FILEGROUP TestDB_Part2(NAME = 'TestDB_Part2',FILENAME ='C:DataSecondaryTestDB_Part2.ndf',SIZE = 3,MAXSIZE=100,FILEGROWTH=1 );GOUSE TestDB;GO--- Step 2 : Create Partition Range FunctionCREATE PARTITION FUNCTION TestDB_PartitionRange (INT)AS RANGE LEFT FORVALUES (10);GOUSE TestDB;GO--- Step 3 : Attach Partition Scheme to FileGroups--- A partition scheme maps the partitions produced by a partition function to a set of filegroups that you define.CREATE PARTITION SCHEME TestDB_PartitionSchemeAS PARTITION TestDB_PartitionRangeTO ([PRIMARY], TestDB_Part2);GOUSE TestDB;GO--- Step 4 : Create Table with Partition Key and Partition SchemeCREATE TABLE TestTable(ID INT NOT NULL,Date DATETIME)ON TestDB_PartitionScheme (ID);GOUSE TestDB;GO--- Step 5 : (Optional/Recommended) Create Index on Partitioned TableCREATE UNIQUE CLUSTERED INDEX IX_TestTableON TestTable(ID)ON TestDB_PartitionScheme (ID);GOUSE TestDB;GO--- Step 6 : Insert Data in Partitioned TableINSERT INTO TestTable (ID, Date) -- Inserted in Partition 1VALUES (1,GETDATE());INSERT INTO TestTable (ID, Date) -- Inserted in Partition 2VALUES (11,GETDATE());INSERT INTO TestTable (ID, Date) -- Inserted in Partition 2VALUES (12,GETDATE());GOUSE TestDB;GO--- Step 7 : Test Data from TestTableSELECT *FROM TestTable;GOUSE TestDB;GO--- Step 8 : Verify Rows Inserted in PartitionsSELECT *FROM sys.partitionsWHERE OBJECT_NAME(OBJECT_ID)='TestTable';GOhttp://msdn.microsoft.com/en-us/library/ms188730.aspx
All the jobs run with the account assigned to SQL Agent service. What if we have to perform some task which requires some extra credentials or the other way around than what should we do.http://www.codeproject.com/KB/database/SQL_Server_Agent_Proxy.aspx
Clustered Index -> non clustered index
Slide Title: Mirrored BackupsKeywords: Mirrored Backups, backup recovery, drive Key Message: Mirrored backups provide an additional level of protection for your important data. Slide Builds: 3Slide Script: [BUILD3] If the media in one mirror becomes corrupted, the mirrored media can replace it during restore.Slide Transition: We will show you how to do this in the next demonstration. Slide Comment: Additional Information: SQL Server 2005 Books Online: Topic: “Using Mirrored Backup Media Sets”
Slide Title: Community HelpKeywords: CommunityKey Message: Where to get more helpSlide Builds: 0Slide Script: There are a number of community resources available on TechNet, all of them then free.You can attend a regular chat with members of the products groups or technology specialists from Microsoft, or you can attend a Web cast where you can see sessions like the one you’ve just watched, but presented live and with the ability to ask questions as you go.You can also read or post questions in the public newsgroups. The newsgroup page lists the available groups, plus provides an interface from which you can to read and post messages. TechNet Plus subscribers can use these groups to post questions that, through their subscription ID, will be answered by Microsoft within 24 hours.The main community site provides a comprehensive list of resources available — more than we can cover on this slide — plus the page has some dynamic features with continually updating content.The events page provides dates and details where you can attend a TechNet event live. These events take place worldwide and provide the opportunity for you to talk to Microsoft specialists face-to-face.And finally, the TechNet Columns provide a variety of topics written by industry authors.Slide Transition: [Thank the audience for attending and sign off]Slide Comment: Additional Information: HTTP://www.microsoft.com/technet/community/columnsHTTP://www.microsoft.com/technet/community/events HTTP://www.microsoft.com/technet/community/chatsHTTP://www.microsoft.com/technet/community/webcastsHTTP://www.microsoft.com/technet/community/newsgroupsHTTP://www.microsoft.com/technet/community
Show linkshttp://www.microsoft.com/sqlserver/2008/en/us/editions.aspxhttp://www.microsoft.com/Sqlserver/2005/en/us/compare-features.aspxhttp://www.microsoft.com/sqlserver/2008/en/us/editions-compare.aspx