Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Default User Profile Oracle
  • SAN Linux/Unix
  • This is from Temi Oracle
  • Oracle Identifiers Oracle
  • DBMS_UTILITY PACKAGE Oracle
  • Flowers Resize datafiles Oracle
  • Good RAC & Standby Notes Oracle
  • OEM-Commnds Oracle
  • get_aix_vmstat.ksh Oracle
  • Pending Distributed Transations Oracle
  • oracle Dba site Oracle
  • Move WordPress site from one hosting service to other. PHP/MYSQL/Wordpress
  • Some OS level threshold for performance. Linux/Unix
  • Kernel Parameters for Solaris Linux/Unix
  • Find total file sizes Linux/Unix

Category: SQL scripts

perf_today.sql

Posted on 10-May-2008 By Admin No Comments on perf_today.sql

column start_dt format a20 column start_dt1 format a20 set lines 120 pages 300 select to_char(start_date, ‘DD-MON-RRRR:HH24:MI’) start_dt, user_cpu, system_cpu, idle_cpu, wait_cpu from STATS$VMSTAT2 where start_date > trunc(sysdate) order by start_date; select to_char(measured_date, ‘DD-MON-RRRR:HH24:MI’) start_dt, total_users, Active_users from STATS$TOTALUSERS where measured_date > trunc(sysdate) order by measured_date; select to_char(start_date, ‘DD-MON-RRRR:HH24:MI’) start_dt1, system_sessions, active_users, inactive_users, dedicated_servers, user_sessions, transactions…

Read More “perf_today.sql” »

Oracle, SQL scripts

pvm_rbs1.sql (to collect rbs info from db)

Posted on 10-May-2008 By Admin No Comments on pvm_rbs1.sql (to collect rbs info from db)

select segment_name, status from dba_rollback_segs order by status, segment_name; select status, count(1) from dba_rollback_segs group by status;

Oracle, SQL scripts

Find sort details from Db find_sort.sql

Posted on 10-May-2008 By Admin No Comments on Find sort details from Db find_sort.sql

select sql_text,(executions-sorts) “Diff” from v$sqlarea where (executions-sorts) < 20 and executions > 100 order by 2 ; SELECT S.sid || ‘,’ || S.serial# sid_serial, S.username, T.blocks * TBS.block_size / 1024 / 1024 mb_used, T.tablespace, T.sqladdr address, Q.hash_value, Q.sql_text FROM v$sort_usage T, v$session S, v$sqlarea Q, dba_tablespaces TBS WHERE T.session_addr = S.saddr AND T.sqladdr = Q.address…

Read More “Find sort details from Db find_sort.sql” »

Oracle, SQL scripts

temp_use.sql diplays usage of temp ts

Posted on 10-May-2008 By Admin No Comments on temp_use.sql diplays usage of temp ts

SELECT b.TABLESPACE, b.segfile#, b.segblk#, b.blocks, a.SID, a.serial#, a.username, a.osuser, a.status, c.sql_text FROM v$session a, v$sort_usage b, v$sqlarea c WHERE a.saddr = b.session_addr AND a.SQL_HASH_VALUE = c.HASH_VALUE ORDER BY b.TABLESPACE, b.segfile#, b.segblk#, b.blocks / set pagesize 10000 set linesize 133 column tablespace format a15 heading ‘Tablespace Name’ column segfile# format 9,999 heading ‘File|ID’ column segblk# format…

Read More “temp_use.sql diplays usage of temp ts” »

Oracle, SQL scripts

get_ratio.sql get the ratio of users from v$session and this uses CASE-WHEN-THEN clause

Posted on 10-May-2008 By Admin No Comments on get_ratio.sql get the ratio of users from v$session and this uses CASE-WHEN-THEN clause

set time on set timing on set verify off select to_char(sysdate, ‘DD-MON-RRRR:HH24:MI’) from dual; prompt ‘Total distinct users and total user sessions’ select count(distinct username), count(1), round(count(1)/count(distinct username),1 ) from v$session where username is not null; prompt ‘Total terminal server distinct users and total user sessions’ select count(distinct username), count(1), round(count(1)/count(distinct username),1 ) from v$session…

