Oracle Database 12c New Features

Using glogin.sql to have friendly and nice SQLPLUS multitenancy environment

When we are working at multitenancy it is good to have glogin configured to show container info. I am having following glogin.sql.

You can find the glogin.sql file in $ORACLE_HOME/sqlplus/admin


column id_plus_exp format 990 heading i
column parent_id_plus_exp format 990 heading p
column plan_plus_exp format a60
column object_node_plus_exp format a8
column other_tag_plus_exp format a29
column other_plus_exp format a44
define _editor=notepad
--define _editor=vi
set serveroutput on size 1000000
set trimspool on
set long 5000
set linesize 100
set pagesize 9999
column plan_plus_exp format a80
column global_name new_value gname
set termout off
define gname=idle
column global_name new_value gname
select lower(user) || '@' || substr(global_name, 1,
decode( dot, 0,
length(global_name), dot-1)
) || '->'|| host_name global_name
from (select global_name, instr(global_name,'.') dot from global_name)
,v$instance;
set sqlprompt '&gname> '
set termout on

For unix or linux you need to change the define_editor
define_editor=notepad

to
define_editor=vi
The sample like following

C:\>sqlplus system/oracle@pdb2

SQL*Plus: Release 12.1.0.1.0 Production on Tue Dec 17 15:40:38 2013

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

Last Successful login time: Tue Dec 17 2013 15:32:59 +08:00

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

system@PDB2->ora12cn1>