Sqlplus environment configuration (login. SQL)

Source: Internet
Author: User

Sqlplus environment configuration (login. SQL) in Oracle, two files can be used to set the SQL * Plus environment: (1) Global setting file: $ ORACLE_HOME/sqlplus/admin/glogin. SQL (2) Personalized setting file: login. SQL, and then the operating system environment variable to specify its location: [plain] exportSQLPATH =/home/oracle/oracle_relate commonly used login. the SQL statement is as follows: [plain] define _ editor = vi set serveroutput on size 1000000 set trimspool on set long 5000 set linesize 300 set pagesize 9999 column plan_plus_exp format a80 column global_name new_value gname se T 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 Description: (1) set trimout on settrimspool on set trimout on or set trimspool on removes trailing blanks at the end Each displayed orspooled line. setting these variables ON can reduce the amount of datawritten. however, if LINESIZE is optimal, it may be faster to set the variablesOFF. the SQL * Plus output line is blank filled throughout the query processingroutines so removing the spaces cocould take extra effort. trimout and trimspool process whether to remove spaces at the end of the standard terminal output and spool output respectively. If on, the space is removed. If off, no space is removed and the number of spaces is added according to the linesize. Trimout on and trimspool off by default. (2) column plan_plus_expformat a80 This sets the default width of the explainplan output we receive with AUTOTRACE. a80is generally wide enough to hold the full plan. (3) set termout off when set to set termout off, the output of SQL statements is ignored if this SQL statement is run in the script. That is to say, if the command is not run in the script, the SQL result will still be returned even if it is set termout off. (4) set the SQL prompt to define the SQL prompt: [SQL] 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 (selectglobal_name, instr (global_name ,'. ') dot from global_name); set sqlprompt' & gname> 'set termout on The directive column global_name new_valuegname tells SQL * Plus to take the last value it retrieves for any column named global_name, and place it into the substitution variable gname. I then select the global_nameout of the database, and concatenate this with the username I am logged inwith. that makes my prompt look like this ops $ tkyte @ ora11gr2> so I know who I am as well as where I am. you can simply change it to [SQL] select lower (user) | '@' | global_name from global_name; to get the following result: sys @ NFIRMS

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.