Maximo Open Forum

 View Only
  • 1.  Need to truncate audit tbale in DB2

    Posted 10 days ago

    Hi 

    What is the best query to truncae A_WORKORDER in DB2 to create space in the storage

    How can if ind size of the table.

    Regards

    Naveed


    #Administration

    ------------------------------
    Naveed Wasay
    Serco
    ------------------------------


  • 2.  RE: Need to truncate audit tbale in DB2

    Posted 9 days ago
    Edited by Steven Shull 8 days ago

    If you don't need the data, the best way is absolutely to truncate the table (TRUNCATE TABLE A_WORKORDER IMMEDIATE). 

    To get the total size of the table in DB2 you can use something like this:

    SELECT 
        (data_object_p_size + index_object_p_size + long_object_p_size + 
         lob_object_p_size + xml_object_p_size) AS TOTAL_SIZE_KB
    FROM TABLE (SYSPROC.ADMIN_GET_TAB_INFO('MAXIMO', 'A_WORKORDER'))



    ------------------------------
    Steven Shull
    Naviam
    ------------------------------



  • 3.  RE: Need to truncate audit tbale in DB2

    Posted 8 days ago

    Thanks Steven from your answer,

    Can I use truncate for all work order related table. (WORKORDER+WPMATERiAL+LABTRAN)

    Actually we have a non-production environment  and storage, so we nee free up some space.

    -Naveed



    ------------------------------
    Naveed Wasay
    Serco
    ------------------------------



  • 4.  RE: Need to truncate audit tbale in DB2

    Posted 8 days ago

    Audit tables are purely informational for the customer and have no functional meaning to Maximo. That's the reason why it's safe to truncate that table without impacting Maximo.

    WORKORDER and the supporting tables are functional tables so deleting is more problematic and there are references to workorder in many tables (DOCLINKS, LONGDESCRIPTION, MATUSETRANS, MATRECTRANS, TOOLTRANS, etc.) and customers add their own custom tables too. There are third party archiving utilities that are built to try and handle this when you're talking about production systems. 

    For the non-production systems, you can opt to take this risk, but you may encounter unusual issues. 



    ------------------------------
    Steven Shull
    Naviam
    ------------------------------



  • 5.  RE: Need to truncate audit tbale in DB2

    Posted 7 days ago

    Thanks for help.

    I truncated the table , but the size in storage is not reflecting . 

    Do i need run REORG TABLE schema_name.table_name;

    REORG MAXIMO A_WORKORDER



    ------------------------------
    Naveed Wasay
    Serco
    ------------------------------



  • 6.  RE: Need to truncate audit tbale in DB2

    Posted 23 hours ago
    Edited by Chris Brown 23 hours ago

    Hello,

    Truncate in DB2 is a funny one, it removes the data but it keeps the space that table used reserved in the table space to be reused by that table specifically unless you tell it not to.

    If you want to reclaim some disk space you need to first tell the truncate statement you want the space to be released from the table once the truncate has ran, see drop storage here.

    So your truncate command ends up looking like this

    TRUNCATE TABLE A_WORKORDER DROP STORAGE IMMEDIATE

    This however just releases the space back to the table space itself not the disk so any table within that table space can consume it, the next step is to shrink the table space which will release that storage back to the disk. The details of the commands can be found here specifically the lower high water mark and the reduce max arguments.

    There are a couple of assumptions I'm making here that are worth noting

    1. I'm assuming your table spaces are using Automatic Storage
    2. I'm assuming your table space is called MAXDATA - the default name for the Maximo Data table space.
    --Lower the High Watermark
    ALTER TABLESPACE MAXDATA LOWER HIGH WATER MARK;
    
    --Reduce the Tablespace size
    ALTER TABLESPACE MAXDATA REDUCE MAX;



    ------------------------------
    Chris Brown
    Naviam
    ------------------------------