Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

23
Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues

Transcript of Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Page 1: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Module 20

Troubleshooting Common SQL Server

2008 R2 Administrative Issues

Page 2: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Module Overview

• SQL Server Troubleshooting Methodology

• Resolving Service-related Issues

• Resolving Concurrency Issues

• Resolving Login and Connectivity Issues

Page 3: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Lesson 1: SQL Server Troubleshooting Methodology

• Discussion: Characteristics of Good Trouble-shooters

• Applying a Troubleshooting Methodology

Page 4: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Discussion: Characteristics of Good Trouble-shooters

• What characteristics have you observed in people that you consider to be good trouble-shooters?

• What characteristics do you notice in people that are poor trouble-shooters?

Page 5: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Applying a Troubleshooting Methodology

• Investigate Clearly define the issue as perceived by the user What works? What doesn't work? Did it ever work? When did it last work? What else

changed? How would you know if it is resolved?

• Analyze Brainstorm all potential causes Which potential causes are likely? How could they be

tested for and eliminated?

• Implement Eliminate potential causes in descending order of

likelihood

• Validate Ensure that the issue really is resolved

Page 6: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Lesson 2: Resolving Service-related Issues

• Troubleshooting Service-related Issues

• SQL Server Error Log

• Windows Event Logs

• Demonstration 2A: Troubleshooting Service-related Issues

Page 7: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Troubleshooting Service-related Issues

• Check Windows and SQL error logs

• If SQL Server can be started but not accessed: Check for network related issues

Try to access SQL Server via the DAC

• If SQL Server will not start: Check the Windows system log

Check master and model databases for corruption

Check that the paths to tempdb files are accessible

Try to start the service from the command prompt

Typical issue: One or more SQL Server services will not start or cannot be accessed.Typical issue: One or more SQL Server services will not start or cannot be accessed.

Page 8: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

SQL Server Error Log

• Log File Viewer cannot be used when the instance is not started Use editor to open the current log file and review it

Also review previous logs as the problem might have occurred before

Page 9: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Windows Event Logs

• System Log to review Windows related information

• Application Log to find application related messages

Page 10: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Demonstration 2A: Troubleshooting Service-related Issues

• In this demonstration you will see how to troubleshoot a service-related issue.

Page 11: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Lesson 3: Resolving Concurrency Issues

• Core Concurrency Concepts

• Troubleshooting Blocking

• Demonstration 3A: Troubleshooting Blocking

• Troubleshooting Deadlocks

• Demonstration 3B: Troubleshooting Deadlocks

Page 12: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Core Concurrency Concepts

• SQL Server has to ensure ACID properties of transactions

• Locking is the mechanism used to synchronize access by multiple users to the same data at the same time

• Isolation levels define the type and length of locks used

• Two main types of lock: Shared locks – Allow others to read but not write

Exclusive locks – Stop others from reading or writing

• Locks prevent update conflicts Locking ensures that transactions are serialized

Locking is automatic

Locks enable safe concurrent access to data

Page 13: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Troubleshooting Blocking

• Processes are blocked when they wait for locked resources Normal behavior, essential for the system

Resource is shown as waiting to acquire a lock

Only a problem when the wait duration is lengthy

• Monitor long lasting blocking scenarios SQL Server Activity Monitor

Dynamic Management Views

SQL Server Data Collector

Typical issue: Applications don't seem to be doing anything but also aren't returning errors.Typical issue: Applications don't seem to be doing anything but also aren't returning errors.

Page 14: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Demonstration 3A: Troubleshooting Blocking

• In this demonstration, you will see how to troubleshoot a blocking issue

Page 15: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Troubleshooting Deadlocks

• Deadlocks are circular blocking scenarios

• SQL Server automatically detects deadlocks Rolls back transactions with error 1205 on deadlock victim

• Monitor using deadlock occurrences with Profiler and SQL Trace

Granted Lock

Granted Lock

Waiting Lock

Waiting Lock

Resource 1

Resource 2

Task 1 Task 2

Typical issue: Deadlock errors (1205 errors) are returned.Typical issue: Deadlock errors (1205 errors) are returned.

Page 16: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Demonstration 3B: Troubleshooting Deadlocks

• In this demonstration, you will see: How to trace a deadlock using SQL Server Profiler

How to extract deadlock events from SQL Server Profiler

How to open deadlock files using SSMS

Page 17: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Lesson 4: Resolving Login and Connectivity Issues

• Troubleshooting Connectivity Issues

• Troubleshooting Login Failures

Page 18: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Troubleshooting Connectivity Issues

• Try to access using Shared Memory on the server If no access via Shared Memory, troubleshoot the login and the

service

• Test the network connectivity Can the server name be resolved?

Can the network and the server be reached?

Is the Browser Service Running for Named Instances that are not using fixed ports?

Is the client configured to use the right protocol and settings?

Is a firewall blocking connectivity?

Typical issue: Cannot connect to SQL Server.Typical issue: Cannot connect to SQL Server.

Page 19: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Troubleshooting Login Failures

• Windows Logins Is the Domain Controller available? Can SQL Server communicate with the Domain Controller?

• SQL Server Logins Is SQL Server configured for Mixed Mode? Is the password correct? Is the login locked or is there a requirement to change

password?

• General Considerations Is the login enabled and does it have CONNECT permission? Is the default/requested database available and access

permitted?

Typical issue: Cannot logon to SQL Server.Typical issue: Cannot logon to SQL Server.

Page 20: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Lab 20: Troubleshooting Common Issues

• Exercises 1 – 5: Troubleshoot and resolve SQL Server administrative issues

Logon information

Estimated time: 45 minutes

Virtual machine 623XB-MIA-SQL

User name AdventureWorks\Administrator

Password Pa$$w0rd

Page 21: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Lab Scenario

You need to be able to resolve common issues with SQL Server processes and services at the time they are occurring. There are five exercises that create issues. You should attempt to troubleshoot and resolve as many of these issues as possible.

Page 22: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Lab Review

• What advantage would monitoring for deadlock errors using SQL Trace have over using SQL Server Profiler?

• What is the first place you should look for information when the SQL Server service will not start?

Page 23: Module 20 Troubleshooting Common SQL Server 2008 R2 Administrative Issues.

Module Review and Takeaways

• Review Questions

• Best Practices