Oracle修改提示符方法

來源:互聯網
上載者:User

Oracle修改提示符方法

sqlplus啟動的時候會讀取glogin.sql指令碼,在$Oracle_HOME/sqlplus/admin目錄中,寫在裡面就可以了。

給你個例子。

[php]

--

-- Copyright (c) Oracle Corporation 1988, 2000.  All Rights Reserved.

--

-- NAME

--   glogin.sql

--

-- DESCRIPTION

--   SQL*Plus global login startup file.

--

--   Add any sqlplus commands here that are to be executed when a user

--   starts SQL*Plus on your system

--

-- USAGE

--   This script is automatically run when SQL*Plus starts

--

-- For backward compatibility

SET SERVEROUTPUT ON SIZE 1000000

SET TRIMSPOOL ON

SET LONG 5000

SET LINESIZE 100

SET PAGESIZE 9999

SET SQLPLUSCOMPATIBILITY 8.1.7

COLUMN global_name new_value gname

SET TERMOUT OFF

select lower(user) || '@' || decode(global_name,'Oracle8.WORLD','8.0','ORA8I.WORLD','8i',global_name) global_name from global_name;

SET SQLPROMPT '&gname>'

SET TERMOUT ON

-- Used by Trusted Oracle

COLUMN ROWLABEL FORMAT A15

-- Used for the SHOW ERRORS command

COLUMN LINE/COL FORMAT A8

COLUMN ERROR    FORMAT A65  WORD_WRAPPED

-- Used for the SHOW SGA command

COLUMN name_col_plus_show_sga FORMAT a24

-- Defaults for SHOW PARAMETERS

COLUMN name_col_plus_show_param FORMAT a36 HEADING NAME

COLUMN value_col_plus_show_param FORMAT a30 HEADING VALUE

-- Defaults for SET AUTOTRACE EXPLAIN report

COLUMN id_plus_exp FORMAT 990 HEADING i

COLUMN parent_id_plus_exp FORMAT 990 HEADING p

COLUMN plan_plus_exp FORMAT a80

COLUMN object_node_plus_exp FORMAT a8

COLUMN other_tag_plus_exp FORMAT a29

COLUMN other_plus_exp FORMAT a44

[/php]

D:\Temp>;sqlplus

SQL*Plus: Release 9.2.0.4.0 - Production on Tue Dec 16 12:07:06 2003

Copyright (c) 1982, 2002, Oracle Corporation.  All rights reserved.

Enter user-name: scott/tiger@ora921.hl3

Connected to:

Oracle9i Enterprise Edition Release 9.2.0.4.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.4.0 - Production

Welcome to Seraphim's SQL*PLUS!

You are connected to ORA921.IAGENT as SCOTT

SQL>;

實現這種效果,在glogin.sql中加入以下行:

set heading off

prompt Welcome to Seraphim's SQL*PLUS!

select 'You are connected to ' || global_name || ' as ' || user from global_name;

set serveroutput on

set heading on

或

COLUMN host_name new_value hname

SET TERMOUT OFF

select SYS_CONTEXT('USERENV','HOST') host_name from dual;

SET SQLPROMPT '&hname>;'

SET TERMOUT ON

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

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.