SlideShare ist ein Scribd-Unternehmen logo
1 von 38
Zohar Elkayam
www.realdbamagic.com
Twitter: @realmgic
Is SQLcl the Next
Generation of SQL*Plus?
Who am I?
• Zohar Elkayam, CTO at Brillix
• DBA, team leader, database trainer, public speaker, and a
senior consultant for over 18 years
• Oracle ACE Associate
• Involved with Big Data projects since 2011
• Blogger – www.realdbamagic.com and www.ilDBA.co.il
http://brillix.co.il2
About Brillix
• Brillix is a leading company that specialized in Data
Management
• We provide professional services and consulting for Databases,
Security, NoSQL, and Big Data solutions
• Providing the Brillix Big Data Experience Center
3
Agenda
• SQL*Plus and what is it good for
• Introducing SQLcl
• Installing and Using SQLcl
• SQLcl cool features and a demo
• Q&A
http://brillix.co.il4
SQL*Plus
• Introduced in Oracle 5 (1985)
• Looks very simple but has tight integration with other Oracle
infrastructure and tools
• Very good for reporting, scripting, and automation
• Replaced old CLI tool called …
UFI (“User Friendly Interface”)
http://brillix.co.il5
What’s Wrong With SQL*Plus?
• Nothing really wrong with SQL*Plus – it is being updated constantly
but it is missing a lot of trivial functionality
• SQL*Plus forces us to use GUI tools to complete some basic tasks
• Easy to understand, a bit hard to use
• Not easy for new users or developers
http://brillix.co.il6
Introducing: SQLcl
• SQLcl is a new command line interface (CLI) for SQL developers,
report users, and DBAs
• It is part of the SQL Developer suite – developed by the same
team: Oracle Database Development Tools Team
• Does (or will do) most of what SQL*Plus can do, and much more
• Main focus: making life easier for CLI users
• Minimal installation, minimal requirements
http://brillix.co.il7
Current Status (May 2016)
• Still in Early Adopter version
• current version: 4.2.0.16.131.1023 RC, May 13, 2016
• QA is still logging bugs from SQL*Plus regression tests
• Version comes out every couple of months
• Adding support for existing SQL*Plus commands/syntax
• Adding new commands and functionality
• The team is accepting bug reports and enhancement requests
from the public
http://brillix.co.il8
Prerequisites
• Very small footprint: 12MB
• Tool is Java based so it can run on Windows, Linux, and OS/X
• Java 7/8 JRE (runtime environment - no need for JDK)
• No need for installer or setup
• No need for any other additional software or special license
• No need for Oracle Client
http://brillix.co.il9
Installing
• Download from: SQLcl Developer tool OTN Page
• Unzip the file
• Verify has +x if in Linux/OSX
• Run it
http://brillix.co.il10
Running SQLcl
http://brillix.co.il11
Connecting to the Database
• When no Oracle Client: Using thin connection:
EZConnect connect style out of the box
connect host:port/service
• Support TNS, Thick and LDAP connection when Oracle home
detected
• Auto-complete connection strings from last connections AND
tnsnames.ora
http://brillix.co.il12
Object Completion and Easy Edit
• Use the tab key to complete commands
• Can be used to list tables, views or other queriable objects
• Can be used to replace the * with actual column names
• Use the arrow keys to move around the command
• Use CTRL+W and CTRL+S to jump to the beginning/end of
commands
http://brillix.co.il13
Command History
• 100 command history buffer
• Commands are persistent between sessions (watch out for security!)
• User SET NOHISTORY to blacklist commands to not go into history
• Use UP and DOWN arrow keys to access the old commands
• Usage:
history
history usage
history time
history script
history full
history clear [session?]
• Load from history into command buffer:
history <number>
http://brillix.co.il14
Describe, Information and Info+
• Describe lists the column of the tables just like SQL*Plus
• Information shows column names, default values, indexes and
constraints.
• In 12c database information shows table statistics and In
memory status
• Works for table, views, sequences, and code objects
• Info+ shows additional information regarding column statistics
and column histograms
http://brillix.co.il15
SHOW ALL and SHOW ALL+
• The show all command is familiar from SQL*Plus – it will show
all the parameters for the SQL*Plus settings
• The show all+ command will show the show all command and
some perks: available tns entries, list of pdbs, connection
settings, instance settings, nls settings, and more!
http://brillix.co.il16
Repeat
• Repeats the current SQL or PL/SQL in the buffer the specified
number of times with specified sleep intervals
• Looks like the “watch” command in Linux
• Usage:
repeat <iterations> <sleep>
http://brillix.co.il17
Repeat as “tail -f alert.log”
• Jeff Smith (@thatjeffsmith) had a cool implementation for the
repeat command on Oracle 12c:
• tail –f on the alert log
http://brillix.co.il18
SELECT
To_Char(Originating_Timestamp, 'DD-MON-YYYY HH24:MI:SSxFF') Time_Entry,
substr(trim(message_text), 0, 75) || '...' ABBR_MESSAGE_TEXT
FROM X$dbgalertext
ORDER BY Originating_Timestamp DESC, indx desc
fetch FIRST 15 ROWS ONLY;
DDL and DBMS_METADATA
• Extract DDL of objects using a single command
DDL <object name>
• Uses DBMS_METADATA.GET_DDL to extract the object
• We can modify the output using SET DDL:
http://brillix.co.il19
SET DDL
SET DDL [[ PRETTY | SQLTERMINATOR | CONSTRAINTS | REF_CONSTRAINTS |
CONSTRAINTS_AS_ALTER|OID | SIZE_BYTE_KEYWORD | PARTITIONING |
SEGMENT_ATTRIBUTES | STORAGE | TABLESPACE | SPECIFICATION |
BODY | FORCE | INSERT | |INHERIT | RESET] {on|off}
]| OFF ]
OERR
• OERR shows an error message just like the oerr in the
command line (in *nix systems)
http://brillix.co.il20
SQL> oerr ora-0
00000. 00000 - "normal, successful completion"
*Cause: Normal exit.
*Action: None.
SQL> oerr ora-1
00001. 00000 - "unique constraint (%s.%s) violated"
*Cause: An UPDATE or INSERT statement attempted to insert a duplicate
key.
For Trusted Oracle configured in DBMS MAC mode, you may see
this message if a duplicate entry exists at a different level.
*Action: Either remove the unique restriction or do not insert the key.
Alias
• Alias is a command which allows us to save a SQL, PL/SQL or
SQL*Plus scripts, and assign it a shortcut command.
• Command can receive parameters using bind variables
• Aliases are session persistent and being saved
• Usage:
• alias - for list of aliases
• alias list <aliasName> - for definition
• Setting an alias:
• alias my_command=sql; (terminate with ;)
• alias my_code=begin command; end; (terminate with /)
http://brillix.co.il21
Alias Example
• We’re tired of running the dbms_xplan after we explain a query
• So we set this alias:
http://brillix.co.il22
alias plan=select * from table(dbms_xplan.display);
SQL> explain plan for select * From dual;
Explained.
SQL> plan
PLAN_TABLE_OUTPUT
---------------------------------------------------------------
Plan hash value: 272002086
CTAS
• Extract DDL for a table and use it to recreate another table
using select * from
• Useful when we want to copy a table with partitions or a primary
key
• Might not stay in the final version – have a lot of small and
annoying issues
• Usage:
ctas table new_table
http://brillix.co.il23
SQLPATH
• SQLPATH is the order in which the CLI is looking for sql scripts
(both in SQL*Plus and SQLcl)
• Running a script not from the path requires full path location
• Default search order is:
1. Current cd directory
2. Current running directory
3. The rest of the sqlpath
• Show SQLPATH will show that current search path
http://brillix.co.il24
CD command
• When we want to change the path in SQL*Plus, we usually can’t.
• SQLcl comes with CD command to change that path and make it
easier to run scripts:
• Usage:
cd /u01/app/oracle/scripts
Show SQLPATH
http://brillix.co.il25
Bridge
• Used mainly to script data move between two connections from
the client (no server direct server connections)
• The following functionality is available:
1. Query tables in other connections
2. Query tables in multiple connections in the same statement
3. Insert data from one connection into another
4. Create a table and insert data into it from another connection
http://brillix.co.il26
Bridge (cont.)
• Uses JDBC connection string to connect our client to the remote
connection.
• Creates a table with the results in the database
• Usage:
BRIDGE <targetTableName> as "<jdbcURL>"(<sqlQuery>);
• Example:
http://brillix.co.il27
BRIDGE dept_remote as
“jdbc:oracle:thin:scott/tiger@localhost:1521/orcl"(select * from dept);
Pretty Input
• Using the SQL Developer formatting rules, it will change our input into
well formatted commands.
• Use the SQLFORMATPATH to point to the SQL Developer rule file (XML)
http://brillix.co.il28
SQL> select * from dual;
D
-
X
SQL> format buffer;
1 SELECT
2 *
3 FROM
4* dual
SQL*Plus Output
• SQL*Plus output is generated as text tables
• We can output the data as HTML but the will take over
everything we do in SQL*Plus (i.e. describe command)
• We can’t use colors in our output
• We can’t generate other types of useful outputs (CSV is really
hard for example)
http://brillix.co.il29
Generating Pretty Output
• Outputting query results becomes easier with the “set sqlformat”
command (also available in SQL Developer)
• We can create a query in the “regular” way and then switch
between the different output styles:
• ANSIConsole
• Fixed column size output
• XML or JSON output
• HTML output generates a built in search field and a responsive
html output for the result only
http://brillix.co.il30
Generating Other Useful Outputs
• We can generate loader ready output (with “|” as a delimiter)
• We can generate insert commands
• We can easily generate CSV output
• Usage:
set sqlformat { csv,html,xml,json,ansiconsole,insert,
loader,fixed,default}
http://brillix.co.il31
Load Data From CSV File
• Loads a comma separated value (csv) file into a table
• The first row of the file must be a header row and the file must
be encoded UTF8
• The load is processed with 50 rows per batch
• Usage:
LOAD [schema.]table_name[@db_link] file_name
http://brillix.co.il32
SCRIPT
• SQLcl exposes javascript scripting with nashorn to make things
very scriptable
• This means we can create our own commands inside SQLcl
using JavaScript
• For more information (and DEMO), check out Kris Rice’s blog
(product manger for SQLcl): http://krisrice.blogspot.com/
http://brillix.co.il33
Q&A
http://brillix.co.il34
Conclusion
• We talked about SQL*Plus and SQLcl differences
• We saw how to start working with SQLcl
• We tried some of its new features
• There are more new features coming and since it's and EA
version, more bug fixes to come
• I’ve been using this tool for over a year now – it’s just getting
better all the time!
http://brillix.co.il35
What Did We Not Talk About?
• Official release date (but rumer says it will be shipped out with
12cR2
• The SQLcl is very open to ideas – check them out
• Bug reporting can be done on the community page:
https://community.oracle.com/community/database/developer-
tools/sql_developer/sqlcl
http://brillix.co.il36
Useful Resources
• SQLcl OTN page:
http://www.oracle.com/technetwork/developer-
tools/sqlcl/overview/index.html
• SQLcl Community page:
https://community.oracle.com/community/database/developer-
tools/sql_developer/sqlcl
• Kris Rice (@krisrice) manage Oracle SQL Developer team
Blog: http://krisrice.blogspot.com/
• Jeff Smith (@thatjeffsmith) Oracle SQL Developer Product Manager at
Oracle
Blog: http://www.thatjeffsmith.com/
http://brillix.co.il37
Thank You
Zohar Elkayam
twitter: @realmgic
Zohar@Brillix.co.il
www.realdbamagic.com
http://brillix.co.il38

Weitere ähnliche Inhalte

Was ist angesagt?

Less08 managing data and concurrency
Less08 managing data and concurrencyLess08 managing data and concurrency
Less08 managing data and concurrency
Imran Ali
 
Less17 flashback tb3
Less17 flashback tb3Less17 flashback tb3
Less17 flashback tb3
Imran Ali
 
Less07 schema
Less07 schemaLess07 schema
Less07 schema
Imran Ali
 

Was ist angesagt? (20)

Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAsOracle Database Performance Tuning Advanced Features and Best Practices for DBAs
Oracle Database Performance Tuning Advanced Features and Best Practices for DBAs
 
Oracle 12c New Features for Developers
Oracle 12c New Features for DevelopersOracle 12c New Features for Developers
Oracle 12c New Features for Developers
 
Ordina Oracle Open World
Ordina Oracle Open WorldOrdina Oracle Open World
Ordina Oracle Open World
 
Oracle SQL Tuning
Oracle SQL TuningOracle SQL Tuning
Oracle SQL Tuning
 
Less08 managing data and concurrency
Less08 managing data and concurrencyLess08 managing data and concurrency
Less08 managing data and concurrency
 
Oracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSOracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTS
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Optimizer percona live_ams2015
Optimizer percona live_ams2015Optimizer percona live_ams2015
Optimizer percona live_ams2015
 
An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)
 
