2.1 EA1 - Capitalizing SQL text in worksheet

Whenever I enter some SQL commands in the Worksheet window and press ENTER after the semicolon, it re-formats the text and Capitalizes all keywords. So the following:
select * from dual;
becomes
Select * From Dual;
Which is quite annoying, because SQL Developer shouldn't mess with my code unless I ask it to. I know there is Right-Click -> Format (CTRL-F7), which does a great job fixing messy SQL and I love this feature... but it never used to change the actual text. In v2.1 EA it does, and it uses a different capitalization scheme to that of the worksheet, which results in:
SELECT * FROM dual;
Personally I'd prefer it to behave thus:
1. Don't mess with ANY text in the SQL worksheet, unless specifically asked to do so
2. When formatting SQL with "Format", don't change the case of any text
3. Have another option (or an extension to "Format") that will change the case of text to fit a configurable standard
4. If a block of text is selected when "Format" is invoked, then only format this block, instead of the entire Worksheet window
Edited by: gclough on Oct 6, 2009 11:09 AM

Sorry if I can't reproduce the exact terms, my windows in in Brazilian Portuguese, but I will try my best.
Latin languages such as portuguese have lots of letters with accents and most accented letters are produced by key combinations. The most common accent in portuguese is the acute accent that can happen with any vowel. To produce an accented vowel, I have to press the single quote key (the one besides enter on a standard American keyboard). By this point, Windows does nothing. Then, if I press <space> I get the single quote and if I press a vowel I get that vowel with an acute accent and if I press a key that doesn't accept acute accent I get a single quote and the character I pressed.
This only happens with keyboard layouts that support such languages with accented letters. I myself use a standard American keyboard on my main workstation and an ABNT approved Brazilian Portuguese keyboard on most others. To set the keyboard layout you go to Control Panel, Region and Language options, Languages tab and click Detail button. If you have a standard American keyboard you should choose United States (International) as the keyboard layout. Now, if you open any text editor (notepad or even the Worksheet editor within SQL Developer) you will notice the behavior I tried to describe above. You must start the software after applying keyboard layout change.
Problem is that Windows will only send the single quote to the active software after it realizes I really want a quote and not an accented vowel. If you open the Shortcut Keys on the Preferences dialog on SQL Developer you will notice that with a keyboard that is set to produce accents is impossible to reproduce <ctrl><quote> and for that reason it doesn't work on the Worksheet editor.
As I said is no biggie change it to something else, but it would be really nice if I didn't had to.
best regards,
Tiago

