DBA Hub

📋Steps in this guide1/3

SQLPlus History In Oracle 12.2 New feature DBACLASS

SQL*Plus History In Oracle 12.2 is a new feature . No we can keep the history of the sql commands executed. You can enable or disable the HISTORY command in the current SQL*Plus session by

oracle clusteringintermediate
by OracleDba
14 views
1

Overview

In Oracle 12.2, SQL*Plus can keep the history of the commands executed. You can enable or disable the HISTORY command in the current SQL*Plus session by using the SET HISTORY command. The history feature is not enabled by default, so after you start SQL*Plus, you need to enable history by running “ set hist[ory] on ” You can run “ show hist” to be sure that the history is enabled:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
SQL> set history on

SQL> select name from v$database;

NAME
———
Test

SQL> select host_name from v$instance;

HOST_NAME
—————————————————————-
checking.compute-technologia.oraclecloud.internal

SQL> history
1 select name from v$database;
2 select host_name from v$instance;

SQL> exit
2

Section 2

You can delete all history by running “hist clear ”: The following example shows you how to enable or disable command history, and how to check the command history status:

Code/Command (click line numbers to comment):

1
2
3
4
5
6
SQL> SHOW HIST
history is ON and set to “100”

SQL>  HIST CLEAR
SQL>  HIST
SP2-1651: History list is empty.
3

Section 3

— To keep history of 1000 sql command.

Code/Command (click line numbers to comment):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
SQL> set history on

SQL> show history
History is ON and set to “100”

SQL> set history off

SQL> show history
History is OFF

SQL> set history 1000

SQL> show history
History is ON and set to “1000”

Comments (0)

Please to add comments

No comments yet. Be the first to comment!