0% found this document useful (0 votes)
70 views11 pages

VERY NICE Solutions For The Issues.2

The document lists various issues that may occur with SQL Server and potential solutions. Some issues include users being unable to connect, job failures, backups failing, inability to restore backups, services failing to start, and performance problems. Suggested solutions involve checking connectivity settings, SQL Agent status, disk space, permissions, logs, and enabling traces to diagnose issues like blocking, locking, and deadlocks. The goal is to methodically check common causes and use tools like Profiler and error logs to identify the root cause of the problem.

Uploaded by

SHAFFI D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views11 pages

VERY NICE Solutions For The Issues.2

The document lists various issues that may occur with SQL Server and potential solutions. Some issues include users being unable to connect, job failures, backups failing, inability to restore backups, services failing to start, and performance problems. Suggested solutions involve checking connectivity settings, SQL Agent status, disk space, permissions, logs, and enabling traces to diagnose issues like blocking, locking, and deadlocks. The goal is to methodically check common causes and use tools like Profiler and error logs to identify the root cause of the problem.

Uploaded by

SHAFFI D
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Possible issues with solutions

 User Unable to connect to SQL Server


 Job Failures
 Backup failed to complete
 Unable to restore the backup files
 Services Failed to start
 Performance issues
 TempDB Full
 Log File Full
 Disk Space issues
 Permission issues
 Database issues
 SQL Server is running slowly
 Slow running Queries
 Application running slowly
 SQL Server stopped
 Maintenance plan issues
 Agent Down

1. User Unable to connect to SQL Server

1. Check whether the ping request is working or not


a. Ping ip address –t (-t for continuous pinging)
2. Checking the credentials
a. Checking user name and password
3. Checking if the protocols are enabled or not
a. Run-> sqlservermanager.msc
4. Checking if the login was created for that particular user or not
a. Select * from syslogins
b. Select * from sysusers
5. Check that the client and the server run on the same network protocol or not
6. Checking if the login was disabled/expired
7. Check if the authentication mode is Windows only and where user is connecting to
SQL Server Authentication
Instance Properties ->Security tab
8. Maximum number of connections in connection pool
Instance Properties -> Connections tab -> maximum concurrent user
connections (0= unlimited)
9. Browser service is running but service account associated with Browser service has
permission issues
10. We can try the following
a. SSMS(SQLWB) ...>QUERY ANALYZER
b. Application (web/standalone/mobile/window/3rd party)
c. sqlcmd
d. osql
e. isql
f. udl extention based files
g. ......> notepad.udl....>save...> double click
h. ODBC connection through sql native client 
.....> goto...>administration tool...>ODBC connection 
i. profiler, surface area configuration , configuration manager , windows
server, BI studio 

2. Job Failures
1. We will check whether the Agent service is down
Management - > SQL Server Agent
2. Check whether the job `s Schedule is enabled
Management -> SQL Server Agent -> Jobs
(or)
use msdb
go
select * from sysjobs
3. Check whether the MSDB is corrupt
select databasepropertyex ('msdb','status')
4. Check whether Event log Services are running or not
Services.msc
Comparing the dates and times for alert failure events between the SQL
Server error log, the SQL Server Agent error log, and the Windows NT or
Windows 2000 application log can help you to determine the reason of
the failure.
5. Check whether the backup path is accessible or not
6. Check whether there might be same process or query running on the task
parallel
sp_who2
7. It can be due to Owner change
USE msdb
GO
EXEC msdb.dbo.sp_update_job @job_name='Your Job Name', 
@owner_login_name='DOMAIN\ThenewOwner'
GO
8. Permission issues
'SQLAgentCmdExec'
Set the proxy account in the security policy "Replace a process level token" in
the server,
xp_sqlagent_proxy_account

9. Server Down
10. Disk Space
Xp_fixeddrives
11. We can check clear description if the job failure from view job history
SQL Server Agent -> Jobs - > Select Job and then right click and open View
History
12. We can check Event Viewer, Error Logs for failure causes

3. Backup failed to complete


1. Checking the Disk space
a. Xp_fixeddrives – > we can see local drives free space
b. Use dbname
Go
Exec sp_spaceused - > space used for particular database
c. Dbcc sqlperf (logspace) -> Log space used in % for all the databases
2. Need to check if SQL server Agent is Down
Management - > SQL Server Agent
3. Checking specified path is available for backup or not?
Need access to the specified path
4. Backup operator role must be given to the user
Security - > Logins - > select user -> properties - > Database Access ->
db_backupoperator
5. Check the backup base ( Full & then Diff/Tlog)
We have script - > Full, Diff, Tlog.txt
6. Can be because job is disabled
Management - > SQL Server Agent - > Jobs
7. Can be because steps inside job are failed
Management - > SQL Server Agent - > Jobs – Right click on the particular
job - > Properties - > steps tab
8. Can happen if job owner is changed
Security - > Logins - > select user -> properties - > Database Access ->
db_backupoperator

Backup verification command


restore verifyonly from disk='backup path'
4. Unable to Restore the backup files
1. Check whether the Backup is valid or not
Restore verifyonly from disk = ‘Backup path’
2. We will check the Base Backup is restored first or not
We will check basing upon the error message.

5. Services Failed to start


1. SCM – start instance (run: sqlservermanager.msc)
2. OS services (run: services.msc)
3. SAC – Surface Area Configuration (2005)
4. On the command line: Run – net start service name
Find the service name in services.msc
5. Using object explorer (Right click on the instance and try to start)
6. Startup parameters have incorrect file path locations.
Right click the instance -> Properties -> General Tab -> startup parameters
7. Need to check whether Services are disabled or not Services.msc

6. Performance issues
1. CPU Utilization
We will check the performance of CPU usage of the server in Task Manager

2. Memory
We will check memory manager counters
3. I/O Blocking
i. We will identify if blocking is really present or not?
Select * from sys.sysprocesses where blocked<>0

ii. After identifying the SPID's, find out which SPID is doing what task

DBCC INPUTBUFFER (SPID1) DBCC, INPUTBUFFER (SPID2)

iii. Identify which SPID belongs to which application/login/network address


Select * from sys.sysprocesses where spid=<SPID1>
iv. Priority should be chosen based on Time started, CPU Time, Memory
usage, IO Usage sp_who2

v. If confused on the priority immediately escalate to respective


application Team Lead/Application Contact Person. Also approach any
escalation in your team.

4. Locking
1. We will check Error log for the issue
Server - Management - SQL Server Logs – Current
exec master..xp_readerrorlog 1, 2
2. We can use sp_lock to check the locks
3. We can also get information about locks using
select * from syslockinfo
5. Deadlock
1. As per the request we will enable traces and find the deadlock issues.
DBCC traceon(1204)
DBCC traceon(1222)
2. Please stop the trace, once monitoring is completed. Else it would lead to
performance issues.
DBCC traceoff(1204)
DBCC traceoff(1222)
3. Enable Traces or Profiler so that the deadlock occurrence reason can be found
Runprofiler (2000)/profiler 90 (2005)
4. DBCC TRACEON(1204) – will write error to SQL Server Log`s
5. DBCC TRACEON (1222,-1)- will write error to XML file
6. Finding details through Profiler
Profilerlocksdeadlock chain deadlock graphsel batch completedsel
batch stared RPC completed.
Inform Application team that they have to run the query again so that you can
enable the trace and then find the reason for deadlock (if it occurs again).
Explain application team that DBA Team can troubleshoot only when
trace/profiler are enabled.
7. If trace 1204 is enabled information is written into SQL Server logs.
 SPID of both processes
Sp_who
sp_who2
select *From sys.sysprocess
 what queries they were running
dbcc inputbuffer(spid)
 For how long that deadlock occurred
By default 5 seconds detected the deadlock
 Which process was killed
