Week 7 : Chapter 7 Agenda SQL 710 Maintenance Plan:

Slides:



Advertisements
Similar presentations
Week 6: Chapter 6 Agenda Automation of SQL Server tasks using: SQL Server Agent Scheduling Scripting Technologies.
Advertisements

Maintaining and Automating SQL Server
®® Microsoft Windows 7 for Power Users Tutorial 6 Optimizing Your Hard Disk.
FlareCo Ltd ALTER DATABASE AdventureWorks SET PARTNER FORCE_SERVICE_ALLOW_DATA_LOSS Slide 1.
SQL Server Best Practices Keep Your Database In Top Performance Shape and Maintain Effective Backups September, 2007 Richard Kokoski.
SQL Server 2005 Implementation and Maintenance Chapter 10: Maintaining and Automating SQL Server.
©2006 ITT Educational Services Inc. Course Name: IT390 Business Database Administration Unit 5 Slide 1 IT390 Business Database Administration Unit 5 :
Database Optimization & Maintenance Tim Richard ECM Training Conference#dbwestECM Agenda SQL Configuration OnBase DB Planning Backups Integrity.
Fundamentals, Design, and Implementation, 9/e Chapter 11 Managing Databases with SQL Server 2000.
Chapter 12 - Backup and Disaster Recovery1 Ch. 12 – Backups and Disaster Recovery MIS 431 – Created Spring 2006.
A+ Guide to Software, 4e Chapter 4 Supporting Windows 2000/XP Users and Their Data.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment Chapter 12: Managing and Implementing Backups and Disaster Recovery.
Week 9 – Chapter 8 SQL 710 Methods to Backup Databases
RMAN Restore and Recovery
Agenda  Overview  Configuring the database for basic Backup and Recovery  Backing up your database  Restore and Recovery Operations  Managing your.
Database Configuration and Maintenance Database Configuration and Maintenance Exam / 30.
Transaction log grows unexpectedly
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.
1 Chapter Overview Understanding Backup Terms, Media, and Devices Backing Up Databases, Files, Filegroups, and Transaction Logs Restoring a User Database.
NovaBACKUP 10 xSP Technical Training By: Nathan Fouarge
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 12: Managing and Implementing Backups and Disaster Recovery.
70-293: MCSE Guide to Planning a Microsoft Windows Server 2003 Network, Enhanced Chapter 14: Problem Recovery.
Module 8: Designing Active Directory Disaster Recovery in Windows Server 2008.
Administration etc.. What is this ? This section is devoted to those bits that I could not find another home for… Again these may be useless, but humour.
SQL Server 2008 Implementation and Maintenance Chapter 7: Performing Backups and Restores.
CN1276 Server Kemtis Kunanuraksapong MSIS with Distinction MCTS, MCDST, MCP, A+
Chapter 4 SQL. SQL server Microsoft SQL Server is a client/server database management system. Microsoft SQL Server is a client/server database management.
Database Systems: Design, Implementation, and Management Eighth Edition Chapter 10 Database Performance Tuning and Query Optimization.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 12: Managing and Implementing Backups and Disaster Recovery.
Chapter 18: Windows Server 2008 R2 and Active Directory Backup and Maintenance BAI617.
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.
Chapter 13 Maintaining Windows. O BJECTIVES FOR THE NEXT SEVERAL LESSONS Learn how to set up and perform scheduled preventive maintenance tasks to keep.
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.
Databases Lesson 5.
Architecture Rajesh. Components of Database Engine.
Discovering Computers Fundamentals Fifth Edition Chapter 9 Database Management.
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 16: Performing Ongoing Database Maintenance
XP New Perspectives on Microsoft Access 2002 Tutorial 1 1 Microsoft Access 2002 Tutorial 1 – Introduction To Microsoft Access 2002.
11 DISASTER RECOVERY Chapter 13. Chapter 13: DISASTER RECOVERY2 OVERVIEW  Back up server data using the Backup utility and the Ntbackup command  Restore.
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.
Windows Vista Inside Out Chapter 28 - Chapter 28 - Managing Disks and Drives Last modified
Copyright 2007, Paradigm Publishing Inc. ACCESS 2007 Chapter 3 BACKNEXTEND 3-1 LINKS TO OBJECTIVES Modify a Table – Add, Delete, Move Fields Modify a Table.
Maintaining a Database Access Project 3. 2 What is Database Maintenance ?  Maintaining a database means modifying the data to keep it up-to-date. This.
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.
Maintenance Practices. Goal  Automate the necessary DBA chores to put organizations on the path of having healthier, consistent and more trustworthy.
SQL Query Analyzer. Graphical tool that allows you to:  Create queries and other SQL scripts and execute them against SQL Server databases. (Query window)
NOTE: To change the image on this slide, select the picture and delete it. Then click the Pictures icon in the placeholder to insert your own image. DATABASE.
Hands-On Microsoft Windows Server 2008 Chapter 7 Configuring and Managing Data Storage.
SQL SERVER MAINTENANCE PLANS Kat
Microsoft SQL is known as RDMS (Relational Database Management System) which is developed by Microsoft and is highly used at corporate and enterprise.
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.
Database Administration for the Non-DBA Denny Cherry twitter.com/mrdenny.
Agenda for Today  DATABASE Definition What is DBMS? Types Of Database Most Popular Primary Database  SQL Definition What is SQL Server? Versions Of SQL.
VMware Recovery Software RECOVER DATA FROM CORRUPT VMDK FILE.
SQL Database Management
You Inherited a Database Now What?
Designing Database Solutions for SQL Server
Introduction to Computers
Introduction to SQL Server Management for the Non-DBA
Database Administration for the Non-DBA
You Inherited a Database Now What?
Performing Database Recovery
Chapter 11 Managing Databases with SQL Server 2000
Ch 10. Maintaining and Automating SQL Server
Presentation transcript:

