Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • TOP-N Sql to find Nth max or Top N rows Oracle
  • SQL Tracker by SID sqltrackerbysid.sql Oracle
  • Sequence Resetting Oracle
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • How to Use DBMS_STATS to Move Statistics to a Different Database Oracle
  • Jai Shree Ram Oracle
  • How to Make Trace Files Created by Oracle Readable by All Users ? Oracle
  • CTAS with LONG Column for 7.x and 8 and 8i Oracle
  • mutex in Oracle 10.2.0.2 or Oracle 10g Oracle
  • Remove duplicate rows from table Oracle
  • move_arch_files.ksh Linux/Unix
  • longtx.sql with the flag whether session is blocking any DML locks or not. Oracle
  • CPU speed on solaris Linux/Unix
  • v$event_name Oracle
  • find_idle_cpu.sql Oracle

refre.sql for multitenant

Posted on 01-Apr-2026 By Admin No Comments on refre.sql for multitenant
REM   Author  : Paresh Mehta (Modified)
REM   Purpose : Change the look of sql prompt with CON_NAME.

set echo off
set numwidth 9
set linesize 80
set pagesize 240
Set head off
set time on
set timing on

define _PVMUSRNM=""
define _PVMSID=0
define _PVMCON=""

column USERNAME new_value _PVMUSRNM;
column ses1 new_value _PVMSID;
column con1 new_value _PVMCON;

-- Retrieve session information
select username from user_users;
select trim(sid) as ses1 from v$mystat where rownum < 2;

-- Retrieve container name (available in Oracle 12c and later)
select sys_context('USERENV', 'CON_NAME') as con1 from dual;

-- Set the prompt: USER-SID-CONTAINER@IDENTIFIER
set SQLPROMPT '&_PVMUSRNM-&_PVMSID-&_PVMCON@&_CONNECT_IDENTIFIER:-> '

define _editor=vi
set head on
set echo on
set feedback 1

This will provide prompt with session details.

Oracle, SQL scripts

Post navigation

Previous Post: prepfiles.sh for step by step generating pending statistics files
Next Post: track_autoupgrade_copy_progress.sql

Related Posts

  • find_err.sql for finding errors from dba_errors. Oracle
  • Specify the Rollback segment to use in Transaction Oracle
  • V$transaction notes for finding XID composition. Oracle
  • SCRIPT TO LIST RECURSIVE DEPENDENCY BETWEEN OBJECTS UTLDTREE.sql Oracle
  • Good Oracle Architecture In Short and point to point Oracle
  • before_trunc.sql Before Truncate table needs to execute following: Oracle

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

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

Recent Posts

  • track_autoupgrade_copy_progress.sql01-Apr-2026
  • refre.sql for multitenant01-Apr-2026
  • prepfiles.sh for step by step generating pending statistics files10-Mar-2026
  • tracksqltime.sql05-Mar-2026
  • Complete Git Tutorial for Beginners25-Dec-2025
  • Postgres DB user and OS user.25-Dec-2025
  • 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

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Postgres DB user and OS user. POSTGRESQL
  • run this before doing any dbchange pvm_pre_change.sql Oracle
  • TRUNCATE Privs Oracle
  • Remove DOS CR/LFs (^M) Linux/Unix
  • RMAN : Consistent Backup, Restore and Recovery using RMAN Oracle
  • Oracle Statspack survival Guide Oracle
  • Oracle vs MYSQL Architecture differences (For DBAs) MYSQL
  • catall.sh Linux/Unix

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme