ALTER TABLE RETRACTABLE and DELETE are same as far as space is concerned. Right?

DB version: 11.2.0.4

OS: Oracle Linux 6.5

In my shop, we want to do a data cleanup (purge) so that we don't have to buy additional storage.

As far as I know, that when you can do a manual resizing of the data file, you can release space back to the system of files/Diskgroup.

SHRINK and DELETE free space for the data file, but it will create empty blocks for future insertions/changes.

Imagine a tablespace with a single file data (32GB) and 1 single segment. This segment can be created anywhere in a data file. In this 32 GB datafile oracle may place this segment in the 25 GB. So even if the total space used in the data file is 10 MB, you can resize only to 25 GB!  The solution for this is to move the debate and then run an ALTER DATABASE DATAFILE... RESIZE the control.

But this 'moving segment' approach is not practical when want to deal with a lot of data with a lot of segments in her files.

Back to my original question about SHRINK and DELETE; If SHRINK and DELETE can free space in a data file, there is virtually no difference between SHRINK and REMOVE what little space is. Right?

Thus, the only advantage of SHRINK on delete, I can think of is that SHRINK will lower the HWM to the level of the segment so that Oracle does not have to scan all blocks (a lot of blocks empty sometimes) under the HWM of the segment.

My assumptions are correct?

I see no link between SHRINK and REMOVE.

However, your understanding of SPACE SHRINK is defective. Unless you explicitly use the COMPACT clause, a therapist will indeed free degrees and therefore make space available in the data file.

Tags: Database

Similar Questions

  • in what table hours and jobs are stored

    Hello
    in what table hours and jobs are stored

    Sanna says:
    Hello
    in what table hours and jobs are stored

    DBA_SCHEDULER_JOBS

  • ALTER TABLE RETRACTABLE is possible online?

    RDBMS Version: 11.2.0.4

    Platform: Oracle Linux 6.4

    We have a database of CARS of Production 2 nodes very critical. To recover the space, we want to cut some large tables. The first table we'll shrink is a 300 GB, which is not partitioned with no LOB table.

    Here are the steps that we'll run.

    Step1.alter mytable table allow the movement of the line;

    Step2.alter mytable table shrink space compact;

    Step3.alter mytable table shrink space;

    Step4.alter table mytable disable the movement of the line;

    STEP 5. COLLECT STATISTICS of the table (because the RETRACTABLE table will cancel all the sliders in the shared pool)

    The steps above will take at least 10 hours to complete a 300 GB table. We would like to know if all of these steps can be done online. That is to say. We do not want the SHRINK command to lock the table and prevents the table to be modified (any DML) by the application

    Doc below said this can be done online. But, MOS DOC 1357878.1 said that it is not and you must use the DBMS_REDEFINITION package if you want to do it online.

    https://docs.Oracle.com/CD/E18283_01/server.112/e17120/schema003.htm

    The MOS article you are talking about is not correct. Outside the DOF at the end of a SHRINK lock when the high tide is shifted, SHRINK the SPACE is an online operation. DBMS_REDEFNITION is actually worse because you have DDL locks at both the beginning and the end. However, in both cases, it is the DDL that is blocked by other operations DML (and not the other way around) so that your users will have no problem. If the narrowing or the redefinition is blocked, you can suspend the database for a few seconds. I described how to do here,

    Database Quiesce

    --

    John Watson

    Oracle Certified Master s/n

  • ALTER Table of the default Oracle and the length of name of column Type

    Hi all

    I want to increase the length of the table names and the names of the columns in Oracle.

    By default, it is set like this:

    SQL > dba_tab_columns desc;

    TABLE_NAME NOT NULL VARCHAR2 (30)
    COLUMN_NAME NOT NULL VARCHAR2 (30)
    ...

    Is it possible to change the VARCHAR2 (30) to VARCHAR2 (100)?

    Published by: sukrandere on 12:21 10.Mar.2010

    Table names and column are all two identifiers
    According to the documentation, the maximum length of an identifier is 30 characters.
    It is hard coded in the database software and you can't change it.
    Or do you need to change.

    ---------------
    Sybrand Bakker
    Senior Oracle DBA

  • Compare the implementation plans for SELECT and DELETE

    Hello

    Version: 10.2.0.3

    I REMOVE slow running in the Production db. I can't import and data, or run the REMOVE to get the Plan. For now, I managed to get the history of the plan.

    However I would like to know if it is reasonable to assume the plans to SELECT and DELETE the same?

    Rgds,
    Guenoun

    Gugui wrote:
    Hello

    Version: 10.2.0.3

    I REMOVE slow running in the Production db. I can't import and data, or run the REMOVE to get the Plan. For now, I managed to get the history of the plan.

    However I would like to know if it is reasonable to assume the plans to SELECT and DELETE the same?

    Rgds,
    Guenoun

    Do not understand your question.
    Because I can very easy do a:

    explain plan for
    remove from... where...;

    And then take a look at the plan generated in the PLAN_TABLE.

    However, I guess that plans for a DELETE and a SELECT statement must be the same, because they need to finish work on the same data, in any case...
    A simple test showed that I'm right.

       PLAN_ID OPERATION                      OPTIONS              OBJECT_TYPE                          COST CARDINALITY      BYTES
    ---------- ------------------------------ -------------------- ------------------------------ ---------- ----------- ----------
             3 DELETE STATEMENT                                                                       177714     7702839
             3 DELETE
             3 TABLE ACCESS                   FULL                 TABLE                              177714     7702839
             4 SELECT STATEMENT                                                                       179707     7702839 3928447890
             4 TABLE ACCESS                   FULL                 TABLE                              179707     7702839 3928447890
    
  • ALTER table move & shrink space

    Hello
    What is the difference between alter table move and alter table shrink space orders
    Two free blocks not used in the table so that the free space will be given to the tablespace. Can you explain mw in detail or provide some links

    Sekar_BLUE4EVER wrote:
    Hello
    What is the difference between alter table move and alter table shrink space orders
    Two free blocks not used in the table so that the free space will be given to the tablespace. Can you explain mw in detail or provide some links

    ALTER table move would make invalid indexes and would require so rebuild you the index. In addition to him, it requires extra space in the tablespace, even that would be used for the creation of the object in double. So if you have a table of 10 GB, you need additional 10 GB free todo table alter move. Whereas in the narrowing is a place, the online operation, does not make you go and rebuild the index because it doesn't make them not disabled, requires no additional space to have.

    HTH
    Aman...

  • I deleted the backup but the iCloud space does not come back?

    Hello, I'm Edding:

    A few days earlier, iCloud warn me your iCloud-storage space is nearly full , so I check Storage manage my iCloud and I find backing up my iPhone and iPad are about 3 G of space above. So I delete the backup on iPhone.

    BUT!, so far, the backup space deleted do not come back?

    This is a shot of the screen of the Preferences system-> iCloud-> Manage

    Is there something wrong with that?

    THX.

    Seems like you always have space reserved for your backup. One of the fixes that worked for me was to start backup until it becomes larger, then removes it again.

    I also heard that he did not work for some.

  • I noticed that many of my updates there is 2 times. The same exact. Can I safely delete those that are lined and exactly the same thing? Seems I don't need the same exact 2 and 3 updates times.__Thanks__Michael

    I noticed that many of my updates of widows is 2 times. The exact same ones. I can safly remove those that are lined and exactly the same thing? Seems like I don't need at the same time exact windows updates 2 and 3.
    Here's what are installed now that confuses me.
    Running vista Home premium
    version 6.0.6002 Service Pack 2 Build 6002
    PC x 64
    Intel Core 2 Duo CPU T5550 1.83 GHz, 1833 MHz, 2 Lossnay, 2 Log
    4.00 GB
    Microsoft Silverlight
    These files were add and remove.
    Update for Microsoft Visual C++ 2005 ALT kb973923 - x 6...
    Update for Microsoft Visual C++ 2005 ALT kb973923 - x 8...
    Microsoft Visual C++ 2005 Redistributable
    Microsoft Visual C++ 2005 Redistributable
    Update for Microsoft Visual C++ 2005 ALT kb973924 - x 8...
    Microsoft Visual C++ 2005 Redistributable - x 86 9.0.2...
    Microsoft Visual C++ Run Time Setup Lib
    Would it not be better to uninstall all these and start from scratch with Silverlight?
    Or!
    To uninstall only some?
    Very confused about this.
    Some tips would help a lot.
    I think I posted all the files that were related to this as well as information on the system.
    Thank you
    Member of 1care Michael B.

    Mike

    CF. http://social.answers.microsoft.com/Forums/en-US/vistawu/thread/b9132e0a-31ad-4f3c-af7d-8719972453ab

    Visit the Microsoft Solution Center and antivirus security for resources and tools to keep your PC safe and healthy. If you have problems with the installation of the update itself, visit the Microsoft Update Support for resources and tools to keep your PC updated with the latest updates.

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • COMPARING TWO ROWS IN THE SAME TABLE AND DELETE THEM USING DELETION BLOCK

    Hi all
    I have a problem. I have an Employee table

    employee

    Emp_name Emp_id Emp_status Emp_date

    John 1 P 11-27-2010

    Mike 2 26/11/2010 S

    Simon P 3 22 / 11 / 2010

    Dennis C 4 25/11/2010...


    I compare the rows in the table and their employee_status if 'P', should I remove the... Here, I should delete lines 1 and 3 as their Emp_status is 'P '. I only use BULK DELETE... I tried to use the join query internal and deletion, but it does not work... Can someone help me...

    Ooops, it should be:

    and e2.emp_status in ('P', 'C')

    not

    and e2.emp_status in ('P', 'A')

    Here it goes:

    SQL> select  *
      2    from  employees
      3  /
    
    E EMP_NAME      EMP_KEY          X
    - ---------- ---------- ----------
    C John              123          1
    P Mike              123          2
    P Paul              123          6
    C Harry             124          5
    A Gass              125          7
    C Gass              125          7
    
    6 rows selected.
    
    delete  employees e1
      where 2 = (
                 select  count(distinct e2.emp_status)
                      from  employees e2
                      where e2.emp_key = e1.emp_key
                        and e2.emp_status in ('P','C')
                   )
    /
    
    3 rows deleted.
    
    SQL>
    

    SY.

  • ALTER INDEX REBUILD and large waste area

    Hello world.

    Concerns the RDBMS EE 10.2.0.2 on a box with 16CPUs. Non-standard initialization parameters:

    db_16k_cache_size = 3G
    pga_aggregate_target = 3G
    SGA_MAX_SIZE = 12G
    SGA_TARGET = 5G
    workarea_size_policy = AUTO

    I have a large table partitioned on a monthly basis with a local couple of bitmap index on this subject. Table and index are stored in different areas of storage. The index tablespace is

    EXTENT MANAGEMENT UNIFORM LOCAL 1 M SIZE
    16K BLOCKSIZE
    SEGMENT SPACE MANAGEMENT AUTO

    Nightly batch processing allows a few partitions index unusable then inserts/adds one part of the data and rebuilds the index with

    ALTER INDEX... REBUILD PARTITION... NOLOGGING PARALLEL

    When you are finished, query on DBA_IND_PARTITIONS shows that, for all the index, partition value SCOPES is much greater than the value of used BYTES, for example one of the partitions has 106 DEGREES (1 MB each so he made 106 MB space) while only 15 MB for the BYTES.

    I understand that during the reconstruction of the parallel process slave create segments in the tablespace of the index of destination so that spend a lot more space than this segment takes finally. But it also means that the space is not released. (Deallocation/shrinkage will not help). Same thing can be demonstrated by the queries on DBA_SEGMENTS and DBA_FREE_SPACE. Because of this behavior, I have huge waste of space in the tablespace to index.

    Can someone help, please?
    Przemek

    Allocate space for parallel process slave is documented in the book 'Data warehousing database Oracle 10 g 2', chapter 25 "run in parallel to assistance.

    user2038804 wrote:
    Concerns the RDBMS EE 10.2.0.2 on a box with 16CPUs. Non-standard initialization parameters:

    When you are finished, query on DBA_IND_PARTITIONS shows that, for all the index, partition value SCOPES is much greater than the value of used BYTES, for example one of the partitions has 106 DEGREES (1 MB each so he made 106 MB space) while only 15 MB for the BYTES.

    Przemek,

    I can confirm that there is a bug in 10.2.0.2 leading to inconsistent information related to size in DBA_SEGMENTS / DBA_EXTENTS after an index rebuild in parallel to a big clue, maybe a bug 4771672 in 10.2.0.3. If I remember correctly the information of MEASUREMENT is correct and the information provided in DBA_SEGMENTS is misleading.

    The Metalink note suggests to use DBMS_SPACE_ADMIN Procedure TABLESPACE_FIX_SEGMENT_EXTBLKS to correct erroneous information in the dictionary, but I don't know if it was the one we used when encountering the problem.

    Kind regards
    Randolf

    Oracle related blog stuff:
    http://Oracle-Randolf.blogspot.com/

    SQLTools ++ for Oracle (Open source Oracle GUI for Windows):
    http://www.sqltools-plusplus.org:7676 /.
    http://sourceforge.NET/projects/SQLT-pp/

  • I have 2 Mozilla Firefox on my desktop. They are both version 41.0.2 - in my installation and delete I find only one. How can I delete one of them?

    I tried to update to Mozilla Firefox and I had another icon on my desktop. Now, I have Mozilla Firefox 2 and they are both Version 41.0.2. They are both exactly the same thing when I open the. I see only one on my add/remove program location so I won't delete it because I could delete them both. Can you help me?

    You can remove one of the office shortcuts if both point to the same firefox.exe in the same Firefox program folder.
    You can keep the one with the correct version information where the other is an older version of Firefox.
    Note that Firefox 42 will come out next week (Tuesday).

  • My keyboard loses functionality when I try to leave comments on Facebook. Delete, BACKSPACE, apostrophe and cut, copy and paste are disabled.

    My keyboard loses functionality when I try to leave comments on Facebook.

    Delete, BACKSPACE, apostrophe and cut, copy and paste are disabled. This only happens in the comments, no functionality is lost in the mail or status updates.

    I disabled all my Add-ons and restarted Firefox and the problem persists. I've updated modules, restarted Firefox and the problem persists.

    I updated Firefox and that made no difference.

    I deleted the cookies and cache and still no luck.

    SOLUTION: I disabled the add-on Grammarly Lite and this seems to have solved the problem.

    I informed the Facebook of the show. I can't find any information about this problem in troubleshooting of Facebook.

    I can't reproduce this problem in Internet Explorer. All functions work fine.

    I have the same problem on another device that is running Windows 7 Starter and a laptop running Windows 8.1.

    Separate the issue;
    Shows details of the system;

    Plug-ins installed

    Shockwave Flash 15.0 r0
    Shockwave Flash 11.5 r502

    Having multiple versions of a program can cause problems.

    Take uninstaller from here:
    Uninstall Flash Player | Windows
    Uninstall Flash Player | Mac
    Reinstall the latest version.

    Flash Player v15.0.0. 239 http://get.adobe.com/flashplayer/

  • The printer indicates that online, my laptop said that it is in offline mode, I've deleted and reinstalled the printer and still the same problem,

    The printer indicates that online, my laptop said that it is in offline mode, I've deleted and reinstalled the printer and still the same problem, please help

    You are not quite correct.  Some newer wireless printers have only a wireless connection.  No USB port and a standard Ethernet cable port.

  • Using insert and delete at the same time

    Good afternoon

    I want to do an insert on the table A in table B, while at the same time do a delete on table a.

    and I want to do with the procedures.

    Here is the script I came up with.

    INSERT the table_a (select * from table_b where status = was ') REMOVE from table_b where status = has '

    but I get an error ORA-00933.

    Got any ideas on how I can do this?

    Thank you

    try to:

    BEGIN

    Insert into table_b (select * from table_a where status = has ');

    remove from table_a where status = ';

    END;

    In addition, to create a procedure and see if you can only call this:

    some_procedure

    in some cases, for example (type ODBC connection)

    {call some_procedure ;}

    MK

  • Query to select other records and then the same in 2 tables

    Dear all,

    My database is 10 gr 2 and OS is Linux.
    I have 2 tables with the same fields and almost the same data. There are just a few different lines in table 1 and table 2 that do not match each other.

    I need to select these non-matching rows in both tables in a single request.

    Kindly help on that.

    Best regards, Imran

    You have at LEAST two ways!

    (SELECT * FROM table_A
    minus
    SELECT * FROM table_B)
    union all
    (SELECT * FROM table_B
    minus
    SELECT * FROM table_A)
    /
    

    For example:

    SQL> create table table_a (col_1 number,  col_2 varchar2(5));
    
    Table created.
    
    SQL> create table table_b (col_1 number,  col_2 varchar2(5));
    
    Table created.
    
    SQL> insert into table_a values (1,'A');
    
    1 row created.
    
    SQL> insert into table_a values (2,'B');
    
    1 row created.
    
    SQL> insert into table_b values (1,'X');
    
    1 row created.
    
    SQL> insert into table_b values (2,'Z');
    
    1 row created.
    
    SQL> insert into table_a values (3,'C');
    
    1 row created.
    
    SQL> insert into table_b values (3,'C');
    
    1 row created.
    
    SQL> commit;
    
    Commit complete.
    
    SQL>
    SQL> select * from table_a minus select * from table_b
      2  union all
      3  select * from table_b minus select * from table_a
      4  /
    
         COL_1 COL_2
    ---------- -----
             1 X
             2 Z
    
    SQL> (select * from table_a minus select * from table_b)
      2  union all
      3  (select * from table_b minus select * from table_a)
      4  /
    
         COL_1 COL_2
    ---------- -----
             1 A
             2 B
             1 X
             2 Z
    
    SQL>
    

    Hemant K Collette

Maybe you are looking for