Oracle Commands.............!!!!!!!!

SQL.RELEASE Oracle Version show release
SQL.SQLCODE Current error code show sqlcode
SQL.USER Currently connected user show user

List SQL*Plus Parameters show all
SQL> show all

CONN as SYS CONN <logon> AS <SYSDBA | SYSOPER>
conn / as sysdba

conn sys@orabase AS SYSDBA

Define / Undefine
SQL*Plus: Release 10.1.0.2.0 - Production on Fri Nov 19 15:20:10 2004

Copyright (c) 1982, 2004, Oracle. All rights reserved.


Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options

SQL> DEFINE _CONNECT_IDENTIFIER
DEFINE _CONNECT_IDENTIFIER = "ORABASE" (CHAR)

SQL> DEFINE _DATE
DEFINE _DATE = "19-NOV-04" (CHAR)

SQL> DEFINE _EDITOR
DEFINE _EDITOR = "Notepad" (CHAR)

SQL> DEFINE _O_VERSION
DEFINE _O_VERSION = "Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Production With the Partitioning, OLAP and Data Mining options" (CHAR)

SQL> DEFINE _PRIVILEGE
DEFINE _PRIVILEGE = "AS SYSDBA" (CHAR)

SQL> DEFINE _SQLPLUS_RELEASE
DEFINE _SQLPLUS_RELEASE = "1001000200" (CHAR)

SQL> DEFINE _USER
DEFINE _USER = "SYS" (CHAR)

SQL>UNDEFINE _USER

Display

Clear Screen
clear scr
Display Headers SET HEAD <OFF | ON> 
SELECT table_name FROM all_tables;

set head off

SELECT table_name FROM all_tables;

set head on

Line Size
SET LINESIZE <integer>
SELECT text
FROM all_source
WHERE ROWNUM < 21;

set linesize 121

SELECT text
FROM all_source
WHERE ROWNUM < 21;

Page Size
SET PAGESIZE <integer>
SELECT object_name
FROM all_objects
WHERE ROWNUM < 60;

set pagesize 20

SELECT object_name
FROM all_objects
WHERE ROWNUM < 60;

set pagesize 0

SELECT object_name
FROM all_objects
WHERE ROWNUM < 60;

Page Break
BREAK ON <column_name> [SKIP PAGE]
break on overload skip page

set pagesize 20
set linesize 121
col overload format a8

SELECT overload, position, argument_name, in_out, data_type
FROM all_arguments
WHERE object_name = 'CREATE_TUNING_TASK'
ORDER BY overload, position;

Pause
SET PAUSE <OFF | ON>
SELECT object_name
FROM all_objects
WHERE ROWNUM < 60;

set pause on

SELECT object_name
FROM all_objects
WHERE ROWNUM < 60;

set pause off

Timing
SET TIMING <OFF | ON>
SELECT COUNT(*)
FROM all_objects
WHERE SUBSTR(object_name,1,1) BETWEEN 'A' AND 'W';

set timing on

SELECT COUNT(*)
FROM all_objects
WHERE SUBSTR(object_name,1,1) BETWEEN 'A' AND 'W';

set timing off

Display Output From DBMS_OUTPUT.PUT_LINE built-in package
set serveroutput <ON | OFF>
DECLARE
 x VARCHAR2(20) := 'This is a test';
BEGIN
  dbms_output.put_line(x);
END;
/

set serveroutput on

DECLARE
 x VARCHAR2(20) := 'This is a test';
BEGIN
  dbms_output.put_line(x);
END;
/
Edit / Editor
Define An Editor _editor
define _editor=vi
Edit The Last Command ed
ed

Execute

Run a stored procedure
exec <procedure_name>
CREATE OR REPLACE PROCEDURE demoexec IS
BEGIN
  dbms_output.put_line('*** Executed ***');
END demoexec;
/

set serveroutput on

exec demoexec
Help
Display SQL*Plus Help help <command>
help index

help
variable
Host
Shell to the operating system host
host

exit
Unix Shell !
SQL> !

exit
Windows Shell $
SQL> $

exit
Password
Change Password password
password
Quit
Exit exit
exit
Quit quit
quit
Run
Run RUN
set serveroutput on

BEGIN
  dbms_output.put_line('test');
END;
/

run

SQL> SET SQLPROMPT '_CONNECT_IDENTIFIER> '

SQL> set sqlprompt 'SQL> '

Comments

Popular posts from this blog

How to Get Back Asus Zenphone 5 from Soft Brick

How to configure Glowroot with Liferay

Restore Database from .idb & .frm files in MySQL