SQL Server 2005 Implementation and Maintenance Chapter 10: Maintaining and Automating SQL Server.

Slides:



Advertisements
Similar presentations
Yukon – What is New Rajesh Gala. Yukon – What is new.NET Framework Programming Data Types Exception Handling Batches Databases Database Engine Administration.
Advertisements

Little Used, but Powerful Features with GP Cathy Fregelette, CPA, PMP Practice Manager BroadPoint Technologies September 20, 2012.
Module 8 Importing and Exporting Data. Module Overview Transferring Data To/From SQL Server Importing & Exporting Table Data Inserting Data in Bulk.
Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
Module 5: Performing Administrative Tasks. Overview Configuration Tasks Routine SQL Server Administrative Tasks Automating Routine Maintenance Tasks Creating.
Maintaining and Automating SQL Server
SQL Server Agent Keith Binford. SQL Server Agent SQL Server Agent is a Windows service that can execute and schedule tasks and jobs.
Module 4 Working with Databases. Module Overview Overview of SQL Server Databases Working with Files and Filegroups Moving Database Files.
DataBase Administration Scheduling jobs Backing up and restoring Performing basic defragmentation and index rebuilding Using alerts Archiving.
Backup, Integrity Check and Index and Statistics Maintenance
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
Maintenance Plans Keith Binford Nebiyu Sorri. Maintenance Plans Most plans have at least four steps: Database consistency checking Database backup and.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 11: Monitoring Server Performance.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Backup, Integrity Check and Index and Statistics Maintenance
CS27510 Commercial Database Applications. Maintenance Maintenance Disaster Recovery Disaster Recovery.
Designing Custom Maintenance Plans with TSQL By John Miner.
1 Chapter Overview Transferring and Transforming Data Introducing Microsoft Data Transformation Services (DTS) Transferring and Transforming Data with.
Today’s Agenda Chapter 12 Admin Tasks Chapter 13 Automating Admin Tasks.
Module 13 Automating SQL Server 2008 R2 Management.
Module 15: Monitoring. Overview Formulate requirements and identify resources to monitor in a database environment Types of monitoring that can be carried.
MS Access Advanced Instructor: Vicki Weidler Assistant:
Module 8: Server Management. Overview Server-level and instance-level resources such as memory and processes Database-level resources such as logical.
Chapter 4 SQL. SQL server Microsoft SQL Server is a client/server database management system. Microsoft SQL Server is a client/server database management.
Chapter 9 Scripting RMAN. Background Authors felt that scripting was a topic not covered well Authors wanted to cover both Unix/Linux and Windows environments.
Maintaining a Mirrored Database Tips and Tricks by Paul G. Hiles.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Informix IDS Administration with the New Server Studio 4.0 By Lester Knutsen My experience with the beta of Server Studio and the new Informix database.
Chokchai Junchey Microsoft Product Specialist Certified Technical Training Center.
Agenda for Today Do Chapter 14 Final Project Review for Final.
Learningcomputer.com SQL Server 2008 – Administration, Maintenance and Job Automation.
IT 456 Seminar 5 Dr Jeffrey A Robinson. Overview of Course Week 1 – Introduction Week 2 – Installation of SQL and management Tools Week 3 - Creating and.
Module 14 Configuring Security for SQL Server Agent.
Triggers A Quick Reference and Summary BIT 275. Triggers SQL code permits you to access only one table for an INSERT, UPDATE, or DELETE statement. The.
Oracle Data Integrator Procedures, Advanced Workflows.
Module 16: Performing Ongoing Database Maintenance
1 Chapter Overview Preparing to Upgrade Performing a Version Upgrade from Microsoft SQL Server 7.0 Performing an Online Database Upgrade from SQL Server.
1 Chapter Overview Performing Configuration Tasks Setting Up Additional Features Performing Maintenance Tasks.
Module 15 Monitoring SQL Server 2008 R2 with Alerts and Notifications.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 11: Monitoring Server Performance.
Indexes / Session 2/ 1 of 36 Session 2 Module 3: Types of Indexes Module 4: Maintaining Indexes.
Week 7 : Chapter 7 Agenda SQL 710 Maintenance Plan:
1 Chapter Overview Defining Operators Creating Jobs Configuring Alerts Creating a Database Maintenance Plan Creating Multiserver Jobs.
SQL/Lesson 7/Slide 1 of 32 Implementing Indexes Objectives In this lesson, you will learn to: * Create a clustered index * Create a nonclustered index.
Chapter 4 Indexes. Index Architecture  By default data is inserted on a first-come, first-serve basis  Indexes bring order to this chaos  Once you.
MISSION CRITICAL COMPUTING Siebel Database Considerations.
1 Intro stored procedures Declaring parameters Using in a sproc Intro to transactions Concurrency control & recovery States of transactions Desirable.
SQL Server 2005 Implementation and Maintenance Chapter 6: Security and SQL Server 2005.
Maintenance Practices. Goal  Automate the necessary DBA chores to put organizations on the path of having healthier, consistent and more trustworthy.
1 Chapter Overview Using Standby Servers Using Failover Clustering.
Log Shipping, Mirroring, Replication and Clustering Which should I use? That depends on a few questions we must ask the user. We will go over these questions.
SQL Triggers, Functions & Stored Procedures Programming Operations.
SQL SERVER MAINTENANCE PLANS Kat
Linkedin: dennisegraham Dennis E Graham Reporting For SQL Health.
You Inherited a Database Now What? What you should immediately check and start monitoring for. Tim Radney, Senior DBA for a top 40 US Bank President of.
In this session, you will learn to: Manage databases Manage tables Objectives.
SSIS ETL Data Resource Management. Create an ETL package using a wizard database server to database server The business goal of this ETL package is to.
ProgressBook Suite Maintenance
SQL Database Management
SQL Server Agent All the Knobs You Need to Know
You Inherited a Database Now What?
Designing Database Solutions for SQL Server
Automating SQL Server Management
Dynamics AX Performance
The Ultimate Maintenance Plan By Ed Roepe Perimeter DBA, LLC
You Inherited a Database Now What?
Chapter 11 Managing Databases with SQL Server 2000
PCW-09 Vision: Information Center Approval System
Sql Saturday Philadelphia
Ch 10. Maintaining and Automating SQL Server
Presentation transcript:

