[MSSQL] 실행 쿼리 이력 조회
admin 계정으로 실행. SELECT TOP 1000 DB_NAME(ST.DBID) DBNAME , OBJECT_SCHEMA_NAME(OBJECTID, ST.DBID) SCHEMANAME , OBJECT_NAME(OBJECTID, ST.DBID) SPNAME , TEXT , QS.last_worker_time , QS.execution_count , CREATION_TIME , LAST_EXECUTION_TIME , QS.max_worker_time , QS.min_worker_time , QS.total_worker_time , QS.TOTAL_ELAPSED_TIME FROM SYS.DM_EXEC_QUERY_STATS QS CROSS APPLY SYS.DM_EXEC_SQL_TEXT(QS.plan_ha..
2023. 7. 5.
[MSSQL] 테이블 정보 조회
SELECT A.TABLE_NAME AS 테이블명 , C.VALUE AS 테이블코멘트 , A.COLUMN_NAME AS 컬럼ID , A.COLUMN_NAME AS 컬럼명 , A.DATA_TYPE AS 데이터타입 , CASE A.DATA_TYPE WHEN 'varchar' THEN CONVERT(VARCHAR(10), A.CHARACTER_MAXIMUM_LENGTH) WHEN 'numeric' THEN CONVERT(VARCHAR(10), A.NUMERIC_PRECISION) + ',' + CONVERT(VARCHAR(10), A.NUMERIC_SCALE) END 길이 , CASE WHEN A.COLUMN_NAME = ISNULL(E.COLUMN_NAME, '') AND D.CONSTRAINT_TYPE =..
2023. 3. 10.
[오라클] 락 정보 조회 쿼리 및 락 세션 KILL
1. 락 정보 조회 쿼리 1.1 SQL 정보 제외 SELECT VLO.OBJECT_ID , VLO.SESSION_ID , VS.SERIAL# , VLO.SESSION_ID || ',' || VS.SERIAL# AS LOCK_ID , VLO.ORACLE_USERNAME , VLO.OS_USER_NAME , DO.OBJECT_NAME , VS.PROGRAM , VS.STATE , VS.STATIS , DO.OBJECT_TYPE , DECODE(VLO.LOCKED_MODE, 1,'NULL', 2,'ROW-SHARE', 3,'ROW-EXCLUSIVE', 4,'SHARE', 5,'SHARE-ROW-EXCLU', 6,'EXCLU') AS LOCK_MODE , VS.SQL_ID FROM V$LOCKED_OBJECT ..
2023. 3. 7.