Monitor the operation of database things

Source: Internet
Author: User

SELECT DBT. database_id, Db_name (DBT). database_id) ' database name ', DBT. transaction_id, At.name, at. Transaction_begin_time, case at.             Transaction_type when 1 Then ' read/write Transaction ' When 2 Then ' read-only transaction ' when 3 Then ' system transaction ' When 4 Then ' Distributed transaction ' END ' transaction type ', case at. Transaction_state when 0 Then ' transaction has not been fully initialized ' when 1 Then ' transaction has been initialized but not started ' when 2 Then ' transaction is live State ' when 3 then ' transaction has ended. This state is used for read-only transactions ' when 4 then ' has initiated a commit process to a distributed transaction ' when 5 Then ' transaction is in a ready state and waits for parsing ' when 6 then ' transaction has been raised Turn ' when 7 then ' transaction is being rolled back ' when 8 then ' transaction rolled back ' END ' transaction state ', ST. session_id, TT. TEXT as ' recently executed statement ', ES. Program_name from SYS. Dm_tran_database_transactions dbtleft JOIN SYS. Dm_tran_active_transactions at on DBT. transaction_id = at. Transaction_idleft JOIN SYS. Dm_tran_session_tRansactions ST on. transaction_id = ST. Transaction_idleft JOIN SYS. Dm_exec_sessions ES on ST. session_id = ES. Session_idleft JOIN SYS. Dm_exec_connections EC on ES. session_id = EC. Session_idouter APPLY SYS. Dm_exec_sql_text (EC. Most_recent_sql_handle) Ttwhere ST. session_id >= database_id <> 32767

Monitor the operation of database things

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.