Table Truncated

Hi Folks,
I have TRUNCATED a table (for testing), now i want to recover it.
Can anyone please assist how to accomplish this task.
Thanks.

sorry doesn't work that way. A restore cannot be done for specific tables.
The Flashback utility could do this task, but in Oracle9i it isn't that advanced.
When the truncate command is still in de retention period of undo management, you could do a flashback query. In this way you can retrieve the records as they were at the time of the truncate command.
Is your retention period long enough (UNDO_RETENTION in init.ora)

Similar Messages

  • Table truncated, but segments were not cleaned

    Hi,
    I am running oracle 11g 11.2.0.1.0 version on ASM.
    I have truncated a 3.5 GB partitioned table, but the extents are not getting dropped and space is not getting released.
    the table do not have any rows now, but the dba_extents and dba_segments are still showing 3.5 gb size.
    Please suggest what could be the possible reason.
    Please let me know if additional information is required to answer my qustion.
    regards

    Here's a demo which shows that if a table is created with a large INITIAL, a TRUNCATE doesn't shrink the initial size.  A MOVE with a STORAGE clause can.
    SQL> create table hkc_test_99 (id_column number, data_column varchar2(10)) storage (initial 64M);
    Table created.
    SQL> insert into hkc_test_99 select 1,'One' from dual;
    1 row created.
    SQL> commit;
    Commit complete.
    SQL> select extent_id, bytes/1024 from user_Extents where segment_name = 'HKC_TEST_99';
    EXTENT_ID BYTES/1024
             0      65536
    1 row selected.
    SQL>
    SQL> truncate table hkc_test_99;
    Table truncated.
    SQL> select extent_id, bytes/1024 from user_Extents where segment_name = 'HKC_TEST_99';
    EXTENT_ID BYTES/1024
             0      65536
    1 row selected.
    SQL>
    SQL> alter table hkc_test_99 move storage (initial 64K);
    Table altered.
    SQL> select extent_id, bytes/1024 from user_Extents where segment_name = 'HKC_TEST_99';
    EXTENT_ID BYTES/1024
             0         64
    1 row selected.
    SQL>
    Hemant K Chitale

  • Access Pivot Table truncates sums

    I use Pivot Tables in Access 2007 a lot and discovered recently when trying to tie out the results that when the raw data has decimal values, as in a currency format, the sum function in the pivot table is truncating the results to a whole interger. 
    Not rounding, but truncating, so this is an issue with accuracy.  The results are displaying in a currency format, but anything to the right of the decimal is a zero.  How can I get the pivot table sums to be accurate to two decimal points? 

    SUM("Sales Measures".Dollars By Markets.Region )) it will return sum of dollars by region wise
    or
    try new calculated item
    $1 + $2 +$3 likewise it will sum all the n columns u r having
    Edited by: Kishore P on Jun 22, 2010 7:16 PM

  • What privs r required to run Alter table truncate partition update indexes?

    I rebuilt the indexes on the table. Know my problem is that when I truncate a partition on the table the unique index whic consist of the primary key fields becomes unusable which causes my to have to rebuild it after each truncate. I tried to runm the following statement from the master schema on but get
    an insufficient privs error when I use "update indexes":
    Alter table schema_name.table_name truncate partition partition_name storage update indexes;
    What priv does master need to perform statement successfully when there's data in it?
    Does using 'update indexes' needs extra priveleges?
    Thanks in Advance
    Gagan

    Hi Its Oracle 10.2.0.4 64 Bit on HP UX.
    I dont have the exact error as I got this much information only from the end user....It will be couple of hours more then he will be available again
    ok so for Truncate we need 'Drop any' privs but to use clause 'update indexes' alongwith do we need some extra privelege?
    Thanks again
    Gagan

  • Large tables truncated or withheld from webhelp

    I'm running into a major issue trying to include a large table in my WebHelp build.  I'm using RoboHelp 8 in Word.  When I include a large table (6 columns x 180 rows) the table is either truncated or withheld from the compiled WebHelp.
    I've tried several things to resolve it, but they all end in the same results.  I've tried importing the table from its original Word file.  I've tried breaking it up into many smaller tables.  I've tried building a new table in Word, then copying the data.  Oddly enough if I build the table blank and compile--the table appears.  But once I copy data into the table, it disappears.
    RoboHelp seems unable to process the table, as when I've broken the single table into several smaller tables, it chokes, doesn't include the table or even put the topic in the TOC, even though it is in the source file.
    Any ideas?  I've not been able to find anything in the forums or anywhere else online. 
    Many thanks!

    Can you tell us what you mean "using RoboHelp in Word"? Do you mean you are using it as your editor or that you are using the RoboHelp for Word application? If the later, is there a reason why you can't use the RoboHelp HTML application? This is much more suited to producing WebHelp. Personally I wouldn't touch the HTML that Word creates with a bargepole.

  • Locating table truncation source

    Hi all,
    I have a problem with a database schema that I use, but am not a DBA for. Every night certain tables are truncated from 200,000+ records to just 100 records. At first I wasn't sure if it was a table deletion or a truncation, so i set up a trigger for both events that populate an audit table to identify who, when and what is happening. This is the trigger for the truncate check:
    CREATE OR REPLACE TRIGGER IDMS_TMP.capture_trunc
    before truncate on schema
    WHEN (
    ora_dict_obj_name='E_TRACK_WO_SSL_VALID' AND ora_dict_obj_TYPE='TABLE'
    DECLARE
    IntPKID NUMBER;
    Begin
    IntPKID := 0;
       SELECT SEQ_ZATSW_PKID.NEXTVAL INTO IntPKID FROM dual;
    INSERT INTO Z_AUDIT_TRK_SSL_WO (ZATSW_PK_ID, ZATSW_USER_ID, ZATSW_DATE, ZATSW_ALTERTYPE) Values (  IntPKID, USER, SYSDATE, 'TRUNCATE');
    END;This returned the following results:
    ZATSW_USER_ID ZATSW_DAT ZATSW_ALTERTYPE
    SYS 12-APR-2010 21:35:35 TRUNCATESo i can tell that it is a truncation, occurring at 9:35pm, run by the sys user, but I still need to track down how this being run. So my question is:
    Does anyone know how to capture the executing statement causing the truncation, be it a PL/SQL stored proc, scheduled job, manual SQL statement or some other method or identifying what is deleting the data? This would help me to eliminate the cause but at the moment i can only tell who and when, not how or why :(
    Not even sure why it then populates with 100 records (as a truncate would remove all?) but finding the calling truncate statement location would probably also answer this question :)
    Many thanks
    Dan

    Hi all,
    Thanks for the adivse, unfortunately I do not have access to the DBA_JOBS or any other way or finding out what jobs are running (DBA has restricted access). He tells me that the following jobs are scheduled but should not have this sort of impact:
    DAILY_PURGE_SCHEDULE
    EMD_MAINTENANCE.EXECUTE_EM_DBMS_JOB_PROCS
    Both of these are supposed to be general housekeeping tasks so shouldn't do anything like this, but these are the only scheduled jobs that he can find. The only other possible option is that the truncation is coming from another DB schema across one of two DB_Links we have, but when this first happened I created a copy of one the tables, renamed it, and this is still being hit by the subsequent truncation the next day so it doesn't look like it is table specific (although only certain tables seem to be affected).
    As i mentioned in my previous post, what I am really after is a method by which the trigger can find the calling package / procedure of the truncation and tell me what is causing the truncation, however i will look into using the log miner, although my understanding fro the DBA is that there is no logging (it is only a dev DB but not sure why no logging was specified), and not sure if a table being truncated would be captured by the redo log?
    Cheers
    Dan

  • Table Truncated, Flashback is enabled ... How to recover.

    Hi,
    There is a table which was truncated, as we have flashback enabled. Even we have previously enabled row movement of the particular table.
    How to recover ????
    Thanks.

    hi,
    There are three options available:
    1. Restore and recover the primary database to a point in time before the drop.
    This is an extreme measure for one table as the entire database goes back in
    time.
    2. Restore and recover the tablespace to a point in time before the drop.
    This is a better option, but again, it takes the entire tablespace back in time.
    3. Restore and recover a subset of the database as a DUMMY database to export
    the table data and import it into the primary database. This is the best option
    as only the dropped table goes back in time to before the drop.
    For the first, see information on performing incomplete recovery on a database.
    The second and third options are virtually the same, it depends if the entire
    tablespace data should be taken back in time, or just recovering the one table.
    The tablespace point in time recovery (TSPITR) may be useful if there are
    dependencies between the dropped/truncated table and other tables in the
    database. For the second option, see RMAN documentation on TSPITR and/or Note 180436.1 RMAN Tablespace Point in Time Recovery Example. Both procedures
    for the second and third options are very much the same. The differences are
    that the TABLE PITR has to be exported/imported manually while the TABLESPACE
    PITR is fully automated by RMAN.
    This article will deal with the third option.
    General overview of procedure to recover from a DROP or TRUNCATE table by using RMAN.
    To recover from a dropped or truncated table, a dummy database (copy of primary)
    will be restored and recovered to point in time so the table can be exported.
    Once the table export is complete, the table can be imported into the primary
    database. This dummy database can be a subset of the primary database. However,
    the 'dummy' database must include the SYSTEM, UNDO (or ROLLBACK), and the
    tablespace(s) where the dropped/truncated table resides.
    The simpliest method to create this 'dummy' database is to use the RMAN
    duplicate command. See:Note 228257.1 RMAN Duplicate Database in Oracle9iNote 73912.1 RMAN Creating a Duplicate Database -- Oracle8i
    The difference between the two versions is that Oracle9i duplicate command
    allows for a 'SKIP TABLESPACE' option. Thus Oracle9i allows for a duplication
    of a subset of the database.
    In Oracle8i, you cannot 'skip' tablespaces when using duplicate, so you must
    duplicate the entire database. If this is not a desired option, or you must
    restore the original database and thus cannot use
    the rman DUPLICATE.
    NOTE: The remainder of this information is for users who cannot use the
    DUPLICATE command in Oracle8i. I.e., you want to restore only a subset
    of the Oracle8i database.
    Requirements :
    a) RMAN backup of the primary database should be available to the
    host where it has to be restored on.
    b) Use of an RMAN-catalog database
    c) Auxiliary instance created and started in NOMOUNT
    (See Note 180436.1 step I. Create the auxiliary initSID.ora.)
    Create this from the init.ora of the primary database and:
    !!!!! IMPORTANT !!!!!!!!
    If using the same host as the primary, be VERY careful as you do not want to
    restore on top of existing files being used by the primary (production database).
    Doing so can corrupt and crash the production database!!!!!!
    - be sure all paths for this AUX instance are different than primary.
    - be sure CONTROL_FILES parameter has different location but more importantly DIFFERENT NAME.
    - add LOCK_NAME_SPACE to any value other than the primary database name.
    - change/add SERVICE_NAME=AUX1.
    - use the SAME DB_NAME as for the production database
    - BE SURE you include the 'alter database rename file' command at the end
    of the script. This changes the location and/or name of the online
    redo log files.
    d) Set ORACLE_HOME and ORACLE_SID set to the auxiliary instance
    e.q set ORACLE_SID=AUX1
    set ORACLE_HOME=<....>
    !!!!! IMPORTANT !!!!!!!!
    1: Restore and recover the tablespace
    The restore and recovery is done by RMAN. Create a file
    of the script below (e.q table_pitr.cmd) and execute the following
    command :
    $ rman cmdfile=table_pitr.cmd
    NOTE: ORACLE_HOME and ORACLE_SID set to the auxiliary instance
    NOTE: The Auxiliary instance IS the target to rman at this point.
    The RMAN-script :
    connect catalog rman/rman@v920_nlsu31
    connect target /
    run
    allocate channel t1 type sbt_tape
    parms='SBT_LIBRARY=/home/usupport/liblsm.so';
    set until time "to_date( '09-10-2005 06:00', 'DD-MM-RRRR HH24:MI')";
    restore controlfile;
    sql "alter database mount clone database";
    set newname for datafile 1 to '/fs01/oradata/tspitr/system01.dbf';
    set newname for datafile 2 to '/fs01/oradata/tspitr/undotbs01.dbf';
    set newname for datafile 4 to '/fs01/oradata/tspitr/tools01.dbf';
    restore tablespace system, undotbs1, tools;
    switch datafile all;
    sql "alter database datafile 1,2,4 online";
    recover database skip forever tablespace TEMP,INDX,USERS,OLTS_ATTRSTORE,
    OLTS_CT_DN,OLTS_CT_CN, OLTS_CT_OBJCL,OLTS_CT_STORE,OLTS_DEFAULT,
    OLTS_TEMP,OLTS_IND_ATTRSTORE,
    OLTS_IND_CT_DN,OLTS_IND_CT_CN,
    OLTS_IND_CT_OBJCL,OLTS_IND_CT_STORE,
    P1TS_ATTRSTORE,P1TS_IND_STORE;
    sql "alter database rename file ''/fs01/oradata/primary/REDO01.LOG'' to ''/fs01/oradata/tspitr/REDO01.LOG''";
    sql "alter database rename file ''/fs01/oradata/primary/REDO02.LOG'' to ''/fs01/oradata/tspitr/REDO02.LOG''";
    sql "alter database rename file ''/fs01/oradata/primary/REDO03.LOG'' to ''/fs01/oradata/tspitr/REDO03.LOG''";
    /* NOTE: Syntax within rman is two single quotes around each name, this may be operating system specific. */
    release channel t1;
    Explanation :
    - Tape channel allocated, but could also be a disk channel, depending
    on where the backups are.
    - SET UNTIL TIME
    User specified time, just before the DROP/TRUNACTE table
    - MOUNT CLONE DATABASE.
    This forces all datafiles to be put OFFLINE. Just for safety reasons.
    - SET NEWNAME
    New path for the datafile to be restored. Keep in mind that this is
    done on the auxiliary instance and should NOT interfere/overwrite the
    prodution database.
    - ALTER DATABASE RENAME FILE
    This is required to change the location of the online log files. When the
    'resetlogs' is issued, Oracle will create online logs based on specification
    in the controlfile. This command changes the location and/or name. If
    this is being performed on the SAME server, not issuing a rename will
    cause Oracle to reset the production online log files. This will corrupt
    and crash the production database!!!!!!
    - RESTORE TABLESPACE ...;
    Restore the tablespaces which need to be recoverd.
    This includes always the SYSTEM, rollback/undo tablespace and
    the tablespace(s)where the dropped/truncated table resides.
    The SYSTEM tablespace is always included as it containts most / all of
    the objects owned by SYS and SYSTEM. Some other tablespaces might be
    included as well when they contain objects owned by SYS and SYSTEM.
    SQL> select distinct tablespace_name
    from dba_segments where owner in ('SYS', 'SYSTEM');
    - SWITCH DATAFILE ALL;
    Make the changes in the pathname (set by SET NEWNAME) active in the
    controlfile.
    - ALTER DATABASE DATAFILE ... ONLINE
    Online the datafiles which are restored and have to be recovered.
    - RECOVER DATABASE SKIP FOREVER TABLESPACE ......;
    You need to specify the complete list of tablespaces which will not be
    recovered. Else the recovery fails, that it cannot dentify/file the
    tablespace datafile. The SKIP FOREVER clause causes RMAN to take the
    datafiles offline using the DROP option. Only use skip forever when the
    specified tablespaces will be dropped after opening the database. I.e.,
    all tablespaces except the one which contains your data.
    The recovery of RMAN, checks the datafileheaders, to get a starting point
    for the recovery.
    2: Open auxiliary database with RESETLOGS
    $ sqlplus /
    SQL> alter database open resetlogs;
    This step should ALWAYS be executed outside RMAN via SQL*Plus. If the open
    is executed in RMAN it may effect the primary database's entry in the RMAN
    catalog. Backups will fail with messages like:
    RMAN-20011 "target database incarnation is not current in recovery catalog"
    3: Export the table
    The database is recovered and open, so it can be used by export.
    Example:
    $ exp userid=system/<password> file=table.dmp
    tables=(<owner>.<tablename>, ...) rows=Y
    4: Import the export-dump
    Import the data of the dropped table back into the primary/production database.
    Example:
    $ imp userid=system/<password> file=table.dmp ignore=Y
    5: Remove this AUX/DUMMY database
    Shutdown and remove all files associated with this database. It has satisfied
    your purpose. I.e., to give you an export of this table.

  • Truncating a table from inside an application

    Hi all,
    Got a new problem to tackle. I am creating an application to calculate a very complex production bonus based on alot of different variables...
    I am working through retrieving all the data and created an apex temp table called site_bonus. I dump all the retireved values I get from Oracle for attendance, SIT data on discipline etc into the temp table as a count of number of occureneces to start the calculation of the bonus factors - here's the gotcha.....
    Prior to dumping the new run data into the temp table I want to truncate the table to remove anyprevious run data so that I dont get duplicate records cuased by a previous run. I created an on demand application process that basically does the following:
    truncate table "SITE_BONUS" /
    ( I basically copied it right from SQL workshop inside apex,by retrieving the SQL fromthe table truncate process where it works....
    When I run it anywhere inside my page as an on demand process It fails with the following error:
    ORA-06550: line 1, column 16: PLS-00103: Encountered the symbol "TABLE" when expecting one of the following: := . ( @ % ; The symbol ":= was inserted before "TABLE" to continue.
    Error
    OK
    I have tried it as a plsql process, an on demand process....and I get teh same error from any page inside my app and I cant figure out why I can do this from SQL worksop but cant call it from a page within my app.....
    Any ideas?
    Edited by: DSULLIVAN on Oct 28, 2009 3:13 PM - I corrected the typo

    You are trying : trucate
    trucate table "SITE_BONUS" /It should be : tuncate
    truncate table SITE_BONUSHope this helps,
    Sam
    +Please reward good answers by marking them correct or helpful!                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • 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.

  • Release of space after delete/truncate table

    Hello,
    How does release of space after delete/truncate table works? Is the space used before deletion released once delete is complete or not? Will I see the space occupied by deleted table as free in dba_segments or will I need to reorganize the table (drop and recreate again?). Reason why I am asking is that I can see table with 0 rows, but in dba_segment I can see it is occupying few gigabytes....
    Thank you

    Here is a little illustration for you;
    SQL> conn ogan/password
    Connected.
    SQL> create table ogan_deneme as select * from all_objects;
    Table created.
    SQL> select count(*) from ogan_deneme;
      COUNT(*)
        228470
    SQL> set line 1000
    SQL> set pagesize 1000
    SQL> select * from dba_segments where owner='OGAN';
    OWNER    SEGMENT_NAME        PARTITION_NAME           SEGMENT_TYPE       TABLESPACE_NAME                HEADER_FILE HEADER_BLOCK      BYTES     BLOCKS    EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE  FREELISTS FREELIST_GROUPS RELATIVE_FNO BUFFER_
    OGAN      OGAN_DENEME          TABLE              SYSTEM                                 854       319981   *30408704*       *1856*         *44*          65536                       1  2147483645                       1               1          854 DEFAULT
    SQL> truncate table ogan_deneme;
    Table truncated.
    SQL> select * from dba_segments where owner='OGAN';
    OWNER    SEGMENT_NAME        PARTITION_NAME           SEGMENT_TYPE       TABLESPACE_NAME                HEADER_FILE HEADER_BLOCK      BYTES     BLOCKS    EXTENTS INITIAL_EXTENT NEXT_EXTENT MIN_EXTENTS MAX_EXTENTS PCT_INCREASE  FREELISTS FREELIST_GROUPS RELATIVE_FNO BUFFER_
    OGAN      OGAN_DENEME           TABLE              SYSTEM                                 854       319981      *65536*          *4*          *1*          65536                       1  2147483645                       1               1          854 DEFAULT
    SQL>Hope it Helps,
    Ogan

  • Space is not released after truncating the table

    Team,
    We have a table of size 550gigs in size and we truncated the table , truncated sucessfully but space is not released in os level, what action we can take to release the space and this table has only one row and contains the binary data.
    Thanks
    PGR

    Team,
    We have a table of size 550gigs in size and we truncated the table , truncated sucessfully but space is not released in os level, what action we can take to release the space and this table has only one row and contains the binary data.
    Thanks
    PGR
    Hello,
    Yes space wont be released immediately .If large extents are in picture which I assume is your case it goes into deferred drop a background process which will execute after some time( time may vary).See below link for details.
    As per BOL if extents are more than 128 it goes in deferred drop.
    http://msdn.microsoft.com/en-us/library/ms177495.aspx
    You should wait for some time .keep checking the free space
    Below discussion will surely help you in understanding.See Jonathan's reply
    http://social.msdn.microsoft.com/Forums/en-US/4aa2537e-246b-4bfe-818d-3482531d9149/sql-server-2005-massive-400gb-table-dropped-space-not-released
    Please mark this reply as the answer or vote as helpful, as appropriate, to make it useful for other readers

  • Truncate table and materialized view log

    I user oracle 10 R2
    I have a table and on that table a materialized view log.
    I execute in a pl/sql procedure:
    1) execute immediate('drop materialized view log on tab1');
    then:
    2) execute immediate('truncate table tab1');
    3) Now I insert a lot of records in tab1
    4) execute immediate('create materialized view log on tab1 WITH rowid INCLUDING NEW VALUES');
    When I create the materialized view log I recieved this message:
    ora32321: refresh fast on tab2 unsupported after detail table truncate
    Why?

    Refresh fast after truncate operation on container table is not supported, regardless the container table is or is not partitioned.
    Perform a refresh complete.
    ORA-32321 :
    Cause:     A detail table has been truncated and no materialized view
         supports fast refersh after a detail table has been truncated
    Action:     Use REFRESH COMPLETE. Note: you can determine why your
         materialized view does not support fast refresh after TRUNCATE
         using the DBMS_MVIEW.EXPLAIN_MV() API.

  • Truncate table will delete the corresponding LOB segment of table or not ?

    Hi All,
    I have few table with LOB segments, if i fire the truncate table on those table will it purge the LOB segment as well ?
    Approximately how much time will take to truncate 100gb LOB segments.
    Thanks

    903787 wrote:
    Hi ,
    1.Truncate will delete the LOB segment or not ?It won't delete the LOB segments but it should release most of the allocated space.
    >
    2.To reclaim space we need to run the below command, is it correct ?
    ALTER TABLE <table_name> MODIFY LOB (LOB_COLUMN) (SHRINK SPACE);
    Should not be needed in 11.2:
    SQL> select * from v$version;
    BANNER
    Oracle Database 11g Express Edition Release 11.2.0.2.0 - Production
    PL/SQL Release 11.2.0.2.0 - Production
    CORE    11.2.0.2.0      Production
    TNS for 32-bit Windows: Version 11.2.0.2.0 - Production
    NLSRTL Version 11.2.0.2.0 - Production
    SQL> select count(*) from user_segments;
      COUNT(*)
             0
    SQL>
    SQL> create table t(x clob);
    Table created.
    SQL> select segment_name, segment_type, bytes
      2  from user_segments;
    SEGMENT_NAME                             SEGMENT_TYPE            BYTES
    T                                        TABLE                   65536
    SYS_IL0000030908C00001$$                 LOBINDEX                65536
    SYS_LOB0000030908C00001$$                LOBSEGMENT              65536
    SQL>
    SQL> insert into t select lpad(segment_name,8192) from dba_segments;
    6312 rows created.
    SQL> commit;
    Commit complete.
    SQL>
    SQL> select segment_name, segment_type, bytes
      2  from user_segments;
    SEGMENT_NAME                             SEGMENT_TYPE            BYTES
    T                                        TABLE                  393216
    SYS_IL0000030908C00001$$                 LOBINDEX                65536
    SYS_LOB0000030908C00001$$                LOBSEGMENT           53477376
    SQL>
    SQL> truncate table t;
    Table truncated.
    SQL>
    SQL> select segment_name, segment_type, bytes
      2  from user_segments;
    SEGMENT_NAME                             SEGMENT_TYPE            BYTES
    T                                        TABLE                   65536
    SYS_IL0000030908C00001$$                 LOBINDEX                65536
    SYS_LOB0000030908C00001$$                LOBSEGMENT              65536
    SQL>
    SQL> alter table t modify lob(x) (shrink space);
    Table altered.
    SQL>
    SQL> select segment_name, segment_type, bytes
      2  from user_segments;
    SEGMENT_NAME                             SEGMENT_TYPE            BYTES
    T                                        TABLE                   65536
    SYS_IL0000030908C00001$$                 LOBINDEX                65536
    SYS_LOB0000030908C00001$$                LOBSEGMENT              65536
    SQL>

  • Bug 3.2.20.09 Build MAIN-09.87 - Using GUI to truncate - Wrong table

    Here is what I am running into with this version of SQL developer. I can repeat this issue every time with these steps.
    From Connections, open a connection, list tables.
    Right click on table, select Privileges - Grant. Select the user ID, the actions & Apply. (you do not need to take these action, just go through the motions)
    At this point it does not seem to matter if I stay within this connection or select a different connection.
    Select a different table by clicking on it so it opens a new tab.
    Select Actions - Table - Truncate.
    At this point you would expect the pop-up to display the table you are trying to take action on, instead what happens is you are presented with the last table you took Privilege actions on. This will even open a closed connection to take these actions on.
    So if you are not paying careful attention, you are about to truncate the wrong table!
    I am also able to repeat this with 3.1.07.42 where you are presented with the last table you went through the motions on for Privileges. (you do not have to take any actions.
    Edited by: user2794298 on Jan 31, 2013 2:55 PM

    Now all I need to know is when this gets corrected so I can download a updated version of SQL Developer to reduce the change of accidently truncating the wrong table again due to a software bug.

  • Problem in enabling constraint - after disabling and truncation of table .

    Hello Friends,
    I have a table called DRR_TABLES that has list of table names . The requirement is to truncate the tables present in DRR_TABLES except KEY_IDS table and table_name like '%TYPE%' table.
    written a procedure . successfullly truncating the tables from DRR_TABLES but while enabling constraints after truncation , I am getting problem in enabling constraints .
    ERROR at line 1:
    ORA-02270: no matching unique or primary key for this column-list
    ORA-06512: at "schema123.TRUNCATE_DRR_TABLES ", line 49
    ORA-06512: at line 1
    Heres is the code .
    PROCEDURE TRUNCATE_DRR_TABLES is
    x varchar2(200);
    v_tablecount number := 0;
    cursor c is select TABLE_NAME from DRR_TABLES where population_source='PUBLISHING' and TABLE_NAME != 'KEY_IDS' and TABLE_NAME NOT LIKE '%TYPE%';
    BEGIN
    DBMS_OUTPUT.PUT_LINE (' TRUNCATING DRR TABLES ...........');
    OPEN c ;
    LOOP
    FETCH c INTO x ;
    EXIT WHEN c%NOTFOUND;
    for c1 in (select table_name, constraint_name from user_constraints where TABLE_NAME = x and status ='ENABLED' ORDER BY CONSTRAINT_TYPE DESC )
    loop
    begin
    execute immediate ('alter table '||c1.table_name||' disable constraint '||c1.constraint_name|| ' cascade');
    NULL;
    end;
    end loop;
    EXECUTE IMMEDIATE 'TRUNCATE TABLE ' || x ;
    v_tablecount := v_tablecount + 1 ;
    DBMS_OUTPUT.PUT_LINE('TABLE TRUNCATED :'|| x );
    END LOOP ;
    DBMS_OUTPUT.PUT_LINE (' TOTAL TABLES TRUNCATED ' || v_tablecount );
    CLOSE c;
    OPEN c ;
    LOOP
    FETCH c INTO x ;
    EXIT WHEN c%NOTFOUND;
    for c2 in (select table_name, constraint_name from user_constraints where TABLE_NAME = x and status = 'DISABLED' ORDER BY CONSTRAINT_TYPE)
    loop
    begin
    execute immediate ('alter table '||c2.table_name||' enable constraint '||c2.constraint_name);
    NULL;
    end;
    end loop;
    END LOOP ;
    CLOSE c ;
    END TRUNCATE_DRR_TABLES ;
    LINE 49 is the line corresponding to enable constraint statement.
    Edited by: kumar73 on 3 Sep, 2012 11:44 PM

    It is such a pity that a user having 321 posts till date is unaware of basics of Posting a Question.
    1. You need to provide us with your Oracle version
    select * from v$version;2. You need to understand and get accustomed to using tags before and after Code or SQL's for better readability.
    3. You need to provide us with the Table Structure and the Constraints Definition.
    There are many things that looks like Bad Coding practices:
    <font face="Times New Roman" size=2>
    1. Avoid RBAR (Loops).
    2. Implement Bulk Collect.
    3. Why do you need to disable the constraints before truncating? Are you kind of handling the Referential Integrity Constraints?
    4. Duplicate checking of Disabled Constraints.
    5. When the procedure is being executed at Production Environment, are you going to Monitor the DBMS_OUTPUT? Why not Log the Statements into a LOG Table?
    6. Why use a TableCount variable? Would the TableCount Variable be not equal to the Number of Records returned by Cursor C?
    7. What is the need to use a NULL statement after every Execute Immediate?
    8. What is the Need to surround each execute Immediate with Begin .. End block?
    9. Where is your Exception handling Block? Forgot to write?
    </font>
    What has been your effort in finding which Constraint/Table is causing you the trouble?                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Maybe you are looking for