Rediscovering the beautiful glogin. SQL of Oracle

Source: Internet
Author: User

Rediscovering the beautiful glogin. SQL of Oracle
When I first started to access Oracle, sometimes the following situations often occur when I log on to a production environment:
[Oracle @ rh64 app] $ sqlplus/as sysdba


SQL * Plus: Release 11.2.0.4.0 Production on Thu May 15 03:17:34 2014


Copyright (c) 1982,201 3, Oracle. All rights reserved.




Connected:
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
Sys @ ora11g (34)>
----- >>> The preceding figure shows the user you used to log on to, the Instance name you used to log on to the database, and the operation time log. In fact, this can also improve the user's vigilance, always remind yourself that
When performing operations, be careful and avoid misoperations. In fact, this definition is very simple, as long as you carefully read the Oracle official documentation, people will know how to set up. The location of the official document is as follows:
I used the official 11.2.0.4 documentation, 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 configuration file of SQLPLUS. One is in $ ORACLE_HOME/sqlplus/admin/glogin. SQL
This is called Site Profile File. Every time sqlplus is used, sqlplus will first read this File. Therefore, if you want to set global settings for all database login users, the definition is OK here.
There is also a User Profile File, which is a personal profile File, which can be defined as a login. SQL, in fact, can be stored anywhere. It will traverse the files in your current directory to see if there is any login. SQL. If yes, it will read and set and overwrite glogin. SQL. My personal habit is to define a login. SQL directly under the Home Directory of the user I log on to, and write some SQL variables that I like to set, which meets my personal requirements. For the sake of Personalized Requirements and security, I personally suggest you define your system variables in your home directory. The following is my variable settings for your reference:
[Oracle @ rh64 ~] $ Pwd
/Home/oracle
[Oracle @ rh64 ~] $ Cat login. SQL
Define _ editor = vi
Set serveroutput on size 1000000
Set trimspool on
Set timing on
Sets 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
[Oracle @ rh64 ~] $


Of course, software installation is fixed, and people are active. If you want to play with it, please refer ~~~~

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.