Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 2

Setup glogin.

sql in Oracle
Let's take you want to execute some sql commands every time you login to SQL*PLUS. It
would be so hard to run those commands manually whenever you start SQL*PLUS. With
glogin.sql you can specify the commands you want to run every time you invoke
SQL*PLUS.

Any query, script, parameter, PL/SQL code etc, you can simply put under glogin.sql file
and SQL*PLUS will first execute glogin.sql before allowing you to query database.

I would like to display below message every time a user logs into the database

Open the glogin.sql file

vi $ORACLE_HOME/sqlplus/admin/glogin.sql

Put below query at the end of the file

select 'Welcome, you are connected to '||name||' database' "Hello" from


v$database;

En ambientes de producción usamos esta


leyenda.
select 'Bienvenido, estas conectado a database: '||V.name || ',
servidor:'|| upper(t."HOST_NAME") "CUIDADO--[BD DE PRODUCCION]"
from v$instance t,v$database v;

En ambientes de desarrollo usamos esta


leyenda.
select 'Bienvenido, estas conectado a database: '||V.name || ',
servidor:'|| upper(t."HOST_NAME") "AMBIENTE--[BD DE DESARROLLO]"
from v$instance t,v$database v;

You might also like