Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Difference between SYNC and AFFIRM Oracle
  • ORA-00064: object is too large to allocate on this O/S during startup Oracle
  • set_env_dba Linux/Unix
  • Handling LOB data in Oracle Oracle
  • RMAN : Consistent Backup, Restore and Recovery using RMAN Oracle
  • EXTPROC Oracle
  • DETERMINING WHICH INSTANCE OWNS WHICH SHARED MEMORY & SEMAPHORE SEGMENTS Oracle
  • Export Import with QUERY Oracle
  • grep multuple patterns Linux/Unix
  • process id based files and processes Linux/Unix
  • Find sort details from Db find_sort.sql Oracle
  • How to find password change date for user Oracle
  • Finding Oracle Patches with opatch Oracle
  • Is It Recommended To Apply Patch Bundles When PSU Is Available? -ID 743554.1 Oracle
  • Oracle Internal Good Websites 1 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

  • 272332.1 CRS 10g Diagnostic Collection Guide Oracle
  • Goldengate Tutorial Oracle
  • Query to Generate aggregate on every 30 mins. Oracle
  • Histogram information Oracle
  • RMAN : Consistent Backup, Restore and Recovery using RMAN Oracle
  • ext#.sql 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 (402)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (150)
  • SQL scripts (350)
  • SQL Server (6)
  • Uncategorized (3)
  • Videos (0)

Recent Posts

  • runon_allpdbs_show_conname.sh23-Apr-2026
  • runon_allcdbs_find_pdbs.sql23-Apr-2026
  • Running PDB on single node in RAC09-Apr-2026
  • find_arc.sql09-Apr-2026
  • pvm_pre_change.sql08-Apr-2026
  • find_encr_wallet.sql08-Apr-2026
  • find_pdbs.sql08-Apr-2026
  • Creating a Container Database using dbaascli08-Apr-2026
  • track_autoupgrade_copy_progress.sql01-Apr-2026
  • refre.sql for multitenant01-Apr-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • tuning commmand for cpu, ip and memory stats Linux/Unix
  • Drop all SPM baselines for SQL handle Oracle
  • prepfiles.sh for step by step generating pending statistics files Oracle
  • online_ts_bkup.sql Oracle
  • True Session Wait Activity in Oracle 10g Verygood Oracle
  • Process Map for CPU and Memory for OS processes Linux/Unix
  • DBMS_Shared_pool pinning triggers Oracle
  • Some useful Unix Commands Linux/Unix

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme