Get the App
SLTechnology News&Howtos  ›  Database  › 

How to display the command prompt of 2-2 sqlplus configuration variables as user name after oracle installation

Shulou Source: shulou.com Published: 2022-06-01 15:32:45 09月28日 Update

How the oracle command prompt is displayed as a user name

For example, the command prompt after sqlplus / as sysdba is sys >

Fang 1: temporarily modify the sqlplus configuration variable

Sql > show user

-- the output is the current user. Take sys as an example

User is "SYS"

Sql > show all

Look at all the environment variables and you can find sqlprompt

Sql > set sqlprompt "_ user >"

SYS >

Note: this setting is valid only in this reply.

Square 2: modify the configuration file of sqlplus to achieve global validity in all sessions

Cd $ORACLE_HOME

Cd sqlplus/admin

Vi glogin.sql

Add at the end

Set sqlprompt "_ user >"

Note: glogin.sql for the sql configuration file, you can set the line length, page capacity, column width automatically adapt and other information, if not written in the file, only in the session set, will temporarily play a role, with the session closed and closed, if it is used for spool and sqlloader export text files, can be written in the corresponding sql script file, and then called. The configuration file of sqlplus will be mentioned again in the corresponding blog posts of spool and sqlloader.

Set linesize 180 # sets 180 characters per line

Set pagesize 800 # sets the page capacity to 800 lines per page, and the default 24 can be set to 0 to force no paging.

DEFINE _ EDITOR='vi' # modify edit in sqlplus to open a text editor to use vi

Set echo off;-- does not display SQL statements that are being executed in the script

Set term off;-- does not display the results on the screen and exports them directly to a file.

Set heading off;-- does not output column names

Set feedback off;-if the default number of rows is greater than 6, xx rows selected,off will be displayed and no return information will be displayed.

Set colsep {|};-- sets the delimiter between columns

Tags: File configuration variable command prompt user prompt valid information capacity text result script page output user name between action global again Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Linux Xiaomi macOS Shulou Tech Info Redmi