Tag: executing

How to find SQL running for a user/sid?

Using the SQL below in which joining with V$session and V$sqlarea one can find the SQL currently running. In this example using a session id one can find the SQL running SQL> select a.sid, a.serial#, b.sql_text from v$session a, v$sqlarea b where a.sql_address=b.address and a.sid = 257; SID SERIAL# ---------- ---------- SQL_TEXT -------------------------------------------------------------------------------- 257 8885 … Continue reading How to find SQL running for a user/sid?

How to monitor jobs that are running on SQLServer through SQLServer Agent?

By calling msdb..sp_get_composite_job_info or msdb.dbo.sp_help_job one can find the current jobs running on SQLServer. Example: exec msdb..sp_get_composite_job_info @execution_status=1 Or exec msdb.dbo.sp_help_job @execution_status = 1 Sample output: job_id originating_server name ------------------------------------ ------------------------------ --------------------- 7E043796-44F3-4ABF-A047-AA27691DF674 sqlserver01 job_name

How to find DDL lock on objects?

The following example shows how to find lock on a store procedure, the following store procedure has infinite loop.  A store-procedure is locked when it's running that it can't be modified/recompiled when it's executing. Window 1) SQL> create or replace procedure p as begin while true loop null; end loop; end; / SQL> exec p; … Continue reading How to find DDL lock on objects?