Updated on 2025-10-28 GMT+08:00

Locks and Transactions

RDS for SQL Server is a popular relational database management system with powerful deadlock detection functions. If there are two or more processes accessing the same resource at the same time, a deadlock may occur because the processes are waiting for each other to release the resource and cannot continue running. In this case, Microsoft SQL Server kills one of the processes so that the other processes can complete their transactions.

To solve this problem, DAS provides the Deadlocks page. On this page, you can quickly locate various types of deadlocks in your instance. The Details area displays information such as transaction start time, session ID, locked resource details, and deadlock mode, helping you locate and optimize problematic SQL statements and other exceptions.

Procedure

  1. Log in to the Huawei Cloud console.
  2. Click in the upper left corner and select a region and project.
  3. Click in the upper left corner, and under Databases, click Data Admin Service.
  4. In the navigation pane, choose Intelligent O&M > Instance List.

    Alternatively, on the Overview page, click Go to Intelligent O&M.

  5. In the upper right corner of the Instance List page, search for instances by engine type, instance name, or instance IP address.
  6. Locate the target instance and click Details.
  7. Choose Locks and Transactions.

    • Deadlocks

      Select a period (last 1 day, last 1 week, last 2 weeks, last 1 month, or a custom period) to view the deadlocks. The custom period cannot exceed three days.

    • Deadlocks over time

      You can view deadlocks over time within a specified period.

      Table 1 Parameter description

      Parameter

      Description

      Total

      Total number of deadlocks.

      Key Lock

      Number of index-related deadlocks.

      Object Lock

      Number of object-related deadlocks.

      Rid Lock

      Number of row deadlocks.

      Page Lock

      Number of page deadlocks.

      Compile Lock

      Number of compilation deadlocks.

      • Details

        On the Deadlocks page, you can select a period to view deadlock details, including LastTranStarted, SPID, isVictim, Database, LogUsed, LockMode, WaitResourceDesc, ObjectOwned, ObjectRequested, WaitResource, HostName, LoginName, Status, ClientApp, SQL, DataBase, and Operation.

        To view the deadlock relationship diagram, click Deadlock Diagram in the Operation column. In the displayed dialog box, you can click Download to download the diagram.

        The downloaded deadlock diagram is an XDL file. You can open and check it using the SQL Server Management Studio (SSMS) client.

        Table 2 Parameter description

        Parameter

        Description

        LastTranStarted

        Start time of the transaction.

        SPID

        ID of the session that starts the transaction.

        isVictim

        Whether the session is killed.

        Database

        Name of the database where the transaction is executed.

        LogUsed

        Size of a log generated for a session. The unit is byte.

        LockMode

        Lock mode.

        WaitResourceDesc

        Details of the resource that the transaction is waiting for.

        ObjectOwned

        Locked object.

        ObjectRequested

        Object that the transaction requests to lock.

        WaitResource

        Resource that the transaction is waiting for.

        HostName

        Name of the host on which the transaction is run.

        LoginName

        Username of the account that is used to run the transaction.

        Status

        Transaction status.

        ClientApp

        Name of the client that initiates the transaction.

        SQL

        SQL statement details.

        Operation

        You can view the deadlock diagram.