Rediscover Oracle's Beauty Glogin.sql
When we first came into contact with Oracle, sometimes when you landed in a production environment, the following situation often occurred:
[Email protected] app]$ Sqlplus/as SYSDBA
Sql*plus:release 11.2.0.4.0 Production on Thu 15 03:17:34 2014
Copyright (c) 1982, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-64bit Production
With the partitioning, OLAP, Data Mining and Real application testing options
Sp2-0103:nothing in SQL buffer to run.
Session altered.
elapsed:00:00:00.00
[email protected] (>)
----->>> above will show you which user logged in, the instance name of the login database, and the time log of the operation and other information. In fact, this can also improve the user's vigilance, always remind themselves to be
What user performs the operation, should be careful, do not produce misoperation. In fact, this definition is very simple, as long as you carefully read the Oracle Official document people will know how to set up。 Here's where the official documents are
I use the official documents of the 11.2.0.4, but the location is the same.
Database Administration
--->>>unix and Windows Database administration
--->>>administrator ' s Reference for Linux and unix-based Operating Systems
--- >>>4 administering Sql*plus
This is the Sqlplus setup file with two,one is in $oracle_home/sqlplus/admin/glogin.sql .
This is calledSite profile File, every time you go in with Sqlplus, Sqlplus will first read the file, so if you want to set it globally so that all users who log in to the database can use it, the definition here is OK.
There's another one calledUser profile File, as the name implies, is an individual profile file, which can be defined asLogin.sql, in fact, this place can be, he will traverse your current directory of the file to see if there is no login.sql, if there is, will read and set, and then overwrite the glogin.sql inside the things. My personal habits are placed under my login user's home directory, directly under the home directory to define a login.sql, write on the I like to set some of the SQL variables, in line with my personal requirements. For the sake of personalization and safety, I personally recommend defining your own system variables in your home directory. Here are my variable settings for your reference:
[Email protected] ~]$ pwd
/home/oracle
[email protected] ~]$ cat Login.sql
Define _editor=vi
Set serveroutput on size 1000000
Set Trimspool on
Set timing on
Set Long 5000
Set PageSize 5000
Set Linesize 1024
Column Plan_plus_exp format A80
Column Global_name New_value gname
Alter session set nls_date_format= ' Yyyy-mm-dd hh24:mi:ss ';
Set Termout off
Define Gname=idle
Column Global_name New_value gname
Select lower (user) | | ' @ ' | | Lower (instance_name) | | ' (' | | (select distinct SID from V$mystat) | | ') ' Global_name from V$instance;
Set Sqlprompt ' &gname> '
Set Termout on
[Email protected] ~]$
Of course the software installation is fixed, people are alive, how to play, see you ~ ~ ~