SQL Server 2005 Implementation and Maintenance Chapter 10: Maintaining and Automating SQL Server

Maintaining Indexes Page splits cause database fragmentation Query DM_DB_INDEX_PHYSICAL_STATS to find fragmentation –USE AdventureWorks; SELECT INDEX_ID, AVG_FRAGMENTATION_IN_PERCENT FROM sys.dm_db_index_physical_stats (db_id(),Object_ID(N'Sales.SalesOrderDet ail'), NULL, NULL, 'DETAILED') find the fragmentation on the Sales.SalesOrderDetail table in the Adventure- Works database © Wiley Inc All Rights Reserved.

Reorganizing Indexes If database fragmentation is less than 10%, no action is required 20 – 30% requires you to reorganize indexes Use ALTER INDEX REORGANIZE –USE AdventureWorks ALTER INDEX PK_ProductPhoto_ProductPhotoID ON Production.ProductPhoto REORGANIZE reorganize the PK_Product_Product-PhotoID index on the Production.ProductPhoto table © Wiley Inc All Rights Reserved.

Rebuild Indexes More than 30% fragmentation requires you to rebuild indexes There are two methods –CREATE INDEX WITH DROP EXISTING –ALTER INDEX REBUILD © Wiley Inc All Rights Reserved.

Maintaining Statistics SQL Server formulates an execution plan to run queries –This is a map of available tables and indexes Statistics are used to create an execution plan Statistics are updated automatically by default If you have changed this for an index run UPDATE STATISTICS to bring it up to date © Wiley Inc All Rights Reserved.

Using DBCC CHECKDB Checks allocation, logical, and structural integrity of objects It has several options –NOINDEX intensive checks of nonclustered indexes should not be performed –REPAIR_REBUILD –REPAIR_ALLOW_DATA_LOSS –ALL_ERRORMSGS If this is not used, then only the first 200 errors display. –NO_INFOMSGS This suppresses all informational messages. –TABLOCK TABLOCK causes DBCC CHECKDB to obtain locks instead of using a snapshot, which makes it run faster. –ESTIMATE_ONLY Displays the estimated amount of tempdb space needed to run DBCC CHECKDB with all the other specified options. The actual database check is not performed. –PHYSICAL_ONLY Using this option causes DBCC CHECKDB to run much faster than performing a full check, which makes it well suited for frequent use on production systems. –DATA_PURITY This causes DBCC CHECKDB to check the database for column values that are not valid or are out of range. © Wiley Inc All Rights Reserved.

Shrinking Data Files When users add data, the data files may grow in size When data is removed, the files are not automatically reduced in size Files can be shrunk manually or on a scheduled basis © Wiley Inc All Rights Reserved.

Automation Basics SQL Agent performs automation tasks The Agent has three subcomponents –Jobs –Alerts –Operators Make sure the Agent is set to start automatically Have it log on with a domain account © Wiley Inc All Rights Reserved.

Database Mail Database Mail allows SQL Server to send SMTP It uses Service Broker so it runs asynchronously For the SQL Agent to send mail the MSDB database must be a mailhost © Wiley Inc All Rights Reserved.

Operators An operator is an object that contains contact information for a DBA –Name – address –Pager address –Net send address –Hours available © Wiley Inc All Rights Reserved.

Jobs A job is a series of tasks that can be scheduled They have three main parts –Steps The action(s) to perform –Schedules When to perform the action(s) –Notifications Whom to notify on completion © Wiley Inc All Rights Reserved.

Standard Alerts Alerts are fired when an event occurs They can be configured to notify operators and/or run a job Standard alerts are based on built-in error messages or severity levels © Wiley Inc All Rights Reserved.

Custom Alerts The built-in error messages do not cover every circumstance You can create custom error messages to based alerts on –They must start at 50,001 –They are fired using the RAISERROR() command –They accept parameters %ls and %s for strings %ld and %d for numbers © Wiley Inc All Rights Reserved.

Performance Alerts These are based on Windows performance counters –I.e. Processor: % Processor Time When the counter reaches the specified threshold, the alert fires © Wiley Inc All Rights Reserved.

WMI Alerts These are based on Windows Management Instrumentation This allows you to fire alerts under special circumstances: –When a DDL statement is run ALTER LOGIN CREATE TABLE © Wiley Inc All Rights Reserved.

Maintenance Plans Maintenance needs to be run regularly You can create jobs manually to do this, but that is tedious It is best to use the Maintenance Plan Wizard –This will create a Maintenance Plan to automate necessary maintenance © Wiley Inc All Rights Reserved.

Copying Databases The easiest way to copy a database is the Copy Database Wizard There are several reasons to copy a database –Moving databases to an upgraded server –Create a standby server for emergencies –Copy a database from development to production © Wiley Inc All Rights Reserved.