修改sqlplus的ed编辑器!

Windows 安装完以后,默认输入SQL> ed 则调出记事本,原因如下_EDITOR = "Notepad"
SQL> define
DEFINE _DATE           = "23-11月-10" (CHAR)
DEFINE _CONNECT_IDENTIFIER = "win" (CHAR)
DEFINE _USER           = "SYS" (CHAR)
DEFINE _PRIVILEGE      = "AS SYSDBA" (CHAR)
DEFINE _SQLPLUS_RELEASE = "1002000100" (CHAR)
DEFINE _EDITOR         = "Notepad" (CHAR)
DEFINE _O_VERSION      = " Oracle Database 10g Enterprise Edition Release 10.2.0.
1.0 - Production
With the Partitioning, OLAP and Data Mining options" (CHAR)
DEFINE _O_RELEASE      = "1002000100" (CHAR)
DEFINE _RC             = "1" (CHAR)
而在Linux下默认则为 _EDITOR = "ed" (CHAR),下面我们把默认的 编辑器设置为vi或vim
[oracle@rhel5 admin]$ vi $ORACLE_HOME/sqlplus/admin/glogin.sql
在文件的末尾添加
DEFINE _EDITOR         = "vi"

DEFINE _EDITOR         = "vim"
这样我们在使用 sqlplus的ed命令时就可以调用vi或vim编辑器了。

例如:

[oracle@linux ~]$ cat $ORACLE_HOME/sqlplus/admin/glogin.sql
--
-- Copyright (c) 1988, 2005, Oracle.  All Rights Reserved.
--
-- NAME
--   glogin.sql
--
-- DESCRIPTION
--   SQL*Plus global login "site profile" file
--
--   Add any SQL*Plus commands here that are to be executed when a
--   user starts SQL*Plus, or uses the SQL*Plus CONNECT command.
--
-- USAGE
--   This script is automatically run
--
DEFINE _EDITOR         = "vim"

[oracle@linux ~]$ sqlplus /nolog

SQL*Plus: Release 11.2.0.1.0 Production on 星期二 6月 26 01:21:48 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

SQL> conn u1/u1
已连接。
SQL> define
DEFINE _DATE           = "26-6月 -12" (CHAR)
DEFINE _CONNECT_IDENTIFIER = "orcl" (CHAR)
DEFINE _USER           = "U1" (CHAR)
DEFINE _PRIVILEGE      = "" (CHAR)
DEFINE _SQLPLUS_RELEASE = "1102000100" (CHAR)
DEFINE _EDITOR         = "vim" (CHAR)
DEFINE _O_VERSION      = "Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, Automatic Storage Management, OLAP, Data Mining
and Real Application Testing options" (CHAR)
DEFINE _O_RELEASE      = "1102000100" (CHAR)
SQL> ed
SP2-0107: 无须保存。
SQL> select * from dual;

D
-
X

SQL> ed
已写入 file afiedt.buf

select * from dual
/
~
~
~
 1* select * from dual
SQL> /

D
-
X



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值