How to check the performance of query via the command sqlplus prompt

Hello

I work in the production environment, I want to check the performance of the queries in a production environment, we have no specific tools such as the expliin plan, TK Proff.

I need chek performnce of sqlplus command line query

Please let me know the process of query tuning of sqlplus command promt

Here to explain plan:

SQL> explain plan for
  2  select * from employees where employee_id = 170;

Explained.

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

PLAN_TABLE_OUTPUT
-----------------------------------------------------------------------------------------------
Plan hash value: 1833546154

---------------------------------------------------------------------------------------------
| Id  | Operation                   | Name          | Rows  | Bytes | Cost (%CPU)| Time     |
---------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT            |               |     1 |    69 |     1   (0)| 00:00:01 |
|   1 |  TABLE ACCESS BY INDEX ROWID| EMPLOYEES     |     1 |    69 |     1   (0)| 00:00:01 |
|*  2 |   INDEX UNIQUE SCAN         | EMP_EMP_ID_PK |     1 |       |     0   (0)| 00:00:01 |
---------------------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

   2 - access("EMPLOYEE_ID"=170)

You can also use autotrace, which is super easy:

SQL> set autotrace on
SQL> select * from emp;

               EMPNO ENAME      JOB                        MGR HIREDATE
-------------------- ---------- --------- -------------------- --------------------
                7369 SMITH      CLERK                     7902 17-DEC-1980 00:00:00
                7499 ALLEN      SALESMAN                  7698 20-FEB-1981 00:00:00
                7521 WARD       SALESMAN                  7698 22-FEB-1981 00:00:00
                7566 JONES      MANAGER                   7839 02-APR-1981 00:00:00
                7654 MARTIN     SALESMAN                  7698 28-SEP-1981 00:00:00
                7698 BLAKE      MANAGER                   7839 01-MAY-1981 00:00:00
                7782 CLARK      MANAGER                   7839 09-JUN-1981 00:00:00
                7788 SCOTT      ANALYST                   7566 19-APR-1987 00:00:00
                7839 KING       PRESIDENT                      17-NOV-1981 00:00:00
                7844 TURNER     SALESMAN                  7698 08-SEP-1981 00:00:00
                7876 ADAMS      CLERK                     7788 23-MAY-1987 00:00:00
                7900 JAMES      CLERK                     7698 03-DEC-1981 00:00:00
                7902 FORD       ANALYST                   7566 03-DEC-1981 00:00:00
                7934 MILLER     CLERK                     7782 23-JAN-1982 00:00:00

14 rows selected.

Execution Plan
----------------------------------------------------------
Plan hash value: 3956160932

--------------------------------------------------------------------------
| Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
--------------------------------------------------------------------------
|   0 | SELECT STATEMENT  |      |    14 |   532 |     3   (0)| 00:00:01 |
|   1 |  TABLE ACCESS FULL| EMP  |    14 |   532 |     3   (0)| 00:00:01 |
--------------------------------------------------------------------------

Statistics
----------------------------------------------------------
        480  recursive calls
          0  db block gets
         92  consistent gets
          9  physical reads
          0  redo size
       1630  bytes sent via SQL*Net to client
        520  bytes received via SQL*Net from client
          2  SQL*Net roundtrips to/from client
          7  sorts (memory)
          0  sorts (disk)
         14  rows processed

This guide has lots of good info:
http://docs.Oracle.com/CD/B19306_01/server.102/b14211/TOC.htm

Tags: Database

