Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • Export With Query Another Example. Oracle
  • get_vmstat.ksh for Solaris Oracle
  • remove archfiles only when it is applied to DR rm_archfiles.sh Linux/Unix
  • Which environment is used by currently running process ( Very good) Linux/Unix
  • SQL_PLAN.sql for checking real execution plan Oracle
  • track_autoupgrade_copy_progress.sql Oracle
  • Find sort details from Db find_sort.sql Oracle
  • Unix command for system configuration Linux/Unix
  • Linux CPU info. Linux/Unix
  • currwaitobj.sql SQl_ID and SQL statement you can get from currwaitobj.sql Oracle
  • How to change hostname in Linux Linux/Unix
  • Disbaling DBA_SCHEDULER_JOBS Oracle
  • Creating never expiring DB user accounts in Oracle Oracle
  • pvm_metric.sql for gathering report from vmstat tables Oracle
  • Physical Standby switchover with session active 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

  • database trigger failing Oracle
  • Rownum with Order by Oracle
  • In Addition to previous note, following grants needed on PERFSTAT user. Oracle
  • usnsql.sql Displays information about UNDO segments with sql statements Oracle
  • oracle Dba site Oracle
  • Btee and Bitmap Plans in Oracle 9i and higher Oracle

Leave a Reply Cancel reply

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

Categories

  • AMC10 (0)
  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Django (0)
  • GIT (1)
  • Linux/Unix (150)
  • MYSQL (5)
  • Oracle (403)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (1)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (18)
  • rman-dataguard (26)
  • shell (151)
  • SQL scripts (349)
  • SQL Server (6)
  • Uncategorized (9)
  • Videos (0)

Recent Posts

  • Tutornet.US — Source of excellent learning14-Oct-2026
  • OCI Infrastructure Patching14-Oct-2026
  • Free API credits for AI models14-Oct-2026
  • AMC1020-Sep-2026
  • Key Management in Oracle: The Core Issue: Missing Master Key12-May-2026
  • SAT Mathematics 10 questions and answer at the end.30-Apr-2026
  • top 10 AI news today30-Apr-2026
  • runon_allpdbs_show_conname.sh23-Apr-2026
  • runon_allcdbs_find_pdbs.sh23-Apr-2026
  • Running PDB on single node in RAC09-Apr-2026

Archives

  • 2026
  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • export import with parameter file. Oracle
  • Good Oracle Architecture In Short and point to point Oracle
  • When to rebuld B-tree index Oracle
  • shr1.sql for MTS or Shared server configuration Oracle
  • DBMS_JOB all example Oracle
  • secure crt settings Linux/Unix
  • find the files that are 1 day old. Linux/Unix
  • kill all processes from specific user in solaris. Linux/Unix

Copyright © 2026 pvmehta.com.

Powered by PressBook News WordPress theme