Truncate command

With truncate command the default option is drop ,how about reuse ?
truncate table table_name reuse ;
What does reuse mean here .
With regards

Check this out.
http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96540/statements_107a.htm#2067573

Similar Messages

  • Database in noarchivelog mode, truncate command issued

    Database in noarchivelog mode, truncate command has been issued how to restore the table?
    FACTS:-
    1. DB In noarchivelog Mode
    2. Cannot enable flash back mode because of 1. above
    3. No exports available
    4. No backup's Available.
    Any thoughts ?

    Oracle Support/ Professional Services has a Data Unloader (DUL) and ORA-00600 has DUDE, both of which may be able to extract information from data files that are corrupted, where the control files are lost, etc.
    These are not, however, cheap utilities. Unless the data itself is really valuable, it is generally not a viable option.
    Justin

  • "Table Action: Override OPI truncate command"

    Hi All,
    I am working on BI Apps 7.9.6.3, informatica 9.0 , DAC and OBIEE 11g.
    I am doing SCM full load, i have face some issue like
    executing sql (Truncate OPI:ORA_R12)
              Call apps.OPI_OBIA_BOMPEXPL_WRAPPER_PKG.do_sql('TRUNCATE TABLE OPI.OPI_OBIA_W_BOM_HEADER_DS')
              "Truncate OPI" failed on "ORA_R12"
              sql: Call apps.OPI_OBIA_BOMPEXPL_WRAPPER_PKG.do_sql('TRUNCATE TABLE OPI.OPI_OBIA_W_BOM_HEADER_DS')
              Error: MESSAGE:::ORA-06576: not a valid function or procedure name
    :OPI_OBIA_W_BOM_HEADER_DS:"Table Action: Override OPI truncate command"
    how to solve this issue...
    Please give me your suggestions.
    Regards
    Prashant

    Hi,
    we also had faced the same issue,
    for this, first we need to run table scripts for creating BOM tables in ur source. U have look into the BI Apps configuration guide for more details.
    If ur schema in which u r creating the table is not apps. In DAC, goto tools->seed data->Actions->table actions and select the task 'OPI Truncate table" and click on the value corresponding to that action and change the schema name and trigger the load.
    Thanks

  • Auditing question executing the TRUNCATE command.

    Hello.
    We have some audit controls in place that interrogate SQL codes to determine whether an INSERT, UPDATE or DELETE command has been executed by a user. However, when a user executes a TRUNCATE command, an sudit record is not generated. Since I cannot find a specific code for Truncate, I was thinking that the code that caputes a DELETE command would work... but it doesn't appear that is the case.
    We only have a very few users that can issue the TRUNCATE command, but I'd like to know if anyone knows of a specific code for TRUNCATE. Or if anyone has an idea how we could generate AUDIT records when a user does issue a TRUNCATE command.
    Thanks!

    There is certainly a lot of bad information floating around on this topic.
    "Audit table" will audit create table, drop table and truncate table - which is absolutely true. It is the ONLY way to reliably audit truncate table operations.
    Object auditing on a specific table (e.g. audit all on scott.mytab) never creates an audit record for truncation.
    You can audit "DROP ANY TABLE" which will create an audit record ONLY when someone with the DROP ANY TABLE system privilege attempts to truncate a table in another schema.
    Contrary to what some "experts" (including at least one ACE) think, "audit truncate table" is NOT valid syntax.
    "Audit truncate" does not return an error, but (as far as I can tell and I've actually tested it on 9.2.0.4, 10.2.0.1, 10.2.0.5 and 11.2.0.3) it does nothing. It creates no record in DBA_STMT_AUDIT_OPTS or DBA_PRIV_AUDIT_OPTS and it never produces a record in the audit trail. It is a half-baked auditing option that does not actually work - so, "audit truncate" should return an error!

  • Report6i is getting hanged when i am using truncate command in srw.do_sql

    Hi All,
    I am using Reports 6.0.8.18.0 and oracle 9.2.0.1 on Windows XP with SP1.
    I am having a report in which i have used "truncate table <tablename>" command using SRW.do_sql command. some times report is getting hanged and some times it is giving an error as given below
    18:26:52 ERR REP-1425: 'afterpform': Error running DO_SQL package - 'Error parsing the SQL statement.
    ORA-04021: timeout occurred while waiting to lock object <object name >
    When i checked with the Oracle 8.1.7 database it is working fine.
    is there any patches are requried at database side ?
    Can any body help me in this.
    Regards,
    Gouri

    First: you should get a new keyboard. Seems your shift-key is stuck.
    Second: A header of a post is a header and not for a summary of your question
    Third: This is the forum for the tool SQL Developer. Please mark this question as answered and post again in Forms
    Forth: When you expect an answer, the least would be to include the errormessage and your forms version.
    Regards
    Marcus

  • Help me with TRUNCATE command

    1 begin
    2 TRUNCATE TABLE atrd.revrec;
    3* eND;
    SQL> /
    TRUNCATE TABLE atrd.revrec;
    ERROR at line 2:
    ORA-06550: line 2, column 11:
    PLS-00103: Encountered the symbol "TABLE" when expecting one of the following:
    := . ( @ % ;
    The symbol ":= was inserted before "TABLE" to continue.

    Check out this procedure. i think your problem will solve your all problems.
    declare
    mcount int;
    my_drop varchar2(500):='drop table emp';
    my_create varchar2(500):='create table emp as select * from LG_TYPES';
    my_trunc varchar2(200):='truncate table emp';
    begin
    select count(*) into mcount from tab where UPPER(LTRIM(RTRIM(TNAME)))='ABC#';
    if mcount>0 then
    delete from abc#;
    execute immediate my_drop;
    end if;
    execute immediate my_create;
    execute immediate my_trunc;
    end;

  • Acquire with NOWAIT error and TRUNCATE command

    Why is it that, sometimes when i try to TRUNCATE a table. I would get
    ORA-00054: resource busy and acquire with NOWAIT specified error. And i would be able to DELETE the same table using DELETE FROM table_name;
    Message was edited by:
    C. Boutet

    Because some other session has a lock on that table, you can delete it because you are in fact deleting your read consistent view of the table. See this test case:
    In session 1:
    YAS@10G>create table t as select * from dual;
    Table created.
    YAS@10G>insert into t values(2);
    1 row created.In session 2:
    YAS@10G>truncate table t;
    truncate table t
    ERROR at line 1:
    ORA-00054: resource busy and acquire with NOWAIT specified
    YAS@10G>delete from t;
    1 row deleted.
    YAS@10G>commit;
    Commit complete.
    YAS@10G>select * from t;
    no rows selectedI was not able to truncate it because session 1 inserted a row and it is holding a lock on the table. I could delete from the table because the rows I want to delete are not locked.
    TRUNCATE is DDL and it needs an exclusive lock on the table. Session 1 is holding a shared lock on the table which does not permit the other session to get an exclusive lock.

  • Internal Behaviour of Truncate Table Command in Oracle Database

    Hi,
    Can anyone let me know the internal behaviour of Truncate Table Command in Oracle Database?
    Thanks,
    Harshad.

    Hi Tuhinshoor,
    I know the functioning of Truncate Command.
    But, I needed to know whether it drops the table before recreating it, maintaining all the indexes and constraints intact??
    Thanks,
    Harshad.

  • ORA-00942 error on truncating a table with a XML Index

    Oracle Version: 11.2.0.1.0
    When truncate command fails with error "ORA-00942: table or view does not exist" when run against a table with an XML Index defined
    SQL> CREATE TABLE XML_TEST
    2 (
    3 ID INTEGER,
    4 TESTXML SYS.XMLTYPE
    5 );
    Table created.
    SQL> truncate table XML_TEST;
    Table truncated.
    SQL> CREATE INDEX xmlindex ON XML_TEST(TESTXML)
    2 indextype IS xdb.xmlindex
    3 parameters ('PATH TABLE MY_PATH_TABLE');
    Index created.
    SQL> truncate table XML_TEST;
    truncate table XML_TEST
    ERROR at line 1:
    ORA-00942: table or view does not exist
    SQL> Drop Index xmlindex;
    Index dropped.
    SQL> truncate table XML_TEST;
    Table truncated.

    No, I don't think that explanation is correct. I don't think it has to do with user privs. besides, we don't
    adjust rowids on an import -- we recreate the index, just like a b-tree index import would.
    This should be working. It's most likely a bug in our (i.e. Text) import code -- SYS.XMLTYPE is a little
    strange because under the covers it's actually a function-based index.
    I will test it out and file a bug if I can reproduce the behavior on solaris.

  • Use of truncating table

    Hi,
    I'm using some temporary load tables which are populated with bulk data daily & data is deleted after processing.
    During processing, I found that suddenly select statements became very slow inspite of very small data.
    Then I ran truncate command on the table & the select queries became faster as were before.
    Here I want to know the significance of running truncate on tables on a fixed time as there are tables in production which are being populated & deleted daily but never truncated.
    As truncate directly pulls down the water mark to 0, is there any option to do so using delete+commit?
    Thanks
    Deepak

    If you have temporary tables, you would generally want to declare them as GLOBAL TEMPORARY tables rather than declaring them as permanent tables. Life is generally much easier that way.
    If you do require permanent tables with transient data, you would need to use DDL to reset the high water mark, and TRUNCATE is the easiest option on that front. You may, however, be able to simply gather/ set statistics on the object that reflect the actual data volume to avoid any performance problems. Resetting the high water mark will only affect the performance of full table scans, but the CBO may choose full table scans less frequently if it has appropriate statistics on the table.
    Justin

  • TRUNCATE TABLE  does not work in procedure

    Hi Friends,
    I create a procedure that have a command TRUNCATE TABLE errdbg;
    It use to record data processing information. It iworks in SQLPLUS by manually.
    I put it in procedure and get message as
    Warning: Package Body created with compilation errors.
    SQL> show error;
    Errors for PACKAGE BODY DATALOAD:
    LINE/COL ERROR
    172/10 PLS-00103: Encountered the symbol "TABLE" when expecting one of
    the following:
    := . ( @ % ;
    The symbol ":= was inserted before "TABLE" to continue.
    How to use TRUNCATE command in procedure?
    I can use delete. but it is not good for table space resused based on book.
    Thanks
    JIm

    You can't use DDL in pl/sql unless you use it with execute immediate
    e.g.,
    execute immediate 'truncate table errdbg' ;

  • Table_exists_action=truncate takes more time

    My customer is on 10.2.0.4 ( in SR 7282685.992 )
    [smlora:jeetest1n]/data/t0430/oradata/POC0GIP>cat impdp.par
    DIRECTORY=gip_dump1
    dumpfile=TGIPR_LURNFACTOR_MOTOR_TEMP01.dmp
    logfile=TGIPR_LURNFACTOR_MOTOR_TEMP01.dmp.log
    tables=TGIPR_LURNFACTOR_MOTOR_TEMP
    table_exists_action=truncate
    [smlora:jeetest1n]/data/t0430/oradata/POC0GIP>impdp parfile=impdp.par
    Import: Release 10.2.0.4.0 - 64bit Production on Tuesday, 18 November, 2008 11:00:19
    when he specified table_exists_action=truncate , it takes 25 minutes to do the Datapump Import.
    I suggested to drop the table and do the datapump import which took just 5 minutes.
    Any idea on this ?
    See his update
    SQL> drop table TGIPR_LURNFACTOR_MOTOR_TEMP;
    Table dropped.
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, Data Mining and Real Application Testing options
    [smlora:jeetest1n]/data/t0430/oradata/POC0GIP>impdp parfile=impdp.par
    Import: Release 10.2.0.4.0 - 64bit Production on Tuesday, 25 November, 2008 16:36:12
    Copyright (c) 2003, 2007, Oracle. All rights reserved.
    Username: calcengine_own_gip
    Password:
    Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
    With the Partitioning, Data Mining and Real Application Testing options
    Master table "CALCENGINE_OWN_GIP"."SYS_IMPORT_TABLE_02" successfully loaded/unloaded
    Starting "CALCENGINE_OWN_GIP"."SYS_IMPORT_TABLE_02": calcengine_own_gip/******** parfile=impdp.par
    Processing object type TABLE_EXPORT/TABLE/TABLE
    Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
    . . imported "CALCENGINE_OWN_GIP"."TGIPR_LURNFACTOR_MOTOR_TEMP" 4.076 GB 30091922 rows
    Job "CALCENGINE_OWN_GIP"."SYS_IMPORT_TABLE_02" successfully completed at 16:40:57
    4 1/2 minutes compared to around 25 minutes for the previous test.

    I guess this could be your issue
    When you use the table_exists_action=truncate command,the indexes on the underlying table are marked as UNUSABLE after import i think it truncates the indexes on those tables.So meaning it will create new index segment for each and every index is the one sould be causing the slowness whereas the DROP just drop the table and there is no recreation of segments
    If you have many indexes on the table and if the size of the table is big this slowness can happen
    Thanks to Metalink(read sometime before ,cant remember doc)
    Edited by: Maran Viswarayar on Dec 15, 2008 4:56 PM

  • Drop Command taking considerable time!!!

    Hi guys,
    In the morning i had asked u alll about Truncate command taking time.
    I used "Truncate <table> reuse storage" for truncating the table. It worked fine.
    Now, when i'am dropping that same table due to some change in our plan, this is also taking considerable amount of time...
    FYI,
    The tablespace is Dictionary Managed Tablespace and the Oracle Version for this is 9.2.0.8.
    Can somebody help...
    Regards,
    Nick.
    Message was edited by:
    Nick-- wud b DBA
    Message was edited by:
    Nick-- wud b DBA

    <pre>
    Hi
    1. Note 68836.1 spells out a method to do this. Basically, it involves
    a) truncate table reuse storage.
    b) Then releasing extents slowly spreading it over many nights.
    Night 1:
    SQL> ALTER TABLE BIGTAB DEALLOCATE UNUSED KEEP 1707M; (2Gb*5/6)
    Night 2:
    SQL> ALTER TABLE BIGTAB DEALLOCATE UNUSED KEEP 1365M; (2Gb*4/6)
    Night 3:
    SQL> ALTER TABLE BIGTAB DEALLOCATE UNUSED KEEP 1024M; (2Gb*3/6)
    But, you are out of luck. Since you have already started dropping the table, if you interrupt it, smon needs to cleanup. That might take longer time.
    2. Another option, need to be planned better, is to convert Dictionary managed to locally managed tablespaces first and then drop the table. I never tested this method, but giving you an option.
    dbms_space_admin.tablespace_migrate_to_local call can be used to convert from dictionary to locally managed tablespace.
    Cheers
    Riyaj
    blog: http://orainternals.wordpress.com
    </pre>

  • SQL loader and truncate drop storage clause

    Hi,
    I check that during load data via sqlloader like that:
    LOAD DATA
    TRUNCATE
    INTO TABLE TEMP_TABLE
    FIELDS TERMINATED BY ","
    (id,
    text
    it use reuse storage in truncate command. Is there any way to set truncate with drop storage option?

    But drop storage is the one which happens by default then You issue truncate command
    From documentation
    Use the TRUNCATE statement to remove all rows from a table or cluster. By default, Oracle Database also performs the following tasks:
    Deallocates all space used by the removed rows except that specified by the MINEXTENTS storage parameter
    Sets the NEXT storage parameter to the size of the last extent removed from the segment by the truncation process
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10006.htm
    After additional reading I found out that sqlloader uses truncate with reuse storage by default and if You need drop storage, then You have to issue this command through sqlplus. There is no way how to mention it via controlfile.
    Edited by: Laura Gaigala on Mar 3, 2009 12:26 PM

  • SQL Loader Truncate and SQL TRUNCATE difference

    Could any one let me know what is difference between truncate used by control file of the SQL Loader and TRUNCATE command used by SQL? Is there any impact or difference of these both over the data files.
    Thanks

    Mr Jens I think TRUNCATE in SQLLDR control file reuses extents, unlike SQL TRUNCATE command. In my opinion it is best to truncate these to show the normal usage of these tables, not the elevated values.
    Could you please further comment?

Maybe you are looking for