Similar Questions

  • How to run the command sqlplus in file beats?

    Hello

    I have a simple script file that looks like this:

    "admin/admin sqlplus as sysdba.
    stop immediately.

    But... when I start this file.bat my system will connect but do not have any script. Sqlplus waiting to order and when I write "exit" I logout of sqlplus and system then executes the following command, which is "immediate stop", but beyond sqlplus (so my base still works). Is it possible to log and run commands file.bat or in some other way?

    I am using oracle 11g, windows 7 x 64

    Best regards and thx for help

    Edited by: 879529 2011-11-27 04:52

    Create a batch file say FILE.bat and a file1.sql to say sql file which contains the sql commands (in your case "stop immediately") and call inside this file sql batch file.

    FILE.bat:
    admin/admin sqlplus as sysdba @C:\file1.sql

    File1. SQL:
    immediate stop

  • How to check the size of the tablespace by query?

    How to check the size of the tablespace by query?

    Run this query...

    SELECT
    A.tablespace_name 'space ',.
    A.bytes / (1024 * 1024) "Total_Size (MB).
    Sum (B.bytes) / (1024 * 1024) "free_space (MB).
    NVL (Round (Sum (B.bytes) * 100 / A.bytes), 1) "%Free."
    Round ((A.bytes - SUM (B.bytes)) * 100/A.bytes) '% Used_Space '.
    FROM dba_free_space B,.
    (SELECT tablespace_name, SUM (bytes) bytes
    FROM dba_data_files
    A GROUP BY nom_tablespace)
    WHERE B.tablespace_name (+) = A.tablespace_name
    GROUP OF A.tablespace_name, A.bytes
    UNION ALL
    SELECT
    A.tablespace_name 'space ',.
    B.bytes / (1024 * 1024) "Total_Size (MB).
    Sum (A.bytes_free) / (1024 * 1024) "free_space (MB).
    NVL (Round ((Sum (B.bytes) - A.bytes_used) * 100 / B.bytes), 1) "%Free."
    Round ((Sum (B.bytes) - A.bytes_free) * 100 / B.bytes) '% Used_Space '.
    FROM dba_temp_files B,.
    (SELECT tablespace_name, bytes_free, bytes_used
    V $ temp_space_header
    GROUP BY tablespace_name, bytes_free, bytes_used) has
    WHERE B.tablespace_name (+) = A.tablespace_name
    GROUP OF A.tablespace_name, B.bytes, A.bytes_free, A.bytes_used
    ORDER BY DESC 4;

  • HP G42 notebook: how to check the heat sensor

    my laptop fire but there is no system message...

    and performance down... could be heat sensor not properly detect...

    How to check the heat sensor...

    my laptop G-42-355tu

  • How to check the MSDS 13.2 running MSD Agent (legacy mode) or TMS provisioning or extension of TMS provisioning services.

    Hello

    How to check the MSDS 13.2 running MSD Agent (legacy mode) or TMS provisioning or extension of TMS provisioning services.

    Kind regards

    Siva

    My TMS is strictly using Extension of Provisioning, because I am running 14.3.2 TMSPE is the only option for me, so I can't provide a screenshot.

    However check you by going to: administrative tools > Configuration > General settings, look for the commissioning Mode.

    That said, I suggest that you consider migrating to TMSPE if you have not already, that the recent version of TMS have removed TMS Agent legacy mode.  If you want to use the latest versions of TMS and take advantage of the features it provides, you will need to perform the migration, if not already done.

  • How to check the CPU usage in the database

    How to check the CPU usage?

    in Linux and database level

    Hello

    under Linux, you can use mpstat command, for example:

    [oracle@vSLLGM132 ~] $ mpstat Pei ALL 2 10
    Linux 2.6.32 - 300.10.1.el5uek (vSLLGM132) 23.11.2014

    14:27:08 CPU user nice sys % iowait % irq % sweet % fly % idle intr/s
    14:27:10 all 1.00 8.50 9.00 0.00 0.00 0.50 0.00 1423,50 81.00
    14:27:10 0 1.00 8.50 9.00 0.00 0.00 0.50 0.00 81.00 26.50

    CPU utilization tracking can be done with the command SAR u.
    .

    At the database level: data dictionary views: v$ sysstat, v$ iostat, V$ SYSMETRIC_HISTORY.

    Read the MOS Notes:

    Diagnose hardware base caused by Performance issues (Doc ID 148176.1)

    Troubleshooting: The use of high processor (Doc ID 164768.1)

    Concerning

    Borys

  • How to check the NUMA on ESXi host node

    Dear team,

    I have cisco ucs Server Blade configuration below b - 200 m3. I want to know how to check the NUMA on ESXi host node.

    RAM: 192

    Socket 2 (8 cores).

    concerning

    Mr. VMware

    Unfortunately, it seems THAT NUMA is disabled hardware wise. You can only activate it via the BIOS setting.

  • How to check the locks in the database

    Hello

    oracleDatabase version: 11 GR 2
    OS: Solaris

    How to check the locks on database objects .it can be any lock?
    None Select sql query to check the levlel of objects of database locks? what basis locks occur?

    Please explain on the locks or share notes MOS?

    Rgds,
    Sam.

    Check below sql.

    Select s1.username. '@' || S1.machine
    || ' (SID =' | s1.sid | block him ') '
    || S2. UserName | '@' || S2.machine | ' (SID =' | s2.sid |) ') ' AS blocking_status
    v $ lock l1, v$ session s1, v$ lock l2, s2 of v$ session
    where s1.sid = l1.sid and s2.sid = l2.sid
    and l1. BLOCK = 1 and l2.request > 0
    and l1.id1 = l2.id1
    and l2.id2 = l2.id2;

    http://psoug.org/snippet/locks-view-locked-Objects_866.htm
    http://www.DBA-Oracle.com/t_locked_rows_user_locks.htm

  • How to check the space on the asm and raw device?

    Hi all

    I want to know how to check the space on the device of the DSO.
    We use a feature of the asm, which is on a raw partition.
    Our archive is full. I need to check the space on asm archve partiotion.
    How can I check the destination space archive?
    We are using partition raw device for crs and voting system.
    How can we check the space on the raw device and how do know us which device is currently in use and are not in service

    Thanks in advance

    4 - 5 raw partitions...
    What version of oracle?
    Install the OCR + VOTE in gross unit better than OCFS2. If you use 10g to 11 GR 1 material.

    If use 11 GR 2, take the OCR + VOTE in ASM disk group.

    You can check what raw OCR device:
    $ ocrcheck

    VOTEDISK:
    $ crsctl query css votedisk

    On 10g if using the raw device for OCR + votedisk: recommend 1 file = 250M
    11g recommend 1 file = 512M

    Good luck

  • How to check the backup?

    Hi, we take each backup to hot day and export the backup via scripts?...

    export backup we can check by using the log file, he succeeded...
    But how to check the backup to hot or cold backup is successfully completed?

    Help, please...

    Published by: user10745179 on February 24, 2010 03:39

    Hello

    CHCK the size of the backup in the backup location...

    Kind regards
    Deepak

  • How to check the status of FNDSM

    Hello

    How to check the TM FNDSMListenerStatus, I know that we can use the APPS_sid is the MT listener, y at - it another way to check the status of the FNDSM listener,.

    Thank you

    Hello

    OS, you can use tnsping to check the status of auditor of th.

    Of the database, run the following query and make sure that it returns something:

    SQL> select CONCURRENT_QUEUE_NAME
    from FND_CONCURRENT_QUEUES
    where CONCURRENT_QUEUE_NAME like 'FNDSM%';
    

    You can also check:

    Note: 735148.1 - Troubleshooting problem competitor Manager Start Up associated with Service Manager
    https://metalink2.Oracle.com/MetaLink/PLSQL/ml2_documents.showDocument?p_database_id=not&P_ID=735148.1

    Kind regards
    Hussein

  • Anyone know how to check the date of warranty until when?

    Anyone know how to check the date of warranty until when?

    https://checkcoverage.Apple.com/Jo/en/;JSESSIONID=9pJ0X9pFPJtNg3c44yDGCvk9pVpt5l QSgn4B60y4Skv1WfmnqMkF!-1840326800

  • How to check the balance on the gift card itunes

    How to check the balance on the gift card itunes

    Redeem it

  • Satellite A200 - how to check the temperature of the processor fan?

    Hi all

    I have a Satellite A200 that my teenagers use a little, or abuse a little! Recently, it would not start up. I suspect the fan and pulled out the fan cleaned and tested the fan on a PSU, worked out well. He put it back together, ran startup repair and now the computer is operating normally. The fan is however not appear to come at all. In the Device Manager it tells me it works very well. I'm all good with the mechanical side of the House, but I'm a quamby operating system! How to check the temp CPU or fan?

    Thought that replace the fan but don't want to go that far just to get no results. Currently using the vacuum on low like an external fan and didn't want to just run the laptop with no cooling for fear of permanent damage. Although children watch movies with her on their doona may have already reached this!

    Any advice would be appreciated.

    Hey mate,

    How to clean the fan exactly? It s advisable to use the jet of compressed air. This could blow the dust of fans cooling and, therefore, it of not necessary to disassemble the laptop.

    In addition if the fan doesn't work anymore it of necessary to replace. You can order spare parts at an authorized service provider.

  • How to check the print queue in Windows 8

    Difficulty controlling the queue with your new Windows 8? Here's a great video on how to do it:

    Hope this helps to understand how to check the print queue in Windows 8. If you have problems, let me know, I'll see what I can do to help.

Maybe you are looking for