pages

Showing posts with label SQL*Plus. Show all posts
Showing posts with label SQL*Plus. Show all posts

2012-11-29

SQL*Plus explain plan

Assuming that the PLAN_TABLE has been properly set up by running utlxplan.sql:
SQL> set linesize 130
SQL> explain plan for select * from dual where null is not null;

ExplicitÚ.

SQL> select * from table(dbms_xplan.display);

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------

Plan hash value: 3752461848

---------------------------------------------------------------------------
| Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------
|   0 | SELECT STATEMENT   |      |     1 |     2 |     0   (0)|          |
|*  1 |  FILTER            |      |       |       |            |          |
|   2 |   TABLE ACCESS FULL| DUAL |     1 |     2 |     2   (0)| 00:00:01 |
---------------------------------------------------------------------------

Predicate Information (identified by operation id):

PLAN_TABLE_OUTPUT
----------------------------------------------------------------------------------------------------------------------------------

---------------------------------------------------

   1 - filter(NULL IS NOT NULL)

14 ligne(s) sÚlectionnÚe(s).

SQL>

SQL*Plus login

Assuming that you have a valid tnsnames.ora:


Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\>sqlplus [USER]/[PASSWORD]@[DATABASE]

SQL*Plus: Release 11.2.0.1.0 Production on Jeu. Nov. 29 14:59:12 2012

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


ConnectÚ Ó :
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> exit
DÚconnectÚ de Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

C:\>sqlplus [USER]/[PASSWORD]@[DATABASE] as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Jeu. Nov. 29 15:00:16 2012

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

ConnectÚ Ó :
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> exit
DÚconnectÚ de Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

C:\>exit