Truncate table related questions

Hi Folks,
Environment: 10g Rel 2
I am trying to prove the following two points by way of experimentation
a, The truncate table operation will reset the high water mark (HWM) to the first usable data block in the table segment
# Take a HWM snap shot before the truncate operation
select a.BLOCKS - b.EMPTY_BLOCKS -1 HWM
from
  (SELECT BLOCKS
   FROM   DBA_SEGMENTS
   WHERE  OWNER=UPPER('JIM') AND SEGMENT_NAME = UPPER('EMPLOYEES')) a,
   (SELECT EMPTY_BLOCKS
    FROM   DBA_TABLES
    WHERE  OWNER=UPPER('JIM') AND TABLE_NAME = UPPER('EMPLOYEES')) b;Output: 7
truncate table JIM.EMPLOYEES;
Re ran the above code and got the same result (i.e. 7 blocks). I was expecting to see 0 blocks instead? Is the above query the right method of
finding the HWM?
b, The truncate operation will also truncate the corresponding indexes for the table
Q, Is there a view that will show all the index values of the table? These values will probably be meaningless, but I would like to see them before
and after the truncate operation.
Thanks
rogers42

a) If you would have read on the empty_blocks column in dba_tables, you would have known it is populated by dbms_stats.
Did you run dbms_stats.analyze_table?
b)
There is no such view.
All dictionary views are documented in the view DICT and the online documentation.
Sybrand Bakker

