How to trace a running process?

Using strace one can trace the system calls being executed by a running process. To stop the strace press control-C To display the system calls being executed $ strace -p <pid> or To display a summary of system calls being executed $ strace -cfo <logfile> -p <pid> Example: In this example smon process was being…

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…

Check archiver is running on archivelog mode?

In 8i and 9i archiver process doesn’t automatically startup when database is archive log mode so using the SQL below one can verify if archiver is running on database that has archive log mode turned on. SQL> SELECT DECODE(d.log_mode, 'ARCHIVELOG', DECODE(i.archiver, 'STOPPED', 'Issue archiver not running on archivelog database', 'NoIssue archiver running on archivelog database'),…

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

Enable trace in a running session from PL/SQL or SQL*Plus

Using Oracle SID and SERIAL# can turn trace on/off a Oracle session that has already started. The values of SID and serial# can be obtained from GV$SESSION. This will create trace file in directory set by the parameter user_dump_dest. To find the SID and SERIAL# you want to debug you can query GV$session to query…