Oracle 12C new features Sqlplus view the history command

Source: Internet
Author: User
Tags sqlplus

In 12c, Oracle introduced the History command, which is much like the history in the Shell, reducing the knock-down of SQL and bringing a lot of convenience.

1. View the history Help
Sql> Help
History
-------
Stores, lists, executes, edits of the commands
Entered during the current Sql*plus session.
Hist[ory] [N {RUN | EDIT | Del[ete]}] | [CLEAR]
N is the entry number listed in the History list.
Use this number to recall, edit or delete the command.
Example:
HIST 3 Run-will RUN The 3rd entry from the list.
Hist[ory] without any option would list all entries in the list.
2. hist syntax
Hist[ory] [N {RUN | EDIT | Del[ete]}] | [CLEAR]
3. Hist is turned off by default, and is automatically closed after each session disconnects, and the hist list is emptied when hist is closed.
Sql> history;
Sp2-1650:history is off, the use "SET hist[ory] on" to enable the history.
4. Turn hist on or off
Sql> set hist on;
Sql> set hist off;
5. View hist Status
Sql> Show hist;
History is OFF
6. Set the number of records retained by the Hist, the default number of reserved Records is 100
Sql>set History 3;
7. View Hist retained Records
Sql> hist list;
1 show Con_name
2 show parameter version;
3 Show hist;
Description: The number of records retained is calculated by command rather than by line count.
8. Run the specified record
Sql> hist;
1 Select sysdate from dual;
2 show Con_name
3 Select date from dual;
Sql> hist 2 run;
Con_name
------------------------------
Cdb$root
9. Edit the previous command
hist 1 edit;
Description: You can operate like Linux VI and edit the retained record to the end of the number of records.
10. Delete the specified number of records
hist 2 del
11. Clear All Records
Sql> hist Clear;

Oracle 12C new features Sqlplus view the history command

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.