Read More “get_ratio.sql get the ratio of users from v$session and this uses CASE-WHEN-THEN clause” »

Oracle, SQL scripts

pvm_metric.sql for gathering report from vmstat tables

Posted on 10-May-2008 By Admin No Comments on pvm_metric.sql for gathering report from vmstat tables

col AVG_ACTIVE_USR format 999999.99 col AVG_TOT_USR format 9999.99 col AVG_USR_CPU format 9999.99 col AVG_SYS_CPU format 99.99 col AVG_IDLE_CPU format 99.99 col AVG_WAIT_CPU format 99.99 col TOT_ODR format 99999999 col AVG_ACT_USR format 999999.99 col RUNQ format 999.99 col CSW format 99999.99 set lines 120 pages 2000 accept start1 prompt ‘Enter Start Dare in DD-MON-RRRR:HH24:MI format :…

Read More “pvm_metric.sql for gathering report from vmstat tables” »

Oracle, SQL scripts

ORA-4031 issue and solution on 09-MAY-2008

Posted on 10-May-2008 By Admin No Comments on ORA-4031 issue and solution on 09-MAY-2008

++++++++++++++++++++ Problem description ++++++++++++++++++++ Some users started getting ORA-4031. This is the eror that show following: 4031, 00000, “unable to allocate %s bytes of shared memory (“%s”,”%s”,”%s”,”%s”)” ++++++++++++++++++++++ Problem solution ++++++++++++++++++++++ We ran following query and found failues that may result into 4031. set echo off verify off set lines 120 pages 555 /* V$SHARED_POOL_RESERVED_SIZE…

Read More “ORA-4031 issue and solution on 09-MAY-2008” »

Oracle, SQL scripts

How to calculate PROCESSES parameter

Posted on 09-May-2008 By Admin No Comments on How to calculate PROCESSES parameter

SEMMSL Set to 10 plus the largest initsid.ora PROCESSES parameter of an Oracle database on the system. The PROCESSES parameter can be found in each initsid.ora file, loc ORACLE_HOME/dbs directory. The default value of PROCESSES for the 8.1.5 prebuilt database is 50. SEMMNS Set to the sum of the PROCESSES parameter for each Oracle database…

Read More “How to calculate PROCESSES parameter” »

Oracle, SQL scripts

How to set Processes Parameter

Posted on 09-May-2008 By Admin No Comments on How to set Processes Parameter

The only drawback in setting the processes value high is that the corresponding kernel settings, SEMMNS and SEMMSL need to be set higher based on the following formulas: SEMMSL – Set to 10 plus the largest PROCESSES parameter of any Oracle database on the system. SEMMNS – Set to the sum of the PROCESSES parameter…

Read More “How to set Processes Parameter” »

Oracle, SQL scripts

Explain Plan Doesn’T Change For Sql After New Statistics Generated

Posted on 06-May-2008 By Admin No Comments on Explain Plan Doesn’T Change For Sql After New Statistics Generated

If you use dbms_stats in 10g it will not automatically invalidate dependant cursors. This is the default behaviour as of 10. To revert to older previous behaviour you will have to set the parameter no_invalidate to false. . no_invalidate Does not invalidate the dependent cursors if set to TRUE. The procedure invalidates the dependent cursors…

Read More “Explain Plan Doesn’T Change For Sql After New Statistics Generated” »

Oracle, SQL scripts

Posts pagination

Previous 1 … 12 13 14 … 35 Next

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (393)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (342)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • Trace a SQL session from another session using ORADEBUG30-Sep-2025
  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025
  • V$INSTANCE of Oracle in MYSQL24-Jul-2025
  • Day to day MYSQL DBA operations (Compared with Oracle DBA)24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • In Addition to previous note, following grants needed on PERFSTAT user. Oracle
  • PLSQL Table Syntax 1 Oracle
  • avail.sh ( find filesystem spae usage) Linux/Unix
  • chk_space_SID.ksh Linux/Unix
  • pvm_metric.sql for gathering report from vmstat tables Oracle
  • telnet listening Linux/Unix
  • Day to day MYSQL DBA operations (Compared with Oracle DBA) MYSQL
  • dbms_job.submit example Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme