ITPub博客

首页 > 数据库 > Oracle > Oracle 12C新特性-History命令

Oracle 12C新特性-History命令

原创 Oracle 作者:chenoracle 时间:2020-03-18 11:21:49 0 删除 编辑


Oracle 12C新特性-History命令


在12c里,推出了History命令,类似Shell中的history命令

语法如下:

SQL> help history

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 will list all entries in the list.

过程如下:

[oracle@cjcos ~]$ sqlplus / as sysdba

SQL> hist

SP2-1650: History is off, use "SET HIST[ORY] ON" to enable History.

SQL> set hist on

SQL> show pdbs

SQL> select * from v$version;

SQL> select tablespace_name from dba_tablespaces;

SQL> alter session set container=cjcpdb01;

SQL> select * from tab;

SQL> hist

  1  show pdbs

  2  select * from v$version;

  3  select tablespace_name from dba_tablespaces;

  4  alter session set container=cjcpdb01;

  5  select * from tab;

---重新执行第二条  

SQL> hist 2 run

---编辑第二条

SQL> hist 2 edit

欢迎关注我的微信公众号"IT小Chen",共同学习,共同成长!!!



来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/29785807/viewspace-2681112/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
Oracle ACE、OCMU 用户组成员、Oracle 11g OCM、微信公众号"IT小Chen"

注册时间:2014-08-05

  • 博文量
    853
  • 访问量
    2727948