Similar Messages

  • How to set alert mail contain SQL text activities

    How to set alert mail contain SQL text activities.
    In "Notification Templates" topic have no Available Tags about sql text. Can I send mail alert with SQL text?

    it should be text/plain, for a complete list refer
    http://www.freeformatter.com/mime-types-list.html
    Regards.

  • ORA-13786: missing SQL text of statement object - Unable to profile a sql_id in oracle 11g -

    11.2.0.3.5 / 2 node rac on rhel-6 / 64-bit
    I would like to a profile a sql_id since its following 4 plans and one of them is the optimal.
    But im unable to do it as it throwing ORA-13786.
    Steps I followed :
    {code}
    SET SERVEROUTPUT ON
    -- Tuning task created for specific a statement from the AWR.
    DECLARE
      l_sql_tune_task_id  VARCHAR2(100);
    BEGIN
      l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task (
                              begin_snap  => 29676,
                              end_snap    => 29707,
                              sql_id      => 'fjndcnvzkjkb5',
                              scope       => DBMS_SQLTUNE.scope_comprehensive,
                              time_limit  => 60,
                              task_name   => '420tavt57dxkx_tuning_task',
                              description => 'Tuning task for statement 420tavt57dxkx in AWR.');
      DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
    END;
    EXEC DBMS_SQLTUNE.execute_tuning_task(task_name => 'fjndcnvzkjkb5_CFO_tuning_task');
    SET LONG 10000;
    SET PAGESIZE 1000
    SET LINESIZE 200
    SELECT DBMS_SQLTUNE.report_tuning_task('420tavt57dxkx_tuning_task') AS recommendations FROM dual;
    SET PAGESIZE 24
    SQL>  execute dbms_sqltune.accept_sql_profile(task_name =>'420tavt57dxkx_tuning_task_task', replace => TRUE,force_match  => TRUE);
    BEGIN dbms_sqltune.accept_sql_profile(task_name =>420tavt57dxkx_tuning_task', replace => TRUE,force_match  => TRUE); END;
    ERROR at line 1:
    ORA-13786: missing SQL text of statement object "1" for tuning task "420tavt57dxkx_tuning_task"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 16442
    ORA-06512: at "SYS.PRVT_SQLPROF_INFRA", line 31
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 7544
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 7568
    ORA-06512: at line 1
    {code}
    Can somebody help me out on this?

    Hi Experts,
    i too getting this error while attaching the tuning task to the sql profiler, below are the details, appreciate any help on this.
    SQL> SQL> VAR profile_name VARCHAR2(30);
    SQL> BEGIN
       :profile_name := DBMS_SQLTUNE.ACCEPT_SQL_PROFILE(task_name => 'sql_tuning_task');
    END;
    /  2    3    4
    BEGIN
    ERROR at line 1:
    ORA-13786: missing SQL text of statement object "1" for tuning task "sql_tuning_task"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 16442
    ORA-06512: at "SYS.PRVT_SQLPROF_INFRA", line 31
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 7544
    ORA-06512: at line 2
    SQL> select banner from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

  • How to populate SQL Text in auditing table?

    Hi,
    Only modifying the 'AUDIT_TRAIL' .ora parameter is enough to popoulate SQL text?
    Plz reply,if you have any concerns.
    Thanks,

    Hi,
    >>I gone through few documents to enable SQL_TEXT in audit table,it says Changing the . ora parameter to 'DB_EXTENDED' is enough to populate SQL text.
    That's right. The exact SQL statement executed by the user and the bind variables used with the SQL are collected in the audit trail when the initialization parameter AUDIT_TRAIL is set to DB_EXTENDED. The DB or TRUE value will not populate the SQLTEXT and SQLBIND columns of the AUD$ table.
    Cheers
    Legatti

  • FULL SQL TEXT를 찾는 방법

    FULL SQL TEXT를 찾는 방법
    PURPOSE
    전통적으로 특정 process가 실행하고 있는 SQL을 살펴보기 위해 V$SQL / V$SQL_TEXT 등의 view가 사용됩니다. 다만, varchar2 datatype이므로 full SQL을 볼 수 없다는 제한이 있습니다.
    10g 부터는 SQL_FULLTEXT 라는 CLOB 형태의 컬럼을 통해 1000 byte 가 넘는 SQL text도 열람할 수 있게 되었습니다.
    CONTENTS
    1. test에 사용할 SQL text
    2. 전통적 방법으로 접근
    3. 새로운 방법으로 접근
    4. 요약
    1. 다음과 같은 TEST 목적의 query가 있습니다. 영문캐릭터만 사용하여 SELECT 부터 DUAL까지 1125 글자이므로, 1125 bytes 입니다.
    select /* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa */ * from dual;
    이 query를 SCOTT 으로 수행해봅니다.
    2. 전통적 방법으로 접근
    새로운 SESSION을 열어 다음과 같이, SCOTT 으로 접속된 SESSION의 sid 및 serial# 를 확인합니다.
    (1) USERNAME을 통해 sid 및 serial# 를 확인
    select b.sid, b.serial#, b.username
    from v$session b where b.username ='SCOTT';
    SID SERIAL# USERNAME
    309 1198 SCOTT
    (2) 확인된 정보를 통해, SQL TEXT를 확인합니다.
    VARCHAR2(1000)에 저장된 DATA 이므로, 다음과 같이 FULL SQL은 확보하지 못했습니다.
    set linesize 50
    column sql_fulltext format a60 word_wrap
    break on sql_text skip 1
    select s.username username, s.osuser, s.program, a.sql_text SQL
    from v$sql a, v$session s
    where s.sid = 309 and s.serial# = 1198
    and a.address = s.sql_address and a.hash_value = s.sql_hash_value;
    USERNAME
    OSUSER
    PROGRAM
    SQL
    SCOTT
    oracle
    [email protected] (TNS V1-V3)
    select /* aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    USERNAME
    OSUSER
    PROGRAM
    SQL
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    USERNAME
    OSUSER
    PROGRAM
    SQL
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    USERNAME
    OSUSER
    PROGRAM
    SQL
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    USERNAME
    OSUSER
    PROGRAM
    SQL
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    3. 새로운 방법으로 접근
    새로운 SESSION을 열어 다음과 같이, SCOTT 으로 접속된 SESSION의 sid 및 serial# 를 확인합니다.
    (1) USERNAME을 통해 sid 및 serial# 를 확인
    select s.username username, s.osuser, s.program, a.sql_text SQL
    from v$sql a, v$session s
    where s.sid = 309 and s.serial# = 1198
    and a.address = s.sql_address and a.hash_value = s.sql_hash_value;
    SID SERIAL# USERNAME
    309 1198 SCOTT
    (2) 확인된 정보를 통해, SQL TEXT를 확인합니다.
    VARCHAR2(1000)에 저장된 DATA 이므로, CLOB datatype인 SQL_FULLTEXT 컬럼에 접근하였으므로 full SQL text를 확보할 수 있습니다.
    set linesize 50
    column sql_fulltext format a60 word_wrap
    break on sql_text skip 1
    select
    replace(translate(a.sql_fulltext,'0123456789','999999999'),'9','')
    SQL_FULLTEXT
    from v$sql a, v$session s
    where
    s.sid = 309 and s.serial# = 1198
    and a.address = s.sql_address and a.hash_value = s.sql_hash_value
    and a.sql_text like '%aaaaaaaaaaa%'
    group by replace(translate(a.sql_fulltext,'0123456789','999999999'),'9','');
    set linesize 50
    column sql_fulltext format a60 word_wrap
    break on sql_text skip 1
    SQL_FULLTEXT
    select /*
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    SQL_FULLTEXT
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    SQL_FULLTEXT
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
    */ * from dual
    4. 요약
    10g 이상 버젼에서는, 다음과 같은 형태의 query를 응용함으로서 FULL SQL TEXT를 확보할 수 있습니다.
    select
    replace(translate(sql_fulltext,'0123456789','999999999'),'9','')
    SQL_FULLTEXT
    from v$sql
    where sql_text like '%<찾고자_하는_SQL_KEYWORD>%'
    group by replace(translate(sql_fulltext,'0123456789','999999999'),'9','')
    NOTE
    혹시라도 SQL TEXT가 4000 BYTE 이상 저장되어 있는 경우라면, ORA-22835 가 발생합니다. (VARCHAR2 형태로 출력되는 과정에서 최대 4000 BYTE 라는 제한조건이 발생됩니다) 이 경우, 다음과 같이 4000 byte만 읽도록 DBMS_LOB.SUBSTR()을 설정해줄 수 있습니다.
    *** BEFORE
    replace(translate(sql_fulltext,'0123456789','999999999'),'9','')
    *** AFTER
    replace(translate(dbms_lob.substr(a.sql_fulltext,4000,1),'0123456789','999999999'),'9','')
    만약 4000 BYTE 이상의 SQL text 가 모두 필요, java/proc/developer 등의 CLOB 처리가 가능한 3rd part tool를 사용해주시거나, 필요한 APP를 작성해주셔야 합니다.
    References
    Note 437304.1

    스크립트의 RMAN 구동 후 돌려 주시는 구문 중에 $db_bk_sql 호출하여 백업을 받으시는데 채널 할당하는 부분에 format 구문을 넣어서 각 채널에서 저장하는 위치을 다르게 잡아 줄 수 있습니다. 대신 쓰시는 backup database 구문에서 format 관련된 부분을 빼 주셔야 합니다...
    예로
    ALLOCATE CHANNEL disk1 DEVICE TYPE DISK FORMAT '/disk1/backups/%U';
    뒤으 %U는 구분을 해 주기위해서 쓴 구문이구요... 위 구문과 같은 형식으로 채널 할당을 조절해 주시면 원하시는 대로 백업을 나누어서 할 수 있을 겁니다...
    추가적으로 더 다양한 형식으로 컨트롤을 할 수 있지만 그런 부분들은 백업 정책 및 기타 고려 사항을 참고해서 구성을 하셔야 입맛에 맞게 조절할 수 있으리라 봅니다.
    글 수정:
    명품 관

  • How to get triggering sql text in a statement trigger

    hi,
    I need to get sql text that run on the table in statement trigger on that table. I will log sql statements that run on table for a few weeks. I search for it, there is a ORA_SQL_TEXT function but this function is working on event triggers not statement or for each row triggers.
    is there any other way to achive that ?

    You can use AUDIT
    http://docs.oracle.com/cd/E11882_01/server.112/e26088/statements_4007.htm#i2115972
    >
    Auditing Queries on a Table: Example To choose auditing for every SQL statement that queries the employees table in the schema hr, issue the following statement:
    AUDIT SELECT
    ON hr.employees;
    To choose auditing for every statement that successfully queries the employees table in the schema hr, issue the following statement:
    AUDIT SELECT
    ON hr.employees
    WHENEVER SUCCESSFUL;
    To choose auditing for every statement that queries the employees table in the schema hr and results in an Oracle Database error, issue the following statement:
    AUDIT SELECT
    ON hr.employees
    WHENEVER NOT SUCCESSFUL;
    Auditing Inserts and Updates on a Table: Example To choose auditing for every statement that inserts or updates a row in the customers table in the schema oe, issue the following statement:
    AUDIT INSERT, UPDATE
    ON oe.customers;

  • Unicode literals lost in SQL text

    I am using SQL Developer 1.0.0.15.57, Build MAIN 15.57, on Winodws XP SP2, against a 10g db. I have already found that I need to set the environment variable
    ORA_NCHAR_LITERAL_REPLACE to TRUE on clients issuing SQL text containing Unicode (e.g. an OracleClient Command object in VB.NET), to prevent the Unicode characters from being transposed to the database character set. However, setting this environment variable does not address the exact same issue in SQL Developer. I have hunted for a setting in SQL Developer itself, but to no avail. Does anyone know how, or if it is not possible, to address this issue in SQL Developer?
    Thanks very much in advance for any assistance.
    David

    Your table appears to have 5 columns not 5 rows.
    Your statement does not provide a column list, so your value list must contain an entry for each column in the table, which is why you're getting the exception.
    When finally created your statement should read:
    insert into users (Name,address,city,state,zip) values ('John Doe','123 anystreet','sometown','ab','12345')
    Dave

  • SQL-text from java.sql.PreparedStatement ?

    If I have a java.sql.PreparedStatement object,
    is it somehow possible from that object to retrieve the last SQL-text statement that was executed or that it was associated with?

    I should add that if you're prepared to investigate "manually" then you can poke around in the driver as it does its thing using a debugger. You may well be able to find the string that way, but it's entirely dependent upon the driver implementation.
    Note that because a prepared statement typically represents a compiled object on the server end of the connection, there's no absolute requirement for it to retain this information at all - an identifier value will do just as well!

  • SQL Text in DATABASE VAULT Events

    I'm using Audit Vault 10.2.3.2 to collect audit data from a source database 11gR2 (11.2.0.1) protected with Database Vault. The DBAUD collector is collecting all the Database Vault Events, but in all cases the SQL Text column is empty.
    The collector seems to be working fine, I've added the collector user to the Oracle Data Dictionary Realm and I've also granted dv_secanalyst to the user.
    Are there any aditional steps that have to be done in order to get the SQL Text?
    Thanks.

    In case anybody is interested, this error has been filed as bug 11818022 with Oracle Support.
    Thanks.

  • SQL TEXT and ID from previous Snaps

    Hi Gurus,
    Need help please, few days ago a SQL was ran in one of our database release 10.2.0.4 which contains the bind variables values passed by the application. That SQL is not in library cache and can't run due to missing/unknown variable values. I have the SQL text , how can I find the snap id/sql id for this sql text which can search through the snap id (unfortunately I dont have SQL ID either).
    Thanks
    -Samar-

    Hi,
    You can try querying the hist views:
    select sql_id from dba_hist_sqltext where sql_text like '%%';
    dba_hist_active_sess_history
    wrh$_active_session_history
    Do you have any tools like Toad? You can try running an awr or ash report (if you have the license for it) within the approximate time when you think the query was run.
    Thanks and Regards,
    Raj..

  • What is the data dictionary that stores the SQL text of stored procedures?

    I am handling both Oracle 8i on IBM AIX 5L and Oracle9i on SUN Soliars 8 /9.
    What is/are the data dictionary tables, or v$ views that store the SQL text of stored procedured and triggers?
    Thank you in advance!

    If the procedures are not wrapped, you can view them in the dba/all/user_source view. Trigger bodies can be seen in dba/all/user_triggers view.
    Message was edited by:
    Daniel Fink

  • Sql text

    Hi all,
    i checked from sid,serial#,sql_id from gv$session_longops where time_remaining!=0;
    i would like to check the complete sql_text that is executing.
    I have tried from select sql_fulltext from gv$sql; but i can't able to see complete sql command.
    could you please tell me, how i can get the complete sql text.
    I am using: -
    Putty to access HP UNIX box
    oracle 11g

    Use v$sqlarea.sql_fulltext
    select sql_fulltext from v$sqlarea
    where sql_id in (select sql_id from gv$session_longops where time_remaining!=0)Edited by: Chinar on Jan 3, 2011 5:48 AM

  • How to see SQL TEXT for inactive sessions.

    Hi,
    I have SID where the session have been completed.I wanna know,what the session has done.
    Is there any sessions which has SQL TEXT of inactive sessions.
    Thanks.Plz help me.

    Hi,
    As others already suggested, try this SQL below:
    select sess.sid,
           sess.serial#,
           sess.username,
           sql_text
    from v$sqlarea sqlarea, v$session sess
    where sess.prev_hash_value = sqlarea.hash_value
       and sess.prev_sql_addr  = sqlarea.address
       and sess.username is not null
       and sess.status='INACTIVE';   Cheers
    Legatti

  • Sql Profile Error ORA-13786: missing SQL text of statement object "1"

    Hi,
    I am testing a Sql Profile sample executiion with the hint result_cache for faster execution of a query. I have created a tuning task but got no recommendations. But when i tried to create sql profile with the pkg dbms_sqltune.accept_sql_profile i am getting an error. The db version is 11.1.0.7. Given below is the sql and the output.
    Please let me know if you have any suggestions.
    -- Accept SQL Profiles
    SET SERVEROUTPUT ON
    DECLARE
    l_sql_tune_task_id VARCHAR2(2000);
    BEGIN
    l_sql_tune_task_id := DBMS_SQLTUNE.accept_sql_profile (
    task_name => 'Permissionstab_tuning_task',
    name => 'Permissionstab_profile',
    description => 'sql profile for Permissionstab_profile',
    force_match => TRUE);
    --profile_type => DBMS_SQLTUNE.PX_PROFILE);
    DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
    END;
    with profile_type commented out output
    DECLARE
    ERROR at line 1:
    ORA-13786: missing SQL text of statement object "1" for tuning task "Permissionstab_tuning_task"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 11049
    ORA-06512: at "SYS.PRVT_SQLPROF_INFRA", line 30
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 5836
    ORA-06512: at line 4
    including profile_type
    profile_type => DBMS_SQLTUNE.PX_PROFILE);
    ERROR at line 9:
    ORA-06550: line 9, column 35:
    PLS-00302: component 'PX_PROFILE' must be declared
    ORA-06550: line 4, column 5:
    PL/SQL: Statement ignored
    Given below is the complete script and output
    CONN / AS SYSDBA
    GRANT CREATE ANY SQL PROFILE TO ariba;
    GRANT DROP ANY SQL PROFILE TO ariba;
    GRANT ALTER ANY SQL PROFILE TO ariba;
    conn ariba/****;
    EXEC DBMS_SQLTUNE.DROP_TUNING_TASK('Permissionstab_tuning_task');
    -- Tuning task created for a manually specified statement.
    DECLARE
    l_sql VARCHAR2(4000);
    l_sql_tune_task_id VARCHAR2(1000);
    BEGIN
    l_sql := 'SELECT /*+ result_cache */ rootId, pe_DefaultingSetBits, pe_Version, pe_Creator, pe_Active, pe_AdapterSource, pe_AdapterFlag, pe_PartitionN
    umber, '||
    'pe_PurgeState, pe_TimeCreated, pe_TimeUpdated, pe_CommonId, pe_ServerVersion, pe_UniqueName, pe_Name, mls_DefaultingSetBits, '||
    'mls_PrimaryString, mls_MaxTranslationID, mls_Translations, mls_PrimaryStringLanguageID, mls_LocalizationKey, pe_Description, '||
    'mls0_DefaultingSetBits, mls0_PrimaryString, mls0_MaxTranslationID, mls0_Translations, mls0_PrimaryStringLanguageID, '||
    'mls0_LocalizationKey, pe_Created, pe_Modified '||
    'FROM PermissionTab '||
    'where pe_UniqueName = '||''''||'PurchasingAgent'||''''||' '||
    'and ( pe_PurgeState = :1 ) AND pe_PartitionNumber = :2';
    l_sql_tune_task_id := DBMS_SQLTUNE.create_tuning_task (
    sql_text => l_sql,
    user_name => 'ARIBA',
    scope => DBMS_SQLTUNE.scope_comprehensive,
    time_limit => 60,
    task_name => 'Permissionstab_tuning_task',
    description => 'Tuning task for an Permissionstab query.');
    DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
    END;
    EXEC DBMS_SQLTUNE.execute_tuning_task(task_name => 'Permissionstab_tuning_task');
    SELECT task_name, status FROM dba_advisor_log WHERE owner = 'ARIBA';
    SET LONG 10000;
    SET PAGESIZE 1000
    SET LINESIZE 200
    SELECT DBMS_SQLTUNE.report_tuning_task('Permissionstab_tuning_task') AS recommendations FROM dual;
    SET PAGESIZE 24
    -- Accept SQL Profiles
    SET SERVEROUTPUT ON
    DECLARE
    l_sql_tune_task_id VARCHAR2(2000);
    BEGIN
    l_sql_tune_task_id := DBMS_SQLTUNE.accept_sql_profile (
    task_name => 'Permissionstab_tuning_task',
    name => 'Permissionstab_profile',
    description => 'sql profile for Permissionstab_profile',
    force_match => TRUE,
    profile_type => DBMS_SQLTUNE.PX_PROFILE);
    DBMS_OUTPUT.put_line('l_sql_tune_task_id: ' || l_sql_tune_task_id);
    END;
    11:17:17 SYS@FLBUYPM 02-APR-13> @sql_profile_result_cache.sql
    Connected.
    Grant succeeded.
    Grant succeeded.
    Grant succeeded.
    Connected.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    PL/SQL procedure successfully completed.
    TASK_NAME STATUS
    Permissionstab_tuning_task COMPLETED
    RECOMMENDATIONS
    GENERAL INFORMATION SECTION
    Tuning Task Name : Permissionstab_tuning_task
    Tuning Task Owner : ARIBA
    Workload Type : Single SQL Statement
    Scope : COMPREHENSIVE
    Time Limit(seconds): 60
    Completion Status : COMPLETED
    Started at : 04/02/2013 11:17:20
    Completed at : 04/02/2013 11:17:20
    Schema Name: ARIBA
    SQL ID : 2y6yar7r71tj1
    SQL Text : SELECT /*+ result_cache */ rootId, pe_DefaultingSetBits,
    pe_Version, pe_Creator, pe_Active, pe_AdapterSource,
    pe_AdapterFlag, pe_PartitionNumber, pe_PurgeState,
    pe_TimeCreated, pe_TimeUpdated, pe_CommonId, pe_ServerVersion,
    pe_UniqueName, pe_Name, mls_DefaultingSetBits,
    mls_PrimaryString, mls_MaxTranslationID, mls_Translations,
    mls_PrimaryStringLanguageID, mls_LocalizationKey,
    pe_Description, mls0_DefaultingSetBits, mls0_PrimaryString,
    mls0_MaxTranslationID, mls0_Translations,
    mls0_PrimaryStringLanguageID, mls0_LocalizationKey, pe_Created,
    pe_Modified FROM PermissionTab where pe_UniqueName =
    'PurchasingAgent' and ( pe_PurgeState = :1 ) AND
    pe_PartitionNumber = :2
    ADDITIONAL INFORMATION SECTION
    - At least one important bind value was missing for this sql statement. The
    accuracy of the advisor's analysis may depend on all important bind values
    being supplied.
    EXPLAIN PLANS SECTION
    1- Original
    Plan hash value: 778402129
    | Id | Operation | Name | Rows | Byte
    s | Cost (%CPU)| Time |
    | 0 | SELECT STATEMENT | | 1 | 29
    8 | 1 (0)| 00:00:01 |
    | 1 | RESULT CACHE | 9qsg9vxnpk5r13h9gb3wcgujg1 | |
    | | |
    |* 2 | TABLE ACCESS BY INDEX ROWID| PERMISSIONTAB | 1 | 29
    8 | 1 (0)| 00:00:01 |
    |* 3 | INDEX UNIQUE SCAN | ARIBAINDEX341 | 1 |
    | 1 (0)| 00:00:01 |
    Predicate Information (identified by operation id):
    2 - filter("PE_PURGESTATE"=TO_NUMBER(:1))
    3 - access("PE_UNIQUENAME"='PurchasingAgent' AND "PE_PARTITIONNUMBER"=TO_NUMB
    ER(:2))
    Result Cache Information (identified by operation id):
    1 - column-count=30; dependencies=(ARIBA.PERMISSIONTAB); attributes=(single-r
    ow); parameters=(nls, :1, :2); name="SELECT /*+ result_cache */ rootId, pe_Defau
    ltingSetBits, pe_Version, pe_Creator, pe_Active, pe_AdapterSource, pe_AdapterFla
    g, pe"
    DECLARE
    ERROR at line 1:
    ORA-13786: missing SQL text of statement object "1" for tuning task "Permissionstab_tuning_task"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 11049
    ORA-06512: at "SYS.PRVT_SQLPROF_INFRA", line 30
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 5836
    ORA-06512: at line 4
    11:17:20 ARIBA@FLBUYPM 02-APR-13>
    profile_type => DBMS_SQLTUNE.PX_PROFILE);
    ERROR at line 9:
    ORA-06550: line 9, column 35:
    PLS-00302: component 'PX_PROFILE' must be declared
    ORA-06550: line 4, column 5:
    PL/SQL: Statement ignored
    Edited by: 997562 on Apr 2, 2013 8:34 AM

    Hi Experts,
    i too getting this error while attaching the tuning task to the sql profiler, below are the details, appreciate any help on this.
    SQL> SQL> VAR profile_name VARCHAR2(30);
    SQL> BEGIN
       :profile_name := DBMS_SQLTUNE.ACCEPT_SQL_PROFILE(task_name => 'sql_tuning_task');
    END;
    /  2    3    4
    BEGIN
    ERROR at line 1:
    ORA-13786: missing SQL text of statement object "1" for tuning task "sql_tuning_task"
    ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
    ORA-06512: at "SYS.DBMS_SQLTUNE_INTERNAL", line 16442
    ORA-06512: at "SYS.PRVT_SQLPROF_INFRA", line 31
    ORA-06512: at "SYS.DBMS_SQLTUNE", line 7544
    ORA-06512: at line 2
    SQL> select banner from v$version;
    BANNER
    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
    PL/SQL Release 11.2.0.3.0 - Production
    CORE    11.2.0.3.0      Production
    TNS for Linux: Version 11.2.0.3.0 - Production
    NLSRTL Version 11.2.0.3.0 - Production

  • How to extract sql text with SID and SERIAL#

    Hi,
    I am new to oracle database and recently i have started my journey in performance tuning.
    i need to extract sql text which is fired by user based ont SID and SERIAL#.
    Thanks in advance..
    prabha

    seankim wrote:
    Hi~
    select a.sid, a.serial#, b.sql_fulltext
    from   v$session a, v$sql b
    where  decode(a.sql_id,null,a.prev_sql_id, a.sql_id)=b.sql_id
    and    decode(a.sql_id,null,a.prev_child_number, a.sql_child_number)=b.child_number
    and    a.sid=&sid
    and    a.serial#=&serial;
    Also a bad idea - have you checked the exection plan ?
    Do you think it might be a good idea to think about the need for statistics on fixed objects ?
    Here's a possible plan from 11.1.0.7 - and it's not very nice.
    | Id  | Operation                  | Name              | Rows  | Bytes | Cost (%CPU)| Time     |
    |   0 | SELECT STATEMENT           |                   |     1 |  2182 |     0   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS              |                   |     1 |  2182 |     0   (0)| 00:00:01 |
    |   2 |   MERGE JOIN CARTESIAN     |                   |     1 |  2075 |     0   (0)| 00:00:01 |
    |   3 |    NESTED LOOPS            |                   |     1 |    39 |     0   (0)| 00:00:01 |
    |*  4 |     FIXED TABLE FIXED INDEX| X$KSLWT (ind:1)   |     1 |    26 |     0   (0)| 00:00:01 |
    |*  5 |     FIXED TABLE FIXED INDEX| X$KSLED (ind:2)   |     1 |    13 |     0   (0)| 00:00:01 |
    |   6 |    BUFFER SORT             |                   |     1 |  2036 |     0   (0)| 00:00:01 |
    |*  7 |     FIXED TABLE FULL       | X$KGLCURSOR_CHILD |     1 |  2036 |     0   (0)| 00:00:01 |
    |*  8 |   FIXED TABLE FIXED INDEX  | X$KSUSE (ind:1)   |     1 |   107 |     0   (0)| 00:00:01 |
    Predicate Information (identified by operation id):
       4 - filter("W"."KSLWTSID"=82)
       5 - filter("W"."KSLWTEVT"="E"."INDX")
       7 - filter("INST_ID"=USERENV('INSTANCE'))
       8 - filter("S"."INDX"=82 AND "S"."KSUSESER"=53 AND "S"."INST_ID"=USERENV('INSTANCE')
                  AND BITAND("S"."KSSPAFLG",1)<>0 AND BITAND("S"."KSUSEFLG",1)<>0 AND
                  "KGLOBT03"=DECODE("S"."KSUSESQI",NULL,"S"."KSUSEPSI","S"."KSUSESQI") AND
                  "KGLOBT09"=DECODE("S"."KSUSESQI",NULL,DECODE("S"."KSUSEPCH",65535,TO_NUMBER(NULL),"S"."K
                  SUSEPCH"),DECODE("S"."KSUSESCH",65535,TO_NUMBER(NULL),"S"."KSUSESCH")))You need to avoid the "full tablescan" of the library cache.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com

Maybe you are looking for

  • Problems in using database link

    Hi all, I have problems in using the following created database link: Name: fzanalyze User: fzanalyze PWD: xxx Host: fz.domain.com I get the following error message, if I try to start this select: select * from tab@fzanalyze; FEHLER in Zeile 1: ORA-1

  • Query is not working properly when statistics are computed (XE 11g Windows 7 32 bits)

    Hi, We have an application with a Oracle XE 11.2 database on a Windows 7 32 bits plateform. We have a query wich access 4 tables end use a user defined package function. When the statistics are computed the query is returning no rows, (with the data

  • BI Scheduler configuration for a report

    When I schedule a BI Publisher report to send out an email monthly. Where is that information stored in the configuration files? I looked around online and can't find any documentation on where it is stored. Is it stored within the report XDO file it

  • If i login to bank ffox removes id & pwd. ffox wont save changes to history or cookie settings.

    when i log onto my bank it prompts for id and password. i key them in hit enter and the page comes back with id and password empty. i tried changing settings for history from remember history to use custom settings for history, deleting cookies and r

  • Business Role to System/Technical Role Mapping in CUP

    All, In our design of CUP we are having end-users logon and choose their "business role" and having CUP select the system/tecnhical roles. For example, we want an AP Clerk to be able to logon and choose "AP Clerk" and have role A, B & C from ECC sele