SQL*Plus Enhancements in Oracle Database 12c (12.1 and 12.2)
This article provides a brief description of the enhancements to SQL*Plus in Oracle Database 12.1 and 12.2.
oracle 12cconfigurationintermediate
by OracleDba
13 views
This article provides a brief description of the enhancements to SQL*Plus in Oracle Database 12.1 and 12.2.
12345678910111213141516171819202122232425
$ sqlplus test/test@pdb1
SQL*Plus: Release 12.1.0.2.0 Production on Sat Apr 22 15:04:59 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Last Successful login time: Sat Apr 22 2017 14:45:04 +01:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>
$ sqlplus
-nologintime
test/test@pdb1
SQL*Plus: Release 12.1.0.2.0 Production on Sat Apr 22 15:07:10 2017
Copyright (c) 1982, 2014, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
SQL>1234567891011121314151617
SQL>
SHOW CON_ID
CON_ID
------------------------------
1
SQL>
SHOW CON_NAME
CON_NAME
------------------------------
CDB$ROOT
SQL>
SHOW PDBS
CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO
SQL>1234567
# UNIX/Linux
export ORACLE_PATH=/path/to/my/scripts/
Rem Windows
set SQLPLATH=C:\path\to\my\scripts
@@/path/to/my/scripts/login.sql12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
SQL> HISTORY
SP2-1650: History is off, use "SET HIST[ORY] ON" to enable History.
SQL> SET HISTORY ON
SQL> HISTORY
SP2-1651: History list is empty.
SQL>
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.
SQL>
ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';
SELECT SYSDATE FROM dual;
SELECT 'Banana' FROM dual;
SQL> HISTORY
1 ALTER SESSION SET NLS_DATE_FORMAT='DD-MON-YYYY HH24:MI:SS';
2 SELECT SYSDATE FROM dual;
3 SELECT 'Banana' FROM dual;
SQL>
SQL> HISTORY 2 RUN
SYSDATE
--------------------
22-APR-2017 13:49:41
SQL>
SQL> HISTORY 1 DELETE
SQL> HISTORY
1 SELECT SYSDATE FROM dual;
2 SELECT 'Banana' FROM dual;
SQL>1234567891011121314151617181920212223242526
SET LOBPREFETCH {0 | n}
SET ROWPREFETCH {1 | n}
SET STATEMENTCACHE {0 | n}
sqlplus / as sysdba
SQL> SHOW ARRAYSIZE LOBPREFETCH PAGESIZE ROWPREFETCH STATEMENTCACHE
arraysize 15
lobprefetch 0
pagesize 14
rowprefetch 1
statementcache is 0
SQL>
sqlplus
-fast
/ as sysdba
SQL> SHOW ARRAYSIZE LOBPREFETCH PAGESIZE ROWPREFETCH STATEMENTCACHE
arraysize 100
lobprefetch 16384
pagesize 50000
rowprefetch 2
statementcache is 20
SQL>123456789101112131415161718192021222324
MARK[UP] {HTML html_option|CSV csv_option}
html_option;
{ON|OFF} [HEAD text] [BODY text]
[TABLE {ON|OFF}] [ENTMAP {ON|OFF}]
[SPOOL {ON|OFF}] [PRE[FORMAT] {ON|OFF}]
csv_option:
{ON|OFF} [DELIM[ITER] {c}]
[QUOTE {ON|OFF}]
SET MARKUP CSV ON
SELECT level AS ID,
'Description of ' || level AS description
FROM dual
CONNECT BY level <= 5
ORDER BY 1;
"ID","DESCRIPTION"
1,"Description of 1"
2,"Description of 2"
3,"Description of 3"
4,"Description of 4"
5,"Description of 5"
SQL>12345678910111213141516171819202122232425262728293031323334353637
SET FEEDBACK ONLY
SELECT level AS ID,
'Description of ' || level AS description
FROM dual
CONNECT BY level <= 5
ORDER BY 1;
5 rows selected.
SQL>
SET FEEDBACK ON LINESIZE 100
SELECT * FROM TABLE(DBMS_XPLAN.display_cursor);
PLAN_TABLE_OUTPUT
------------------------------------------------------------------------------
SQL_ID f6a46jn2dsjj9, child number 1
-------------------------------------
SELECT level AS ID, 'Description of ' || level AS description
FROM dual CONNECT BY level <= 5 ORDER BY 1
Plan hash value: 3764016154
------------------------------------------------------------------------------
| Id | Operation | Name | Rows | Cost (%CPU)| Time |
------------------------------------------------------------------------------
| 0 | SELECT STATEMENT | | | 3 (100)| |
| 1 | SORT ORDER BY | | 1 | 3 (34)| 00:00:01 |
| 2 | CONNECT BY WITHOUT FILTERING| | | | |
| 3 | FAST DUAL | | 1 | 2 (0)| 00:00:01 |
------------------------------------------------------------------------------
16 rows selected.
SQL>12345678910111213
$
sql test/test@pdb1
SQLcl: Release 12.2.0.1.0 RC on Sat Apr 22 15:59:49 2017
Copyright (c) 1982, 2017, Oracle. All rights reserved.
Last Successful login time: Sat Apr 22 2017 15:59:50 +01:00
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
SQL>Please to add comments
No comments yet. Be the first to comment!