Query needed to find reclaimable space in db

10.2.0.4
Linux 4.
Hi.
On a test database I suspect there are a lot of objects that are not needed that are taking up valuable disk space. These may include tables that are backups of tables etc.
Does anyone have a tested query to seek out these objects? They will have probably been named test, or backup, etc.
Thanks in advance.

Apparently you want to find candidate junk objects to discard. This is a quite specific subset of the overall issue of finding reclaimable space. In the overall issue a lot of attention should be paid to whether temporarily supressing some free space (due to massive deletions, for example) is worthwhile. In the subset you inquire about, if you can identify the junk it is almost certainly a win to discard it. Some shops have naming standards for objects not officially sanctioned in the production schema. My favorite is the prefix JUNK_<initials>_, so that all the objects can be found quickly with the wildcard on the efficient end of the query, as in:
select owner,object_name,object_type
   from dba_objects
   where object_name like 'JUNK%'
   order by object_name;
or
select owner,object_name,object_type
   from dba_objects
   where object_name like 'JUNK_MWF%'
   order by object_name;Even just the naming convention makes it easy to identify candidate objects, and if you have rules about creating "JUNK" objects such as maintaining a log with expiration dates and purposes, then further inquiry is easy. Having the object's sponsor's initials at hand makes a personal interview possible if the log entries are not useful, and if an expiration date is provided you can simply use the log table as a list to control deleting discardable objects.
In your case you are dealing with catching the horses after the stalls and barn door were left open. Up to now I've written more about closing the barn door for future efforts.
For the cleanup, the similar query with the like predicate '%TEST' and other candidate name templates should suffice. Depending on how creative folks have been spelling TST and BCKUP, you may want to play with the regex functions. Just be sure to treat the generated list as a list of candidates. Depending on the length of the list you can then either generate the appropriate drop statement by type or simply type them into a file for review and execution. Sending out the list of objects to be deleted with a reasonable warning period is highly recommended, since having the ability to create unknown objects often implies sufficient rank to ignore organizational rules. Whether creating an individual object export prior to the drop will vary from site to site and by the size of the object to be dropped.
Good luck,
mwf (aka pudge)