Dead loc priorities
8. Finally once the information is handy work with Application team in
modifying/code enhancements in the queries used for the application.
9. Additional option is to set event "Deadlock Graph" under Locks segment in
Profiler and monitor the process, object, query and much more additional
information about the deadlock.
Profiler -locksdeadlock chaindeadlock Graph
10. Additional Points: DBA/App Team/Developers can control the deadlock priority
using SET DEADLOCK_PRIORITY [LOW|NORMAL|HIGH]
6. How is the instance performing
Configuration Tools >> SQL Server Configuration Manager >> SQL Server
Services, and check if SQL Server service status is “Running”.
7. How many logins/sessions are connected

SELECT login_name, count(session_id) as session_count

FROM sys.dm_exec_sessions GROUP BY login_name

8. What is the current load on the system


Open Task Manager, switch to Performance tab, you will find your entire four cores are
listed. 

1.    Run a single task; watch the changes of the CPU Usage History of every core. 
2.    You can find the load may switch between cores. 
3.    Switch to Processes tab, right-click the task’s process, chooses Set Affinity. You will
find all four cores are selected. 
4.    You can uncheck three cores, click Ok. 
5.    Switch back to Performance tab, check if the task load switches between cores. You
may close and rerun the task to watch the changes.

9. How is OS performing
10. What is the most resource consuming session

use master
go
EXEC sp_get_resource_most_consuming_spids

11. What is the scope of all the applications that are deployed to use the instance
12. OS monitoring tools (Perfmon)
13. Buffer Cache Hit Ratio means Buffer Cache has less space and most feasible solution can
be increasing memory on the system or increasing memory allocation or utilizing AWE
Instance prop-memory---awe
Monitor Tool display alert and complete information
14. Indexes, Fragmentation, Blocking, Locking, Deadlocks, AWE, Lock Pages in Memory,
Isolation Levels, Update Statistics, BCHR, Waits/Latches

1)Select *from sys.sysindexes


2)Sp_helpindex
3)DBCC SHOWCONTIG (‘tablename’, 1)-- 2000/2005
4)Select *from sys.dm_db_index_physical_sates (null, null, null, null, null)-
2008
5)Select *from sys.sysprocesses where blocked<>0
6)Sp_lock
7)Sp_updatestatics
8)AWE database prop memory

9) SET TRANSACTION ISOLATION LEVEL

     { READ UNCOMMITTED


     | READ COMMITTED
     | REPEATABLE READ
     | SNAPSHOT
     | SERIALIZABLE
     }
[;]

SET TRANSACTION ISOLATION LEVEL READ


UNCOMMITTED
GO
DBCC USEROPTIONS
GO
10) Deadlock traceon(1204/1222/1205)
SET DEADLOCK_PRIORITY

7. Tempdb full
1. Purging the old files
2. Increase the LOG file size or Enable Auto Growth (Make sure it’s not set to Maximum)
USE TEMPDB
GO
EXEC SP_HELPFILE
GO