Dan Hotka's Top 10 Oracle 12c New Features
Dan Hotka's Top 10 Oracle 12c New FeaturesDan Hotka's Top 10 Oracle 12c New Features
Dan Hotka's Top 10 Oracle 12c New Features
 
Less17 flashback tb3
Less17 flashback tb3Less17 flashback tb3
Less17 flashback tb3
 
Using existing language skillsets to create large-scale, cloud-based analytics
Using existing language skillsets to create large-scale, cloud-based analyticsUsing existing language skillsets to create large-scale, cloud-based analytics
Using existing language skillsets to create large-scale, cloud-based analytics
 
Adding real time reporting to your database oracle db in memory
Adding real time reporting to your database oracle db in memoryAdding real time reporting to your database oracle db in memory
Adding real time reporting to your database oracle db in memory
 
Less07 schema
Less07 schemaLess07 schema
Less07 schema
 
MySQL Optimizer Cost Model
MySQL Optimizer Cost ModelMySQL Optimizer Cost Model
MySQL Optimizer Cost Model
 
Best New Features of Oracle Database 12c
Best New Features of Oracle Database 12cBest New Features of Oracle Database 12c
Best New Features of Oracle Database 12c
 
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expre...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expre...Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expre...
Oracle Database 12c Release 2 - New Features On Oracle Database Exadata Expre...
 
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should KnowDBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
DBA Brasil 1.0 - DBA Commands and Concepts That Every Developer Should Know
 
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
OOW16 - Oracle Database 12c - The Best Oracle Database 12c New Features for D...
 
