Which locks are acquired during database restore

Chaitanya Kiran 656 Reputation points

Which lock does SQL Server place during database restore

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
11,632 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Bruce (SqlWork.com) 49,051 Reputation points

    none really, the database is basically in single user mode, only the restore has access.

    0 comments No comments

  2. Erland Sommarskog 93,131 Reputation points

    Open a query window. Noe the spid in the status bar. Start a restore of a database of some size (so that the restore complete directly).

    In a second window run, while the restore is running:

    SELECT * FROM sys.dm_tran_locks WHERE request_session_id = <spid in restore window>

    This will display the locks taken for the RESTORE.