Week 7 : Chapter 7 Agenda SQL 710 Maintenance Plan: Why do maintenance? Overview Maintenance Plan wizard DBCC maintenance commands SQL 710

Why do Maintenance? Routinely want to make a backup copy of database in case of hardware problems or data corruption Data in a database becomes fragmented over time as data is added, modified and deleted Should verify integrity of data occasionally Normally want to perform these tasks when you choose – not as the result of a crisis (just like car maintenance; don’t want to be stuck on the side of a highway with no oil in engine)! SQL 710

Maintenance Overview SQL 710 Day-to-day operation Very important responsibility of a DBA If you do maintenance nobody notices but if you don’t do it everyone knows 2 types of maintenance: - to keep database running  most important - to improve performance Database maintenance can be fully automated – there is a wizard for almost every task SQL 710

Database Maintenance Wizard Primary tool for database maintenance Graphical tool Can create a scheduled maintenance plan for each database that performs: Backups (most important!) Optimization Integrity Check Reporting SQL 710

Maintenance Planning SQL 710 Normally use wizard to create a maintenance plan for each database Best to have one plan per database but can choose more than 1 database per plan Plans are scheduled separately as required by application Very important to create a separate maintenance plan for critical system databases: master, msdb SQL 710

Maintenance Plan A Maintenance Plan consists of a group of jobs and schedules called a plan A plan can be edited after you create it Very simple tool to use - no excuse not to use it Within a job you can perform: Backups Optimization Integrity Check Reporting SQL 710

Database Backups Most important part of maintenance plan: permits recovery of data from backup copy Backs up database files or logs to a tape or hard drive Hard drive location can be broken into several directories for each database Can automatically delete older backups after a certain time Wizard records all activities and sends notification Report can be sent to disk, a central server, a history table or to an operator SQL 710

Optimization SQL 710 Improves database performance Database gets fragmented when data is inserted and deleted (same as files on a hard drive, see last slides for illustration) Optimization causes the following to be performed that can improve database performance: Examine and minimize fragmentation of data Update database statistics Remove excess free space from database SQL 710

Data Fragmentation SQL 710 Database get fragmented when data is inserted or deleted You can select how much free space for new data will be left when defragmenting is done If database is primarily for data entry (OLTP) then it is best to leave significant free space at the end of each page so that related data stays together If database is composed of data that is read more often than being written (OLAP) such as a report server then leave lower percentage of page space free. SQL 710

Update database statistics Statistics are samples of data used to assist SQL Server search engine in locating data As data is added and deleted these statistics become outdated Can keep statistics updated 2 ways: Use wizard to schedule update of statistics periodically (this may slow performance if statistics are out of date because data would not be retrieved efficiently) Set database option that automatically updates statistics (this slows performance because statistics are continually updated) SQL 710

Remove excess free space This setting in the wizard permits shrinking the database at a specific recurring time. Automatic shrink of database can be set as an option SQL 710

Database Integrity Check SQL Server is a very stable RDBMS However should check integrity of a database periodically Integrity checks validity of defined database constraints (NN, PK, FK, CK, UN) Integrity check can correct minor errors automatically May have to restore data from backup if major integrity error is found (very rare!) SQL 710

T-SQL Maintenance Commands T-SQL maintenance commands are the Database Consistency Check commands (DBCC) Command line utility Maintenance wizard actually uses these commands Perform maintenance on Database Index and file groups Commands include: DBCC CHECKDB DBCC CHECKTABLE DBCC DBREINDEX SQL 710

SQL 710 DBCC CHECKDB Command CHECKDB command examines an entire database for corruption (checks all tables and indexes in database) Command can be run in diagnostic mode To correct any problem it has to be run in single user mode Can use REPAIR_FAST or REPAIR_ALLOW_DATA_LOSS switch SQL 710

CHECKDB Switches SQL 710 REPAIR_FAST Switch: Least amount of damage to database Quickly fixes any inconsistency Don’t lose any data REPAIR_ALLOW_DATA_LOSS Switch: Most harmful switch but could save overall database You can use this command on a database that you plan to recover from tape backup SQL 710

DBCC CHECKTABLE Command Checks for database corruption against a table. You can use this command while people are using the table except while performing repair SQL 710

DBCC DBREINDEX Command Command updates the indexes on a server Indexes are used for faster data access Indexes are stored like data pages and become fragmented over time DBCC DBREINDEX command defragments indexes Time required depends on: Number of indexes Size of indexes Load on server when running command SQL 710

SQL 710 Physical structure of database Order 1 Item 1 Quantity Item 2 Insert Order 1 orderlines on Page 1: Order 1 Item 1 Quantity Item 2 SQL 710

SQL 710 Physical structure of database (ctd) Order 1 Item 1 Client 1 Insert Order 2’s orderlines on Page 1(blue) and page 2 (white) Order 1 Item 1 Client 1 Item 2 Order 2 Client 2 Item 3 Item 4 Item 5 Item 6 Item 7 SQL 710

SQL 710 Physical structure of database (ctd) Add order 1 orderlines – no room on page 1 so place on page 2 – data for order 1 is fragmented Order 1 Item 1 Quantity Item 2 Order 2 Item 3 Item 4 Item 5 Item 6 Item 7 SQL 710

SQL 710 Physical structure of database (ctd) Order 2 cancelled- delete Order 2’s orderlines – leaves Order 1’s orderlines fragmented Order 1 Item 1 Quantity Item 2 Item 3 Item 4 SQL 710