Query optimizer vivek sharma
Query optimizer vivek sharmaQuery optimizer vivek sharma
Query optimizer vivek sharma
 

Andere mochten auch

Andere mochten auch (11)

SQLcl overview - A new Command Line Interface for Oracle Database
SQLcl overview - A new Command Line Interface for Oracle DatabaseSQLcl overview - A new Command Line Interface for Oracle Database
SQLcl overview - A new Command Line Interface for Oracle Database
 
Oracle SQLcl
Oracle SQLcl Oracle SQLcl
Oracle SQLcl
 
Spring 3 MVC CodeMash 2009
Spring 3 MVC   CodeMash 2009Spring 3 MVC   CodeMash 2009
Spring 3 MVC CodeMash 2009
 
新版阿尔法城背后的前端MVC实践
新版阿尔法城背后的前端MVC实践新版阿尔法城背后的前端MVC实践
新版阿尔法城背后的前端MVC实践
 
Introduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard BrokerIntroduction to Oracle Data Guard Broker
Introduction to Oracle Data Guard Broker
 
Oracle SQL Developer Tips & Tricks
Oracle SQL Developer Tips & TricksOracle SQL Developer Tips & Tricks
Oracle SQL Developer Tips & Tricks
 
Exploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12cExploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12c
 
