Query to find recoverable space on segments of business

Hello

I use under SQL to find how much space we can recover after the reduction of the LOB segments.

DB version: 11.2.0.3

WITH ACE TEMP_TAB)

"T_ORDER" SELECT TABLE_NAME, COLUMN_NAME "BLOB_COL", ROUND(SUM(dbms_lob.getlength(BLOB_COL)/1024/1024)) T_ORDER UNION ALL SPACE_USED

"T_ORDER" SELECT TABLE_NAME, COLUMN_NAME "CLOB_COL", ROUND(SUM(dbms_lob.getlength(CLOB_COL)/1024/1024)) T_ORDER SPACE_USED

)

SELECT SEG.*, TEMP_TAB. SPACE_USED, TOTALSIZE_MB-SPACE_USED SPACE_RECLAIM OF)

SELECT T2. TABLE_NAME, T2. COLUMN_NAME, T1. NOM_SEGMENT, ROUND (T1. BYTES/1024/1024,0) TOTALSIZE_MB

Of

DBA_SEGMENTS T1,

DBA_LOBS T2

WHERE T1. OWNER = T2. OWNER

AND T1. NOM_SEGMENT = T2. NOM_SEGMENT

AND T2. TABLE_NAME = "T_ORDER") SEG, TEMP_TAB

WHERE SEG. TABLE_NAME = TABLE TEMP_TAB.

AND SEG. COLUMN_NAME = COLUMN_NAME TEMP_TAB.

/

TABLE-NAMECOLUMN_NAMENOM_SEGMENTTOTALSIZE_MBSPACE_USEDSPACE_RECLAIM
T_ORDERCLOB_COLT_ORDER_CLOB_COL936
T_ORDERBLOB_COLT_ORDER_CONTENT_COL56799543962403

Is there one way other/more intelligent to write/edit the SQL code (as the number of tables is about 100 with multiple lob columns)

or is it fine ( frame a SQL as mentioned above, for all the lob of tables in a temporary table)

Kind regards

Veera

That's OK by me.

Tags: Database

