Slide 1

Slide 1 text

Jeff Smith

Slide 2

Slide 2 text

Modern Tooling Empowers Users, Increases Productivity Use the right tool for the right job Desktop REST APIs CLI WEB Copyright © 2021, Oracle and/or its affiliates | All Rights Reserved.

Slide 3

Slide 3 text

User Friendly Interface ▪ UFI 1979 SQLDev 1.1 ▪ SQL Worksheet with Script Engine (F5) ▪ Basic SQL*Plus Support ▪ Ships with 11gR1 SQL*Plus ▪ UFI Advanced ▪ Ships with Oracle v5 2007 1985 2008 2015 2016 SQLcl Early Adopter ▪ takes existing SQL*Plus engine in SQL Developer to a new CLI sqlplusW & iSQL*Plus discontinued ▪ no longer shipped as of Oracle Database 11g 1998 iSQL*Plus ▪ Web Based SQL*Plus ▪ Ships with 8i (Internet) 1993 SQL*Plus GUI ▪ sqlplusW.exe ▪ Windows ONLY SQLcl Released ▪ support tied to Database ▪ stand-alone or bundled ▪ ships with 12cR2

Slide 4

Slide 4 text

Copyright © 2021, Oracle and/or its affiliates | All Rights Reserved. • Best of SQLDev & SQL*Plus • Auto-Formatting • Persistent Query History • Power of JavaScript • Custom Commands • vi & Emacs • Liquibase • OCI Integration • Data Pump & Data Guard https://www.oracle.com/sqlcl SQLcl

Slide 5

Slide 5 text

Accessible from anywhere, easily Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 5

Slide 6

Slide 6 text

Commands, new from SQL*Plus are Underlined 6

Slide 7

Slide 7 text

It’s Automatic! Query Output Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 7 • Fit to screen, default (ANSICONSOLE) • Color Coded • CSV • DELIMITED • HTML INSERT • JSON • JSON-FORMATTED • XML

Slide 8

Slide 8 text

set sqlformat or /*format*/ Formatting Copyright © 2021, Oracle and/or its affiliates | All Rights Reserved.

Slide 9

Slide 9 text

HELP, SET, & SHOW are your friends Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 9

Slide 10

Slide 10 text

Edit Mode, Prompt, Statusbar Editing Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 10

Slide 11

Slide 11 text

Inline editing with vi command support & the statusbar Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 11

Slide 12

Slide 12 text

History persists between instances, except for FAILED statements/scripts History Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 12

Slide 13

Slide 13 text

Object names, keywords, commands, and files! Code Completion/Insight Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 13

Slide 14

Slide 14 text

Tell me more about my database objects DESC, INFO, & INFO+ Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 14

Slide 15

Slide 15 text

Object Metadata, Comments, Primary Keys, Indexes, and Foreign Keys INFO(RMATION) – DESC but so much Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 15

Slide 16

Slide 16 text

Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 16 Instead of Column Comments, Show Statistics INFO+

Slide 17

Slide 17 text

We print the ANON BLOCK required to execute said program INFO for PL/SQL Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 17

Slide 18

Slide 18 text

Change directory… Commons tasks: CD Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 18

Slide 19

Slide 19 text

We grab ALL the DDL for the TABLE, just not the COLUMNs Create TABLE as SELECT Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 19

Slide 20

Slide 20 text

Use SET DDL to ‘shape’ how the code is generated DDL – generate DDL for any object Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 20

Slide 21

Slide 21 text

New or existing tables, file can be local or in Oracle Object Store (OSS) LOAD – take delimited data and load to a table Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 21

Slide 22

Slide 22 text

…JUST show me the DDL for proposed table Load, New Table, but… Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 22

Slide 23

Slide 23 text

Data Pump (21.4) Copyright © 2021, Oracle and/or its affiliates | All Rights Reserved. • Very simple commands, e.g., dp export • Send Exports to Oracle Object Store, automatically! • Easy Imports for Databases in Oracle Cloud

Slide 24

Slide 24 text

Extending the toolkit with JavaScript Copyright © 2021, Oracle and/or its affiliates | All Rights Reserved. script // issue the SQL var binds = {} var ret = util.executeReturnList('select id,file_name,content from media',binds); // loop the results FOR (i = 0; i < ret.length; i++) { // debug IS nice ctx.write( ret[i].ID + "\t" + ret[i].FILE_NAME+ "\n"); // GET the BLOB stream var blobStream = ret[i].CONTENT.getBinaryStream(1); // GET the path/file handle TO WRITE TO var path = java.nio.file.FileSystems.getDefault().getPath(ret[i].FILE_NAME); // dump the file stream TO the file java.nio.file.Files.copy(blobStream,path); } / !dir

Slide 25

Slide 25 text

Extract all BLOBs from a TABLE to local files on your OS 8 lines of js… Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 25

Slide 26

Slide 26 text

Free Liquibase Technology Enhanced for better Oracle Support • Built into SQLcl via Liquibase (lb) command • Automatically generate changeLogs • changeLogs automatically sorted for creation order • Automated rollbacks • 100% Oracle data type, schema, and SQL scripting support CI/CD, Schema Versioning with Liquibase Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 26

Slide 27

Slide 27 text

Interact with your OCI tenancies Oracle Cloud Support (OCI) Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 27 • Object Store [read | write] • SDK/APIs • DBCCRED Manage credentials for DBMS_CLOUD

Slide 28

Slide 28 text

Alias Potpourri Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 28 • Alias = shortcuts! • alias xyz=select 1 from dual;

Slide 29

Slide 29 text

REPEAT Potpourri Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 29 • Run a command… • Repeatedly • For X times with Y delay

Slide 30

Slide 30 text

Thanks everyone! Download: oracle.com/sqlcl Current Release :21.3 Next Release :21.4 (December 2021) Copyright © 2020, Oracle and/or its affiliates | All Rights Reserved. 30