Oracle Sql Commands Cheat Sheet



  1. Mysql Commands Cheat Sheet
  2. Oracle Sql Syntax Cheat Sheet
  3. Oracle Sql Commands Cheat Sheet Pdf
  4. Oracle Sql Commands Cheat Sheet

As a database admin who works on various different types of databases (Oracle, MySQL, PostgreSQL), I sometimes forget commands that are specific to a database product.
I work with Oracle database quite a fair bit and while there’s always the Oracle Database Documentation Library to refer to, it’s always the same few commands I find myself having to look up.

So I have decided to create an Oracle SQL cheat sheet to list all the Oracle specific SQL commands which I commonly “forget”.
This will be a growing list and I will add items in there as I come across them. If there’s anything you feel is worth adding to the list, please feel free to share in the comments.

This page lists the most important SQL statements and contains links to their documentation pages. If you need a basic tutorial on how to use the MariaDB database server and how to execute simple commands, see A MariaDB Primer. Also see Common MariaDB Queries for examples of commonly-used queries. Defining How Your Data Is Stored.

  1. RMAN CHEAT SHEET SET command Set the value of various attributes that affect RMAN behavior for the duration of a RUN block or a session. RMAN SET ECHO ON; RMAN SET ECHO OFF; RMAN SET DATABASE; RMAN SET DBID=; RMAN SET DBID; RMAN SET COMMAND ID TO 'rman'; RMAN SET MAXCORRUPT FOR DATABASE TO 2.
  2. This list can be used by penetration testers when testing for SQL injection authentication bypass.A penetration tester can use it manually or through burp in order to automate the process.The creator of this list is Dr. Emin İslam TatlıIf (OWASP Board Member).If you have any other suggestions please feel free to leave a comment in.

Also, do you know about Oracle Database’s Recycle Bin?

Cheat Sheet Contents

SQL Login

$ sqlplus <username>@<service-name>/<password>

e.g: $ sqlplus johnsmith@oracle/password

Oracle sql commands cheat sheet pdf

Drop all tables in database

To drop all tables in a database, use the following script:

SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET HEADING OFF
SET MARKUP HTML OFF
SET ESCAPE
SPOOL DELETEME.SQL
select ‘drop table ‘, table_name, ‘cascade constraints PURGE ;’ from user_tables;
SPOOL OFF
@DELETEME

Show all tables in database

select * from user_objects where object_type = ‘TABLE’;

or

select TABLE_NAME from tabs;

Show errors in Create Stored Procedures

CONNECT SYSTEM/MANAGER
CREATE PROCEDURE HR.PROC1 AS
BEGIN
: P1 := 1;
END;
/

Warning: Procedure created with compilation errors.

SHOW ERRORS PROCEDURE PROC1

NO ERRORS.

SHOW ERRORS PROCEDURE HR.PROC1

Errors for PROCEDURE HR PROC1:
LINE/COL ERROR
——————————————————–
3/3 PLS-00049: bad bind variable ‘P1’

Basics

Related Unix commands

Oracle Sql Commands Cheat Sheet

Output formatting

Commands

See the last command you typed in the command buffer

Execute the command buffer

Edit a command you just typed in the command buffer

Execute a command (must end in semicolon)

Require screen to stop after each page of output

Set the page size to

Run system commands

Redirect screen output to a file (including everything you type)

Show schemas/tables/tablespaces

Look up SQL based on sql_id

Setting schema type

Dropping a table/tablespace

User Account Management

Look up user account status

Reset user password with hashed value

Disable password expiration (only applies when new password is created or modified)

Mysql Commands Cheat Sheet

Unlock user account

Change user password

Query Optimization

Index

Statistics

Check the time table statistics were last updated

Oracle Sql Commands Cheat Sheet

Oracle Sql Syntax Cheat Sheet

Check the time index statistics were last updated

By default, AutoTask is scheduled to run every day, which includes automatic optimizer statistics collection. If automatic optimizer statistics collection is disabled, you can enable it with the ENABLE procedure in DBMS_AUTO_TASK_ADMIN package.

Oracle Sql Commands Cheat Sheet Pdf

Session

Oracle Sql Commands Cheat Sheet

Identify blocking statements