Similar Questions

  • query to find or space associated with a tablespace

    Hi the gems...

    I need to import a dump in an empty a new database schema. For this I need to create two storage spaces. But there are problems of space and that's why I need assign almost the exact space for the tablespaces that I create.

    Is there so any query I can get the space occupied by the schema of the source to the corresponding tablespaces?

    >

    There is an existing database server on which is located a SOURCE_SCHEMA schema... I took a dump of who... Suppose that this SOURCE_SCHEMA is associated with two tablespaces TABLESPACE_1 and TABLESPACE_2... now I need to know the space occupied by the SOURCE_SCHEMA on these two individual this database server storage space...

    Hope this helps:

    Select sum (bytes) / 1024/1024/1024 taille_en_Go
    from dba_segments
    where owner = 'SOURCE_SCHEMA.
    and nom_tablespace = 'TABLESPACE_1 ';

  • Query to find the group name for the Business of the employee

    Hello

    I'm new to the HRMS module.

    I want to find employee (per_all_people_f) information about commercial groups.

    I found a HR_ALL_ORGANIZATION_UNITS database table, but there are many records in this table with the same business_group_id that in itself is not a unique key.

    Could someone help me find the link between employees and their BG.

    Thank you.

    Hello

    The link is between per_all_people_f.business_group_id and hr_all_organization_units.organization_id (i.e., the pharmacokinetics of the table). It will be useful.

    Kind regards.

  • query to find space to reduce the point.

    There are storage spaces where the current use is met 90%, and we receive alerts.

    I want to know how much space to add to these storage areas (data files) that use current can be reduced to 80%. or 70%

    Is the any SQL query to find this information.

    database to Oracle 10 g.

    .


    If I have the right to calculation, is perhaps what you are looking for:

    select b.tablespace_name, (b.used_space/b.new_size) * 100 new_used_percent, b.used_percent,
           b.add_size_MB
      from (
            select tablespace_size + (((round(used_percent, 5) - 90)/100) * tablespace_size) new_size,
                   (((round(used_percent, 5) - 90)/100) * tablespace_size) add_size_MB,
                   a.*
              from dba_tablespace_usage_metrics a
           ) b;
    
  • Recoverable space

    I have fdund this request online.

    pages value 50000 lines 32767

    Select owner, table_name, round ((blocks*8), 2). ' Ko ' 'Fragmented size', round ((num_rows*avg_row_len/1024), 2). ' Ko '

    "Actual size", round ((blocks*8), 2)-round ((num_rows*avg_row_len/1024), 2). ' Ko ',.

    ((round ((blocks*8), 2)-round ((num_rows*avg_row_len/1024), 2)) / round (NULLIF (blocks, 0) * 8, 2))

    ) * 100 - 10 '% space recoverable' from dba_tables where OWNER = "DATA_INTEGRATION."

    Here are the results.

    OWNER TABLE_NAME fragmented real size ROUND ((BLOCKS*8), 2)-ROUND ((NUM_ROWS * AVG_RO espace récupérable %))
    ------------------------------ ------------------------------ ------------------------------------------ ------------------------------------------ ------------------------------------------ --------------------
    DATA_INTEGRATION DI_APRIMO_LABEL_CONFIG 72 Ko Ko 69,73 2.27 KB - 6.8472222
    DATA_INTEGRATION DI_CONTACT_DELTA_EMAIL 32 KB 10,55 21.45 KB 57.03125 KB
    DATA_INTEGRATION DI_APRIMO_ACTIVITIES 144 k k 190, 32-46, 32 k - 42.166667
    DATA_INTEGRATION DI_ACTIVITY_INTERACTION 288KO 393.5 KB - 105, 5 KB - 46.631944
    DATA_INTEGRATION DI_APRIMO_ETL_STAGING Ko 40 Ko 40 Ko 0 90
    DATA_INTEGRATION DI_APRIMO_EMAIL_SEND_STAGING 0 0 0kb KB KB
    DATA_INTEGRATION DI_CONTACT_DELTA_CHANGES 5000kb 65,21 KB 4934,79 KB 88.6958
    DATA_INTEGRATION DI_CAMPAIGN_TARGETS_DELTA Ko 1438432 ko 4.17 1438427.83 Ko 89.9997101

    8 selected lines.

    Can someone explain which would result in negative numbers for some tables. In addition, the query can be modified to find the reclaiimable space > N %) or 25%)

    Negative numbers are generated when the fragmented space figure is less than the number of actual space:

    SYS WRI$ _OPTSTAT_HISTHEAD_HISTORY 4608 KB 4338,05 KB 269,95 kb -4.1417
    SYS WRI$ _OPTSTAT_HISTGRM_HISTORY 6320 KB 5874,79 KB 445,21 KB -2.9555

    This can happen even with current statistics.

    Yes, the query can be modified tables only report where recoverable space is > [a few percent]:

    pages value 50000 lines 32767
    column owner format a35
    column table table_name format a35
    column 'Fragmented size' format a20
    column 'Size' real format a20
    size of column 'object' format a20
    column format 'Space recoverable %' 990.9990

    Select owner, table_name, 'Fragmented size', 'Real size', 'the object's size', 'space recoverable % '.
    Of
    (select
    owner,
    table_name,
    NVL (Round ((blocks*8), 2), 0) |' Ko ' "fragmented size."
    NVL (Round (((num_rows*avg_row_len)/1024), 2), 0) |' Ko ' "actual size."
    NVL (Round ((blocks*8), 2)-Round (((num_rows*avg_row_len)/1024), 2), 0) |' Ko ' 'size of the object. "
    NVL (((Round ((blocks*8), 2)-Round (((num_rows*avg_row_len)/1024), 2)) / round (NULLIF (blocks, 0) * 8, 2)) * 100 - 10.0) 'space recoverable % '.
    from dba_tables
    where the OWNER as upper ('& owner'))
    where "Reclaimable recoverable space %" > & percent;

    David Fitzjarrell

  • SQL query to find the total number of source based nonsource passangersbetween source and destination station and passenger station on the same chekindate

    Hello

    SQL query to find the total number of source based nonsource passangersbetween source and destination station and passenger station on the same chekindate.

    Please help on this script and let me know if you need more details.

    ---

    You use a SELECT statement.  Let me know if you need more details.

  • What is the query to find the name of all applications for all EBS R12.1.3 modules?

    What is the query to find the name of all applications for all EBS R12.1.3 modules?

    With regard to:

    Mr. Shahzad Saleem

    Try:

    SELECT * FROM fnd_concurrent_programs_vl;

  • Query to find the Pages and the list of permissions associated with a particular role in PS

    I want a query to find the Pages and the list of permissions associated with specific roles in PS.

    For example, if we see the role of manager accounts payable, it conatins Pages and the list of permissions.

    But, to get everything in EXCEL sheet by Manuel priocess's BIG job. So, can someone give me the query.

    Please try under queries

    The roles assigned to the list of Perm:

    SELECT B.ROLENAME

    OF PSCLASSDEFN A, PSROLECLASS B

    WHERE (A.CLASSID = B.CLASSID

    AND A.CLASSID =: 1).

    List of Perm pages can access:

    SELECT B.MENUNAME, B.BARNAME, B.BARITEMNAME, B.PNLITEMNAME, C.PAGEACCESSDESCR, B.DISPLAYONLY

    OF PSCLASSDEFN A, PSAUTHITEM B, PSPGEACCESSDESC C

    WHERE (A.CLASSID = B.CLASSID

    AND A.CLASSID =: 1

    AND B.BARITEMNAME > ' '

    AND B.AUTHORIZEDACTIONS = C.AUTHORIZEDACTIONS)

  • Query to find the sales order

    Hi all
    I need a query to find sales order number against which a serial number is processed.

    Can ny helps an onthis.

    Thank you

    Hello
    Try the following question

    Select wdd.source_document_number
    Of wsn wsh_serial_NUMBERS,.
    wsh_delivery_details JMD
    Where wsn.delivery_detail_id = wdd.delivery_detail_id
    And & wsn.fm_serial_number series
    and nvl (wsn.ti_serial_number, wsn.fm_serial_number)

    Thank you
    Claire

  • query to find the dependent task, attached to the task on a response in OIM 11 g

    can someone help me to do a sql query to find the dependent task, attached to the task on a response in OIM 11 g

    Published by: user13331347 on Sep 3, 2012 14:09

    Use under query to find the dependent task in OIM 11 g: -.

    Select pkg.pkg_name, mil.mil_name, rsc.rsc_data, rsc.sta_key, sta.sta_status, sta.sta_bucket, mil2.mil_name
    pkg pkg, tos tos, mil mil, mil mil2, rsc rsc, sta sta, rgm the rgm
    where pkg.pkg_key = tos.pkg_key
    and tos.tos_key = mil.tos_key
    and mil.mil_key = rsc.mil_key
    and rsc.sta_key = sta.sta_key
    and rgm.rsc_key = rsc.rsc_key
    and rgm.mil_key = mil2.mil_key
    order of pkg.pkg_name, mil.mil_name, rsc.rsc_data, sta.sta_status, mil2.mil_name

  • Query to find and update

    Hello

    Can someone please provide me with a request to find the names with ',' comma as served, which in fact, I have a service name column in a table where I need to find the names by commas ',' and delete per update.

    I enjoyed, if someone provide me with query to find these services with commas between the two and one update statement separated to remove


    Thanks in advance for your cooperation

    Kind regards
    Ahon

    Hello

    use the REPLACE & INSTR sql command

    example:

    Query:
    Select service name
    from YOURTABLE
    where instr (service_name, ',') > 0 - it return those with tank «,»

    Update:

    Update YOURTABLE
    Set service_name = replace(service_name,',','') - to replace the tank ',' null values
    where instr (service_name, ',') > 0

    But before to do that back up your table or do it in a copy of this...

    Syntax
    -------------------------------------------------------------------------------

    REPLACE (string_expression, string_pattern, string_replacement)

    Arguments
    -------------------------------------------------------------------------------

    String_Expression
    Is the string expression to search for. string_expression can be of character or binary type.
    string_pattern
    Is the substring to find. string_pattern can be of character or binary type. string_pattern cannot be an empty string ("") and must not exceed the maximum number of bytes that fits on a page.
    string_replacement
    Is the replacement string. string_replacement can be of character or binary type.

    Charles.

    If it find useful or appropriate then mark it accordingly

  • Query to find the coordinates of employee salary

    Hello

    Could someone help write the query to find the salary of the employee details.

    Thanks in advance.

    This should help you get started:

    SELECT papf.full_name
    papf.email_address
    ppp.proposed_salary_n salary
    OF per_pay_proposals ppp
    per_all_assignments_f ADP
    per_all_people_f women's wear
    WHERE ppp.assignment_id = paaf.assignment_id
    AND paaf.assignment_type = 'E '.
    AND paaf.primary_flag = 'Y '.
    AND paaf.person_id = papf.person_id
    AND nvl (papf.current_employee_flag, 'n') = 'Y '.
    AND trunc (sysdate) BETWEEN
    PPP.change_date AND ppp.date_to
    AND trunc (sysdate) BETWEEN
    PAAF.effective_start_date AND paaf.effective_end_date
    AND trunc (sysdate) BETWEEN
    PAPF.effective_start_date AND papf.effective_end_date;

  • Query to find records with more than 2 decimal places.

    I have written the below query to find records with more than 2 decimal places, but it is returning records with decimal places 1 & 2. 
    The datatype of the AMT column is NUMBER (without any precision).
    
    SELECT amt  FROM amount_table
     WHERE substr(amt, instr(amt, '.')) LIKE '.%'
           AND length(substr(amt, instr(amt, '.') + 1)) > 2
    Output:-

    AMT

    * 41591.1*
    * 275684.82*
    * 64491.59*
    * 3320.01*
    * 6273.68*
    * 27814.18*
    * 30326.79*
    131.8413635
    162.5352898
    208.5203816
    8863.314632
    22551.27856
    74.716992
    890.0158441
    2622.299682
    831.6683841
    * 1743.14*
    2328.195877
    3132.453438
    5159.827334
    3.236234727
    37.784
    Thanks

    Hello

    user1585440 wrote:

    when i inserted fee_amt as 41591.0999999999  it is displayed as 41591.1 in the output i.e,
    
    insert into amount_table (line_number,fee_amt) values (100,41591.0999999999);
    
    select fee_amt from amount_table  where line_number = 100. this query shows the output as below
    
    fee_amt
    
    41591.1
    
    The fee_amt column has number as datatype (without precision)
    
    Why it is automatically shown rounded off as 41591.1? 
    

    Published by: user1585440 on December 28, 2010 04:50

    You use SQL * more your front end?

    SQL * Plus has a fixed width to display all columns. The default for numbers is 10 characters. If necessary, SQL * Plus will be round a number or the use of scientific notation, to represent the number of the expected number of characters.
    You can use the SQL * more "SET NUMLARGEUR" to change the default view for all the numbers of orders, or "COLUMN" to set a sepcific format in an individual column.
    If you explicitly convert your channel numbers in a query, SQL * Plus adjusts the column width to whatever is needed. For example

    SELECT  TO_CHAR (fee_amt, 'TM')     AS fee_amt_d
    

    "TM" is the default format; You can call TO_CHAR with a single argument, if you prefer.

  • Grep: find the space to the start character

    Hello

    Is it possible to find a space at the beginning of a paragraph and replace them with nothing? A document any has them start almost every paragraph. Already, thank you.

    This would be it:

    ^

    (and Yes, I have done type a single space after that ' ^')

    Replace it with nothing. If there may be one or more spaces at the beginning, you can use this:

    ^ +

    (there is a single space between the two). And if you want to throw any type of white space, including tab and width fixed ones, use this one:

    ^((?! [\r\n]) \s)+

    -He has designed to let soft and hard returns alone, but he'll kill the rest. Use with caution.

  • How to find a space using grep?

    Hello

    I tried several ways to find a space (SPACEBAR) at the beginning of a paragraph using grep. I can get to find any white space at the beginning of a paragraph, but not only a space (SPACEBAR) specifically? Anyone know how to find?

    Thank you

    Gary

    ↑ followed by a space. There is no special code for a single regular space.

    If you want to see where you have entered one or more spaces, use this code to enter a space character:

    \x{20}

Maybe you are looking for