4/5/2017 11:22 AM © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
SQL Server 2005 – Správa a monitorování Michael Juřek Software Architect Microsoft s.r.o.
Agenda Správa a administrace Bezpečnost Monitorování a hledání chyb 4/5/2017 11:22 AM Agenda Správa a administrace Bezpečnost Monitorování a hledání chyb Ladění výkonu Automatizace činností The primary idea for this session is to show how much more manageable an application can be if designed with operations/management in mind. Start with designing an appropriate application Move to preventing unwanted change -> ddl triggers And then Auditing change for better troubleshooting -> event notifications Early detection for the unknown -> Agent Alerts Automating responses -> © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Take Advantage When? How much work to leverage the technology? 4/5/2017 11:22 AM Take Advantage When? How much work to leverage the technology? Design and Architect Upgrade Immediate Minimal Work to Leverage SQL Server Management Studio Unified Error Viewer/ Reports/ Monitoring/ Server Dashboard Performance Monitor Integration SQL Server Profiler Database Engine Tuning Advisor SQLCMD System Information Catalog Views and DMVs DDL Triggers Auditing and Prevention SQL Server Agent New Automation/Alerting Microsoft Operations Manager (MOM) SQL Server Management Pack Database Maintenance Plans Database Mail VSTS 2005 Code Analysis and Modeling Event Notifications Auditing and Reaction Events Most of the Availability Features fall within the Upgrade Immediate and Minimal Work to Leverage categories… But there are many other features to work with once you’ve designed your database to stay available. This slide is not meant for any depth whatsoever… it’s meant to be an “impressive list of options” slide. Depending on the type of failure you have, technologies/features are available to prevent and/or provide immediate to latent failover recovery. Additionally, there is probably more than one that may address the expected barriers that you will encounter. Likely not only one feature but possibly a few features that may help your database stay online and already available. Do NOT spend any real time on this slide and don’t even mention these by name. Hit very general highlights here and give them some insight into things we’ll discuss within this presentation: Some of these features will be immediately available – just by upgrading while others require only a minimal amount of code to leverage. Bolded items are new and upcoming technologies for SQL Server™ 2005 Many of the established technologies (such as Failover Clustering) are not radically different but have been improved with some great new features/capabilities. We will not only discuss but also demonstrate how many of these technologies will help your databases stay available through a variety of barriers to availability. The first area that we will cover are the features that are immediately available – just upgrade. Then we will work through a couple of the minimal work to leverage features and then move to high availability/scalability and touch on the large number of technologies possible here. Improving Manageability from Design to Installation to New Features/Extensions Centralized Monitoring to allow a cohesive picture of what’s going on… where… © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Správa a administrace SQL Server Management Studio Dynamic Management Views
Management Studio Integrované prostředí pro správu i vývoj Založené na slupce Visual Studia Nahrazuje nástroje: Enterprise Manager Query Analyzer Analysis Manager Slouží ke správě: Relačních databází Analytických služeb Reportovacích služeb Databází SQL Server Mobile Možnost skriptování: T-SQL/SQLCMD XMLA/MDX/DMX Grafické reporty ...
Procházka nástrojem SQL Server Management Studio 4/5/2017 11:22 AM Procházka nástrojem SQL Server Management Studio © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Dynamic Management Views Veřejné pohledy na interní struktury Ideální pro sledování výkonnosti Na úrovni serveru Jednotlivé komponenty dm_exec_* Příkazy prováděné uživateli, databázová spojení dm_os_* Paměť, zamykání, vlákna, ... dm_tran_* Transakce a izolace dm_io_* I/O operace disku a sítě dm_db_* Databáze a objekty v nich dm_repl_* Replikace dm_broker_* SQL Service Broker dm_fts_* Full-text vyhledávání dm_qn_* Query Notifications dm_clr_* Common Language Runtime
DM_ Object Interface SQL Server Relational Engine 4/5/2017 11:22 AM DM_ Object Interface SQL Server Relational Engine SPs, Views, Tables, etc. User DB Monitoring or Diagnostic Application Resource DB (visible as “sys” schema) DMVs and DMFs New and exposed in SQL Server 2005 Some existed, yet not exposed Operational Memory Structures Aggregate Statistical Data © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
How DMVs Improve Access SQL Server 2000: DBCC SHOWCONTIG Not tabular by default Difficult to programmatically analyze Pre-create temp table, complete definition with data types Must use dynamic string execution to execute results into temp table SQL Server 2005: sys.dm_db_index_physical_stats(params) Table-valued function returns tabular set EASY to programmatically analyze Can use SELECT INTO to catch result set No dynamic string execution needed!
Příklad použití DMV DMV týkající se indexů sys.dm_db_index_physical_stats Velikost a framgentace tabulek a indexů sys.dm_db_index_operational_stats Interní informace o aktivitách kolem tabulek a indexů sys.dm_db_index_usage_stats Statistiky o použití individuálních indexů sys.dm_db_index_partition_stats Stránky a počty řádků pro partice indexů
Bezpečnost SQL Server Surface Area Configuration Auditování a kontrola změn
Nastavení „povrchu“ SQL Server Surface Area Configuration Konfigurace služeb a připojení Nastavení služeb Vzdálená připojení SQL Server Agent Reportovací služby Integrační služby SQL Server Browser Konfigurace jednotlivých rysů sp_configure nastavení Dotazy do katalogu Nastavení mailu xp_cmdshell Integrace .NET frameworku
SQL Server Surface Area Configuration 4/5/2017 11:22 AM SQL Server Surface Area Configuration © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Statická analýza kódu Vytváření bezpečných aplikací užívajících SQL 4/5/2017 11:22 AM Statická analýza kódu Vytváření bezpečných aplikací užívajících SQL Analýza kódu bez provádění Vyhledá známé bezpečnostní problémy před nasazením kódu: SQL injection Buffer Overflow Pro nativní kód i kód .NET frameworku Součást edice Visual Studio Team Edition for Software Developers Vysoce konfigurovatelné Modifikace pravidel Import pravidel Team Developer Edition enables advanced developers to verify the performance and quality of the code they write. Think of Code Analysis as grammar checking for your code. Compilers check your syntax, similar to spell checkers. But, code analysis tools analyze the semantic meaning behind your code and can detect performance problems, security errors, and more. For example, I can completely customize the rules that are important to my organization, and especially for my SQL deployment. I can ensure that any development passes tests such as for SQL injection errors before it is tested or deployed into production, making not only my application safer, but my ultimate deployment more secure. © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Auditování a kontrola změn DDL triggery – zaměření Specifické příkazy: DROP_TABLE Skupiny příkazů: DDL_PROCEDURE_EVENTS CREATE PROCEDURE ALTER PROCEDURE DROP PROCEDURE Event Notifications, WMI Events – výše uvedené a navíc ještě: Speciální události: DATA_FILE_AUTO_GROW Skupiny událostí: TRC_STORED_PROCEDURES SP_RECOMPILE SP_CACHEMISS SP_CACHEREMOVE SP_CACHEINSERT
4/5/2017 11:22 AM DDL trigger © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Monitorování a hledání chyb SQL Server Profiler Integrace výkonnostních čítačů
Monitorování Jednotný přístup Podpora logů z více zdrojů: SQL Server Database Engine SQL Server Agent Windows Event Viewer Database Mail Napříč všemi logy: Vyhledávání Filtrování Export
SQL Server Profiler Analýza událostí z relačních a analytických služeb Přepracované a výrazně příjemnější uživatelské rozhraní Speciální události: Service Broker, Notification Services, ... Uložení do souboru: Showplan XML, Deadlock Graph Pozastavení, modifikace Profilování SQL 2000/2005 Práva k profilování lze nastavit i bez dalších práv k databázi
Integrace výkonnostních čítačů Trasování profilerem Vytvoření záznamu výkonnostních čítačů Otevření trasovacího souboru Import dat z výkonnostních čítačů Korelace založena pouze na čase –musí být dobře synchronizován Automatická obousměrná synchronizace obou zobrazovacích panelů Funguje proti SQL serveru ve verzích 2000 a 2005
SQL Server Profiler 4/5/2017 11:22 AM © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Microsoft Operations Manager Monitoring the Enterprise Use SQL Server Management Pack to Lower Operational Costs and Increase Availability Operate from a central console Manage large SQL Server deployments Detect problems proactively Understand problem details Fix the problems by launching tasks Trend history of performance counters Generate Reports Plan for capacity Microsoft Operations Manager to ship a SQL Server 2005 Management Pack
Ladění výkonu Database Engine Tuning Advisor
Database Engine Tuning Advisor Doporučení pro partitioning Možnost omezení času analýzy Zahrnutí sloupců do indexu XML formát vstupů a výstupů Režim hledání nepotřebných indexů (Drop ONLY) Parametrizované spuštění z příkazové řádky Uložení/načtení ladící seance (XML formát) Možnosti vstupu zátěže: *.trc, *.sql a *.xml soubory Tabulka SQL serveru
Database Engine Tuning Advisor 4/5/2017 11:22 AM Database Engine Tuning Advisor © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Automatizace činností SQL Server Agent Plány pro údržbu databáze Database Mail SQLCMD Upgrade Advisor
SQL Server Agent Alerty mohou být spuštěny Chybami SQL Serveru Překročení hodnoty výkonnostních čítačů WMI události SQL Agent používá Database Mail Proxy účty Proxy účet je asociován s účtem SQL serveru Proxy account může mít garantována práva databázového uživatele, databázové role a serverové role Proxy účet může být asociován s podsystémem SQL Serveru
Plány pro údržbu databáze Založeny na integračních službách SQL serveru Uživatelské rozhraní flexibilního průvodce Možnost vytvoření plánů i pro více než jednu databázi Možnost zaměření plánu na „all users databases“ (zahrne i nově vytvořené)
Database Mail SMTP (žádný Outlook) Odesílání mailů ze separátního procesu Podpora clusteringu a 64-bit Asynchronní architektura používající SQL Server Service Broker Více SMTP účtů Logování
SQLCMD Skriptování z příkazové řádky Nahrazuje OSQL Podporuje spojení na více serverů (master scripts) Substituce parametrů Proměnné definované ve skriptech Proměnné předané při volání skriptu Proměnné prostředí Lepší kontrola chyb Dedikované spojení administrátora
4/5/2017 11:22 AM SQLCMD © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Upgrade Advisor Kontroluje schéma databází a nastavení serveru Ke stažení na webu, na CD SQL 2005 SQL Server 2005 Upgrade Handbook Rozdíly mezi edicemi SQL 2005 http://www.microsoft.com/sql/2005/productinfo/sql2005features.mspx
4/5/2017 11:22 AM Why Upgrade? Database Engine Service Broker HTTP Access Database Tuning Advisor Enhanced Read ahead & scan Indexes with Included Columns Multiple Active Result Sets Persisted Computed Columns Try/Catch in T-SQL statements Common Table Expressions Server Events Snapshot Isolation Level Partitioning Synonyms Dynamic Management Views .NET Framework Common Language Runtime Integration CLR-based Types, Functions, & Triggers SQL Server .NET Data Provider Data Types CLR-based Data Types VARCHAR(MAX), VARBINARY(MAX) XML Datatype Database Failure and Redundancy Fail-over Clustering (up to 8 node) Database Mirroring Database Snapshots Enhanced Multi-instance Support XML New XML data type XML Indexes XQUERY Support XML Schema (XSD) support FOR XML PATH XML Data Manipulation Language SQLXML 4.0 Database Maintenance Backup and Restore Enhancements Checksum Integrity Checks Dedicated Administrator Connection Dynamic Configuration AWE Highly-available Upgrade Online Index Operations Online Restore Management Tools MDX & XML/A Query Editor Maintenance Plan Designer Source Control Support Profiler access to non-sa SQLCMD Command Line Tool Database Mail Performance Tuning Profiling Analysis Services Exportable Showplan & Deadlocks Profiler Enhancements New Trace Events Full-text Search Backup/Restore includes FT catalogs Multi-instance service SQL Client .NET Data Provider Server Cursor Support Multiple Active Result Sets Security Catalog and meta-data security Password policy enforcement Fine Grain Administration Rights Separation of Users and Schema Surface Area Configuration Notification Services Embed NS in existing application User-defined match logic Analysis Services Event Provider Replication Seamless DDL replication Merge Web Sync Oracle Publication Peer to Peer Transactional replication Merge replication perf and scalability New monitor and improved UI Analysis Services and Data Mining Analysis Management Objects Windows Integrated Backup and Restore Web Service/XML for Analysis Integration Services and DM Integration Eight new Data Mining algorithms Auto Packaging and Deployment Migration Wizard Integration Services New high performance architecture Visual design and debugging environment Extensible with custom code and scripts XML task and data source SAP connectivity Integrated data cleansing & text mining Slowly changing dimension wizard Improved flow control Integration with other BI products Reporting Services Report Builder Analysis Services Query Designer Enhanced Expression Editor Multi-valued Parameters Date Picker Sharepoint Web Parts Floating Headers Custom Report Items XML Data Provider There is absolutely NO purpose to this slide other than “shock.” Have fun with this one…make a joke like – “security, lock the doors…we’ve got a lot to cover!” Generally, it’s interesting to mention that – even with four sessions and the keynote, we’ve only just begun to show you what’s available in SQL Server 2005! This is a major release – in many areas – and at a minimum you should be designing for and developing with SQL Server 2005 in mind. How can you get prepared now? Check your applications for their upgrade potential – i.e. using the Upgrade Advisor. Some of the key things that you should hit here are the general highlights that people felt throughout the day. You may have received a large oooohhh for the Profiler/Perfmon integration so for this you can mention the fact that this works against 2000. You can open a saved trace in 2005 Profiler created against a 2000 machine (using EITHER 2000 Profiler or 2005 Profiler) and then you can use the PerfMon integration! © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
Take Advantage When? How much work to leverage the technology? 4/5/2017 11:22 AM Take Advantage When? How much work to leverage the technology? Online Index Operations When Criteria Met Snapshot Isolation Statement-level Snapshot Snapshot Isolation Transaction-level Snapshot (RO) Failover Clustering Database Mirroring Log Shipping Database Snapshots Upgrade Immediate Minimal Work to Leverage Design and Architect Improving Availability from Installation to Design Availability in Layers to minimize downtime and data loss Partial Database Availability Online Piecemeal Restore Instant File Initialization Fast Recovery Online Index Operations When Criteria NOT Met (minority) Snapshot Isolation With Update Conflict Detection Replication DDL Triggers Auditing and Prevention SQL Server Agent New Automation/Alerting Microsoft Operations Manager (MOM) SQL Server Management Pack Database Maintenance Plans Database Mail Upgrade Immediate Minimal Work to Leverage Design and Architect Improving Manageability from Design to Installation to New Features/Extensions Centralized Monitoring to allow a cohesive picture of what’s going on… where… SQL Server Management Studio Unified Error Viewer/ Reports/ Monitoring/ Server Dashboard Performance Monitor Integration SQL Server Profiler Database Engine Tuning Advisor SQLCMD System Information Catalog Views and DMVs VSTS 2005 Code Analysis and Modeling Event Notifications Auditing and Reaction Events User/Schema Separation Query Notifications SQLCLR Procedures LOB Data Types T-SQL TRY/CATCH New T-SQL Statements Data Paging XML Processing Upgrade Immediate Minimal Work to Leverage Design and Architect Security by Policy Secure Metadata Granular Permissions Support for Advanced OS/Hardware features Relational Engine Speed-ups Service Broker Web Services Data Encryption and Key Management Execute Context for Procedures XML Type UDTs/UDAggregates Improving Security and Scalability from Installation to Design Availability in Layers to allow re-architecting in stages Ad Hoc Reporting with Report Builder KPI Engine for AS New IS Data Sources New Data Mining Algorithms BI Wizards Proactive Caching for AS Upgrade Immediate Minimal Work to Leverage Design and Architect Common Development and Management Environment for All BI Solutions 64 Bit Support for All BI Servers New IS Transforms MDX Query Editor in RS Advanced ETL Functions Richer Reporting Features Attribute Analysis in OLAP Functionally Rich Report Models Embedded Reporting Improving Security and Scalability from Installation to Design As the *very* last slide of the day… just leave this slide up as folks leave the room. This slide will rotate through all four of the session’s key features to leverage slides… © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.
© 2005 Microsoft Corporation. All rights reserved. 4/5/2017 11:22 AM © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary. © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. Microsoft makes no warranties, express or implied, in this summary.