sqlplus - autotrace

Hello
I need to insert into the table Oracle execution plan as well as statistics of the statements with autotrace to sqlplus session.

for example:
SQL> set autotrace on;
SQL> select count(*)
  2  from dual;

count(*)                                                                     
----------                                                                      
       1                                                                      


Exrcution Plan
----------------------------------------------------------                      
Plan hash value: 1388734953                                                     
                                                                                
-----------------------------------------------------------------               
| Id  | Operation        | Name | Rows  | Cost (%CPU)| Time     |               
-----------------------------------------------------------------               
|   0 | SELECT STATEMENT |      |     1 |     2   (0)| 00:00:01 |               
|   1 |  FAST DUAL       |      |     1 |     2   (0)| 00:00:01 |               
-----------------------------------------------------------------               


Statistics
----------------------------------------------------------                      
          1  recursive calls                                                    
          0  db block gets                                                      
          0  consistent gets                                                    
          0  physical reads                                                     
          0  redo size                                                          
        425  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 
Can I insert this output in an Oracle table?
I need to draw the many statements for the current session and store it in a table.

Thanks in advance!

RAF Royal wrote:
I need to find the following values for the session of sqlplus set autotrace on;

ID
OPERATION
NAME
LINES
COST (% CPU)
TIME
STATISTICS

I would like to create a table with these columns and insert these values or I would find a system table that gives me the data.

question one or more of the views below

07:43:37 SQL > select dba_views view_name where view_name like ' % PLAN % ';

VIEW_NAME
------------------------------
V_$ ADVISOR_CURRENT_SQLPLAN
V_$ RSRC_PLAN
V_$ RSRC_PLAN_CPU_MTH
V_$ RSRC_PLAN_HISTORY
DBA_ADVISOR_SQLPLANS
V_$ SQLAREA_PLAN_HASH
V_$ SQLSTATS_PLAN_HASH
V_$ SQL_PLAN
V_$ SQL_PLAN_MONITOR
V_$ SQL_PLAN_STATISTICS
V_$ SQL_PLAN_STATISTICS_ALL

VIEW_NAME
------------------------------
GV_$ RSRC_PLAN
GV_$ RSRC_PLAN_CPU_MTH
GV_$ RSRC_PLAN_HISTORY
GV_$ SQLAREA_PLAN_HASH
GV_$ SQLSTATS_PLAN_HASH
USER_ADVISOR_SQLPLANS
USER_SQLSET_PLANS
USER_SQLTUNE_PLANS
USER_SQLTUNE_RATIONALE_PLAN
DBA_HIST_PLAN_OPERATION_NAME
DBA_HIST_PLAN_OPTION_NAME

VIEW_NAME
------------------------------
DBA_HIST_RSRC_PLAN
DBA_HIST_SQL_PLAN
DBA_RSRC_PLANS
DBA_RSRC_PLAN_DIRECTIVES
DBA_SQLSET_PLANS
DBA_SQLTUNE_PLANS
DBA_SQLTUNE_RATIONALE_PLAN
DBA_SQL_PLAN_BASELINES
KU$ _RMGR_PLAN_DIRECT_VIEW
KU$ _RMGR_PLAN_VIEW
ALL_SQLSET_PLANS

VIEW_NAME
------------------------------
GV_$ SQL_PLAN
GV_$ SQL_PLAN_MONITOR
GV_$ SQL_PLAN_STATISTICS
GV_$ SQL_PLAN_STATISTICS_ALL
ALL_EXPFIL_PREDTAB_PLAN
USER_EXPFIL_PREDTAB_PLAN
ALL THE$ AW_CUBE_AGG_PLANS
MGMT_JOB$ EXECPLAN
GV_$ ADVISOR_CURRENT_SQLPLAN

42 selected lines.

07:44:06 SQL >

Tags: Database

Similar Questions

  • Unable to autotrace

    Cannot start autotrace.

    Database: 11g

    Works fine on another instance of test with the same user.

    Does not not on the newly created test instance.

    SQL > set autotrace on;

    SP2-0618: could not find the Session identifier.  Check the PLUSTRACE role is enabled

    SP2-0611: error activation STATISTICS report

    SQL >

    Run the script below

    @$ORACLE_HOME/sqlplus/admin/plustrce.sql

    and then give a user role.

    Grant PLUSTRACE to Scott.

  • time of DB to autotrace

    Hi all

    This is probably an easy question for some of you guys, but...

    What is the best way to get the "db" to a query time in sqlplus?

    Is the way to get to AUTOTRACE or something?

    I found blogger this extended post autotrace output as follows:

    Statistics

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

    2 CPU used by this session

    2 CPU used when calling started

    DB 2 time

    14 customer requests

    14 SQL * Net back and forth to and from the client

    387 bytes received via SQL * Net from client

    24171 bytes sent via SQL * Net to client

    2 calls for instant Yvert: kcmgss

    6 calls to kcmgcs

    Gets 127 consistent

    127 consistent gets cache

    127 consistent gets (fastpath) cache

    2 authentications of cursor

    Releases 1 waiting queue

    1 waiting queue requests

    2. run County

    1040384 logic read the bytes from cache

    121, no work - compatible read doesn't get

    14 no-idle wait County

    2 cursors open cumulative

    open cursors current 1

    1 parse count (hard)

    2 parse count (total)

    1 analysis of time cpu

    1 recursive calls

    1 recursive CPU usage

    127 session logical reads

    -pga 262144 session in memory

    1 sorts (memory)

    638 sorts (lines)

    scan table 121 blocks obtained

    11955 table obtained scan lines

    3 analysis of tables (short tables)

    15 calls from user

    3 executions - optimal activities

    So, I would like to know what are the requirements for obtaining such a result...

    Tip: there will be more than a simple "set autotrace on."

    Kind regards

    Jocelyn

    seems you need developer sql version 4: http://www.thatjeffsmith.com/archive/2013/07/explain-plan-and-autotrace-enhancements-in-oracle-sql-developer-4/

  • 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

  • Cannot SET AUTOTRACE

    I want to autotrace, and I execute following command:
    SQL > set autotrace on;
    Cannot SET AUTOTRACE

    Why I can't set AUTOTRACE?

    Hello
    It seems that you have not enabled the plustrace role.

    Log in as user SYSTEM and run the plustrace.sql script in the $ORACLE_HOME/sqlplus/admin.

    Then try again upgraded in ATUOTRACE of the session.

    Kind regards

    Hitesh

  • Explain the Plan in SQL Developer vs SQLPlus

    Hello world

    I have a small question. Why a plan explain blocking in SQL Developer but return immediately in sqlplus?

    For example, in SQL developer, I write my statement and use the F6 command to bring up the plan to explain it and just, it hangs and crashes. It seems he's trying to produce a plan to explain, but it worked for hours now.

    When I log into SQL Plus, I do a
    SQL> explain plan for <query>:
    SQL> select * from table(dbms_xplan.display);
    The whole process takes less than a minute to get the plan of the explain command.

    Is there something fundamentally different running through SQL Developer?

    Thank you!

    -Joe

    Joe,

    F6 in SQL Developer runs an AutoTrace, which is currently running the SQL and also shows schedules and terms of the explain command. If you only want the plan of the explain command, use F10.

    Kind regards
    Bob

  • Question on AUTOTRACE, 0618 SP2 and SP2-0611

    Hello

    I wanted to look at for some examples of query execution plans. I did a little research with Google, discovered autotrace, plan_table plustrace role utlxplan. I followed the instructions I found, but the result is not quite as expected.

    Here is an exit of a freshly session started:
    0 01:50 [SS1TB Attic-Z] [5G] [750M] Z:\Documentation\Oracle\
    Oracle Concepts\Scripts>sqlplus hr/abc123
    
    SQL*Plus: Release 11.2.0.1.0 Production on Sun Aug 8 01:50:16 2010
    
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    With the Partitioning, OLAP, Data Mining and Real Application Testing options
    
    SQL> select count(*) from plan_table;
    
      COUNT(*)
    ----------
             2
    
    SQL> set autotrace on
    SP2-0618: Cannot find the Session Identifier.  Check PLUSTRACE role is enabled
    SP2-0611: Error enabling STATISTICS report
    SQL> select count(*) from plan_table;
    
      COUNT(*)
    ----------
             2
    
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 3662021055
    
    -------------------------------------------------------------------------
    | Id  | Operation          | Name       | Rows  | Cost (%CPU)| Time     |
    -------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |            |     1 |     3   (0)| 00:00:01 |
    |   1 |  SORT AGGREGATE    |            |     1 |            |          |
    |   2 |   TABLE ACCESS FULL| PLAN_TABLE |     2 |     3   (0)| 00:00:01 |
    -------------------------------------------------------------------------
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    SQL>
    1. the first select statement is there to make sure I have a plan_table, than controls.
    2. when I set autotrace on, I get SP2-0618 and SP2-0611 for reasons I can't understand.
    3. the second selection is there to find out if the autotrace in step 2 have had an impact. He has done now for the explain plan command is displayed.

    The question is: if it works (as shown in step 3) then why I get these errors in step 2? and what do I do to not get these errors more?

    Thanks for your help (again!)

    John.

    Note: I created the role plustrace, granted it select v_$ sesstat, v_$ statname, v_$ session, and then I gave hr plustrace. was there something else?

    John,

    10.2 from, creating the plan_table is not necessary because the table is created in the Sys schema with the name of table plan $ and his public synonym is made available to all users with the name plan_table . For the rest, see if the below demo.

    SQL> select * from V$version;
    
    BANNER
    -------------------------------------------------------------------------------
    Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
    PL/SQL Release 11.2.0.1.0 - Production
    CORE    11.2.0.1.0      Production
    TNS for 32-bit Windows: Version 11.2.0.1.0 - Production
    NLSRTL Version 11.2.0.1.0 - Production
    
    SQL> drop user john purge;
    drop user john purge
                   *
    ERROR at line 1:
    ORA-00921: unexpected end of SQL command
    
    SQL> drop user john cascade;
    
    User dropped.
    
    SQL> @D:\oracle\product\11.2.0\dbhome_1\sqlplus\admin\plustrce
    SQL>
    SQL> drop role plustrace;
    
    Role dropped.
    
    SQL> create role plustrace;
    
    Role created.
    
    SQL>
    SQL> grant select on v_$sesstat to plustrace;
    
    Grant succeeded.
    
    SQL> grant select on v_$statname to plustrace;
    
    Grant succeeded.
    
    SQL> grant select on v_$mystat to plustrace;
    
    Grant succeeded.
    
    SQL> grant plustrace to dba with admin option;
    
    Grant succeeded.
    
    SQL>
    SQL> set echo off
    SQL> create user john identified by john;
    
    User created.
    
    SQL> grant connect, resource to john;
    
    Grant succeeded.
    
    SQL> grant create table to john;
    
    Grant succeeded.
    
    SQL> grant plustrace to john;
    
    Grant succeeded.
    
    SQL> conn john/john
    Connected.
    SQL> create table test(a number);
    
    Table created.
    
    SQL> set autot lon
    Usage: SET AUTOT[RACE] {OFF | ON | TRACE[ONLY]} [EXP[LAIN]] [STAT[ISTICS]]
    SQL> set autot on
    SQL> select * from test;
    
    no rows selected
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 1357081020
    
    --------------------------------------------------------------------------
    | Id  | Operation         | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    --------------------------------------------------------------------------
    |   0 | SELECT STATEMENT  |      |     1 |    13 |     2   (0)| 00:00:01 |
    |   1 |  TABLE ACCESS FULL| TEST |     1 |    13 |     2   (0)| 00:00:01 |
    --------------------------------------------------------------------------
    
    Note
    -----
       - dynamic sampling used for this statement (level=2)
    
    Statistics
    ----------------------------------------------------------
             24  recursive calls
              0  db block gets
              2  consistent gets
              0  physical reads
              0  redo size
            281  bytes sent via SQL*Net to client
            409  bytes received via SQL*Net from client
              1  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
              0  rows processed
    
    SQL>
    

    HTH
    Aman...

  • TIME column result autotrace

    ORACLE VERSION: 10.2.0.3
    Operating system: Windows 2003

    I've been running the same SQL statement twice after rinsing my buffer_cache. As expected the first took more time (elapsed time: 00:00:07.67) according to the second one (00:00:00.51). But why not the given result in time does not change the column of my autotrace report. HE shows me the twice 00:02:01 as you can see in my listings.

    Achim.bigemp DESC;
    Name Null type
    EMPNO NUMBER
    ENAME VARCHAR2 (10)
    USE VARCHAR2 (9)
    MGR NUMBER 4
    HIREDATE DATE
    SAL NUMBER (7.2)
    NUMBER (7.2) COMM
    DEPTNO NUMBER (2)
    8 selected lines

    COUNT (*)
    ----------------------
    7529536



    First ROUND
    SQL > set the calendar;
    SQL > set autotrace traces;

    SQL > select count (empno) in the achim.bigemp;

    Abgelaufen: 00:00:07.67

    Ausf³hrungsplan
    ----------------------------------------------------------
    Hash value of plan: 870989070

    -----------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    -----------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 1. 3. 10023 (3) | 00:02:01 |
    | 1. GLOBAL TRI | 1. 3 | | |
    | 2. TABLE ACCESS FULL | BIGEMP | 7529K | 21 M | 10023 (3) | 00:02:01 |
    -----------------------------------------------------------------------------


    Statistics
    ----------------------------------------------------------
    245 recursive calls
    0 db block Gets
    44436 consistent gets
    44410 physical readings
    0 redo size
    425 bytes sent via SQL * Net to client
    396 bytes received via SQL * Net from client
    2 SQL * Net back and forth to and from the client
    4 sorts (memory)
    0 sorts (disk)
    1 rows processed
    Second RUN
    SQL > select count (empno) in the achim.bigemp;

    Abgelaufen: 00:00:00.51

    Ausf³hrungsplan
    ----------------------------------------------------------
    Hash value of plan: 870989070
    -----------------------------------------------------------------------------
    | ID | Operation | Name | Lines | Bytes | Cost (% CPU). Time |
    -----------------------------------------------------------------------------
    | 0 | SELECT STATEMENT | 1. 3. 10023 (3) | 00:02:01 |
    | 1. GLOBAL TRI | 1. 3 | | |
    | 2. TABLE ACCESS FULL | BIGEMP | 7529K | 21 M | 10023 (3) | 00:02:01 |
    -----------------------------------------------------------------------------
    Statistics
    ----------------------------------------------------------
    0 recursive calls
    0 db block Gets
    44408 compatible Gets
    0 physical reads
    0 redo size
    425 bytes sent via SQL * Net to client
    396 bytes received via SQL * Net from client
    2 SQL * Net back and forth to and from the client
    0 sorts (memory)
    0 sorts (disk)
    1 rows processed

    SQL >

    When I ask the elapsed_time of v$ sqlarea I get the same result, as shown on my screen in SQLPLUS or SQL Developer. It would be nice to give me a hint how I understand the DURATION indicated in the report autotrace.
    Thank you Achim

    See this link for some Autotrace more information: [test Autotrace | http://jonathanlewis.wordpress.com/testing-autotrace/]

  • If sqlplus session statement

    Hi all

    I have to get the result of a statement and continue.

    This runs a sqlplus session.

    Oracle 11g

    declare v_dname varchar (20);
    Start
    Select djob.get_dbname in the sys.dual v_dname;
    end;

    If (v_dname = "PRD") then

    run IMMEDIATELY 'truncate table MY_DAT_TBL;

    -all the summary records
    INSERT in MY_DAT_TB v
    SELECT *.
    OF ROLL_SALES_DATA;

    Commit;

    end if;

    Thank you
    Jac

    Put all your logic/code in a pl/sql block.

    SQL Plus is not a programming language.

  • ORA-12154 for sqlplus username/password@TNS but tns ping works and sqlplus username@TNS works.

    Hello-

    I am facing the following question when I try to connect by using the command prompt sqlplus for Oracle 11.2.0.3 DB installed and running on HP - UX.

    The password is not all special characters & I also tried with the double quotes which did not work.

    Following want to work with username/password@TNSNAME because I'm trying to get my application to connect to the database, the schema mentioned because it uses the jdbc connection with the connection as (username/password@TNS:1521) string.

    C:\Users>sqlplus username/Pa55w0rd@DBNAME;
    
    
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 10 07:21:43 2016
    
    
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    
    
    ERROR:
    ORA-12154: TNS:could not resolve the connect identifier specified
    
    
    
    
    Enter user-name:
    C:\Users>tnsping DBNAME
    
    
    TNS Ping Utility for 32-bit Windows: Version 11.2.0.1.0 - Production on 10-FEB-2
    016 07:21:57
    
    
    Copyright (c) 1997, 2010, Oracle.  All rights reserved.
    
    
    Used parameter files:
    C:\app\product\11.2.0\client_2\network\admin\sqlnet.ora
    
    
    
    
    Used TNSNAMES adapter to resolve the alias
    Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP) (HOST = server.domain) (PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = DBNAME)))
    OK (50 msec)
    
    
    C:\Users>sqlplus username@DBNAME
    
    
    SQL*Plus: Release 11.2.0.1.0 Production on Wed Feb 10 07:22:05 2016
    
    
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    
    
    Enter password:
    
    
    Connected to:
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    With the Partitioning, Automatic Storage Management, OLAP, Data Mining
    and Real Application Testing options
    
    
    SQL> show user
    USER is "username"
    SQL> exit
    Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64
    bit Production
    With the Partitioning, Automatic Storage Management, OLAP, Data Mining
    and Real Application Testing options
    
    
    C:\Users>
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

    content content of tnsnames.ora & sqlnet.ora:

    DBNAME =
    (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP) (HOST = server.domain)  (PORT = 1521))
        (CONNECT_DATA =
            (SERVER = DEDICATED)
            (SERVICE_NAME = DBNAME)
        )
    )
    

    # sqlnet.ora Network Configuration File: C:\app\product\11.2.0\client_2\network\admin\sqlnet.ora
    # Generated by Oracle configuration tools.
    
    
    # This file is actually generated by netca. But if customers choose to 
    # install "Software Only", this file wont exist and without the native 
    # authentication, they will not be able to connect to the database on NT.
    
    
    #SQLNET.AUTHENTICATION_SERVICES= (NTS)
    
    
    NAMES.DIRECTORY_PATH= (TNSNAMES, EZCONNECT)
    
    
    
    
    
    
    
    

    Thanks in advance

    Hello

    sqlplus username/Pa55w0rd@DBNAME;

    Try it without the semicolon;

    sqlplus username/Pa55w0rd@DBNAME

    Regards Thomas

  • Romove spooled sqlplus flatfile return transport between requests.

    I'm trying to export the following to a flatfile. It is what is in my SQLPLUS script. Export works without problem, but I have a cartridge back and forth between the two applications. How can I remove the space of line carriage return and exit to the flatfile as one.

    DEFINE the TERM
    SET ECHO OFF;
    SET FEEDBACK OFF;
    SET SERVEROUTPUT ON;
    GAME CHECK;
    DEFINE the LINES 1000;
    SET ARRAYSIZE 100000;
    NEWPAGE the VALUE NONE;
    SET PAGESIZE 0;
    SET PAGES 0;
    ALIGN the HEAD;
    SET SPACE 0;
    SET TRIMSPOOL;
    The VALUE TRIMOUT;
    DEFINE the TAB;

    SELECT rpad (EMP, 25): rpad (PRODUCT, 37) | rpad (ACCOUNT, 25): rpad (CC, 25) | RPAD (NUMBER 25). RPAD ('00', 25). RPAD ('0', 25). RPAD ('000000', 25). RPAD ('00', 25)
      || RPAD ('0000 ', 25). RPAD (AMT, 19). RPAD (D, 1)
    OF W_EMP_D;
    SELECT rpad (RECORD_INDICATOR, 1) | rpad (PK 2) | rpad (FILE, 10): rpad (REC, 11). LPAD (TOTAL, 8, '0'). RPAD (D 18) | RPAD (C, 18)
    OF W_RECORD_IND;

    spool OFF;
    SET COMMENTS ON;
    SET TO on;

    Help appreciated.

    How about you or UNION all THE

    see you soon

  • [CARS] [root.sh FAILS] sqlplus: error while loading shared libraries

    Good,

    Let me explain the whole scenario...

    -Installation 11.2.0.3.0 RAC on RHEL 6.5

    -Silent Install (GI 4 RAC nodes)

    -Every success, except resolve.conf (that we do not use DNS to resolve the scan) prerequisites in the scene runcluvfy.sh - pre...

    -Installation launched, remote operations successful, root.sh script prompted and DAMN... gave below error

    = o/p of the root.sh on screen script =.

    User ignored the prerequisites during installation

    /U01/app/11.2.0/grid/bin/sqlplus - V... has no rc = 127 with message:

    /U01/app/11.2.0/grid/bin/sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: no such file or directory

    Cannot add (property/value): ('VERSION / ") for the control point: ROOTCRS_STACK. Error code is 256

    /U01/app/11.2.0/grid/bin/ocrconfig.bin: symbol lookup error: /u01/app/11.2.0/grid/lib/libclntsh.so.11.1: undefined symbol: nnfyboot

    Cannot create or upgrade OLR

    /U01/app/11.2.0/grid/Perl/bin/perl-I/U01/app/11.2.0/grid/Perl/lib-I/U01/app/11.2.0/grid/CRS/install /u01/app/11.2.0/grid/crs/install/rootcrs.pl execution failed

    = root.sh records ends =.

    Now, this question is there for nearly 20 hours with Oracle Support and I have tried almost possible workaround suggested by Oracle Support (reboot, reinstall and...)

    Well I have no doubt in the Support of Oracle asking here on the issue, but to get chance that someone had already faced this same question.

    Now, I wish ultimately I find a culprit who are lower than o/p.

    =========================================

    [lib root@node1] # ls - ltr libsqlplus.so

    -rw - r - r - 1 grid oinstall 1477446 August 5, 2011 libsqlplus.so

    [lib root@node1] # ls - ltr libclntsh.so.11.1

    -rw - r - r - 1 root oinstall 52697691 December 10, 00:46 libclntsh.so.11.1

    [root @node1 lib] # ls - ltr libnnz11.so

    -rw - r - r - 1 root oinstall 7955322 August 17, 2011 libnnz11.so

    [root @node1 bin] # ls - ltr sqlplus

    -rwxr-xr-x 1 grid oinstall 9352 sqlplus August 5, 2011

    ======

    [@node1 grid grid] $ ldd /u01/app/11.2.0/grid/bin/sqlplus

    Linux - vdso.so.1 = > (0x00007fff7e72a000)

    libsqlplus.so = > not found

    libclntsh.so.11.1 = > not found

    libnnz11.so = > not found

    libdl.so.2 = > /lib64/libdl.so.2 (0x00000031f7400000)

    libm.so.6 = > /lib64/libm.so.6 (0x00000031f8400000)

    libpthread.so.0 = > /lib64/libpthread.so.0 (0x00000031f7c00000)

    libnsl.so.1 = > /lib64/libnsl.so.1 (0x00000031f9c00000)

    libc.so.6 = > /lib64/libc.so.6 (0x00000031f7800000)

    /lib64/ld-linux-x86-64.so.2 (0x00000031f7000000)

    ========================================

    your questions and comments are welcome...

    Re-install gcc libraries and test it.

  • email HTML of SQLPLUS

    Oracle Version: 11.2.0.4.0

    OS: SunOS

    Hello guys, I am trying to send an HTML email to outlook from sqlplus, that I wrote a script similar to the one below.

    Here's where I'm stuck. My developer comes to me and asks me that the email must come only if the sql returns data. If the SQL returns null then the enamel would not come. I don't know how to implement this requirement. I checked some blogs but not mention how to implement this requirement in this scenario.

    If my developer wants just an HTML attachment, then it would have been easier, but he wants to view this report in the body of the email itself.

    Thank you

    set echo off numf 999G999G999G999 lin 32000 trims on pages 50000 head on feed off markup html off
    alter session set nls_numeric_characters='.''' nls_date_format='Day DD. Month, YYYY';
    spool /tmp/rep.html
    prompt To: [email protected]
    prompt From: [email protected]
    prompt Subject: Daily department report
    prompt Content-type: text/html
    prompt MIME-Version: 1.0
    set markup html on entmap off table 'BORDER="2" BGCOLOR="pink"'
    prompt <i>Good morning, </i>
    prompt <i>Here is the department report per &_DATE</i>
    prompt <i>Kind Regards, </i>
    prompt <i>Your IT Operations</i>

    prompt <br/><h3>List of departments with the total salaries of their employees</h3>
    select dname "Department", sum(sal) "Salary" from emp join dept using (deptno) group by rollup(dname);
    spool off
    host /usr/sbin/sendmail -t </tmp/rep.html
    quit

    The problem is that SQL * Plus has no direct conditional construction (e.g. not if THEN ELSE order).

    There are several possible solutions, like using an anonymous plsql or make conditional coil block (as I call it).

    In your case it should wrap the host of sendmail command in some files, based on the results of the selection. Then run this file.

    + untested example +.

    Instead of ".host /usr/sbin/sendmail -t

    You would do:

    coil doSendMail.go

    Select '/usr/sbin/sendmail -t

    Ofemp join dept using (deptno)

    where rownum = 1;

    spool off

    Home doSendMail.go

    If the select does not return a line, you would get a no line found message. If the feedback is removed this message may not even make it in the hold file. Then, you must run the hold file do nothing.

  • -bash: sqlplus: lsnrctl: command not found

    Hello

    # cat /etc/issue
    Oracle Linux Server release 6.7
    Kernel \r on an \m
    
    [root@hostname bin]# lsnrctl
    -bash: lsnrctl: command not found
    
    [root@hostname bin]# sqlplus
    -bash: sqlplus: command not found
    
    [root@hostname bin]# ps -elf |grep -i smon
    0 S oracle   23239     1  0  80   0 - 315538 semtim 16:37 ?       00:00:00 xe_smon_XE
    0 S root     23411 23043  0  80   0 - 25840 -      16:39 pts/3    00:00:00 grep -i smon
    

    We set up a XEN VPS with Oracle linux. It's really strange to me that db is running, but I'm not able to run the same sqlplus command from $ORACLE_PATH/bin

    Please notify

    Thank you in anticipation

    1. [root@hostname bin] # lsnrctl
    2. -bash: lsnrctl: command not found

    You run the Oracle commands under the root user: do not, run Oracle commands as user oracle.

    Don't forget to set environment variables: http://docs.oracle.com/cd/E17781_01/install.112/e18802/toc.htm#XEINL124

  • [Bug]? AutoTrace without output

    I recently came across a bug (?) while using autotrace in sql developer. Many instructions generate autotrace output. But there are some that do not work. I tried to reproduce our selection for an environment without our data, but I failed. But then I accidentally found this bad behavior when using a select statement very very basic. Its reproducible for me:

    (1) select * from dba_indexes where owner in ('SYS');

    (2) select * from dba_indexes where owner = 'SYS ';

    (3) select * from dba_indexes by "SYS."

    but not during the execution

    (4) select * from dba_indexes;

    Running an autotrace script produces the following output, for example. to select option (2):

    Hash value of plan: 186721070

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

    | ID | Operation                                     | Name | Lines | Bytes | Cost (% CPU). Time |

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

    |   0 | SELECT STATEMENT |                 |    93. 42222 |   784 (1) | 00:00:01 |

    |*  1 |  HASH JOIN                                    |                 |    93. 42222 |   784 (1) | 00:00:01 |

    |   2.   TABLE ACCESS FULL | USER$ |   140.  2800 |     5 (0) | 00:00:01 |

    |   3.   NESTED LOOPS |                 |    93. 40362 |   779 (1) | 00:00:01 |

    |   4.    NESTED LOOPS |                 |    93. 40362 |   779 (1) | 00:00:01 |

    |*  5 |     EXTERNAL RIGHT HASH JOIN |                 |    93. 36921 |   593 (1) | 00:00:01 |

    |   6.      TABLE ACCESS FULL | USER$ |   140.  2800 |     5 (0) | 00:00:01 |

    |   7.      NESTED EXTERNAL LOOPS |                 |    93. 35061 |   587 (1) | 00:00:01 |

    |   8.       NESTED EXTERNAL LOOPS |                 |    93. 31992 |   401 (1) | 00:00:01 |

    |*  9 |        EXTERNAL RIGHT HASH JOIN |                 |    93. 28086 |   308 (1). 00:00:01 |

    |  10.         TABLE ACCESS FULL | TS$             |   141.  4794.    41 (0) | 00:00:01 |

    |  11.         NESTED EXTERNAL LOOPS |                 |    93. 24924 |   266 (1) | 00:00:01 |

    |  12.          NESTED LOOPS |                 |    93. 14043 |   266 (1) | 00:00:01 |

    |  13.           NESTED LOOPS |                 |   409. 24949 |   255 (1) | 00:00:01 |

    |  14.            TABLE ACCESS BY INDEX ROWID | USER$ |     1.    20.     1 (0) | 00:00:01 |

    | * 15 |             INDEX UNIQUE SCAN | I_USER1 |     1.       |     0 (0) | 00:00:01 |

    | * 16.            TABLE ACCESS BY ROWID INDEX BATCH | OBJ$            |   409. 16769 |   254 (1) | 00:00:01 |

    | * 17.             INDEX RANGE SCAN | I_OBJ2 |   409.       |     6 (0). 00:00:01 |

    | * 18.           TABLE ACCESS BY INDEX ROWID | IND$            |     1.    90.     1 (0) | 00:00:01 |

    | * 19.            INDEX UNIQUE SCAN | I_IND1 |     1.       |     0 (0) | 00:00:01 |

    |  20.          TABLE ACCESS BY INDEX ROWID | DEFERRED_STG$ |     1.   117.     0 (0) | 00:00:01 |

    | * 21.           INDEX UNIQUE SCAN | I_DEFERRED_STG1 |     1.       |     0 (0) | 00:00:01 |

    |  22.        CLUSTER OF ACCESS TABLE | SEG$            |     1.    42.     1 (0) | 00:00:01 |

    | * 23.         INDEX UNIQUE SCAN | I_FILE #_BLOCK # |     1.       |     0 (0) | 00:00:01 |

    |  24.       TABLE ACCESS BY ROWID INDEX BATCH | OBJ$            |     1.    33.     2 (0) | 00:00:01 |

    | * 25.        INDEX RANGE SCAN | I_OBJ1 |     1.       |     1 (0) | 00:00:01 |

    | * 26.     INDEX RANGE SCAN | I_OBJ1 |     1.       |     1 (0) | 00:00:01 |

    |  27.    TABLE ACCESS BY INDEX ROWID | OBJ$            |     1.    37.     2 (0) | 00:00:01 |

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

    Information of predicates (identified by the operation identity card):

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

    1 - access("IO".") "OWNER # '=' UI '. ("" USER # ")

    5 - access("ITO".") "OWNER #"="ITU". "USER #" (+)) "

    9 - access("I".") "TS # '=' TS '. » TS#"(+))

    15 - access("U".") THE NAME "= 'SYS')

    16 filter (BITAND ("O". "' FLAGS = 0)»(, 128)"

    17 - access("U".") "THE USER #"="O". "' OWNER # ' AND 'O'. (' ' NAME ' LIKE '% I_CDE')

    filter ("O". "NAME' LIKE '% I_CDE')"

    18 filter (BITAND ("I". "' FLAGS = 0)»(, 4096)"

    19 - access("O".") OBJ # "= 'I'." (' OBJ # ")

    21 - access("I".") ' OBJ # '=' DS '. "OBJ #" (+)) "

    23 - access("I".") TS # « = » S ». "TS #" (+) AND 'I'. " "" FILE # "=" S ". "FILE #" (+) AND 'I'. " "" BLOCK # "=" S ". "BLOCK #" (+)) "

    25 - access("I".") ' INDMETHOD # '=' ITO '. "OBJ #" (+)) "

    26 - access("I".") "BO # '=' IO '. (' ' OBJ # ")

    Statistics

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

    1 CPU used by this session

    1 CPU used when calling began

    DB 2 time

    5 customer requests

    226 consistent gets

    17 compatible gets review

    17 compatible gets (fastpath) review

    226 consistent gets cache

    209 consistent gets PIN

    209 consistent gets PIN (fastpath)

    5 no-idle wait County

    3 sliders open cumulative

    open cursors current 1

    1 pin current sliders

    226 session logical reads

    7 user calls

    Executes the same within the sql developer using the autotrace button generates an output (on the other hand, made a statement (4)):

    strange2.PNG

    Repeatable at least with sql developer 4.1.1 and 4.1.2.

    There is no entry in the log.

    Buggy as 22250314. Thank you for the complete troubleshooting!

Maybe you are looking for