When sqlplus is started, it searches for and loads two files: login. SQL and glogin. SQL.

Source: Internet
Author: User

When sqlplus is started, it searches for and loads two files: login. SQL and glogin. SQL.

Environment Settings after sqlplus is started

Sqlplus searches for and loads two files: login. SQL and glogin. SQL.
The glogin. SQL file is stored in the $ Oracle_HOME/sqlplus/admin directory by default, and login. SQL can be set in SQLPATH.

1. login. SQL File
The login. SQL file can store any commands that can be used in sqlplus, including sqlplus commands and SQL statements.
When sqlplus is started, it first looks for the login. SQL file in the current directory, and then finds it in the SQLPATH directory.
If you find the glogin. SQL file, execute all the content in login. SQL before SQLPLUS displays "SQL>.
If the login. SQL file is not found, stop searching.
Therefore, you can place your favorite common settings in the login. SQL file, which is automatically loaded each time sqlplus is started.

Set SQLPATH
Add the SQLPATH environment variable to the ORACLE user profile file. Mine is. bash_profile
For example, export SQLPATH =/data/app/sqlpath (this path is the directory where your login. SQL is located)
Of course, you can also start sqlplus and then execute the file (use the @ command ).
 
Ii. glogin. SQL
The glogin. SQL file is a default SQLPLUS setting created by ORACLE for All database users. It is stored in the $ ORACLE_HOME/sqlplus/admin directory by default.
When sqlplus is started, all content of the file is automatically executed before "SQL>" is displayed. You can also put some common settings in this file.

 

Common Environment setting commands
1. Set username and instance for sqlplus Login
SQL> set sqlprompt '_ user @ & _ CONNECT_IDENTIFIER>'
SYS @ demo>
2. Number of records returned by enabling/disabling SQL statements
Set feedbak on/offset
3. enable/disable SQL statement running time statistics
Set timing on/off
4. enable/disable System Time Display
Set time on/off

 

Login. SQL example:
Define _ editor = vi

Set serveroutput on size 1000000

Set trimspool on
Sets 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) global_name
From (select global_name, instr (global_name, '.') dot from global_name );
Set sqlprompt '& gname>'
Set termout on

Oracle Study Notes: sqlplus User Logon

Sqlplus ORA-01017 when logging on to Oracle: invalid username/password; logon denied Error

Install Oracle 11gR2 (x64) in CentOS 6.4)

Steps for installing Oracle 11gR2 in vmwarevm

Install Oracle 11g XE R2 In Debian

Related Article

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.