Similar Messages

  • Flashback and truncate table in 11gR2

    Hi,
    From what I can gather, flashback database is the only flashback operation that can undo a table truncate. A truncate table operation cannot be rolled back, because it does not produce the undo data necessary for undo based flashback operations like Flashback query, version, transaction/backup and table.
    Is this assessment correct?
    Thanks.

    Pal wrote:
    Thanks for reply. I hope it's ok to add a couple more related questions:
    SQL> select current_scn from v$database;
    1088080
    SQL> connect hr/hr
    SQL> truncate table test_data;
    SQL> select * from test_data as of SCN 1088080;
    ORA-01466: unable to read data - table definition has changedYes, that's correct Pal. The reason is that with any DDL , the structure/definition of the table would be changed and Flashback Query won't be allowed on such table.
    I cannot use Flashback Query, however, just reading http://ocpdba.wordpress.com/2009/10/19/reversing-the-effect-of-a-truncate-table-in-oracle-11gr2 which demonstrates how to use Flashback Data Archive and Flashback Query to reverse a table truncate operation.
    Why does Flashback Data Archive allow me to use Flashback Query past DDL operations?Please see,
    http://download.oracle.com/docs/cd/E11882_01/appdev.112/e17125/adfns_flashback.htm#BJFJHDAG
    Actually, even with the Flasback data archive too, you can't do anything if the table structure is modified by a command whose effect it can't tolerate. In 11.2, what is given is that you can dissociate your table from the Flashback DAta archive using the package DBMS_FLASHBACK_ARCHIVE.DISASSOCIATE_FBA , do the changes on both target and archive table and then reassociate . Oracle does makes a note in this operation that assume no aboslute guarantee in the data's accuracy if you would do this procedure.
    If I do not have Flashback Data Archive enabled on a table, how can I determine the SCN to undo a truncate table using Flashback database or TSPITR?You would need to mine the logfile using the logminer .
    HTH
    Aman....

  • Table Relation with Payment and Invoice of Vendor

    Hi all,
         I have one question about Table Relation with Payment and Invoice of Vendor.
         the scenario is.
         2 Purchase Order number : 100000001/100000002
         1 Invoice document number : 200000001 which include  2 Purchase Order.
         1 Payment document number : 300000001
         How should I found out table relation from Payment document number - Invoice document number - Purchase Order number. ?
          I try to link the following table, but it does not work.
          RBKP     *     Invoice Receipt
          RSEG     *     Invoice Receipt document line item
          BKPF     *     Accounting Document Header
    BSEG     *     Accounting Document Segment
    PAYR          Payment Medium File
    BSIK          Accounting: Secondary Index for Vendors
    BSAK          Accounting: Secondary Index for Vendors (Cleared Items)
    BSIS          Accounting: Secondary Index for G/L Accounts (Open Items)
    Does any one know about it ?
    Regards
    KY Chuang

    Hi Venkatesh,
    Thnx a lot for the reply. This has almost solved my problem, however there's one thing left. when I'm trying to take a print out after exporting the info into an excel sheet, the information really looks scattered, i.e.,  is there a way where we can go ahead and get the info in a rather unscattered manner.
    I've tried to take a print directly without actually transferring the info into an excel sheet, then each of the vendor is printed in a separate page, which again they feel is a problem.
    So, if you have an idea pls suggest.
    Thnx again for the information.
    regards
    sandhya

  • Easy ways to find/search  different fields and tables relations?

    Dear Friend ,
    I am useing SE11 and SE16 to different table and field name relation . Is it any easy was to find table different table and field name relation .
    Please reply urgently........
    Max award for sol

    Hi,
    I would wonder if you could use SE11 and SE16 for getting information on table relations.
    You can use e.g. SQVI to create queries and you can set the link between tables (define the relation of them).
    As for your question:
    1 Please check this link:
    http://www.erpgenie.com/abap/tables.htm
    2.
    You can use SE16 + DD30L to search for specific field  / table.
    BR
    Csaba

  • Table relation between Sales Organization and Profit centre

    Hi everybody,
    I hava a question:
    How do I know wich Sales organitzation (VKORG) belongs to a Profit centre(PRCTR), which table relation do I need to do to find it, or from wich table do I get this relation because I haven't found anything.
    I've been asked to get the Profit Centre given a Sales Organization.
    Thanks a lot!

    Hi Moises,
    Firstly get the Sales Order Number (VBELN) and Sales Organization(VKORG) from VBAK.
    Now based on the the Sales Order Number (VBELN) get the Profit Center(PRCTR) from VBAP.
    Now you can relate Sales Organization and Profit Center.
    Regards,
    Chandra Sekhar

  • Does a truncate table solve corrupt blocks in a table

    Hi Guys,
    Got a question:
    Does a truncate table solve corrupt blocks in a table?
    I have found corrupt blocks in rman, located them, they are in 1 table.
    And contacted the business, and have permission to drop and recreate the table,
    but my question is does truncate table drop storage also solves my problem?
    And will it let me to do a full backup without set max corrupt blocks?
    To my knowledge does a truncate table moves the high watermark to 0 + 1 extend, but I am unsure how this will effect the corrupt blocks.
    Thanks in advance for your advice

    Hi,
    Yes truncate/drop table fixes the corruption at the database level. You may like to take the backup(if you have index on it) of that table so that you may restore it later if anything goes wrong.
    Note: This would not fix any corruption at the disk level (like bad sectors).
    Regards
    Anurag

  • How index affected by truncate table

    HI, all,
    I have a question about indexes in a table. If I truncate the table and reload data, do the indexes in the table still valid?
    From documentation:
    “a table is truncated, all associated indexes are also truncated.”
    What does that mean?
    Do I need to recreate index every time I truncate table?
    Thanks a lot.

    When you truncate a table, you are removing all the data from the table but leaving the structure of the table intact. Logically, the same thing must happen to the index-- all the index data must be removed (since there are no longer any entries in the table), but the structure of the index remains intact.
    Justin
    Distributed Database Consulting, Inc.
    http://www.ddbcinc.com/askDDBC

  • How truncate table affect index?

    HI, all,
    I have a question about indexes in a table. If I truncate the table and reload data, do the indexes in the table still valid?
    From documentation:
    “a table is truncated, all associated indexes are also truncated.”
    What does that mean?
    Do I need to recreate index every time I truncate table?
    Thanks a lot.

    No, it's just what it says: it truncates the index, just like it truncates the table. You do not have to recreate the table, nor the index.
    Truncating is deleting without the possibility of a rollback.

  • Finding Table relation in SAP

    hi!!
    I'm new to SAP. I only have SAP tables and i don't have access to the frontend..
    I wanna know the tables relation i.e how to join two tables..
    Suppose, if i want to know all the relations VNVK has, where should i start?
    i can only view the primary keys and not the foreigh keys for all the tables..
    I read some posts from this forum and got this information:
    DD02L SAP Tables
    DD05S Foreign key fields
    DD09L DD: Technical settings of tables
    DD26S Base tables and foreign key relationships
    but the DD26S table doesn't give me these information either..
    I even tried to get the table and column description and then try to join, but it's a tedious process..
    I got a document with SAP table relations but it doesn't have all the modules in it..
    please help me out on this.. i'm literally stuck with thousands of tables in front of me without knowing how to join them..

    Samsays,
    You say you
    have SAP tables and i don't have access to the frontend..
    .  You wish to 'join' these tables.
    What is your business requirement? Which tables do you intend to 'join'?  Although I guess it is theoretically possible, I can't think of any reason why anyone would wish to manipulate SAP table data at the server level. I seriously question whether such access complies with the terms of your SAP and database licence agreements.  You do have a licence, right?
    If you really have a legitimate business need for SAP table data, then you must have the appropriate person assign you an SAP logon ID, you must get frontend access, and then use SAP development tools to create the data structures you seek.  Using a non-standard tool to manipulate SAP data can render your system un-usable.
    Rgds,
    DB49

  • Provide truncate table permission for a user

    Please let me know the best possible way to provide truncate table permission to a SQL Server Database user (ddl_admin role cannot be granted to the user in my case)

    Grant CONTROL permissions on table, user will be able to truncate table.
    GRANT CONTROL ON user_table TO User
    http://www.sqlservercentral.com/blogs/steve_jones/2011/03/07/sql-server-truncate-table-permissions/
    Other ways check this:
    Grant Truncate Table Permissions in SQL Server without ALTER Table  
    http://www.mssqltips.com/sqlservertip/2583/grant-truncate-table-permissions-in-sql-server-without-alter-table/
    The ALTER permission provides the access required to alter the schema of a tables, this includes truncating the data in the table.
    http://www.jasonstrate.com/2013/05/security-questions-truncate-table-permissions/

  • Does InnoDB run bugless if PK is FK of same table relating to PK of other ?

    Question: Will the following Part of my DataBase run bugless with InnoDB of MySQL??  Please consider all PK-FK relations!!
    PK:Primary Key FK:Foreign Key PKa belongs to FKa
    table BorrowingProcesses:
    PK *[* *FK* Barcode, DateOfIssue *]*, FK CustomerID, DesiredDateOfRefund, DateOfRefund, FKa BorrowerStaffID, FKa TakeBackStaffID, Paid
    table Customers:
    PK CustomerID, FK FirstName, LastName, Email, PhoneNumber, FK *[* *FK* CountryID, Zipcode *]*, Street, HouseNumber
    table Companies:
    PK Company, POBox, FK CustomerID
    table AcademicDegrees:
    PK&FK CustomerID, AcademicDegree
    table Staff:
    PKa StaffID, StaffFirstName, StaffLastName, Password[encrypted]
    all other table-relations are unproblematic 1:mc-relations
    Edited by: 927185 on 12.04.2012 05:02
    Edited by: 927185 on 12.04.2012 07:12
    Edited by: 927185 on 12.04.2012 08:02
    Edited by: 927185 on 12.04.2012 08:07
    Edited by: 927185 on 12.04.2012 08:09
    Edited by: 927185 on 12.04.2012 08:09
    Edited by: 927185 on 12.04.2012 08:11
    Edited by: 927185 on 12.04.2012 08:13
    Edited by: 927185 on 12.04.2012 08:14

    927185 wrote:
    Question: Will the following Part of my DataBase run bugless with InnoDB of MySQL?? Please consider all PK-FK relations!! And which part of your question relates to Oracle SQL or PL/SQL ?

  • Tables related to PM order for actual and commitment items

    Hello Experts,
    I need help in finding the tables related to PM order for actual and commitment items.
    I need develop a report which can show the actual and commitment items for each order and Operation/component under that each ITEM wise and its related documents.
    For the component we can find the table RESB.
    But i am getting the difficult to find the data related to Operation (services)
    In my client we can able to see PM orders with activity types and SKF
    How can build the logic to find the values for each operation item and its commitments (PO, PR) and actual that is FI documents
    Please guide me the   TABLES and fields or else give me the hints, how can find the tables
    Thanks and Regards,
    Narendra

    Hi,
    The tables are COEP (actuals) and COOI (commitments); that is if you mean the financial figures.
    Regards,
    Eli

  • View links in multi table relations

    Is it advisable (in terms of performance e. g.), to create view links and view objects as local variables in multi table relations?
    examle: the jdev online help says to use
    such multi table relations like this:
    // A (one) -> B (many) -> C (many)
    ViewLink a2b = appMod.findViewLink("AtoB");
    ViewLink b2c = appMod.findViewLink("BtoC");
    ViewObject aV = a2b.getSource();
    ViewObject bV = a2b.getDestination();
    ViewObject cV = b2c.getDestination();
    while(aV.hasNext())
    Row aR = aV.next();
    while(bV.hasNext())
    Row bR = cV.next();
    while(cV.hasNext())
    Row cR = cV.next();
    I would rather keep everything concerning
    a, b, c together, especially when more
    tables (d, e, ...) are added, like this
    ViewLink a2b = appMod.findViewLink("AtoB");
    ViewObject aV = a2b.getSource();
    while(aV.hasNext())
    Row aR = aV.next();
    ViewLink b2c = appMod.findViewLink("BtoC");
    ViewObject bV = a2b.getDestination();
    while(bV.hasNext())
    Row bR = cV.next();
    ViewObject cV = b2c.getDestination();
    while(cV.hasNext())
    Row cR = cV.next();
    Is there anything to say against this approach (in term of performance for example). I am not sure to remeber,
    if this was the approach used in the HotelResevationSystem example.
    Thanks.
    Rx
    null

    For this to work you have to either build a view based on the entities from which you need attributes (joined by the FK) or build a ViewObject with the sql statement giving you all the attributes you need.
    The first case enables you the edit the attributes, the second gives you read only access to the attributes.
    What you try to do isn't a master-detail connection, you are doing a join of some tables.
    Timo

  • Full Load: Error while executing :TRUNCATE TABLE: S_ETL_PARAM

    Hi All,
    We are using Bi Apps 7.9.6.1. Full Load was running fine. But Now we are facing a problem with truncating a table "S_ETL_PARAM".
    I have restart informatica Server And also DAC Srever. But still I am getting the same in the DAC Log as, *"NOMALY INFO::: Error while executing : TRUNCATE TABLE:S_ETL_PARAM*
    *MESSAGE:::com.siebel.etl.database.IllegalSQLQueryException: DBConnection_OLTP:SIEBTRUN ('siebel.S_ETL_PARAM')*
    *Values :*
    *Null Map*
    *EXCEPTION CLASS::: java.lang.Exception"*
    Any Suggestion.....
    Thanks in Advance,
    Deepak

    are you trying to run incremental load when you get this truncate error? can you re-run full load and see that still runs ok? pls also check your DW side database logs like alert lor any DB level issue. such errors do not throw friendly messages in DAC/Informatica side.

  • How to find out the tables related to CRM datasources?

    How to find out the tables related to CRM datasources? For example, the table related to 0CRM_OPPT_H.
    Regards,
    R.Ravi

    Hi Ravi,
    To find out all tables used go into the CRM source system to transaction RSA3 and prepare the selections for extraction of your datasource.
    In a parallel session execute transaction ST05 and press the button 'Activate Trace'
    Go back to the extracor checker and execute the extraction.
    Switch sessions and subsequently 'Deactivate Trace' and 'Display Trace'.
    This will list all tables used.
    regards,
    Olav

Maybe you are looking for