oracle 12.2新特性:sqlplus history

  顾名思义,history就是历史的意思,我们知道linux中使用history来查看历史命令,那么在sqlplus中有没有这个命令呢?

  Oracle 12.2版本推出了一个新特性,history,用来查看并可以输入对应的历史命令序列号来执行之前操作的命令。

1.history命令在Oracle 12.2版本中默认是关闭的,我们需要手工进行开启,如下:

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

SQL> set hist on
SQL> show hist
history is ON and set to "100"

  如果我们不想每次登录sqlplus的时候都要进行设置hist,那么我们可以在$ORACLE_HOME/sqlplus/admin/glogin.sql文件中,添加一下内容

set hist on

2.如何执行hist列出来的历史命令

SQL> hist
  1  select open_mode from v$database;
  2  select instance_name from v$instance;

SQL> hist 1 run

OPEN_MODE
--------------------
READ WRITE

3.清空history中的历史命令

SQL> hist clear
SQL> hist
SP2-1651: History list is empty.

  

  

猜你喜欢

转载自www.cnblogs.com/hanglinux/p/9044187.html
今日推荐