DML in PL/SQL

Dear Experts,
I need to update table using PL/SQL procedure, I've built following procedure. The updates are run on date columns and follow format - DD-MON-RRRR HH24:MI:SS.
Any suggestions on how do I retain this format, can I input in the format when I'm entring the date values, If so, could you kindly suggest what's the modification?
CREATE OR REPLACE PROCEDURE USER1.UPDATE_PROC(STP_ACT_CMPL_DTTM_1 IN DATE, ACSL_SRV_ACT_END_DTTM_1 IN DATE, ACSL_MNTR_STP_ID_1 IN NUMBER)
IS
BEGIN
UPDATE SNIOTM.ACSL_MNTR_STP
SET STP_ACT_CMPL_DTTM = TO_DATE(STP_ACT_CMPL_DTTM_1, 'DD-MON-RRRR HH24:MI:SS'),
ACSL_SRV_ACT_END_DTTM = TO_DATE(ACSL_SRV_ACT_END_DTTM_1,'DD-MON-RRRR HH24:MI:SS')
WHERE ACSL_MNTR_STP_ID = ACSL_MNTR_STP_ID_1;
dbms_output.put_line(SQL%ROWCOUNT||' row(s) updated');
END ACCESSORIAL_UPDATE_PROC;
EXEC USER1.UPDATE_PROC('&STP_ACT_CMPL_DTTM_1', '&ACSL_SRV_ACT_END_DTTM_1', &ACSL_MNTR_STP_ID_1);