PL/SQL All the Things in Oracle SQL Developer
PL/SQL All the Things in Oracle SQL DeveloperPL/SQL All the Things in Oracle SQL Developer
PL/SQL All the Things in Oracle SQL Developer
 
Pennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & Tricks
Pennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & TricksPennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & Tricks
Pennsylvania Banner User Group Webinar: Oracle SQL Developer Tips & Tricks
 
All of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL DeveloperAll of the Performance Tuning Features in Oracle SQL Developer
All of the Performance Tuning Features in Oracle SQL Developer
 
Oracle RAC 12c Release 2 - Overview
Oracle RAC 12c Release 2 - OverviewOracle RAC 12c Release 2 - Overview
Oracle RAC 12c Release 2 - Overview
 

Ähnlich wie Is SQLcl the Next Generation of SQL*Plus?

COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_Features
Alfredo Abate
 
android sqlite
android sqliteandroid sqlite
android sqlite
Deepa Rani
 

Ähnlich wie Is SQLcl the Next Generation of SQL*Plus? (20)

MySQL 5.7 New Features for Developers
MySQL 5.7 New Features for DevelopersMySQL 5.7 New Features for Developers
MySQL 5.7 New Features for Developers
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 
DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2DBA Commands and Concepts That Every Developer Should Know - Part 2
DBA Commands and Concepts That Every Developer Should Know - Part 2
 
COUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_FeaturesCOUG_AAbate_Oracle_Database_12c_New_Features
COUG_AAbate_Oracle_Database_12c_New_Features
 
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
MySQL Baics - Texas Linxufest beginners tutorial May 31st, 2019
 
MOUG17: SQLT Utility for Tuning - Practical Examples
MOUG17: SQLT Utility for Tuning - Practical ExamplesMOUG17: SQLT Utility for Tuning - Practical Examples
MOUG17: SQLT Utility for Tuning - Practical Examples
 
MOUG17: DB Security; Secure your Data
MOUG17: DB Security; Secure your DataMOUG17: DB Security; Secure your Data
MOUG17: DB Security; Secure your Data
 
android sqlite
android sqliteandroid sqlite
android sqlite
 
Oracle sql developer_slides
Oracle sql developer_slidesOracle sql developer_slides
Oracle sql developer_slides
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
ow.ppt
ow.pptow.ppt
ow.ppt
 
Ow
OwOw
Ow
 
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
MySQL 8 -- A new beginning : Sunshine PHP/PHP UK (updated)
 
Ten query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should knowTen query tuning techniques every SQL Server programmer should know
Ten query tuning techniques every SQL Server programmer should know
 
Vendor session myFMbutler DoSQL 2
Vendor session myFMbutler DoSQL 2Vendor session myFMbutler DoSQL 2
Vendor session myFMbutler DoSQL 2
 
Aioug vizag oracle12c_new_features
Aioug vizag oracle12c_new_featuresAioug vizag oracle12c_new_features
Aioug vizag oracle12c_new_features
 
Oracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptxOracle Database 23c Security New Features.pptx
Oracle Database 23c Security New Features.pptx
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAsOracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
SQL Intro
SQL IntroSQL Intro
SQL Intro
 
Oracle Database In-Memory Option for ILOUG
Oracle Database In-Memory Option for ILOUGOracle Database In-Memory Option for ILOUG
Oracle Database In-Memory Option for ILOUG
 

Mehr von Zohar Elkayam

Mehr von Zohar Elkayam (15)

Docker Concepts for Oracle/MySQL DBAs and DevOps
Docker Concepts for Oracle/MySQL DBAs and DevOpsDocker Concepts for Oracle/MySQL DBAs and DevOps
Docker Concepts for Oracle/MySQL DBAs and DevOps
 
Oracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic FunctionsOracle Advanced SQL and Analytic Functions
Oracle Advanced SQL and Analytic Functions
 
Things Every Oracle DBA Needs to Know About the Hadoop Ecosystem 20170527
Things Every Oracle DBA Needs to Know About the Hadoop Ecosystem 20170527Things Every Oracle DBA Needs to Know About the Hadoop Ecosystem 20170527
Things Every Oracle DBA Needs to Know About the Hadoop Ecosystem 20170527
 
Things Every Oracle DBA Needs to Know About the Hadoop Ecosystem (c17lv version)
Things Every Oracle DBA Needs to Know About the Hadoop Ecosystem (c17lv version)Things Every Oracle DBA Needs to Know About the Hadoop Ecosystem (c17lv version)
Things Every Oracle DBA Needs to Know About the Hadoop Ecosystem (c17lv version)
 
Things Every Oracle DBA Needs To Know About The Hadoop Ecosystem
Things Every Oracle DBA Needs To Know About The Hadoop EcosystemThings Every Oracle DBA Needs To Know About The Hadoop Ecosystem
Things Every Oracle DBA Needs To Know About The Hadoop Ecosystem
 
Rapid Cluster Computing with Apache Spark 2016
Rapid Cluster Computing with Apache Spark 2016Rapid Cluster Computing with Apache Spark 2016
Rapid Cluster Computing with Apache Spark 2016
 
Exploring Advanced SQL Techniques Using Analytic Functions
Exploring Advanced SQL Techniques Using Analytic FunctionsExploring Advanced SQL Techniques Using Analytic Functions
Exploring Advanced SQL Techniques Using Analytic Functions
 
