如何更换oracle编辑器,sqlplus里如何修改default的系统编辑器

简单的整理了一下win和linux下的办法,和doc的描述稍有出入[@more@]

doc原文如下:

Using a System Editor from SQL*Plus

If you run an ED or EDIT command at the SQL*Plus prompt, then the system starts an operating system editor, such as ed, emacs, ned, or vi. However, the PATH environment variable must include the directory where the editor executable is located.

When you start the editor, the current SQL buffer is placed in the editor. When you exit the editor, the changed SQL buffer is returned to SQL*Plus.

You can specify which editor should start by defining the SQL*Plus _EDITOR variable. You can define this variable in the glogin.sql site profile or the login.sql user profile. Alternatively, you can define it during the SQL*Plus session. For example, to set the default editor to vi, run the following command:SQL> DEFINE _EDITOR=vi

If you do not set the _EDITOR variable, then the value of either the EDITOR or the VISUAL environment variable is used. If both environment variables are set, then the value of the EDITOR variable is used. If _EDITOR, EDITOR, and VISUAL are not specified, then the default editor is ed.

When you start the editor, SQL*Plus uses the afiedt.buf temporary file to pass text to the editor. You can use the SET EDITFILE command to specify a different file name. For example:SQL> SET EDITFILE /tmp/myfile.sql

SQL*Plus does not delete the temporary file.

测试和doc描述稍微有点出入

我测试的win和linux下结果都一样:

SQL> define

DEFINE _DATE = "08-3月 -10" (CHAR)

DEFINE _CONNECT_IDENTIFIER = "orcl" (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)

SQL>

进入sqlplus之后通过执行define命令发现_EDITOR的值就是default的调用os的编辑器,可以在sqlplus中直接修改自己想用的编辑器:

SQL> define _editor="C:Program FilesEditPlus 2editplus.exe"

SQL> define

DEFINE _DATE = "08-3月 -10" (CHAR)

DEFINE _CONNECT_IDENTIFIER = "orcl" (CHAR)

DEFINE _USER = "SYS" (CHAR)

DEFINE _PRIVILEGE = "AS SYSDBA" (CHAR)

DEFINE _SQLPLUS_RELEASE = "1002000100" (CHAR)

DEFINE _EDITOR = "C:Program FilesEditPlus 2editplus.exe" (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)

SQL>

修改的时候最好写上被调用的编辑器的绝对路径,否则可能和环境变量有关。

通过在sqlplus中直接修改_EDITOR的值作用范围是该session,如果要想永久生效,需要把define_editor="C:Program FilesEditPlus 2editplus.exe"加到$ORACLE_HOME/sqlplus/admin/glogin.sql文件里,linux下也一样,linux如果环境变量设置好了,那么可以直接添加define_editor=vi到glogin.sql文件里,主要是define_editor而不是doc上所提到的_editor...

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值