3 Ways to Invoke / Open Vi Editor by ed Command in SQLPLUS

Generally, SQLPLUS takes the default editor by the OS. You can bypass the OS default editor using following settings. There are 3 option to set vi as the editor for the sqlplus command. 

Option 1: 

define_editor=’vi’ - Temporary for each sqlplus session

 
SQL> define_editor='vi'
SQL> ed
Wrote file afiedt.buf

  1* select name from v$database

Option 2: 

Make above setting permanent for the sqlplus utility by adding settings in $ORACLE_HOME/sqlplus/ admin/glogin.sql file. Once you add this entry in glogin.sql file it will be affective for all the sessions.

 
vi $ORACLE_HOME/sqlplus/admin/glogin.sql
define _editor='vi'
advertisements
 
Option 3: 

Set the default edit as vi in the unix environment.

$ export EDITOR="vi"
$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.2.0 Production on Wed Feb 22 05:02:28 2017

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


Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL> select name from v$database;

NAME
---------
ORCLTEST

SQL> ed
Wrote file afiedt.buf

  1* select name from v$database

No comments:

Post a Comment