Identify and Resolve Concurrency Problems Flashcards

1
Q

What is Live Locking?

A

Shared locks prevent another process from acquiring exclusive locks (but one process wins, then the next process wins)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is Deadlocking?

A

Two processes compete for the same resource

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is Blocking?

A

The second connection is blocked

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How is a deadlock resolved?

A

One transaction is decided to be the “victim” by the server and is cancelled which opens up the resource.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How can we see where the deadlocks are occurring?

A

EXEC SP_WHO2

Column BLKBY shows who the process is being blocked by.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What is the System DM view that shows system locking?

A

sys.dm_tran_locks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is the system DM that shows what queries a user is running and the wait_type that is occuring?

A

sys.dm_exec_requests

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How do you see history of deadlocking?

A
Turn on Trace Flags using: 
DBCC traceon(1204, -1)
DBCC traceon(1222, -1)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

When do the settings for trace files get turned off?

A

If you manually run the DBCC command to shut it off or when you reboot the server.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How would you get SQL Server to automatically start up trace files when you reboot?

A

Go into SQL Server Configuration Manager
Right click the instance and go to Properties and then go to Startup Parameters

In the startup parameter type: -T1204 or -T1222

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you see the trace log?

A

Management -> SQL Server Logs

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What affects SQL Server Performance?

A
CPU
Memory
File I/O
Blocking, Deadlocking, Locking
Long queries/Stored Procedures
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is the system DM view that shows CPU usage?

A

sys.dm_os_schedulers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does Current_Workers_count mean in sys.dm_os_schedulers?

A

The number of workers associated with each scheduler.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What does Work_Queue_count mean in sys.dm_os_schedulers?

A

the number of tasks waiting to be run. A high number here means that the disk is being overworked.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What does Pending_Disk_io_count mean in sys.dm_os_schedulers?

A

Disk activity waiting to be completed.

17
Q

What is the system DM view that shows the Buffer Pool / data cache?

A

sys.dm_os_buffer_descriptors

18
Q

How would you get cache in MB using sys.dm_os_buffer_descriptors?

A

select count(database_id)*8 / 1024.0 as [Cache in Mb], database_id
from sys.dm_os_buffer_descriptors
group by database_id

19
Q

What is the DM view you would use for Memory Issues?

A

sys.sysperfinfo

20
Q

How would you use sys.sysperfinfo to monitor memory issues?

A

select * from sys.sysperfinfo
where object_name like ‘SQLServer:Buffer Manager%’
order by counter_name

Look at Pages and Target pages and make sure that those values don’t change over time.

Buffer cache hit ratio shows the amount of times cache was able to retrieve values. The higher the better.

Page Life Expectancy shows how long a page is active. Anything under 5 minutes in a Prod system can show issues.

21
Q

What tool gives you information about processes that were blocked and how deadlocks are resolved by Sql Server?

A

SQL Server Profiler Trace

22
Q

Which tool monitors SQL Server instances over long periods of time (IE to find the most resource consuming queries?

A

Performance Monitor Data Collector Set

23
Q

What tool displays information about SQL Server processes and how these processes affect the current instance of SQL Server?

A

Activity Monitor. This tool does not support saving monitoring information

24
Q

What tool enables users to collect as much or as little data as is necessary to troubleshoot or identify a performance problem but requires extra development and setup?

A

Extended Events

25
Q

Why would you use DELAYED_DURABILITY = ON (in WITH statement within Update transaction)?

A

This will allow memory optimized data to delay the writes to the transaction log by writing to the log asynchronously and as a batch

26
Q

How do you allow a database to use DELAYED_DURABILITY?

A

SET DELAYED_DURABILITY = ON

27
Q

How can you change statement-terminating errors into batch terminating errors?

A

SET XACT_ABORT ON