Oracle 12cR2 Must Know New Features
SQL*Plus Command History
SQL*Plus now provides the ability to reissue the previously executed commands. This functionality is similar to the shell history command available on the UNIX platform command line Shells.
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.
Imp Commands Usages Summary
help history
show history
set history on|off
set history 1000
HISTORY list
history
history
history clear
Detail Demonstration
sqlplus "/as sysdba"
SQL*Plus: Release 12.2.0.1.0 Production on Wed Jul 26 14:51:57 2017
Copyright (c) 1982, 2016, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 MOUNTED
SQL> alter session set container=PDB1;
Session altered.
SQL> history
SP2-1650: History is off, use "SET HIST[ORY] ON" to enable History.
Note:- By defautl the history Feature is OFF. If you wish to enjoy the benifit you have first enable it
SQL> SET HIST ON
SQL> history
SP2-1651: History list is empty.
SQL> show pdbs;
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
SQL> alter session set container=PDB1;
Session altered.
SQL> create table test (id number, test_desc varchar(100));
Table created.
SQL> insert into test (1, 'test positive');
insert into test (1, 'test positive')
*
ERROR at line 1:
ORA-00928: missing SELECT keyword
SQL> history;
1 show pdbs;
2 alter session set container=PDB1;
3 create table test (id number, test_desc varchar(100));
4 insert into test (1, 'test positive');
SQL> history 4 edit
SQL> history
1 show pdbs;
2 alter session set container=PDB1;
3 create table test (id number, test_desc varchar(100));
4 insert into test (1, 'test positive');
5 insert into test values (1, 'test positive');
SQL> history 5 run;
1 row created.
Hope you likeed the Post and you will enjoy the Beauty of this NF. Please Keep on checking Oracle by Anand to learn the awsome NF of Oracle 12cR2
Have Fun!!!!!and Do not Forget to Leave your Comment in the Comment Section below.
No comments:
Post a Comment