Oracle : Setting up glogin.sql

Share via:

Setting up glogin.sql :

cd $ORACLE_HOME/sqlplus/admin
cp glogin.sql glogin.sql.bkp

vi glogin.sql
SET termout off
DEFINE myv = ‘Not connected’
COLUMN myc new_value myv
select user || ‘@QA@’ || global_name myc from global_name;
SET sqlprompt ‘&myv:SQL> ‘

Execution :

$ sqlplus scott/PW

SQL*Plus: Release 12.1.0.2.0 Production on Mon Mar 27 21:56:19 2017

Copyright (c) 1982, 2014, Oracle. All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 – 64bit Production
With the Partitioning, Automatic Storage Management, OLAP, Advanced Analytics
and Real Application Testing options

SCOTT@QA@ORCL1:SQL> set linesize 300
SCOTT@QA@ORCL1:SQL> select name||’ – ‘||instance_name||’@’||host_name||’ – ‘||DB_UNIQUE_NAME||’ – ‘||version||’ – ‘||open_mode||’ – ‘||to_char(startup_time,’DD-MON-YYYY HH24:MI:SS’) || ‘ – ‘|| database_role
from v$database, v$instance;

NAME||’-‘||INSTANCE_NAME||’@’||HOST_NAME||’-‘||DB_UNIQUE_NAME||’-‘||VERSION||’-‘||OPEN_MODE||’-‘||TO_CHAR(STARTUP_TIME,’DD-MON-YYYYHH24:MI:SS’)||’-‘||DATABASE_ROLE
——————————————————————————————————————————————————————–
ORCL1 – ORCL1@server123 – ORCL1 – 12.1.0.2.0 – READ WRITE – 11-MAR-2017 12:32:06 – PRIMARY

SCOTT@QA@ORCL1:SQL>

 

Share via:
Note: Please test scripts in Non Prod before trying in Production.
1 Star2 Stars3 Stars4 Stars5 Stars (22 votes, average: 5.00 out of 5)
Loading...

5 thoughts on “Oracle : Setting up glogin.sql

Add Comment