Jason S Wong http://usa.redirectme.net Sr. DBA IT Applications Manager DBA Developer Programmer M.S. Rice 88, MBA U.H. 94(MIS)



Similar documents
Microsoft SQL Server OLTP Best Practice

W I S E. SQL Server 2008/2008 R2 Advanced DBA Performance & WISE LTD.

How To Improve Performance In A Database

MS SQL Performance (Tuning) Best Practices:

Mind Q Systems Private Limited

Dynamics NAV/SQL Server Configuration Recommendations

SQL Server Transaction Log from A to Z

SQL Server 2012 Database Administration With AlwaysOn & Clustering Techniques

Would-be system and database administrators. PREREQUISITES: At least 6 months experience with a Windows operating system.

Auditing In SQL Server. SQL Saturday #486 - RVA Presented By Brad McKuhen

SYSTEM SETUP FOR SPE PLATFORMS

Introduction. Part I: Finding Bottlenecks when Something s Wrong. Chapter 1: Performance Tuning 3

MOC 20462C: Administering Microsoft SQL Server Databases

PRO: Optimizing and Maintaining a Database Administration Solution by Using Microsoft SQL Server Practice Test. Version 2.

Optimizing SQL Server 2012 for SharePoint SharePoint Saturday/Friday, Honolulu March 27, 2015

Database Administration with MySQL

Enhancing SQL Server Performance

Only for Data Group Students Do not share with outsiders and do not use for commercial purposes.

Understanding and Controlling Transaction Logs

Microsoft SQL Database Administrator Certification

Choosing a Data Model for Your Database

SQL Server Version. Supported for SC2012 RTM*** Not supported for SC2012 SP1*** SQL Server 2008 SP1, SP2, SP3

Best Practices. Best Practices for Installing and Configuring SQL Server 2005 on an LSI CTS2600 System

Throwing Hardware at SQL Server Performance problems?

SQL Server 2012 Optimization, Performance Tuning and Troubleshooting

SQL Tips and Tricks for Dynamics GP. Lisa Williams and Darrell Moy

Data Compression in Blackbaud CRM Databases

Configuring Apache Derby for Performance and Durability Olav Sandstå

VirtualCenter Database Performance for Microsoft SQL Server 2005 VirtualCenter 2.5

Microsoft SQL Server performance tuning for Microsoft Dynamics NAV

Analyzing & Optimizing T-SQL Query Performance Part1: using SET and DBCC. Kevin Kline Senior Product Architect for SQL Server Quest Software

W I S E. SQL Server 2012 Database Engine Technical Update WISE LTD.

6231B: Maintaining a Microsoft SQL Server 2008 R2 Database

Transaction Log Internals and Troubleshooting. Andrey Zavadskiy

AV-005: Administering and Implementing a Data Warehouse with SQL Server 2014

VMware vcenter 4.0 Database Performance for Microsoft SQL Server 2008

General DBA Best Practices

SQL Database Administration. Overview

ArcSDE for Microsoft SQL Server Administration. Rob Stauder, ESRI

Guerrilla Warfare? Guerrilla Tactics - Performance Testing MS SQL Server Applications

DMS Performance Tuning Guide for SQL Server

David Dye. Extract, Transform, Load

mylittleadmin for MS SQL Server Quick Start Guide

Microsoft SQL Server: MS Performance Tuning and Optimization Digital

DBMS / Business Intelligence, SQL Server

Database Server Migration Guide

Infor LN Performance, Tracing, and Tuning Guide for SQL Server

$99.95 per user. SQL Server 2005 Database Administration CourseId: 152 Skill level: Run Time: 30+ hours (158 videos)

Restoring Data with Database Snapshots

This Tech Note provides detailed guidelines and options for defragmenting and maintaining your production databases.

SQL Server Performance Tuning and Optimization

SQL Server 2016 New Features!

Handling a Full SQL Server Transaction Log

Chancery SMS Database Split

