SQL Execution Plan and statistics are displayed in sqlplus.

Source: Internet
Author: User

Sqlplus displays SQL Execution plans and statistical information 31, 32, 33, 34 keywords: oracle storage structure the most detailed explanation: 1: doc 1 logical storage structure 2: doc 2 physical storage structure how to open oracle sqlplus trace: after opening, you can see the statistical information during execution: first log on to the dba: [SQL] drop role plustrace; Role dropped. create role plustrace; Role created .. grant plustrace to dba with admin option; Grant succeeded. then authorize HR; [SQL] GRANT PLUSTRACE TO HR; Grant succeeded. however Log On with the HR User: [SQL] SQL> conn HR/HR is connected. SQL> set auto trace SP2-0158: Unknown SET autocommit option "trace" Usage: set auto [COMMIT] {OFF | ON | IMM [EDIATE] | n} SQL> set autot trace SP2-0618: The session identifier cannot be found. Enable exam PLUSTRACE role SP2-0611: an error was reported when STATISTICS reporting was enabled: The preceding error solution: 1: log on with an oracle dba user 2: execute the following authorization command: [SQL] SQL> conn/as sysdba is connected. SQL> grant select on v _ $ sesstat to plustrace; authorization successful. SQL> grant select on v _ $ statname to plustrace; authorization successful. SQL> grant select on v _ $ mystat to plustrace; authorization successful. SQL> grant plustrace to dba with admin option; authorization successful. SQL> grant plustrace to HR; authorization successful. After the SQL> exit authorization is complete, log on to the oracle common user HR: Open autotrace on to see the execution plan and statistics. [SQL] SQL> conn HR/HR is connected. SQL> select count (*) from employees; COUNT (*) ---------- 107 SQL> set autotrace on SQL> select count (*) from employees; COUNT (*) ---------- 107 execution Plan -------------------------------------------------------- Plan hash value: 3580537945 bytes | Id | Operation | Name | Rows | Cost (% CPU) | Time | ------------------------------------------------------------------------- | 0 | select statement | 1 | 1 (0) | 00:00:01 | 1 | sort aggregate | 1 | 2 | index full scan | EMP_EMAIL_UK | 107 | 1 (0) | 00:00:01 | shard statistical information defaults 0 recursive cballs 0 db block gets 1 consistent gets 0 physical reads 0 redo size 420 bytes sent via SQL * Net to client 416 bytes received via SQL * Net from client 2 SQL * Net roundtrips to/from client 0 sorts (memory) 0 sorts (disk) 1 rows processed

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.