In sweet memories of my ever loving brother "kutty thambi " ARUN KUMAR

Wednesday, May 5, 2010

Command Line History and Editing in SQL*Plus and RMAN on Linux

rlwrap (readline wrapper) utility provides a command history and editing of keyboard input for any other command. 

This article explains how to install rlwrap and set it up for SQL*Plus and RMAN.

Download the latest rlwrap software from the following URL.
Unzip and install the software using the following commands.
gunzip rlwrap*.gz
tar -xvf rlwrap*.tar
cd rlwrap*
./configure
make
make check
make install
Run the following commands, or better still append then to the ".bashrc" of the oracle software owner.
alias rlsqlplus='rlwrap sqlplus'
alias rlrman='rlwrap rman'
You can now start SQL*Plus or RMAN using "rlsqlplus" and "rlrman" respectively, and you will have a basic command history and the current line will be editable using the arrow and delete keys.

 [oracle@cdbs1 ~]$ rlrmanRecovery Manager: Release 10.2.0.1.0 - Production on Wed May 5 17:14:57 2010

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

RMAN> exit

Recovery Manager complete. 


Instead of rlrman and rlsqlplus, you can use your own alias name for rman and sqlplus. More than that now you can use up and down arrow for previous past queries.
 [oracle@cdbs1 ~]$ alias rajesh='rlwrap rman'
[oracle@cdbs1 ~]$ rajesh

Recovery Manager: Release 10.2.0.1.0 - Production on Wed May 5 17:15:27 2010

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

RMAN>


 [oracle@cdbs1 ~]$ alias lakshmi='rlwrap sqlplus'
[oracle@cdbs1 ~]$ lakshmi

SQL*Plus: Release 10.2.0.1.0 - Production on Wed May 5 17:21:38 2010

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

Enter user-name: sys as sysdba
Enter password:

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5
Next log sequence to archive   7
Current log sequence           7
SQL> select name from v$database;

NAME
---------
ORCL

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     5
Next log sequence to archive   7
Current log sequence           7
SQL> select name from v$database;

NAME
---------
ORCL
hope, it will be useful to you.

regards,
Rajeshkumar Govindarajan.

No comments:

free counters
 
Share/Bookmark