Posts

Showing posts from August, 2023

Useful Scripts to finding Query timings from AWR report and Memory

Below query collecting data from AWR report. Copy SET LINES 155 COL execs FOR 999,999,999 COL avg_etime FOR 999,999.999 COL avg_lio FOR 999,999,999.9 COL begin_interval_time FOR a30 COL node FOR 99999 BREAK ON plan_hash_value ON startup_time SKIP 1 SELECT ss.snap_id, ss.instance_number node, begin_interval_time, sql_id, plan_hash_value, NVL(executions_delta, 0) execs, (elapsed_time_delta / DECODE(NVL(executions_delta, 0), 0, 1, executions_delta)) / 1000000 avg_etime, (buffer_gets_delta / DECODE(NVL(buffer_gets_delta, 0), 0, 1, executions_delta)) avg_lio FROM DBA_HIST_SQLSTAT S, DBA_HIST_SNAPSHOT SS WHERE ss.snap_id = S.snap_id AND ss.instance_number = S.instance_number AND sql_id = ' ' AND executions_delta > 0 ORDER BY 1, 2, 3 /  Below query use to (.sql) file Copy SET ECHO OFF SET VERIFY OFF SET FEEDBACK OFF SET HEADING ON SET TIMING OFF UNDEF sql_id PROMPT "SQL...

Frequently Used Linux Commands for System & Oracle DBA Operations

As an Oracle DBA or Linux system administrator, we frequently perform operational tasks such as checking port usage, cleaning old files, troubleshooting network issues, and monitoring disk space. This post documents commonly used Linux commands that are extremely helpful in day-to-day DBA activities , along with examples for better understanding. 1. How to Check Port Availability Using lsof This command identifies which process is using a specific TCP port. lsof - i tcp: 8031 Sample Output: java 24567 oracle 123u IPv4 987654 TCP *: 8031 (LISTEN) Using netstat This command displays active network connections and listening ports. netstat -putan | grep 8031 netstat -an |grep <Port_Number> Sample Output: tcp 0 0 0.0.0.0:8031 0.0.0.0 :* LISTEN 24567 /java 2. Renaming Multiple Characters in a File This method is useful when you want to replace a specific word throughout a file. Syntax perl - pi -e 's/OLD_VALUE/NEW_VALUE/g' <FILE_N...