Date columns are stored in byts - dont have any format. Formats are used only for display purpose, not for storage.
You could pass date itself to the procedure...
CREATE OR REPLACE PROCEDURE USER1.UPDATE_PROC
STP_ACT_CMPL_DTTM_1 IN DATE,
ACSL_SRV_ACT_END_DTTM_1 IN DATE,
ACSL_MNTR_STP_ID_1 IN NUMBER
IS
BEGIN
UPDATE SNIOTM.ACSL_MNTR_STP
--"Remove TO_DATE as the colums are already date datatype"
SET STP_ACT_CMPL_DTTM = STP_ACT_CMPL_DTTM_1,
ACSL_SRV_ACT_END_DTTM = ACSL_SRV_ACT_END_DTTM_1
WHERE ACSL_MNTR_STP_ID = ACSL_MNTR_STP_ID_1;
dbms_output.put_line(SQL%ROWCOUNT||' row(s) updated');
END ACCESSORIAL_UPDATE_PROC;
--"Pass date type arguments in the procedure call.
EXEC USER1.UPDATE_PROC(to_date('&STP_ACT_CMPL_DTTM_1', 'DD-MON-RRRR HH24:MI:SS'),to_date('&ACSL_SRV_ACT_END_DTTM_1', 'DD-MON-RRRR HH24:MI:SS'),&ACSL_MNTR_STP_ID_1);
{code}                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Restricting the user to operate DML's from SQL PLUS Environment

    how to Restrict the user to operate DML statements from SQL PLUS Environment.

    Once you restrict SCOTT user to not be able to do an INSERT command, the SQL*Plus returns an error for user SCOTT when he tries to execute an INSERT statement.
    Note however, that this is enforced by SQL*Plus, not the database!
    Look into the use of product_user_profile from Oracle documentation for more information.
    SQL> insert into product_user_profile values('SQL*Plus', 'SCOTT', 'INSERT', NULL, NULL, 'DISABLED', NULL, NULL) ;
    1 row created.
    SQL> commit ;
    Commit complete.
    SQL> disconnect
    Disconnected from Oracle9i Enterprise Edition Release 9.2.0.3.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.3.0 - Production
    SQL>
    SQL> connect scott
    Enter password:
    Connected.
    SQL>
    SQL> insert into emp select * from emp ;
    SP2-0544: invalid command: insert
    SQL>
    SQL>

  • DML in PL/SQL Function

    Hi,
    I work with a middleware called Ulis.
    And I must access the Oracle DB through this midlleware.
    Ulis only accept select command.
    My problem is that I was to insert data in a table concerning the use of the function.
    How can I do ?
    Because when I try to insert data in the table in the code of the function,
    Oracle reply that DML are not allowed in a query.
    I tried dynamic SQL, but it doesn't work.
    Is it possible to run a procedure in a select order ?
    I really don' t how to do..
    Think you very much for your help.

    A function that manipulates data generally cannot be called from a SELECT statement. Oracle generally prevents SELECT statements from having side effects. Otherwise, doing things like creating read-only user accounts and the majority of query transformation optimizations would be either disallowed or made far more difficult.
    Why do you want data to be written to a table as a result of calling a function in a SELECT statement?
    If you are solely and exclusively concerned with writing logging information, it declaring the function as an autonomous transaction may be a valid option. But before going down this path, please make sure that you understand all the implications of using autonomous transactions. The function would run in a separate transaction scope from the calling application, so it may see different data. Autonomous transactions deviate substantially from what applications expect in terms of transactional consistency. If you are doing anything other than writing logging information, autonomous transactions are almost certainly not the proper solution.
    Justin

  • DDL and DML separators in sql file

    Hi,
    I have sql files with database changes in them. DDL:s and DML:s mixed. Unfortunately I cannot run them without doing some 'cleaning up' witch is very time consuming.
    I would like to write a VB (or similar) program that replaces the ';' with '/' at the end of a statement and puts in '/' after packages e.t.c so I can run the file in one go.
    The problem is to know where a trigger, package, insert, modify and what not, ENDS. What code belongs to object x and y so I know where to put in the '/'.
    Is there a way to find out what is a DDL or DML and where they start and ends?
    Cheers,
    Magnus

    You can remove GO or batch separator if you don't have:
    1. same variables declared in more than 1 batch
    2. CREATE/ALTER VIEW/PROCEDURE statements, they should be first statement in the batch otherwise will fail. (otherwise it will give you following error: CREATE/ALTER VIEW/PROCEDURE' must be the first statement in a query batch.)
    3. there could be more things, just check based upon my above 2 points.
    ~manoj | email: http://scr.im/m22g
    http://sqlwithmanoj.wordpress.com
    MCCA 2011 | My FB Page

  • How to generate dml scripts through sql prompt

    Hi friends,
    As we ve DBMS_METADATA.GET_DDL to create ddl scripts can we ve something to take out dml scripts..Not through TOAD i want through prompt...
    Thks
    Sonal...

    Hi,
    to take out dml scriptsNot sure what you mean...
    Did you want to get the current statement against your database ?
    Nicolas.

  • LOCKS checking user locked and SQL that he is executing

    Hello all,
    I have this script that inserts into a table the user causing the lock and the users waiting for the lock to be released.
    What I would like to add into this the script is the SQL string that the user causing the lock and the users waiting for the the lock to be released are executing.
    Can you help me on this?
    Script that I have now:
    insert into dba.sessions_bloq
    select sysdate "Data", w.sid "SID E", s1.username "User E", s1.osuser "OS User E", s1.machine "Maquina E", s1.program "Programa E", s1.logon_time "Logon E",
    s.ksusenum "SID B", s2.username "User B", s2.osuser "OS User B", s2.machine "Maquina B", s2.program "Programa B", s2.logon_time "Logon B"
    ,decode(r.ksqrsidt,
    ''MR'', ''Media Recovery'',
    ''RT'', ''Redo Thread'',
    ''UN'', ''User Name'',
    ''TX'', ''Transaction'',
    ''TM'', ''DML'',
    ''UL'', ''PL/SQL User Lock'',
    ''DX'', ''Distributed Xaction'',
    ''CF'', ''Control File'',
    ''IS'', ''Instance State'',
    ''FS'', ''File Set'',
    ''IR'', ''Instance Recovery'',
    ''ST'', ''Disk Space Transaction'',
    ''TS'', ''Temp Segment'',
    ''IV'', ''Library Cache Invalidation'',
    ''LS'', ''Log Start or Switch'',
    ''RW'', ''Row Wait'',
    ''SQ'', ''Sequence Number'',
    ''TE'', ''Extend Table'',
    ''TT'', ''Temp Table'',
    r.ksqrsidt) "Tipo Lock"
    from gv$session_wait w, x$ksqrs r, gv$_lock l, x$ksuse s, gv$session s1, gv$session s2
    where w.wait_Time = 0
    and w.event = ''enqueue''
    and r.ksqrsid1 = w.p2
    and r.ksqrsid2 = w.p3
    and r.ksqrsidt = chr(bitand(p1,-16777216)/16777215)||
    chr(bitand(p1,16711680)/65535)
    and l.block = 1
    and l.saddr = s.addr
    and l.raddr = r.addr
    and s.inst_id = userenv(''Instance'')
    and w.sid = s1.sid
    and w.inst_id = s1.inst_id
    and s.ksusenum = s2.sid
    and s.inst_id = s2.inst_id;
    Thanks in advance

    You can link to:
    gv$sql
    gv$sqltext_with_newlines
    but, if doing this in a trigger, also look at these:
    http://www.psoug.org/reference/system_events.html

  • On DML operations Locked held on Parent tables.

    Hi All,
    Am trying to delete records from a table such as
    DELETE /*+ index(EVENT_JOURNAL row_ts_idx) */  FROM EVENT_JOURNAL WHERE trunc(ROW_TS)= TO_date('09/05/2012','DD/MM/YYYY');table has function based index on row_ts column
    Plan
    DELETE STATEMENT  ALL_ROWSCost: 138  Bytes: 502 K  Cardinality: 8 K             
        3 DELETE BENCHMARKDEV.EVENT_JOURNAL        
            2 TABLE ACCESS BY INDEX ROWID TABLE BENCHMARKDEV.EVENT_JOURNAL Cost: 138  Bytes: 502 K  Cardinality: 8 K     
                1 INDEX RANGE SCAN INDEX BENCHMARKDEV.ROW_TS_IDX Cost: 23  Cardinality: 8 K  Above delete operation takes much time to delete 273 rows
    I have check that above DML perform getting locked on its parent table. such as
    select    OS_USER_NAME os_user,
        PROCESS os_pid,
        ORACLE_USERNAME oracle_user,
        l.SID oracle_id,
        decode(TYPE,
            'MR', 'Media Recovery',
            'RT', 'Redo Thread',
            'UN', 'User Name',
            'TX', 'Transaction',
            'TM', 'DML',
            'UL', 'PL/SQL User Lock',
            'DX', 'Distributed Xaction',
            'CF', 'Control File',
            'IS', 'Instance State',
            'FS', 'File Set',
            'IR', 'Instance Recovery',
            'ST', 'Disk Space Transaction',
            'TS', 'Temp Segment',
            'IV', 'Library Cache Invalidation',
            'LS', 'Log Start or Switch',
            'RW', 'Row Wait',
            'SQ', 'Sequence Number',
            'TE', 'Extend Table',
            'TT', 'Temp Table', type) lock_type,
        decode(LMODE,
            0, 'None',
            1, 'Null',
            2, 'Row-S (SS)',
            3, 'Row-X (SX)',
            4, 'Share',
            5, 'S/Row-X (SSX)',
            6, 'Exclusive', lmode) lock_held,
        decode(REQUEST,
            0, 'None',
            1, 'Null',
            2, 'Row-S (SS)',
            3, 'Row-X (SX)',
            4, 'Share',
            5, 'S/Row-X (SSX)',
            6, 'Exclusive', request) lock_requested,
        decode(BLOCK,
            0, 'Not Blocking',
            1, 'Blocking',
            2, 'Global', block) status,
        OWNER,
        OBJECT_NAME
    from    v$locked_object lo,
        dba_objects do,
        v$lock l
    where     lo.OBJECT_ID = do.OBJECT_ID
    AND     l.SID = lo.SESSION_ID
    oracle     6624     BENCHMARKDEV     216     DML     Row-X (SX)     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNIT
    oracle     6624     BENCHMARKDEV     216     DML     Row-X (SX)     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNIT
    oracle     6624     BENCHMARKDEV     216     DML     Row-X (SX)     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNIT
    oracle     6624     BENCHMARKDEV     216     DML     Row-X (SX)     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNIT
    oracle     6624     BENCHMARKDEV     216     DML     Row-X (SX)     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNIT
    oracle     6624     BENCHMARKDEV     216     DML     Row-X (SX)     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNIT
    oracle     6624     BENCHMARKDEV     216     DML     Row-X (SX)     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNIT
    oracle     6624     BENCHMARKDEV     216     DML     Row-X (SX)     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNIT
    oracle     6624     BENCHMARKDEV     216     DML     Row-X (SX)     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNIT
    oracle     6624     BENCHMARKDEV     216     Transaction     Exclusive     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNIT
    oracle     6624     BENCHMARKDEV     216     DML     Row-X (SX)     None     Not Blocking     BENCHMARKDEV     BUSINESS_UNITI don't know on what basis parent tables are get locked?
    Please help me out to resolve..
    Thanks & Regards
    Sami
    Edited by: Sami on May 16, 2012 3:14 PM
    Edited by: Sami on May 16, 2012 3:15 PM

    Hi Sami,
    Your dont event need Function Based Index on ROW_TS. A normal B*Tree index on ROW_TS will do the trick and also reduce the time for index sorting.
    DELETE FROM EVENT_JOURNAL WHERE ROW_TS >= TO_date('09/05/2012','DD/MM/YYYY') AND ROW_TS < TO_date('10/05/2012','DD/MM/YYYY');
    {code}
    {code}
    Above delete operation takes much time to delete 273 rows
    {code}
    # Is EVENT_JOURNAL parent table and has foreign key references from other tables ?
    # How many records are there in EVENT_JOURNAL ?
    # Check data dictionary view - DBA_WAITERS to see waiting/holding session                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • Simple query returns wrong results in Sql 2012

    On my Windows 8 box running Sql 2012 11.0.3128, this query returns an IncludeCount of 0 and an ExcludeCount of 1.
    On my Windows 7 box running Sql 2008 10.50.2550 this query returns an IncludeCount of 3 and an ExcludeCount of 1, which is correct.
    In short, it runs properly on these versions of OS and Sql's:
    Windows 2008 R2 + Sql 10.50.2550
    Windows 2008 R2 + Sql 10.50.4000
    Windows 2012 SP1 + Sql 11.0.3000
    Windows 7 + Sql 11.0.2100
    And gives incorrect results on these OS's and Sql's (so far, tested):
    Windows 8 Enterprise + Sql 11.0.3128
    Windows 2008 R2 + Sql 10.50.2550
    I wondered if anyone else can reproduce this?  I can't figure out the magic combination of OS and SQL version this breaks on.
    In all scenarios, the resulting @filters table is populated correctly, and the [Include] column is properly set to a 1 or a 0, so why aren't the other variables being properly set?
    If I change the [ID] column to NONCLUSTERED, it works fine, too.  It doesn't matter if @filters is a TVP or a temp table or an actual table, same (incorrect) results in each case.
    DECLARE @filters TABLE([ID] bigint PRIMARY KEY, [Include] bit)
    DECLARE @excludecount int = 0
    DECLARE @includecount int = 0
    DECLARE @id bigint
    INSERT INTO @filters ([ID])
    VALUES (1), (3), (4), (-7)
    UPDATE @filters SET
        @id = [ID],
        @includecount = @includecount + (CASE WHEN @id > 0 THEN 1 ELSE 0 END),
        @excludecount = @excludecount + (CASE WHEN @id < 0 THEN 1 ELSE 0 END),
        [Include] = CASE WHEN @id > 0 THEN 1 ELSE 0 END,
        [ID] = ABS(@id)
    SELECT @includecount as IncludeCount, @excludecount as ExcludeCount
    SELECT * FROM @filters

    What part is undocumented?
    http://technet.microsoft.com/en-us/library/ms177523.aspx
    The above link states I can update variables inside an UPDATE statement ...
    But it does not say what the correct result of what you are trying to would be. Variable assignment in UPDATE only makes sense if the UPDATE hits one row. If the UPDATE matches several rows, which value you the variable is set to is not defined.
    It gets even more complicated when you have the variable on both sides of the expression. But I'd say that the only two values that makes as the final value of @includecount 0. An UPDATE statement, like other DML statements in SQL, is logically defined
    as all-at-once. There are no intermediate results. Therefore the only possible values are the initial value of @includecount plus the value of the CASE statement, which always should returns 0, since @id is NULL when the UPDATE statement starts to execute.
    I'm afraid that what you have is nonsense from a language perspective, and the result is undefined. Whenever you get different results from a query depending on whether you have certain indexes in place, you know that the query is indeterministic. There
    are certainly part of SQL that are indeterministic, for instance ORDER BY on a non-unique columns. But in this particular case you have also wandered out into the land that is also undefined.
    I'm not sure what you are trying to achieve, but I can only advice you to go back to the drawing board.
    Erland Sommarskog, SQL Server MVP, [email protected]

  • Equivalent DML Program, involves Max with Rank 1.  Perf Issues.

    Hoping that someone could shed some light on how one might be able to perform the same using OLAP DML instead of SQL with decent performance.
    PRICE, DT and TM are dimensions. EQUITY_VP_VIEW is a cube with a single measure based on SUM, volume. I am able to obtain the price which contains the maximum volume on a given day. The SQL Query is straight forward. As shown below and returns instantly.
    SELECT *
    FROM
    (SELECT d.end_date date_id,
    p.short_description price,
    e.volume,
    row_number() over (partition BY d.end_date order by e.volume DESC) rank
    FROM EQUITY_VP_VIEW e,
    DT_H_VIEW d,
    ES_PRICE_H_VIEW p,
    TM_H_VIEW t
    WHERE e.dt = d.dim_key
    AND e.es_price = p.dim_key
    AND d.level_name = 'DAY'
    AND e.tm = t.dim_key
    AND t.level_name = 'ALL_TIME'
    AND p.level_name = 'PRICE'
    ORDER BY d.end_date
    WHERE rank = 1
    Trying to perform the same via DML. See below. This takes 84 seconds to return. Would appreciate any input.
    argument _tm TM
    argument _dt DT
    variable _lg number
    variable _ret number
    _ret = na
    limit es_price_new to ES_PRICE_NEW_LEVELREL eq 'PRICE'
    lg = largest(EQUITYVP_VOLUME(TM tm DT dt))
    if _lg ne na
    then do
    limit ES_PRICE_NEW keep EQUITY_VP_VOLUME(TM tm DT dt) eq _lg ifnone SKIP1
    ret = convert(ESPRICE_NEW_SORT_ATTR, number)
    doend
    SKIP1:
    return _ret                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

    Have you tried defining a calculated measure that returns the rank? You should be able to do it in AWM and the measure expression would look something like this:
    RANK() OVER HIERARCHY (
      ES_PRICE_NEW.HIER_NAME
      ORDER BY EQUITY_VP.VOLUME ASC NULLS LAST
      WITHIN LEVEL)You can then use the generated formula in OLAP DML or the column in SQL as you need. If you want to use raw OLAP DML, then consider using the "LIMIT TO TOP n BASEDON expression" command instead of a combination of LARGEST and LIMIT. Also, drop the "EQ" in your first limit before the 'PRICE'.
    limit es_price_new to ES_PRICE_NEW_LEVELREL 'PRICE'
    limit es_price_new keep top 1 basedon EQUITY_VP_VOLUME(TM _tm DT _dt)

  • How to implement & run VBScript within SQL 2008?

    Hello what are the steps to implement/configure a VBScript (with .config file) with SQL 2008?
    (The VBScript file is a sync process that does DMLs within the SQL Server DB that it's on and also updates data on an exterior DB.)
    (Perhaps within a Stored Procedure-Job best way?)
    Thanks in advance.

    Although you could probably accomplish this with a SQLCLR proc, my opinion is an ETL process is better suited for SSIS.  I suggest a job that executes an SSIS package with a Script task.  You can use SSIS configurations to pass the configurable
    value to the script at run time via package variables. 
    Dan Guzman, SQL Server MVP, http://www.dbdelta.com

  • Oracle Database에서... MS-SQL

    궁금한게 있습니다.
    MS-SQL에서 오라클을 연결하여 DML명령을 사용 할 수 있는데..
    오라클에서는 MS-SQL서버를 연결하여 어떻게 DML명령을 사용하는지 궁금합니다.
    오라클 데이터베이스에서 -> MS-SQl서버를 연결하여 사용하는 방법좀 알려주세요... 꾸벅

    일반적으로 ORACLE -> 이기종 DB로의 통신은 Transaparent Gateway 제품을 통해서
    가능합니다.
    대부분의 MSSQL 에서 사용하는 SELECT, DML 기능이 사용가능합니다.
    그러나 가장 확실한 방법이지만 TG 제품은 추가적인 비용이 발생합니다.
    또다른 방법은 HSODBC 를 설정하는 방법이 있습니다.
    HODBC 의 자세한 설정내용은 다음을 참조하세요.
    http://www.hbkr.net/zboard/zboard.php?id=dev_src&page=1&sn1=&divpage=1&sn=off&ss=on&sc=on&select_arrange=headnum&desc=asc&no=102

  • Extract SQL history from 10046 trace files

    Hi all,
    I need to extract the complete sql history from sql trace files to "debug" a client application.
    I know I can read the raw trc file and rebuild the sql history looking for the PARSING / EXEC / FETCH entries.
    However, this is a very long and boring manual task: do you know if there is some free tool to automate this task?
    thanks
    Andrea

    user585511 wrote:
    I agree that the 10046 trace captures everything. If I do read the raw trc file I see the DML. The problem is that tkprof's record does not record the DML (maybe it thinks that some DML is recursive sql and it gets misleaded... I am not sure) so I am looking for an alternate tool to process 10046 trace files
    Regards
    AndreaReally?
    Generate a trace of some dml:
    oracle:orcl$
    oracle:orcl$ sqlplus /nolog
    SQL*Plus: Release 11.2.0.1.0 Production on Thu May 16 08:28:55 2013
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    SQL> conn snuffy/snuffy
    Connected.
    SQL> alter session set tracefile_identifier = "snuffy_session";
    Session altered.
    SQL> alter session set events '10046 trace name context forever, level 12';
    Session altered.
    SQL> insert into mytest values (sysdate);
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> ALTER SESSION SET EVENTS '10046 trace name context off';
    Session altered.
    SQL> exitrun tkprof on the trace
    oracle:orcl$ ls -l $ORACLE_BASE/diag/rdbms/$ORACLE_SID/$ORACLE_SID/trace/*snuffy
    *.trc
    -rw-r----- 1 oracle asmadmin 3038 May 16 08:29 /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_4086_snuffy_session.trc
    oracle:orcl$ tkprof /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_4086_snu
    ffy_session.trc snuffy.rpt waits=YES sys=NO explain=system/halftrack
    TKPROF: Release 11.2.0.1.0 - Development on Thu May 16 08:31:32 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.Look at the report:
    oracle:orcl$ cat snuffy.rpt
    TKPROF: Release 11.2.0.1.0 - Development on Thu May 16 08:31:32 2013
    Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
    Trace file: /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_4086_snuffy_session.trc
    Sort options: default
    count    = number of times OCI procedure was executed
    cpu      = cpu time in seconds executing
    elapsed  = elapsed time in seconds executing
    disk     = number of physical reads of buffers from disk
    query    = number of buffers gotten for consistent read
    current  = number of buffers gotten in current mode (usually for update)
    rows     = number of rows processed by the fetch or execute call
    SQL ID: 938dgt554gu98
    Plan Hash: 0
    insert into mytest           <<<<<<<<<<<<<<<< oh my!  Here is the insert statement
    values
    (sysdate)
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          1          5           1
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.00          0          1          5           1
    Misses in library cache during parse: 0
    Optimizer mode: ALL_ROWS
    Parsing user id: 86  (SNUFFY)
    Rows     Row Source Operation
          0  LOAD TABLE CONVENTIONAL  (cr=1 pr=0 pw=0 time=0 us)
    error during execute of EXPLAIN PLAN statement
    ORA-00942: table or view does not exist
    parse error offset: 83
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       1        0.00          0.00
      SQL*Net message from client                     1        3.35          3.35
    SQL ID: 23wm3kz7rps5y
    Plan Hash: 0
    commit
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          1           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.00          0          0          1           0
    Misses in library cache during parse: 0
    Parsing user id: 86  (SNUFFY)
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       2        0.00          0.00
      SQL*Net message from client                     2        4.72          8.50
      log file sync                                   1        0.00          0.00
    SQL ID: 0kjg1c2g4gdcr
    Plan Hash: 0
    ALTER SESSION SET EVENTS '10046 trace name context off'
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        1      0.00       0.00          0          0          0           0
    Execute      1      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        2      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
    Parsing user id: 86  (SNUFFY)
    OVERALL TOTALS FOR ALL NON-RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        3      0.00       0.00          0          0          0           0
    Execute      3      0.00       0.00          0          1          6           1
    Fetch        0      0.00       0.00          0          0          0           0
    total        6      0.00       0.00          0          1          6           1
    Misses in library cache during parse: 0
    Elapsed times include waiting on following events:
      Event waited on                             Times   Max. Wait  Total Waited
      ----------------------------------------   Waited  ----------  ------------
      SQL*Net message to client                       3        0.00          0.00
      SQL*Net message from client                     3        4.72         11.86
      log file sync                                   1        0.00          0.00
    OVERALL TOTALS FOR ALL RECURSIVE STATEMENTS
    call     count       cpu    elapsed       disk      query    current        rows
    Parse        0      0.00       0.00          0          0          0           0
    Execute      0      0.00       0.00          0          0          0           0
    Fetch        0      0.00       0.00          0          0          0           0
    total        0      0.00       0.00          0          0          0           0
    Misses in library cache during parse: 0
        3  user  SQL statements in session.
        0  internal SQL statements in session.
        3  SQL statements in session.
        0  statements EXPLAINed in this session.
    Trace file: /u01/app/oracle/diag/rdbms/orcl/orcl/trace/orcl_ora_4086_snuffy_session.trc
    Trace file compatibility: 11.1.0.7
    Sort options: default
           1  session in tracefile.
           3  user  SQL statements in trace file.
           0  internal SQL statements in trace file.
           3  SQL statements in trace file.
           3  unique SQL statements in trace file.
          58  lines in trace file.
           8  elapsed seconds in trace file.
    oracle:orcl$

  • Enterprise feature usage: SQL Profile

    Is SQL Profile an enterprise Edition feature only?  As in, just making use of a profile that was not created in this database?
    I've got a development environment, which is licensed for everything.  I create an SQL Profile for a bad statement on that Enterprise database, then I transfer it to a standard edition database using:
    How to copy SQL Profile from one database to another one. | David Marcos&amp;#039; Blog
    When I now execute the statement, I can see that it used the profile, but the following statement returns no hits for me having used this feature:
    col name for a50
    alter session set nls_date_format='dd month yyyy';
    select '##  Enterprise Edition Feature Usage Overview:' from dual;
    Select name,version,first_usage_date,last_usage_date from dba_feature_usage_statistics where name in ('Advanced Replication','AWR Report','AWR Baseline','Automatic Workload Repository','Backup Encryption','Backup ZLIB Compression','Block Media Recovery','Database Replay: Workload Capture','Database Replay: Workload Replay','Diagnostic Pack','EM Performance Page','Flashback Database','Label Security','OLAP - Analytic Workspaces','OLAP - Cubes','Oracle Secure Backup','Parallel SQL DDL Execution','Parallel SQL DML Execution','Parallel SQL Query Execution','Partitioning (user)','Real-Time SQL Monitoring','Result Cache','SQL Monitoring and Tuning pages','SQL Plan Management','SQL Tuning Set (user)','SecureFile Encryption (user)','Spatial','Tune MView','Tuning Pack','Automatic Maintenance - SQL Tuning Advisor','SQL Profile','SQL Tuning Advisor','SQL Tuning Set (user)') and first_usage_date is not null order by first_usage_date asc;
    So my question is: if i've not created the profile in the Standard Edition database... it's just been imported from another database... Am I violating my licensing?

    Hi,
    > So my question is: if i've not created the profile in the Standard Edition database... it's just been imported from another database... Am I violating my licensing?
    You are even violating your Oracle EE license, if you do not have a valid Diagnostics + Tuning pack for it. You can reproduce this very easily as described by Kerry Osborne here: Licensing Requirements for SQL Profiles
    SQL Plan Management is included in Oracle EE as an alternative for example: Does the use of SQL Plan Management and the DBMS_SPM database package require a tuning or diagnostic pack license?
    Regards
    Stefan

  • How to find out which user has locked a particular record of a table

    Hi
    Is it possible to know - which user has locked a particular record (I know the primary key of the record) of a table
    Regards

    select     OS_USER_NAME os_user,
         PROCESS os_pid,
         ORACLE_USERNAME oracle_user,
         l.SID oracle_id,
         decode(TYPE,
              'MR', 'Media Recovery',
              'RT', 'Redo Thread',
              'UN', 'User Name',
              'TX', 'Transaction',
              'TM', 'DML',
              'UL', 'PL/SQL User Lock',
              'DX', 'Distributed Xaction',
              'CF', 'Control File',
              'IS', 'Instance State',
              'FS', 'File Set',
              'IR', 'Instance Recovery',
              'ST', 'Disk Space Transaction',
              'TS', 'Temp Segment',
              'IV', 'Library Cache Invalidation',
              'LS', 'Log Start or Switch',
              'RW', 'Row Wait',
              'SQ', 'Sequence Number',
              'TE', 'Extend Table',
              'TT', 'Temp Table', type) lock_type,
         decode(LMODE,
              0, 'None',
              1, 'Null',
              2, 'Row-S (SS)',
              3, 'Row-X (SX)',
              4, 'Share',
              5, 'S/Row-X (SSX)',
              6, 'Exclusive', lmode) lock_held,
         decode(REQUEST,
              0, 'None',
              1, 'Null',
              2, 'Row-S (SS)',
              3, 'Row-X (SX)',
              4, 'Share',
              5, 'S/Row-X (SSX)',
              6, 'Exclusive', request) lock_requested,
         decode(BLOCK,
              0, 'Not Blocking',
              1, 'Blocking',
              2, 'Global', block) status,
         OWNER,
         OBJECT_NAME
    from     v$locked_object lo,
         dba_objects do,
         v$lock l
    where      lo.OBJECT_ID = do.OBJECT_ID
    AND l.SID = lo.SESSION_ID
    hope this helps
    Zekeriya

  • How to get all INDEXes from a database

    How to get all INDEXes in a database? I need to store them in script file (.SQL). My database version is 10.2.0.3.0.
    Edited by: Iniyavan on Sep 18, 2009 1:39 PM

    --Thanks, Koppelaars. The second query works. But I'm unable to store in spool file. May be it's due to CLOBs in the output. I did the following:
    set head off
    set feedback off
    set linesize 32727
    set pagesize 50000
    spool c:\indexes.sql
    select dbms_metadata.get_ddl('INDEX',INDEX_NAME,'MYSCHEMA')
    from user_indexes;
    spool off
    --In the spool file, I find only this
    CREATE UNIQUE INDEX "MYSCHEMA"."A" ON "MYSCHEMA"."BNK_DEALID" ("DEAL_ID")
    PCTF
    CREATE INDEX "MYSCHEMA"."ACCENT_RAC_REPORT" ON "MYSCHEMA"."ACCENT" ("SCHEME", "VAL
    CREATE INDEX "MYSCHEMA"."ACCENT_REPORT" ON "MYSCHEMA"."ACCENT" ("SCHEME", "APP_REF
    CREATE UNIQUE INDEX "MYSCHEMA"."ACCENT_X" ON "MYSCHEMA"."ACCENT" ("DEAL_ID")
    P
    CREATE UNIQUE INDEX "MYSCHEMA"."ACCNAV_X" ON "MYSCHEMA"."ACCNAV" ("SCHEME", "ACCNA
    --How to get all the DMLs in one SQL file?
    --Nagappan, I'm using WIN.

Maybe you are looking for

  • Error while saving a Entry through view cluster ( getting TK 319 message)

    We are  facing an issue while saving the entry in one of the view at the lowest level of the three level View cluster. Please find the Details of view Cluster below. 1)First level- Key  => MANDT( CLNT, 3) + RULE_ID( CHAR , 20) . 2)Second level-Key =>

  • How can I authorise my computer when the email address no longer exists

    Yesterday, due to software problems I had to have my computer wiped. I reinstalled iTunes and loaded all my music, films etc back on (these are kept on a hard drive) with no problems. I now have about 120 songs/videos that will not play as they were

  • Adobe Flash Player 11.3 r300 crashes

    I just had an update for Adobe Flash Player, and ever since then I have had multiple crashes every time I try to play a youtube video. It will work for a few minutes, then will randomly crash Firefox. If I go to Task Manager and end Adobe Flash Playe

  • What is a "cfm" file??

    I foud a file containing som javascripts called cfm. What does this cfm mean and is it possible to use it in a regular jsp page??

  • P6 R8.3 Problems with BI Publisher, Team Member

    Hi I am setting up a demo server with P6 R8.3 EPPM. The process I have followed so far is: Install Windows Server 2008 R2 SP1 on the box (2 x Quad Core Xeon, 16GB RAM, 2 x 300GB drives) Install SQL Server 2005 and copy across our current demo R8.2 EP