StruxureWare Power Monitoring Database Upgrade FAQ

Using SQL Server Management Studio

SQL Server An Overview

SQL Server Developer Training Program. Topics Covered

Administering Microsoft SQL Server 2012 Databases

WW TSS-02\03 MS SQL Server Extended Performance & Tuning

The Database is Slow

USING FILERELICATIONPRO TO REPLICATE SQL SERVER

Upon completion of the program, students are given a full support to take and pass Microsoft certification examinations.

SQL Server 2012 Query. Performance Tuning. Grant Fritchey. Apress*

Siemens Teamcenter Oracle -to-sql Server 2008 Migration Guide

Tuning Microsoft SQL Server for SharePoint. Daniel Glenn

DBA 101: Best Practices All DBAs Should Follow

Oracle DBA Course Contents

ExecuTrain Course Outline MOC 6231B: Maintaining a Microsoft SQL Server 2008 R2 Database

SQL SERVER Anti-Forensics. Cesar Cerrudo

Best Practices for Running Dassault Systèmes ENOVIA on SQL Server 2008

SQL Server Database Administrator s Guide

SharePoint for the DBA. Régis Baccaro

Brad s Sure DBA Checklist

DBTech EXT Backup and Recovery Labs (RCLabs)

Safexpert Installation instructions MS SQL Server 2008 R2

Troubleshooting Transaction Log Errors

IBM DB2: LUW Performance Tuning and Monitoring for Single and Multiple Partition DBs

Migrate Topaz databases from One Server to Another

Beginning SQL Server Administration. Apress. Rob Walters Grant Fritchey

XenDesktop 7 Database Sizing

Summary: This paper examines the performance of an XtremIO All Flash array in an I/O intensive BI environment.

Execution Plans: The Secret to Query Tuning Success. MagicPASS January 2015

SQL Server 2008 Designing, Optimizing, and Maintaining a Database Session 1

A basic create statement for a simple student table would look like the following.

The 5-minute SQL Server Health Check

Data Migration and Backup Strategies

Database Maintenance Essentials

Monitoring PostgreSQL database with Verax NMS

CHAPTER 8: OPTIMIZATION AND TROUBLESHOOTING

AuditWizard v8. SQL Maintenance

Outline. Failure Types

MCTS Microsoft SQL Server 2005 Implementation & Maintenance

SQL Server Administrator Introduction - 3 Days Objectives

Transcription:

Jason S Wong http://usa.redirectme.net Sr. DBA IT Applications Manager DBA Developer Programmer M.S. Rice 88, MBA U.H. 94(MIS)

Make your defaults Top 10 SQL Server defaults that DBAs need to evaluate and modify for their environment. Recovery model Min - Max memory Initial size, auto-growth Default Isolation Level Read Committed (Index) FillFactor Primary Key Clustered Index Uniqueidentifier Collation Data type - nvarchar(255), the "N" Allow Nulls

1. Recovery model Full recovery mode without backup job; QA/DEV refresh reset recovery model; bad queries fill the log on production host; no more disk space Truncate_Log.sql - next Back by date-time naming file script - next

EXEC sp_dboption 'db','trunc. log on chkpt. ','TRUE'; Checkpoint EXEC sp_dboption 'db','trunc. log on chkpt. ','FALSE'; DBCC SHRINKFILE (db, 2); GO ------------------discontinued functionality in 2008-------------------------------------------- BACKUP LOG db_log WITH NO_LOG; GO SELECT log_reuse_wait_desc FROM sys.databases WHERE NAME = 'db_log'; GO DBCC SHRINKFILE (db_log, 2); GO DO NOT DETACH DATABASE, DELETE LOG FILE, REBOOT

