Oracle 12CR2-新特性--SQLPLUS提供查看历史命令的功能
Tags: Oracle
使用户能够从当前会话的历史记录列表中运行,编辑或删除先前使用的SQL Plus,SQL或PL / SQL命令。 可以使用SET HISTORY命令在当前SQL Plus会话中启用或禁用HISTORY命令。
官方文档:
1 命令及功能
命令:HISTORY
功能:提供执行,编辑,删除之前命令的功能。
2 使用方法
默认HISTORY是没有打开的。
1 2 3 | SQL> HIST 3 EDIT SP2-1650: History is off, use "SET HIST[ORY] ON" to enable History. |
2.1 打开HISTORY
注意:默认记录100条命令而不是命令行数。
1 | SQL> set history on |
2.2 查看状态
1 2 3 | SQL> show hist; history is ON and set to "2" |
2.3 设置记录命令条数
1 | SQL> set history 2; --设置为2条记录 |
2.4 查看已记录的命令
1 2 3 4 5 6 7 8 9 | SQL> hist 1 show user 2 select 1 from dual; |
2.5 编辑之前的命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | SQL> hist 1 select 1 from dual; 2 show sga; SQL> hist 1 edit SQL> hist 1 show sga; 2 select sysdate from dual; |
2.6 删除之前的命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | SQL> hist 1 show sga; 2 select sysdate from dual; SQL> hist 2 del[ete] SQL> hist 1 show sga; |
2.7 运行之前的命令
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | SQL> hist 1 select 1 from dual; 2 show sga; SQL> hist 2 run Total System Global Area 1308622848 bytes Fixed Size 8792440 bytes Variable Size 889194120 bytes Database Buffers 402653184 bytes Redo Buffers 7983104 bytes |
标签:SQLPLUS 历史命令