블로그 이미지
bedbmsguru

Notice

Recent Post

Recent Comment

Recent Trackback

Archive

calendar

1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28
  • total
  • today
  • yesterday
2018. 10. 26. 21:47 SQL SERVER


2Active 클러스터환경
  1. SQL SERVER 설치파일준비 (서비스팩 삭제도중에 필요함)
  2. 클러스터 노드 STANDBY로 이동 
  3. appwiz.cpl의 설치된 업데이트에서 SQL SERVER 서비스팩 제거
  4. INSTANCE를 모두 반대편 NODE로 이동
  5. appwiz.cpl의 설치된 업데이트에서 SQL SERVER 서비스팩 제거
  6. Instance를 각각 노드로 재배치

posted by bedbmsguru
2018. 10. 26. 21:46 SQL SERVER

-- Purpose: Report active transactions by space or duration.-- Author: I. Stirk.

-- Do not lock anything, and do not get held up by any locks.SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED

-- What SQL statements are currently using the transaction logs?SELECT tst.session_id
  , es.original_login_name
  , DB_NAME(tdt.database_id) AS DatabaseName
  , DATEDIFF(SECOND, tat.transaction_begin_time, GETDATE()) AS [TransDuration(s)]
  , tdt.database_transaction_log_record_count AS SpaceUsed
  , CASE tat.transaction_state
      WHEN 0 THEN 'The transaction has not been completely initialized yet'
      WHEN 1 THEN 'The transaction has been initialized but has not started'
      WHEN 2 THEN 'The transaction is active'
      WHEN 3 THEN 'The transaction has ended'
      WHEN 4 THEN 'The commit process has been initiated on the distributed tran'
      WHEN 5 THEN 'The transaction is in a prepared state and waiting resolution'
      WHEN 6 THEN 'The transaction has been committed'
      WHEN 7 THEN 'The transaction is being rolled back'
      WHEN 8 THEN 'The transaction has been rolled back'
      ELSE 'Unknown'
  END AS TransactionState
  , SUBSTRING(TXT.text, ( er.statement_start_offset / 2 ) + 1,
       ( ( CASE WHEN er.statement_end_offset = -1
                     THEN LEN(CONVERT(NVARCHAR(MAX), TXT.text)) * 2
                     ELSE er.statement_end_offset
              END - er.statement_start_offset ) / 2 ) + 1) AS CurrentQuery
  , TXT.text AS ParentQuery
  , es.host_name
  , CASE tat.transaction_type
      WHEN 1 THEN 'Read/Write Transaction'
      WHEN 2 THEN 'Read-Only Transaction'
      WHEN 3 THEN 'System Transaction'
              WHEN 4 THEN 'Distributed Transaction'
              ELSE 'Unknown'
  END AS TransactionType
  , tat.transaction_begin_time AS StartTime
FROM sys.dm_tran_session_transactions AS tst
       INNER JOIN sys.dm_tran_active_transactions AS tat
              ON tst.transaction_id = tat.transaction_id
       INNER JOIN sys.dm_tran_database_transactions AS tdt
              ON tst.transaction_id = tdt.transaction_id
       INNER JOIN sys.dm_exec_sessions es
              ON tst.session_id = es.session_id
       INNER JOIN sys.dm_exec_requests er
              ON tst.session_id = er.session_id
       CROSS APPLY sys.dm_exec_sql_text(er.sql_handle) TXT
--ORDER BY tdt.database_transaction_log_record_count DESC -- log space size.ORDER BY [TransDuration(s)] DESC -- transaction duration.

posted by bedbmsguru
2018. 10. 26. 21:44 SQL SERVER

Select the data in excel and press Ctrl + C
  1. Select the data in Excel and press Ctrl + C
  2. In SQL Server Management Studio right click the table and choose Edit Top 200 Rows
  3. Scroll to the bottom and select the entire empty row by clicking on the row header
  4. Paste the data by pressing Ctrl + V

'SQL SERVER' 카테고리의 다른 글

서비스팩(SERVICE PACK) 제거  (0) 2018.10.26
현재 Transaction Log를 사용중인쿼리 확인  (0) 2018.10.26
최근에 수정된 Object찾기  (0) 2018.10.26
user가 가지고 있는 권한 확인  (0) 2018.10.26
Linked server List  (0) 2018.10.26
posted by bedbmsguru