Solved

commands

Posted on 2014-02-24
14
195 Views
Last Modified: 2014-12-06
SYS@spserv>

How will see the previously used command in a console in sunsolaris box?
0
Comment
Question by:thomasliju
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +3
14 Comments
 
LVL 35

Expert Comment

by:johnsone
ID: 39883985
I don't see what this is doing in the Oracle zone.

If it is set up correctly, then the history command should give you some number of previous commands.
0
 
LVL 68

Expert Comment

by:woolmilkporc
ID: 39884003
Since it's Solaris I assume that your shell is ksh.

Issue

set -o emacs

and hit <Ctrl><P>

(press and hold the <Ctrl> key, then hit the letter "p".)

to see the previous command.

Hit that key combinaton several times to scroll up in the command history.

Add "st -o emacs" to ~/.profile to make this option permanent.
0
 
LVL 8

Expert Comment

by:Lee Ingalls
ID: 39884009
If you're looking for shell command logging...
Set theses variables into local environnement file.

For csh shell (.cshrc)
set history=100
set savehist=100

100 is the max of the command that will be logged

To see the history type history command at the user prompt and the history is also logged in ~/.history file after the user logs out the session.
0
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 

Author Comment

by:thomasliju
ID: 39884029
Slightv
I mean oracle sql commands in sunsolaris machine...
0
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 168 total points
ID: 39884037
For sqlplus try "/" (slash) followed by <ENTER> to repeat the last command.

"l" <ENTER> (the letter "l" followed by the ENTER key) will show the last command.

"edit" or "ed" opens the last command for editing. Save the changed command with <ESC>:wq! <ENTER>
then type / and hit <Enter> to execute it.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39884162
I believe sqlplus in Unix follows the OS settings.

If none of the previous suggestions work, try the 'standard' up arrow key.

I none of this works, I would suggest you spend a little time in the online SQLPlus documentation?
0
 
LVL 22

Assisted Solution

by:Steve Wales
Steve Wales earned 166 total points
ID: 39884168
It does not appear to be built in to sqlplus in Unix.

However I did find reference in a couple of blog posts to a utility called rlwrap that worked on Linux (no idea if it will work on Solaris):

Try it out, let us know if it works :)   (although probably not in a production environment!)

The two links below talk about rlwrap, and how to configure and use it.

http://sysdba.wordpress.com/2006/10/08/how-to-use-rlwrap-to-get-a-command-history-in-sqlplus/
http://www.adp-gmbh.ch/ora/sqlplus/index.html

I did follow the link and the utility does still seem to be available (since the original blog post was from 2006).
0
 
LVL 35

Assisted Solution

by:johnsone
johnsone earned 166 total points
ID: 39885276
SQL*Plus on the Unix side doesn't do command history.  You only have access to the last command as mentioned.
0
 
LVL 77

Expert Comment

by:slightwv (䄆 Netminder)
ID: 39885532
>>SQL*Plus on the Unix side doesn't do command history

You mean the DOS version does something Unix doesn't?  WOW.
0
 
LVL 35

Expert Comment

by:johnsone
ID: 39885544
Yes, kind of amazing isn't it.  It has always been that way.  No idea why they never had that feature on the UNIX version.
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Cursors in Oracle: A cursor is used to process individual rows returned by database system for a query. In oracle every SQL statement executed by the oracle server has a private area. This area contains information about the SQL statement and the…
From implementing a password expiration date, to datatype conversions and file export options, these are some useful settings I've found in Jasper Server.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question