--Full backup using datetime file name DECLARE @devname varchar(256) DECLARE @DirLocationPre varchar(256) DECLARE @DatabaseName varchar(256) SET @DirLocationPre = 'U:\backup\DB1\DB1FullBackup' SET @DatabaseName = 'DB1' SELECT @devname = @DirLocationPre + REPLACE(REPLACE(REPLACE(CONVERT(Varchar(40), GETDATE(), 120),'-',''),':',''), ' ', '') + '.bak'; BACKUP DATABASE @DatabaseName to DISK = @devname GO

2. Min Max memory Memory Usage: Buffer cache, procedure cache, dirty pages SPIDMemoryUsage.sql -- check paging and cache fault counters StalledDatabaseIO.sql -- check physical disk counters Parameterized SP vs ad-hoc query. Memory speed vs Disk IO speed

GPEDIT.MSC Perfmon.exe SQLServer:BufferManager.TotalPages SQLServer:BufferManager.TargetPages SQLServer:BufferManager.FreePages SQLServer:BufferManager.DatabasePages SQLServer:BufferManager.StolenPages

3. Initial size, auto-growth Define realistic size and growth rate, 1K per row, 1 million records 1 GB DiskSpaceReview_SP.sql Default location of tempdb, system DB RAID 1, 5, 10, number of disks and spindle speed

4. Default Isolation Level Read Committed SELECT. Shared Lock Table hint: WITH (NOLOCK) = Read Uncommitted ALTER DATABSE AdventureWorks SET ALLOW_SNAPSHOT_ISOLATION on ALTER DATABSE AdventureWorks SET READ_COMMITTED_SNAPSHOT on Data-warehouse reporting model vs transaction model Schedule jobs at quiet time BOL Enabling Row Versioning-based Isolation Levels Row versioning without exclusive lock SnapshotIsolation.sql - next

ALTER DATABSE AdventureWorks SET ALLOW_SNAPSHOT_ISOLATION on --ALTER DATABSE AdventureWorks SET READ_COMMITTED_SNAPSHOT on USE AdventureWorks GO SET TRANSACTION ISOLATION LEVEL SNAPSHOT --SET TRANSACTION ISOLATION LEVEL READ COMMITTED With Q AS ( SELECT c.firstname, c.lastname, ROW_NUMBER() OVER(ORDER BY SalesYTD DESC) AS Row_Number, s.salesytd, a.postalcode FROM Sales.SalesPerson s JOIN Person.Contact c on s.salespersonid = c.contactid JOIN Person.Address a ON a.addressid = c.contactid WHERE TerritoryID IS NOT NULL AND SalesYTD <> 0 ) insert into dbo.tableinsert select * from Q

5. (Index) FillFactor

http://usa.redirectme.net/repriser/data/indexdefrag.html Update statistics.

6. Primary Key Clustered Index Primary Key has to be unique and not null. Clustered Index is recommended to be on sequential values to avoid fragmentation.

7. Uniqueidentifier

NEWSEQUENTIALID ( ) NEWSEQUENTIALID() can only be used with DEFAULT constraints on table columns of type uniqueidentifier. For example: CREATE TABLE mytable (ColumnA uniqueidentifier DEFAULT NEWSEQUENTIALID()) When NEWSEQUENTIALID() is used in DEFAULT expressions, it cannot be combined with other scalar operators. For example, you cannot execute the following: CREATE TABLE mytable (ColumnA uniqueidentifier DEFAULT dbo.myfunction(newsequentialid())) In the previous example, myfunction() is a scalar user-defined scalar function that accepts and returns a uniqueidentifier value. NEWSEQUENTIALID() cannot be referenced in queries. The GUIDs generated by NEWSEQUENTIALID() are unique only within a particular computer if the computer does not have a network card. You can use NEWSEQUENTIALID() to generate GUIDs to reduce page contention at the leaf level of indexes.

8. Collation The sort order BOL: Default Collations in SQL Server Setup

US English; North America West Europe; US-Europe-MiddleEast-FarEast-Russia

9. Data type nvarchar(255), the N 10. Allow Nulls What is NULL? Technical definition: Do we need NULL in database? What is the impact? What is the solution?