Things Every Oracle DBA Needs to Know about the Hadoop Ecosystem
Things Every Oracle DBA Needs to Know about the Hadoop EcosystemThings Every Oracle DBA Needs to Know about the Hadoop Ecosystem
Things Every Oracle DBA Needs to Know about the Hadoop Ecosystem
 
Exploring Advanced SQL Techniques Using Analytic Functions
Exploring Advanced SQL Techniques Using Analytic FunctionsExploring Advanced SQL Techniques Using Analytic Functions
Exploring Advanced SQL Techniques Using Analytic Functions
 
Advanced PLSQL Optimizing for Better Performance
Advanced PLSQL Optimizing for Better PerformanceAdvanced PLSQL Optimizing for Better Performance
Advanced PLSQL Optimizing for Better Performance
 
The Hadoop Ecosystem for Developers
The Hadoop Ecosystem for DevelopersThe Hadoop Ecosystem for Developers
The Hadoop Ecosystem for Developers
 
Big data for cio 2015
Big data for cio 2015Big data for cio 2015
Big data for cio 2015
 
Intro to Big Data
Intro to Big DataIntro to Big Data
Intro to Big Data
 
Oracle Data Guard A to Z
Oracle Data Guard A to ZOracle Data Guard A to Z
Oracle Data Guard A to Z
 
Oracle Data Guard Broker Webinar
Oracle Data Guard Broker WebinarOracle Data Guard Broker Webinar
Oracle Data Guard Broker Webinar
 

Kürzlich hochgeladen

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

Is SQLcl the Next Generation of SQL*Plus?

  • 1. Zohar Elkayam www.realdbamagic.com Twitter: @realmgic Is SQLcl the Next Generation of SQL*Plus?
  • 2. Who am I? • Zohar Elkayam, CTO at Brillix • DBA, team leader, database trainer, public speaker, and a senior consultant for over 18 years • Oracle ACE Associate • Involved with Big Data projects since 2011 • Blogger – www.realdbamagic.com and www.ilDBA.co.il http://brillix.co.il2
  • 3. About Brillix • Brillix is a leading company that specialized in Data Management • We provide professional services and consulting for Databases, Security, NoSQL, and Big Data solutions • Providing the Brillix Big Data Experience Center 3
  • 4. Agenda • SQL*Plus and what is it good for • Introducing SQLcl • Installing and Using SQLcl • SQLcl cool features and a demo • Q&A http://brillix.co.il4
  • 5. SQL*Plus • Introduced in Oracle 5 (1985) • Looks very simple but has tight integration with other Oracle infrastructure and tools • Very good for reporting, scripting, and automation • Replaced old CLI tool called … UFI (“User Friendly Interface”) http://brillix.co.il5
  • 6. What’s Wrong With SQL*Plus? • Nothing really wrong with SQL*Plus – it is being updated constantly but it is missing a lot of trivial functionality • SQL*Plus forces us to use GUI tools to complete some basic tasks • Easy to understand, a bit hard to use • Not easy for new users or developers http://brillix.co.il6
  • 7. Introducing: SQLcl • SQLcl is a new command line interface (CLI) for SQL developers, report users, and DBAs • It is part of the SQL Developer suite – developed by the same team: Oracle Database Development Tools Team • Does (or will do) most of what SQL*Plus can do, and much more • Main focus: making life easier for CLI users • Minimal installation, minimal requirements http://brillix.co.il7
  • 8. Current Status (May 2016) • Still in Early Adopter version • current version: 4.2.0.16.131.1023 RC, May 13, 2016 • QA is still logging bugs from SQL*Plus regression tests • Version comes out every couple of months • Adding support for existing SQL*Plus commands/syntax • Adding new commands and functionality • The team is accepting bug reports and enhancement requests from the public http://brillix.co.il8
  • 9. Prerequisites • Very small footprint: 12MB • Tool is Java based so it can run on Windows, Linux, and OS/X • Java 7/8 JRE (runtime environment - no need for JDK) • No need for installer or setup • No need for any other additional software or special license • No need for Oracle Client http://brillix.co.il9
  • 10. Installing • Download from: SQLcl Developer tool OTN Page • Unzip the file • Verify has +x if in Linux/OSX • Run it http://brillix.co.il10
  • 12. Connecting to the Database • When no Oracle Client: Using thin connection: EZConnect connect style out of the box connect host:port/service • Support TNS, Thick and LDAP connection when Oracle home detected • Auto-complete connection strings from last connections AND tnsnames.ora http://brillix.co.il12
  • 13. Object Completion and Easy Edit • Use the tab key to complete commands • Can be used to list tables, views or other queriable objects • Can be used to replace the * with actual column names • Use the arrow keys to move around the command • Use CTRL+W and CTRL+S to jump to the beginning/end of commands http://brillix.co.il13
  • 14. Command History • 100 command history buffer • Commands are persistent between sessions (watch out for security!) • User SET NOHISTORY to blacklist commands to not go into history • Use UP and DOWN arrow keys to access the old commands • Usage: history history usage history time history script history full history clear [session?] • Load from history into command buffer: history <number> http://brillix.co.il14
  • 15. Describe, Information and Info+ • Describe lists the column of the tables just like SQL*Plus • Information shows column names, default values, indexes and constraints. • In 12c database information shows table statistics and In memory status • Works for table, views, sequences, and code objects • Info+ shows additional information regarding column statistics and column histograms http://brillix.co.il15
  • 16. SHOW ALL and SHOW ALL+ • The show all command is familiar from SQL*Plus – it will show all the parameters for the SQL*Plus settings • The show all+ command will show the show all command and some perks: available tns entries, list of pdbs, connection settings, instance settings, nls settings, and more! http://brillix.co.il16
  • 17. Repeat • Repeats the current SQL or PL/SQL in the buffer the specified number of times with specified sleep intervals • Looks like the “watch” command in Linux • Usage: repeat <iterations> <sleep> http://brillix.co.il17
  • 18. Repeat as “tail -f alert.log” • Jeff Smith (@thatjeffsmith) had a cool implementation for the repeat command on Oracle 12c: • tail –f on the alert log http://brillix.co.il18 SELECT To_Char(Originating_Timestamp, 'DD-MON-YYYY HH24:MI:SSxFF') Time_Entry, substr(trim(message_text), 0, 75) || '...' ABBR_MESSAGE_TEXT FROM X$dbgalertext ORDER BY Originating_Timestamp DESC, indx desc fetch FIRST 15 ROWS ONLY;
  • 19. DDL and DBMS_METADATA • Extract DDL of objects using a single command DDL <object name> • Uses DBMS_METADATA.GET_DDL to extract the object • We can modify the output using SET DDL: http://brillix.co.il19 SET DDL SET DDL [[ PRETTY | SQLTERMINATOR | CONSTRAINTS | REF_CONSTRAINTS | CONSTRAINTS_AS_ALTER|OID | SIZE_BYTE_KEYWORD | PARTITIONING | SEGMENT_ATTRIBUTES | STORAGE | TABLESPACE | SPECIFICATION | BODY | FORCE | INSERT | |INHERIT | RESET] {on|off} ]| OFF ]
  • 20. OERR • OERR shows an error message just like the oerr in the command line (in *nix systems) http://brillix.co.il20 SQL> oerr ora-0 00000. 00000 - "normal, successful completion" *Cause: Normal exit. *Action: None. SQL> oerr ora-1 00001. 00000 - "unique constraint (%s.%s) violated" *Cause: An UPDATE or INSERT statement attempted to insert a duplicate key. For Trusted Oracle configured in DBMS MAC mode, you may see this message if a duplicate entry exists at a different level. *Action: Either remove the unique restriction or do not insert the key.
  • 21. Alias • Alias is a command which allows us to save a SQL, PL/SQL or SQL*Plus scripts, and assign it a shortcut command. • Command can receive parameters using bind variables • Aliases are session persistent and being saved • Usage: • alias - for list of aliases • alias list <aliasName> - for definition • Setting an alias: • alias my_command=sql; (terminate with ;) • alias my_code=begin command; end; (terminate with /) http://brillix.co.il21
  • 22. Alias Example • We’re tired of running the dbms_xplan after we explain a query • So we set this alias: http://brillix.co.il22 alias plan=select * from table(dbms_xplan.display); SQL> explain plan for select * From dual; Explained. SQL> plan PLAN_TABLE_OUTPUT --------------------------------------------------------------- Plan hash value: 272002086
  • 23. CTAS • Extract DDL for a table and use it to recreate another table using select * from • Useful when we want to copy a table with partitions or a primary key • Might not stay in the final version – have a lot of small and annoying issues • Usage: ctas table new_table http://brillix.co.il23
  • 24. SQLPATH • SQLPATH is the order in which the CLI is looking for sql scripts (both in SQL*Plus and SQLcl) • Running a script not from the path requires full path location • Default search order is: 1. Current cd directory 2. Current running directory 3. The rest of the sqlpath • Show SQLPATH will show that current search path http://brillix.co.il24
  • 25. CD command • When we want to change the path in SQL*Plus, we usually can’t. • SQLcl comes with CD command to change that path and make it easier to run scripts: • Usage: cd /u01/app/oracle/scripts Show SQLPATH http://brillix.co.il25
  • 26. Bridge • Used mainly to script data move between two connections from the client (no server direct server connections) • The following functionality is available: 1. Query tables in other connections 2. Query tables in multiple connections in the same statement 3. Insert data from one connection into another 4. Create a table and insert data into it from another connection http://brillix.co.il26
  • 27. Bridge (cont.) • Uses JDBC connection string to connect our client to the remote connection. • Creates a table with the results in the database • Usage: BRIDGE <targetTableName> as "<jdbcURL>"(<sqlQuery>); • Example: http://brillix.co.il27 BRIDGE dept_remote as “jdbc:oracle:thin:scott/tiger@localhost:1521/orcl"(select * from dept);
  • 28. Pretty Input • Using the SQL Developer formatting rules, it will change our input into well formatted commands. • Use the SQLFORMATPATH to point to the SQL Developer rule file (XML) http://brillix.co.il28 SQL> select * from dual; D - X SQL> format buffer; 1 SELECT 2 * 3 FROM 4* dual
  • 29. SQL*Plus Output • SQL*Plus output is generated as text tables • We can output the data as HTML but the will take over everything we do in SQL*Plus (i.e. describe command) • We can’t use colors in our output • We can’t generate other types of useful outputs (CSV is really hard for example) http://brillix.co.il29
  • 30. Generating Pretty Output • Outputting query results becomes easier with the “set sqlformat” command (also available in SQL Developer) • We can create a query in the “regular” way and then switch between the different output styles: • ANSIConsole • Fixed column size output • XML or JSON output • HTML output generates a built in search field and a responsive html output for the result only http://brillix.co.il30
  • 31. Generating Other Useful Outputs • We can generate loader ready output (with “|” as a delimiter) • We can generate insert commands • We can easily generate CSV output • Usage: set sqlformat { csv,html,xml,json,ansiconsole,insert, loader,fixed,default} http://brillix.co.il31
  • 32. Load Data From CSV File • Loads a comma separated value (csv) file into a table • The first row of the file must be a header row and the file must be encoded UTF8 • The load is processed with 50 rows per batch • Usage: LOAD [schema.]table_name[@db_link] file_name http://brillix.co.il32
  • 33. SCRIPT • SQLcl exposes javascript scripting with nashorn to make things very scriptable • This means we can create our own commands inside SQLcl using JavaScript • For more information (and DEMO), check out Kris Rice’s blog (product manger for SQLcl): http://krisrice.blogspot.com/ http://brillix.co.il33
  • 35. Conclusion • We talked about SQL*Plus and SQLcl differences • We saw how to start working with SQLcl • We tried some of its new features • There are more new features coming and since it's and EA version, more bug fixes to come • I’ve been using this tool for over a year now – it’s just getting better all the time! http://brillix.co.il35
  • 36. What Did We Not Talk About? • Official release date (but rumer says it will be shipped out with 12cR2 • The SQLcl is very open to ideas – check them out • Bug reporting can be done on the community page: https://community.oracle.com/community/database/developer- tools/sql_developer/sqlcl http://brillix.co.il36
  • 37. Useful Resources • SQLcl OTN page: http://www.oracle.com/technetwork/developer- tools/sqlcl/overview/index.html • SQLcl Community page: https://community.oracle.com/community/database/developer- tools/sql_developer/sqlcl • Kris Rice (@krisrice) manage Oracle SQL Developer team Blog: http://krisrice.blogspot.com/ • Jeff Smith (@thatjeffsmith) Oracle SQL Developer Product Manager at Oracle Blog: http://www.thatjeffsmith.com/ http://brillix.co.il37
  • 38. Thank You Zohar Elkayam twitter: @realmgic Zohar@Brillix.co.il www.realdbamagic.com http://brillix.co.il38

Hinweis der Redaktion

  1. In this session, we will talk about SQLcl, which is a new command line tool developed by the SQL Developer team at Oracle Database Development Tools Team. The purpose of this session is to introduce this great tool to you. Even though it is still in its early adopter version, it has some great new features that I thought developers and DBAs ought to know about. We will talk about the old SQLPlus and what made it so great. I will show you how to install SQLcl and some basic functionality. We will talk about some of the new features – there are a lot of them, so I picked only the ones I thought will be really-really cool and we’ll have a live demos for most of them Feel free to raise your hand with questions during the session but I promise we WILL also have time for Q&A in the end of the session.
  2. [Audience interaction] Let me start with a question: please raise your hand if you never used SQLPlus. Is there anyone here who does not use it? I didn’t think so – and I don’t think anybody here will find it as a big surprise. SQLPlus is one of Oracle’s oldest tools. It has been around for at least 30 years – it came out in Oracle database version 5, which came out in 1985. Before that, Oracle command line tool was called UFI ("User Friendly Interface") which was anything but user friendly. That tool was in use in Oracle database version 2 through 4 (1979 to 1985). The SQLPlus might sound like a simple tool but it is actually not. SQLPlus is one of the more complicated tools Oracle puts in their client package. It is the first tool to be updated when syntax changes, it interacts with the grid infrastructure tools seamlessly (for example – if you shut down a RAC instance using SQLPlus, the grid infrastructure will be aware this was intentional and will not try to restart the instance) .
  3. Over the years, this tool was updated a lot but we still used an old tool with not a lot of new features. The tool did get some bugs fixed and some new syntax updates but that was about it – there was little to no new functionality introduced to could make life easier on the end users. The guys in Oracle tried to add some new features to the SQLPlus. They added support for markup language so we could output our queries as html reports – some of the internal tools such as AWR and ASH are using it. They tried to introduce Windows based SQLPlus called SQLPlusw and even had a web based version called iSQLPlus. Oracle also recognized that SQLPlus is been used a lot of scripting and maintenance (they are using it too, themselves) so they also provided a lot of support of such things. For example the use of variables, prompt command, and user challenge like accept and so on. As of Oracle 12cR1, SQLPlus is the only command line tool Oracle provides for SQL queries and database maintenance.
  4. As you are about to see soon, this tool looks very similar to the old SQLPlus, but has a lot of new functionality. Most of the old features we duplicated but let me put it up front: there is no guarantee (as of now) that it will ever replace the SQLPlus completely it in the future but I’m sure you might want to consider it after you see what it can do. About a year ago, the development team for SQL Developer, which is the not-so-new GUI interface that oracle provide free-of-charge to its customers, decided that they want to cover one of the areas that the GUI tool did not cover at all. That area was the command line interface area and automatic scripting. They started rewriting the functionality provided by SQLPlus into Java code and added some cool new features. Their goal was to make the new tool as similar to the SQLPlus as possible but still introduce some things that users had been complaining about for the last 30 years. The really exciting thing here is the team members are really open for suggestions. I know of at least couple of features that development team added to SQLcl just because someone twitted it to them, it sounded cool and not hard to implement…
  5. The actual footprint on the SQLcl tool is really small – it's only 11 or 12 Megabytes in size. Like the SQL Developer, this is a Java based tool and it requires Java 1.7 or 1.8 to run. Unlike SQL Developer, it requires only the Java runtime environment (JRE) and not the Java development kit (JDK). SQLcl does not require anything else – for example, it does not require an Oracle Client at all but it does recognize it if you have one, and give you some extra features like thick client support. Since it Java based, it is not platform specific and can run on Windows, Linux or OS X but I didn’t try it on anything else.
  6. The first thing you will need to do in order to use SQLcl is download it from the SQL Developer site. You can find it under the SQL Developer 4.1 download page, at the bottom. It will be under SQLcl Early Adopter download link. While preparing for this session and building my presentation, there were at least three or four new versions that came out, so keep your eyes open for new releases – at least until they release a stable production version. The installation process is very short and simple: download, unzip, and run. If you're using Linux you might need to change the sql file with the +x (execute flag) for making it an executable but that is about it. We are ready to run the SQLcl and use it.
  7. Let's see how it looks when we're connecting for the first time. we said we don't need an Oracle Client so we will be using the EZConnect JDBC style connection string. I am using my local database for this presentation so we'll use the local IP address 192.168.56.101, my listener's port of 1521 and the database name for the connection. The first new and cool feature I'd like to show you now is that I don't have to know where I want to connect. Let's say I want to connect to a database but I am unsure of its TNS connection name. I write connect zohar@ and then the TAB key and I get a list of all available connection. The list is derived from my tnsnames.ora file and recent connections. If you remember a partial name of the tnsnames it will autocomplete it. Once we're connected we can see the jdbc connection information by using the "show jdbc" command.
  8. Watch out for the bug in edit command Watch out for the bug in host command
  9. Now we know which table we want to query, but we're not really sure what is the table structure. We can use the good old describe command for that, but sometimes it is just not enough. When using the describe command, we can't tell if there are indexes on the table, what constraint the table follows - primary or foreign constraints, or what are the columns' default values. When using SQLPlus, this would be the time to start querying around the data dictionary to find all the relevant information. When using SQLcl all we need to do is run the information command (info for short) and we get a detailed screen with all relevant information. Here we can see the table columns, indexes, primary key, foreign key constraint, and default values. Pretty cool, right? Even then, that is sometimes not enough. What if we want to know more details about the table statistics? And what about the column statistics and histograms? we can use the info+ command where we can see all that information.
  10. Let's continue to the next small and cool feature. Let's say you need to query a table over and over so see when it changes. For example, checking the status of the data guard of if you want to see if there are new user blocking locks and so on. Until now, we had to run it manually every few seconds. In other cases, we built scripts that will loop the query but we didn't have any good way to do it easily. Now we do. Once the query is in the buffer, we can use the repeat command to run it again and again. The repeat command runs the query from the buffer and accepts two parameters: The number of times we want to run the query and the interval in which we will ran it at. For example, if we want to run a query 5 times with 3 seconds interval we will use the "repeat 5 3". As I said, this is really useful if you're impatient as I am…
  11. Jeff Smith from the development team had a great example for implementing this feature. He used it on Oracle 12c to run a live tail command on his alert log using a query. It looked something like this: http://www.thatjeffsmith.com/archive/2015/04/tailing-the-alert-log-with-sqlcl/
  12. One of the disadvantages of being a consultant is that sometimes you get to a customer who doesn't use any graphical tools and we have to get by with what we have. This is why low footprint tools are so important to us. When working with these customers, we sometimes need to extract a structure of an object – and that is a really hard work. Most of the DBAs I know use GUI tools to do it, but as a consultant, we don't always have this luxury. SQLcl solves this problem by introducing a new short code command – the "ddl" command. This will extract the structure of an object in a single, simple command: ddl myobject to get a valid and formatted ddl command. This will work with most objects: table, view, synonym, sequence and even an index. This feature uses the dbms_metadata package so we can be sure the command is valid but it also reformats it so we can be sure the command is readable.
  13. Ah ha! SQLcl comes with an alias feature. The alias feature allows us, just like in unix or linux operating system, to name a command with an alias and use that when we want to run it. For example – if we create a new alias ddl_no_seg
  14. Let's say we want to create a table as select but want to keep the original structure of the table we select. For example, if we want it to have the same partition structure or prmary key. In that case, we will need to extract a ddl, fix whatever need fixing and then run the command. SQLcl helps us with the ctas command: ctas old_table new_table will generate a command that builds the table with the same structure of the queried table and the select star from that table. Bug: when using 'SEGMENT_ATTRIBUTES' false command generated is invalid. Bug: when using ctas, the primary key name is not modified so it might fail when running the generated script.
  15. Even the HTML output is different: the output is responsive, has smartphone and ipad support (small screens and landscape view) and so on. Just note that the old markup doesn't work yet.
  16. When we said we can output the data as csv, but what if we want to load data into our tablespace from CSV (excel files for example)? We can do that as well: use the LOAD command with the table name and csv file it there you have it. In order for this to work, we need to make sure the file format is exactly as the format the sqlformat csv output it: the first line should be the list of columns and the data should be comma-delimited. It is autocommited every 50 records but this is something we can change if we need to.