Similar Messages

  • Query needed to find what time a sales order was closed

    Hi to All,
    Need to find when a sales order was closed. Meaning the exact time. I know the flags that needed to be considered. But what table/column holds the exact time that the sales order was closed.
    Thanks

    If your workflow process details are not purged below query end_date will be order closed date.
    select a.instance_id
    , to_char(b.begin_date, 'DD-MON-RR HH24:MI:SS') begin_date
    ,to_char(b.end_date, 'DD-MON-RR HH24:MI:SS') end_date
    , a.process_name process
    from  wf_process_activities a, wf_item_activity_statuses b
    where b.item_type        = 'OEOH'
    and   b.item_key     in (select to_char(header_id) from oe_order_headers_all where order_number = <Ordrer_num>)
    and a.process_name = 'CLOSE_HEADER_PROCESS'.
    and   b.process_activity = a.instance_idIn R12 if you do not have any customizations ,
    Current close process defines wake up time as last day of month, there is no time component.
    So order will be eligible from midnight of the last day of the month.
    First run of Workflow background process program for item type OEOH should be closing them.
    For example : If the Wait activity in 'Close - Order' process encountered first time on 09-May-2013(Any time in the month of May), then Wake up time will be last day of current month I.e. 31-May-2013 00:00.

  • DATE QUERY (Need to find the financial dates)

    **I want to get the first and last financial dates of any year when i enter some date**
    Say, If i enter today's date "07-aug-2012", The query should written me the financial dates are 01-apr-2012 to 31-mar-2013
    And Note : That query should written me the financial dates of any year. (" not only this year alone ")
    Is there any possibility to find query for this?
    Shoot me if possible!!!

    with t as (
               select trunc(add_months(date '&enter_date',-3),'YYYY') fiscal_year from dual
    select to_char(add_months(fiscal_year,3),'DD-MON-YYYY') fiscal_year_start,
           to_char(add_months(fiscal_year,15) - 1,'DD-MON-YYYY') fiscal_year_end
      from t
    / For example:
    SQL> with t as (
      2             select trunc(add_months(date '&enter_date',-3),'YYYY') fiscal_year from dual
      3            )
      4  select to_char(add_months(fiscal_year,3),'DD-MON-YYYY') fiscal_year_start,
      5         to_char(add_months(fiscal_year,15) - 1,'DD-MON-YYYY') fiscal_year_end
      6    from t
      7  /
    Enter value for enter_date: 2012-08-07
    old   2:            select trunc(add_months(date '&enter_date',-3),'YYYY') fiscal_year from dual
    new   2:            select trunc(add_months(date '2012-08-07',-3),'YYYY') fiscal_year from dual
    FISCAL_YEAR FISCAL_YEAR
    01-APR-2012 31-MAR-2013
    SQL> /
    Enter value for enter_date: 2013-03-31
    old   2:            select trunc(add_months(date '&enter_date',-3),'YYYY') fiscal_year from dual
    new   2:            select trunc(add_months(date '2013-03-31',-3),'YYYY') fiscal_year from dual
    FISCAL_YEAR FISCAL_YEAR
    01-APR-2012 31-MAR-2013
    SQL> /
    Enter value for enter_date: 2013-04-01
    old   2:            select trunc(add_months(date '&enter_date',-3),'YYYY') fiscal_year from dual
    new   2:            select trunc(add_months(date '2013-04-01',-3),'YYYY') fiscal_year from dual
    FISCAL_YEAR FISCAL_YEAR
    01-APR-2013 31-MAR-2014
    SQL> SY.

  • Need to find out how much % of query completed from OEM

    Need to find out how long will a query take to run or when I am running the query where can I check to see that X% of my query is complete.
    Is that % shown on OEM --> Performance --> Top Activitity?

    Under OEM/GC of release 10g you won't be able to see how long the query will take neither how much % of a query are already finished.
    I know that this functionality was given in the old release of the OEM (javas based GUI with ll the databases on the left side). I'm missing
    that old functionality, too...

  • Need to reclaim space from dwh tables.

    We have couple of large tables (> 200G) in one of the DWH schema. I need to reclaim space on the mountpoint.
    I have used ALTER TABLE <> MOVE COMPRESS; command to compress these tables.
    Now in dba_segments it is showing the improvement. 200g table came down to 60G. However I am not able to see any change in datafile and in mountpoint, I beleive due to the HWM.
    I tried shrink for the tables, it did not help.
    Could you please suggest any other approach.

    refer to
    http://jonathanlewis.wordpress.com/2010/01/30/free-space/
    http://jonathanlewis.wordpress.com/2010/02/06/shrink-tablespace/
    Anand

  • Need to find the assets associated to a BCC project using SQL query

    Hi,
    Given a BCC project (project_id), I need to find the assets (type of asset, version, status etc) in that project using SQL queries.
    I need this for reporting purpose and cannot do this programatically using any code.
    Surprisingly ATG does not store this association in a direct way. Can someone provide me the query if you have already done this before?
    I tried enabling loggingDebug in PublishingRepository and VersionManagerRepository to get the queries, but I did not get what I want.
    Thanks in advance,
    Gopinath Ramasamy

    UPDATE:
    When a project is selected in BCC, ATG is doing something crazy, as it appears to me, of querying all the tables (ofcourse when there is a cache miss) in all the versioned item descriptor with the workspace id of the project to display the assets contained in it.
    I do not see an easy or direct way of coming up with a query for this requirement.
    Please let me know if anyone has any other idea.
    Thanks,
    Gopinath Ramasamy

  • I need to find a way to put emails on a personal folder that won't take up all my email space.

    I'm on a mac and I need to find a way to put emails on a personal folder that won't take up all my email space. I've tried 3 times to set them up, but I keep getting the "almost full" message every night.

    Can you tell us exactly what the "almost full" message says? Is it referring to your mailbox (ie, email server space), or your hard drive?
    If your email server is almost full, you can store folders and messages on your Mac. In Mail, go to the Mailbox menu, click New Mailbox, and choose the location "On My Mac". Then drag folders into that new mailbox to move them to your local computer, and off the email server.
    If your hard drive is full, this won't help, and you need a different approach.
    What version of OS X are you running? It helps us for you to put that information into your profile, since there are big differences between versions of OS X.
    Matt

  • Sql query to find the space in between the sentense

    hi,
    can anybody tell me the query to find the space in between the data
    chandan

    Not sure what you mean, but you might want to take a look at INSTR, like in
    instr (txt, ' ')

  • Need to find the free space on storage server

    Hi,
    I need to find the free space on storage server through Java code, and even find whether web server has access to the storage server.
    So please tell me how do i do that.

    This will be through an API for your "storage
    server". It would be helpful if you at least
    indicated what this "storage server" is: a NFS? an
    FTP site? something else?I forgot to mention that. Its NFS. Please let me know
    clearly, what APIs I need to use and in simple how.How am I supposed to clearly know this?
    Consult the documentation for your NFS system and figure it out. That's what to do.

  • How to find which query need to tuned

    Hi ,
    How can i find , which query need to tuned . Is there any mechanism behind it?

    The mechanisms behind it are depending on your database version.
    For example:
    Oracle 9i has STATSPACK that helps you to identify possible problem queries.
    Oracle 10g has AWR - Automatic Workload Repository
    Oracle 11g has SPA - Database Replay SQL Performance Analyzer
    but there are many more tools/mechanisms...trace/tkprof for example.
    Go to http://tahiti.oracle.com and do a search on 'performance tuning guide', and pick the one that matches your (sofar unknown) database version, read a bit every now and then and see what tools are at your disposal and fit your requirement and situation.
    Besides the links that Blu already posted, searches on http://asktom.oracle.com also give lots of pointers and explanations regarding the (neverending) tuning process (at least: helped me tremendously in understanding the tuning process, the do's and dont's).
    Make sure you don't get CTD (Compulsive Tuning Disorder) from all this... ;)

  • Reclaim space at OS level.

    Dear all
    I have performed following activities to reclaim space at database level on development system but I am quite suspicious about to reclaim at OS level.
    1) Choose baldat table for REORG candidate
    2) Size of table before deleting record was 11GB
    3) Delete record from it using slg2
    4) Offline REORG done
    5) Table size is now around 2.5GB
    6) Since database is DB9.7 and tablespace is in DMS type, I need to issue two command as following to reclaim space at DB and OS level.
         alter tablespace TCD#BTABD lower high water mark
         ALTER TABLESPACE TCD#BTABD REDUCE (ALL CONTAINERS G/K/M)
    7) I have issued only first command to lower HWM which freed up space at Database level.
         Checked from DBACOKPIT to see tablespace status as following
         Tablespace Name     KB Total     Percent Used     KB Free     Page Size (KB)     High-Water Mark (KB)    
         TCD#BTABD            16121856        33.25           10762016       16                         5359712
    Now my query is I want to reduce it down by 9GB at OS level so which figure I have to put (??) on the following. Is there any harm to execute this command on the fly which causes database issue???
          ALTER TABLESPACE TCD#BTABD REDUCE (ALL CONTAINERS ??? G/K/M)
    Thanks
    Mehul

    Hi,
    I have a following output from abovemention query
    TBSP_NAME                      TBSP_TYPE  RECLAIMABLE_SPACE_ENABLED
    SYSCATSPACE                    DMS                                1
    SAPTOOLS                       DMS                                1
    SAPEVENTMON                    DMS                                1
    PSAPTEMP16                     SMS                                0
    SYSTOOLSTMPSPACE               SMS                                0
    SYSTOOLSPACE                   DMS                                1
    TCD#STABD                      DMS                                1
    TCD#STABI                      DMS                                1
    TCD#BTABD                      DMS                                1
    TCD#BTABI                      DMS                                1
    TCD#CLUD                       DMS                                1
    TCD#CLUI                       DMS                                1
    TCD#POOLD                      DMS                                1
    TCD#POOLI                      DMS                                1
    TCD#DDICD                      DMS                                1
    TCD#DDICI                      DMS                                1
    TCD#DOCUD                      DMS                                1
    TCD#DOCUI                      DMS                                1
    TCD#EL702D                     DMS                                1
    TCD#EL702I                     DMS                                1
    TCD#LOADD                      DMS                                1
    TCD#LOADI                      DMS                                1
    TCD#PROTD                      DMS                                1
    TCD#PROTI                      DMS                                1
    TCD#ES702D                     DMS                                1
    TCD#ES702I                     DMS                                1
    TCD#SOURCED                    DMS                                1
    TCD#SOURCEI                    DMS                                1
    TCD#USER1D                     DMS                                1
    TCD#USER1I                     DMS                                1
    TCD#DIMD                       DMS                                1
    TCD#DIMI                       DMS                                1
    TCD#FACTD                      DMS                                1
    TCD#FACTI                      DMS                                1
    TCD#ODSD                       DMS                                1
    TCD#ODSI                       DMS                                1
      36 record(s) selected.
    Thanks
    Mehul

  • Reclaim space from DBFs

    Hi All,
    I have one query regarding tablespace reclaim space. I have users tablespace which is having 5 dbfs. Some of the DBFs of USERS tablespace having autoextend on with max size 32G and some of the DBFs not having autoextend on and maxsize 4G.
    Now when I checked the USERS TBS through EM , I come to know only few MBs out of 20G are in used in 3 DBFs of USERS tablespace and rest of 2 dbfs are in good in use. Now I want to reclaim the space from 3 dbfs say users03,users04 and users05. users01 and users02 are properly in used. I want to reclaim the space from 03,04 and 05.
    can I have any idea how to reclaim space from dbfs? I try with alter database datafile ...resize but giving error "ORA-03297: file contains used data beyond requested RESIZE value".
    please suggest me,
    Thanks...

    Yes, I think you are understanding how it works. For a visual example, if this is your data file:
    XXXX--XX-XXXX-XXXX-XXXX-XXXXXXX-----------------
    and you delete some data
    XX----X--------X------------------X-----------------
    The datafile can be resized only down to
    XX----X--------X------------------X
    Which tools are available to do this efficiently vary by database version, for example in my 9.2.0.6 database I can use exp/imp, CREATE TABLE AS SELECT, rebuild indexes (mostly) online, exp/imp, move LOBs around with ALTER TABLE ... MOVE LOB, or other strategies - some of these are more work than others, and all will take some amount of time. In 8i There are fewer options; beginning with 10g data pump and DBMS_REDEFINITION are available; in 11g the index rebuilds don't lock the data, so the time may be less of a concern.
    Before you even spend the time to shrink these data files, consider the space needs for USERS. If the extended size was a one-time thing, then shrinking datafiles may be justified. If USERS may grow that large again then a data file shrink is a lot of work for little gain.

  • I'm trying to manually sync my music to my iPhone but it needs so much free space

    I used to be synced to a different iTunes on a different computer. Now that I have my own laptop with my on music library I'm trying to sync it to my phone. I have to do it manually because I don't have enough space on my phone to sync my entire music library. But every time I try to sync it, it will tell me that it's unable to sync because it needs "at least 3.something more GB of space in order to sync" and every time I unselect an artist it will say it needs more space until I have barely any of my music selected. Why does it need so much free space? Like it requires approx 5GB of free space in order to sync my music and I don't understand why. I've never had this issue before. I even imported all of my pictures to my laptop so I could delete them to make room for my music. Please help me.

    Hi there Sarbunn,
    You may find the information in the article below helpful if there is not enough free space on your device to sync.
    If you get a "Not enough free space" alert on your iPhone, iPad, or iPod touch 
    -Griff W.  

  • I'm trying to transfer my pictures from my iPhoto library to my external hard drive. I dragged the iPhoto Library folder into the drive and after waiting a while it says Error Code -36. I need to free up space asap, what should i do?

    I'm trying to transfer my pictures from my iPhoto library to my external hard drive. I dragged the iPhoto Library folder into the drive and after waiting a while it says "Error Code -36 The finder cannot complete the operation because some data in 'iPhoto Library' could not be read or written". I need to free up space asap, what should i do??

    Yes, the Old Master file has a folder for each year where I find all photos from that specific year. I am attaching a screen shot of the file.
    In the meantime i have managed to download all photos (it did not download any video files though in mpg, avi, 3gp, m4v,mp4 and mov format) to a new iphoto library. Unfortunately the photos are quite mixed and often doubled up. I ma considering to purchase iphoto library which checks all duplicates in iphoto. this will save me a lot of time. What do you think?

  • Find available space in buffer cache

    Hi.
    I want to find available space from buffer cache. First thought was to make it 8i-9i comp, by not using v$bh to calculate sum of memory and available space.
    I have the following pl/sql block to calculate the values:
    declare
    num_free_blck integer;
    num_all_blck integer;
    num_used_blck integer;
    overal_cache number := 0;
    used_cache number := 0;
    free_cache number := 0;
    blck_size integer;
    pct_free number := 0;
    begin
    select count(1) into num_free_blck from v$bh where status='free';
    select count(1) into num_all_blck from v$bh;
    select count(1) into num_used_blck from v$bh where status <> 'free';
    select value into blck_size from v$parameter where name ='db_block_size';
    used_cache := (blck_size * num_used_blck)/(1024*1024);
    free_cache := (blck_size * num_free_blck)/(1024*1024);
    overal_cache := (blck_size * num_all_blck)/(1024*1024);
    pct_free := ((free_cache/overal_cache)*100);
    dbms_output.put_line('There are '||num_free_blck||' free blocks in buffer cache');
    dbms_output.put_line('There are '||num_used_blck||' used block in buffer cache');
    dbms_output.put_line('There are totally '||num_all_blck||' blocks in buffer cache');
    dbms_output.put_line('Overall cache size is '||to_char(overal_cache,'999.9')|| 'mb');
    dbms_output.put_line('Used cache is '||to_char(used_cache,'999.9')||' mb');
    dbms_output.put_line('Free cache is '||to_char(free_cache,'999.9')||' mb');
    dbms_output.put_line('Percent free db_cache is '||to_char(pct_free,'99.9')||' %');
    end;
    The result of the execution is:
    SQL> @c:\temp\bh
    There are 3819 free blocks in buffer cache
    There are 4189 used block in buffer cache
    There are totally 8008 blocks in buffer cache
    Overall cache size is 62.6mb
    Used cache is 32.7 mb
    Free cache is 29.8 mb
    Percent free db_cache is 47.7 %
    PL/SQL-prosedyren ble fullført.
    SQL>
    This is not correct according to the actuall size of the buffer cache:
    SQL> select name,value from v$parameter where name='db_cache_size';
    NAME
    VALUE
    db_cache_size
    67108864
    SQL>
    Anyone that have an idea bout this?
    Thanks
    Kjell Ove

    Mark D Powell wrote:
    select decode(state,0,'Free',
    1,'Read and Modified',
    2,'Read and Not Modified',
    3,'Currently being Modified',
    'Other'
    ) buffer_state,
    count(*)  buffer_count
    from    sys.xx_bh
    group by decode(state,0,'Free',
    1,'Read and Modified',
    2,'Read and Not Modified',
    3,'Currently being Modified',
    'Other'
    Provided the OP figures out that xx_bh is probably a view defined by sys on top of x$bh this will get him the number of free buffers - which may be what he wants - but apart from that your query is at least 10 years short of complete, and the decode() of state 3 is definitley wrong.
    The decode of x$bh.state for 10g is:
         decode(state,
              0,'free',
              1,'xcur',
              2,'scur',
              3,'cr',
              4,'read',
              5,'mrec',
              6,'irec',
              7,'write',
              8,'pi',
              9,'memory',
              10,'mwrite',
              11,'donated'
         ), and for 11g it is:
         decode(state,
               0, 'free',
               1, 'xcur',
               2, 'scur',
               3, 'cr',
               4, 'read',
               5, 'mrec',
               6, 'irec',
               7, 'write',
               8, 'pi',
               9, 'memory',
              10, 'mwrite',
              11, 'donated',
              12, 'protected', 
              13, 'securefile',
              14, 'siop',
              15, 'recckpt',
              16, 'flashfree', 
              17, 'flashcur',
              18, 'flashna'
         ), (At least, that was the last time I looked - they may have changed again in 10.2.0.5 and 11.2.0.2)
    Regards
    Jonathan Lewis

Maybe you are looking for

  • Can you delete an item from itunes and get your money back???

    hi!!! can u please tell me if you can delete an item from itunes and get your money back??? Thanks XD

  • I struggle with this every time I have a new install... Palette configuration... it's embarrassing

    I can at least make it simple to ask- here's an imgur link: http://imgur.com/u6wnZGU the way my current right click palette appears is on the left in red, and I want it to appear like the one in green on the right- I'm trying to get my install at hom

  • Can't assign personal key commands

    Hello, I recently had to reinstall Logic Pro 9 and neglected to backup/save my personal key commands. In reentering these commands I'm having a problem with one specific personal key command for Solo Off For All that Logic won't accept. I have gone i

  • Deleting an account?

    How do I delete an Admin account.  I inadvertantly created an Admin account when I just wanted to create an "ordinary" acount?  When I try to highlight the erroneous account under 'Other Users' to delte it by selecting the minus sign it doesn't selec

  • Center the box

    Hi, I wanna center the panelBox within the page. Any advice? <?xml version='1.0' encoding='UTF-8'?> <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:a