To check the auto growth of tempdb we can use the above query
3. Add one more T-Log file from same drive or another drive
Databasepropfileadd
Alter database dbname add
file(name=’…’,filename=’…’,size=’..’,maxsize=’…’,filegrowth=’…’)
4. Shrink operation ( will never effect data loss)
Dbcc shrinkdb(‘tempdb’, ‘size’)
5. Request wintel team to add more space
Alter database dbname add
file(name=’…’,filename=’…’,size=’..’,maxsize=’…’,filegrowth=’…’)
6. Move LDF`s from one drive to another drive
Databasetaskdetach/attach
7. Find the transactions and kill after approval
Dbcc opentran
Select *from sys.sysprocess where dbid=2
8. Truncate (In critical situations only, we may have data loss)

Backup log tempdb to disk = “path” with TRUNCATE_ONLY

9. Final Option is Restart the instance


Instance - prop-restart

8. Log File full


1. Check the log file size by using DBCC sqlperf(logspace), we can increase log size up to
2TB
2. Purging the old files
3. Take a Log Backup
i. Backup log dbname to disk =’path’
4. Increase the LOG file size or Enable Auto Growth (Make sure it’s not set to Maximum)
5. Add one more T-Log file from same drive or another drive
6. Shrink the file
Use dbname
Go
DBCC shrinkfile (<transactionlogname>,1)
7. Request windows team to add more space
8. If the recovery model is Full change to Simple
9. Find the long running transactions and kill after approval
10. Move LDF from one drive to another drive which need instance restart
11. Final option is to Truncate (May have data loss)

9. Disk drive full


1. We will purge the old files
2. We will raise request to Wintel Team
10. Permission issues
1. Login Creation

If user needs windows Authentication then we will contact Wintel team for the same

2. User Creation
Analyze the user request and we will give the appropriate roles

11. Database Issues


1. Offline
i. ALTER DATABASE <DBNAME> SET ONLINE
ii. EXEC SP_RESET STATUS
iii. Before doing this make sure that we inform the DB Users that we
are going to work on it to make necessary troubleshooting steps.
iv. Reason can be found in SQL Server Logs why/how/who has taken
the database offline.

2. Suspect
3. User Unable to connect
4. DB Corrupt
5. Slow response from the DB when user connected
6. DB is in Restoring state
7. DB is Recovering State

12. SQL Server is running slow


1. Check number of connections
2. Check the processor usage not above 80% of utilization
3. Check the memory usage not above 40-45% of utilization
4. Check the Disk utilization using Perfmon
5. Use profiler to check for the users and current SQL activities and jobs running which
might be a problem
6. Finally run UPDATE_STATISTICS command to update the indexes

When do we use the UPDATE_STATISTICS command?

This command is basically used when we do a large processing of data. If we do a large


amount of deletions any modification or Bulk Copy into the tables, we need to basically
update the indexes to take these changes into account. UPDATE_STATISTICS updates
the indexes on these tables accordingly.
13. Slow running Queries
1. Slow network communication.
2. Inadequate memory in the server computer or not enough memory available for SQL
Server.
3. More Disk activity
4. Poor cache utilization
5. Locking/Blocking/Deadlock
6. Check whether indexes are created or not
7. For information we can check in Query-> Display estimated execution plan
8. Verify the I/O of the query
9. Lack of useful statistics
10. Verify scan density using DBCC SHOWCONTIG
11. If it is needed we can run DBCC UPDATE_STATISTICS

14. Application is running slow


1. Check with the application team from when it is running slow
2. Check my pinging the server
3. Check network latency (contacting with N/W admin)
4. Check improper responsiveness or OS related issue (Wintel team)
5. If nothing is found, we can ask app team, to verify whether the application is running
from other machine or not
6. Check for Blocking
7. Kill the process with approval

15. Sql server stopped

1. Ping the server and check the status


2. Check whether services are running well - services.msc
3. Make sure the TCP end points are configured properly
4. Firewall could be one of the reasons.
5. Check with the authentication & user privileges.
6. Restart the instance after confirming the Trace Flags.-t3608 (optional)
7. This can have many reasons and right reason can be found only when we look into Event
viewer and what has caused SQL Server down.

16. Log backup failed to complete


1. Recovery model might have toggled b/w t-log backups
2. Non - logged operations performed in DB
3. Redundant TLOG backup jobs on primary server
4. Mismatch of LSN - diff in FIRST LSN & LAST LSN

17. Maintenance plan issues


18. Agent Down

Troubleshooting Areas

Under Management -> Sql Server Logs - > ErrorLogs

1. Database Mail
2. Sql Agent
3. Sql Server
4. Windows NT (Event Viewer)

Under Management -> Activity Monitor -> Information about Locks will be present

Under Sql Server Agent -> Job Activity Monitor -> Information about all the jobs

Under Sql server Agent -> Error Logs - > same as Error logs under Management.

For Replication -> Replication – Right Click -> Launch Replication Monitor (Add Publisher)

For Mirroring -> Right Click on the database -> Tasks -> Launch database Mirroring Monitor

For Log shipping -> Right Click on the instance -> Reports -> Transaction Log Shipping Status

Note: From Replication monitor we can go to Database mirroring monitor directly by clicking on GO
option and from Database Mirroring monitor we can see Replication Monitor by clicking on GO

Event Viewer: For OS troubleshooting and SQL troubleshooting

Error Log: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG

You might also like