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

Tags: Database

Similar Questions

  • 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.

  • ALTER table move online in an encrypted tablespace

    Hello

    Our DBA want to put all our data in encrypted storage.

    Once they create encrypted tablespaces, we will have to do «alter table move online...» "orders for encrypted storage space around the tables.

    Has anyone here done already?   Keeps the table moved really 'on-line' (available at query/insert/update) during the move?  Or will we have to wait some time stop/downtime while the tables are moved?
    What about the tables with long or CRAFT?

    Thank you!

    KSandberg and to add to the recall of John that only ITO tables can be moved online, if the table needs to be moved offline the indexes would be invalid until rebuilt.  If the table is an IOT I suggest you rebuild the index online after the move because even if the indexes are always used the logical ROWID is more pointing to the correct location and access of the index will be less effective that will you rebuild the index.

    - -

    The dbms_redefinition package could be an alternative solution if you need to move the tables no - ITO online.

    - -

    HTH - Mark D Powell.

  • Online syntax to create Foreign key with Alter Table statement

    I am a pretty meticulous reader. That being said, from the 4 texts that I read to start to learn SQL, I do not remember and do more that probably not, find a syntax online for the creation of a CF with the statement alter table.

    Just something I thought while I was reading.

    Is there a such syntax?

    And if so someone can give me direction on my code?

    ALTER table emp4 change employee_id key foreign employees of references (employe_id);

    It gives me the option error invalid alter table.

    Any idea would be appreciated.

    Thank you.

    rp0428 wrote:

    A foreign key is a constraint, you must use ADD CONSTRAINT.

    Thare is more than one way to skin a cat:

    SQL > create table tbl (id number, name varchar2 (10))
    2.

    Table created.

    SQL > alter table tbl adds (foreign key references emp (empno))
    2.

    Modified table.

    SQL > select constraint_name,.
    2 constraint_type
    3 from user_constraints
    4 where table_name = 'TBL '.
    5.

    CONSTRAINT_NAME C
    ------------------------------ -
    SYS_C0021920 R

    SQL > drop table tbl purge
    2.

    Deleted table.

    SQL > create table tbl (id number, name varchar2 (10))
    2.

    Table created.

    SQL > alter table tbl change (foreign key references emp (empno))
    2.

    Modified table.

    SQL > select constraint_name,.
    2 constraint_type
    3 from user_constraints
    4 where table_name = 'TBL '.
    5.

    CONSTRAINT_NAME C
    ------------------------------ -
    SYS_C0021921 R

    SQL >

    SY.

  • ALTER TABLE SHRINK the SPACE COMPACT takes a long time

    Hello
    I run:
    ALTER TABLE TOM. TAB1 SHRINK SPACE COMPACT;
    ALTER TABLE TOM. TAB1 SHRINK SPACE WATERFALL;


    The "ALTER TABLE TOM. Tab1 SHRINK SPACE COMPACT"was completed in 2 hours, but"ALTER TABLE TOM. Tab1 SHRINK SPACE WATERFALL"is still underway after 8 hours, less than the size of the table TAB1 and index:

    NOM_SEGMENT... GB
    TAB1................................. 166
    IDX01................................ 83
    SYS_C00......................... 42
    IDX02............................. 142
    IDX03.............................. 66
    IDX04............................. 122


    Why 'SHRINK the SPACE COMPACT' takes a lot of time?
    Is it possible to check how much time should I take?

    Thanks in advance!

    Running

    ALTER INDEX TOM. TAB1_IDX03 SHRINK SPACE COMPACT;

    ALTER INDEX TOM. TAB1_IDX03 SHRINK SPACE;

    set is useless, as does 'SHRINK the SPACE' that means "SHRINK SPACE COMPACT" and much more (see the quote from the Doc Oracle Hemant).  2, 'SHRINK the SPACE' is the operation that will take more time.  So if 'SHRINK the SPACE' is what you wanted (reclaim space) and you can afford to wait, run 'SHRINK the SPACE' only.

    "SHRINK the COMPACT SPACE" is a part of the work that 'SHRINK the SPACE' is only.  Generally, use you it when time is at a premium: you run SHRINK SPACE COMPACT a weekday evening (because SHRINK the SPACE does not fit in one night and accrue hourly) and you run SHRINK SPACE on the weekend to finish following the recovery of your space.

    Regarding the fact that the entire segment or a partition after another, I have no experience - I both of their time and test methods.  Perhaps running several sessions at the same time on different partitions would save time (but be more heavy on the CPU and storage).

    Also note that SHRINK the AREA generates a lot of REDO (keep an eye on the free space of your ARCHIVELOG destination).  With your data volume, I would expect dozens (or even hundreds) of gigabytes of roll forward must be generated.

  • ALTER table, if not amended

    Hi, thank you very much in advance. How to add columns to a table only the columns not yet existed.

    ALTER table

    table-name

    Add

    (

    column1_name column1_datatype column1_constraint,

    column2_name column2_datatype column2_constraint,

    column3_name column3_datatype column3_constraint

    );


    If column1_name does not exist I have add the column in table_name. Otherwise, do not add the column.


    Best regards, ib

    Here the case, I give my client a script and if they add columns or not, I don't know. So, I want only the columns are added to the case where they do not exist. The script includes other ddl and dml so I don't want a mistake due to the change table make the script error. Thank you.

    Sorry-, you will have to wait for someone else to help.

    Just, that makes NO sense to me. If you are unsure when columns are added to a table, then you have lost ALL control over your data model. You can possibly write, test, or deploy code that uses tables and columns without knowing which columns a table has.

    You should just use separate scripts for these tables of problem so that if the script didn't it won't affect other scripts.

  • ALTER TABLE ADD CONSTRAINT

    Hi all
    I need to know if the instructions ALTER TABLE... ADD CONSTRAINT can specify the TABLENAME parameter where I want to create the score.
    Is this possible? If I can, could you please give me the syntax, please?
    If this is not the case, how can I create a table in a schema and for any other primary key?

    Thanks in advance

    Steven

    stesappo wrote:
    Hi all
    I need to know if the instructions ALTER TABLE... ADD CONSTRAINT can specify the TABLENAME parameter where I want to create the score.
    Is this possible? If I can, could you please give me the syntax, please?
    If this is not the case, how can I create a table in a schema and for any other primary key?

    Thanks in advance

    Steven

    What is a "score"? Do you mean the underlying unique index is created to enforce the primary key constraint?

    I guess you mean TABLESPACE, instead of TABLENAME?

    Yes you can.

    alter table ... add constraint ... primary key (...)
    using index tablespace ...
    /
    
  • alter table shrink space! ~ help!

    Hi guys,.

    (1) I have send a space of shrinking orders and it takes ages to complete.

    (2) generated Tons of redo and undo and I'm near my hard drive space max.

    T1) if I had to kill today's session.
    There will be a lot of back to?

    is not alter table a DDL statement, so the movement of the line be committed regularly or only after the entire statement over?

    which means that the decline in price if I kill the session will have to restore all the way at the time that I publish a retraction statement?

    Kind regards
    Noob

    grateful if you could offer some advice.

    My advice is to TEST DDL on dev. DB before launching the Production System; so that you know what to expect coming.

  • 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...

  • ALTER table move partition in parallel

    Hello

    I wish that this command must be run in parallel. is this possible?

    ALTER TABLE xyz PARTITION MOVE xyz_p0608 TABLESPACE q208_ts

    Thank you
    parallel_clause
    
    Purpose
    
    The parallel_clause lets you parallelize the creation of a database object and set the default degree of parallelism for subsequent queries of and DML operations on the object.
    
    You can specify the parallel_clause in the following statements:
    
        * CREATE TABLE: to set parallelism for the table (see CREATE TABLE).
        * ALTER TABLE (see ALTER TABLE):
              o To change parallelism for the table
              o To parallelize the operations of adding, coalescing, exchanging, merging, splitting, truncating, dropping, or moving a table partition
    

    To parallelize append operations, coalescence, Exchange, merger, splitting, truncate, delete or move a partition table

  • ALTER TABLE hf_altertest ADD COLUMN does not

    I am using ORACLE 11g and my FDI is Developer SQL 4.1.1

    It's all free PC version that has limits.

    I tried on:

    CREATE TABLE hf_altertest

    (

    contact_id INTEGER NOT NULL

    , name VARCHAR (25)

    , last_name VARCHAR (35)

    PRIMARY KEY (contact_id)

    );

    ALTER TABLE hf_altertest State to add a CHAR (2) COLUMN;

    But when I go to run the ALTER TABLE statement then I get following error:

    rror starting at line: 1 323 in command.

    ALTER TABLE hf_altertest State to add a CHAR (2) COLUMN

    Error report-

    SQL error: ORA-00904: invalid identifier

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    I can run the same code in MySQL without error.

    This leads me to think that maybe I'm just bumping into a limit in the free version of PC.

    Any thoughts?

    3003916 wrote:

    I am using ORACLE 11g and my FDI is Developer SQL 4.1.1

    It's all free PC version that has limits.

    ALTER TABLE hf_altertest State to add a CHAR (2) COLUMN;

    But when I go to run the ALTER TABLE statement then I get following error:

    rror starting at line: 1 323 in command.

    ALTER TABLE hf_altertest State to add a CHAR (2) COLUMN

    Error report-

    SQL error: ORA-00904: invalid identifier

    00904, 00000 - '% s: invalid identifier '.

    * Cause:

    * Action:

    I can run the same code in MySQL without error.

    This leads me to think that maybe I'm just bumping into a limit in the free version of PC.

    Any thoughts?

    There is no LIMIT to the 'free' version  If you read the error message he said THAT was not a valid identifier.  Just to show you that I tried your erroneous statement

    ALTER TABLE hf_altertest ADD COLUMN state2 CHAR(2);
    

    and here is the indicator error message in SQL +.

    SQL * more: Production of liberation 12.1.0.2.0 Tue Oct 15 14:34:57 2015

    Copyright (c) 1982, 2014, Oracle.  All rights reserved.

    Connected to:

    Oracle Database 11 g Enterprise Edition Release 11.2.0.4.0 - 64 bit Production

    With the partitioning, Real Application Clusters, Automatic Storage Management, OLAP

    and Data Mining options

    Add a COLUMN state2 TANK (2)

    *

    ERROR on line 2:

    ORA-00904: invalid identifier

    As you can see (and as the previous poster of response indicates), the 'COLUMN' KEYWORD is not necessary when adding new columns.  Only when 'RENAME' is used, then you add the keyword COLUMN.

    See the documentation for the syntax of ALTER TABLE here--> http://docs.oracle.com/database/121/SQLRF/statements_3001.htm#SQLRF01001

    See specific clause RENAME syntax here--> http://docs.oracle.com/database/121/SQLRF/statements_3001.htm#i2183480

  • Invalid procedure after alter table add < column >

    Hello Experts,

    I was faced with a situation where I add a column in a table that is used in a procedure, immediately after the addition of the new procedure associated with this table column becomes invalid.

    Can someone explain please know why this happens.

    Database version:-11.2.0.4.

    I was faced with a situation where I add a column in a table that is used in a procedure, immediately after the addition of the new procedure associated with this table column becomes invalid.

    Can someone explain please know why this happens.

    Yes - the Oracle documentation explains this. I found this doc with a simple search of "column, add the oracle 11g invalid procedure.

    http://docs.Oracle.com/CD/B28359_01/server.111/b28318/dependencies.htm#CHDJIIFC

    Table 6-2 , shows how objects are affected by changes to other objects upon which they depend.

    Table 6-2 operations affects this object status

    Operation Where the status of dependent objects

    ALTERTABLEtableADDcolumn

    INVALIDWhen:

    • Uses of the object (except a view)-dependent SELECT * on table .
    • Dependent object uses table %rowtype .
    • Dependent object performs INSERT on table without specifying a list of columns.
    • Dependent object references table in the query that contains a join in SQL.
    • Dependent object references table in the query that refers to a PL/SQL variable.

    Otherwise, no change.

    Read the WHOLE ARTICLE and see if it does not have to explain your problem.

  • I changed my computer; in the former, I installed Adobe Acrobat 7 Pro. I installed the DVD this software in the new computer, the installed software apply for registration, and it is not possible online or by phone because I get an e

    I changed my computer; in the former, I installed Adobe Acrobat 7 Pro. I installed the DVD this software in the new computer, the installed software apply for registration, and it is not possible online or by phone because I get an error message: "Servicio de Activacion not available." I have download the acrobat 7.0 Pro software, following the instructions on the Adobe web site, and I download PPRO_2.0_Ret - NH_ES.zip, but the software has been Adobe Premier Pro, no. Adobe acrobat 7 Pro. How can I use my Adobe Acrobat 7.0 Pro?

    Download Adobe Acrobat 7 and Adobe Creative Suite 2

  • alter table drop column

    Hi all

    I create a simple table like this:

    create table x (a number, b varchar2 (20));

    ALTER table x modify a primary key constraint a_pk;

    insert into x values (1, 'first row');

    insert into x values (2, 'second row');

    commit;

    Then:

    SQL > select * from x;

    A AND B

    ---------- --------------------

    1 first row

    2 second row

    Then I run these commands:

    SQL > alter table drop column x.

    Modified table.

    SQL > select * from x;

    B

    --------------------

    first row

    second row

    Question: Why am I able to remove this column when a PRIMARY KEY for the table? I do not use the key words of CONSTRAINT CASCADE with the DROP COLUMN clause...

    I have Mr. Steve O'Hearn here saying this in his book 'Certified Expert Guide exam 1Z0-047:

    CREATE TABLE ORDER_RETURNS

    (NUMBER OF ORDER_RETURN_ID,

    NUMBER OF CRUISE_ORDER_ID

    DATE OF CRUISE_ORDER_DATE,

    CONSTRAINT PK_OR PRIMARY KEY (ORDER_RETURN_ID));

    .. We can not remove the column the table ORDER_RETURNS that

    is subject to the constraint PRIMARY KEY (ORDER_RETURN_ID)... The reasons are:

    ORDER_RETURN_ID is the PRIMARY KEY of this table...

    Isn't this correct?

    No - it's NOT correct - the book is bad.

    You could have just tested the FULL example in the book to verify that the statement is wrong.

    http://weirdoootamee.yolasite.com/resources/Oracle%20sql%20expert.PDF

    See page 432

    CREATE TABLE CRUISE_ORDERS
    (NUMBER OF CRUISE_ORDER_ID,
    ORDER_DATE DATE,
    PK_CO (CRUISE_ORDER_ID, ORDER_DATE) PRIMARY KEY CONSTRAINT);

    CREATE TABLE ORDER_RETURNS
    (NUMBER OF ORDER_RETURN_ID,
    NUMBER OF CRUISE_ORDER_ID
    DATE OF CRUISE_ORDER_DATE,
    CONSTRAINT PK_OR PRIMARY KEY (ORDER_RETURN_ID).
    FOREIGN KEY CONSTRAINT FK_OR_CO
    (CRUISE_ORDER_ID, CRUISE_ORDER_DATE)
    REFERENCES CRUISE_ORDERS (CRUISE_ORDER_ID, ORDER_DATE));

    create two tables - add data, if you want.

    Then try to delete the primary key column and see what happends

    ALTER table drop column order_return_id order_returns;

    The best way to learn is to actuall TRY of THINGS.

    Try it with your own table, but the FIRST thing that you should try was the real example of the book.

  • ALTER table add constraint vs alter table change

    Hello

    could someone explain why we have two different statements when you add a constraint on an existing table?

    If I need to add a primary key constraint to a column from an existing table that I use:

    ALTER table tab1 add the key primary constraint tab1_id_cst (id)

    But if I want to add a NOT NULL constraint, the same syntax does not work, I need to use alter table change instead

    Why?

    Thank you!

    Hello

    The constraint not null is a constraint inline, average, it applies to the column level. So in order to change anything at the column level you must use "ALTER TABLE CHANGE" only.

    Remaining constraint is forced to outline, which are part of the table definition. The table definition can be modified by "ALTER TABLE... ADD '.

    In the framework of the above mentioned constraints, those are the two columns level constraints and table except constraint NOT NULL value. Change column level, you must use the syntax

    and for the level of the table, you need to use the respective syntax.

    Kind regards

    Bigot

Maybe you are looking for

  • Secondary HDD not recognized

    I recently bought a used HP CD7100 CMT desktop computer and I try to install a secondary (or slave) antibody SATA hard drive. It is the first computer I owned with SATA drives and I can't recognize the drive volley. Any help would be appreciated. Tha

  • Tracing of data vs. time in Excel

    Hello community, My question seems pretty simple: I would like to draw (not in a graph, regular values just next to each other) collected data vs the time they were acquired. My problem is that I take my samples one at a time, creating 1 d-data and t

  • Recovery of Windows server 2003

    Hi all I need your support to recover my HP windows server. I lost the unique created operating system backup media and I need to recover my server. Pls suggest ways. Thank you

  • Find and rename the hidden files

    Hello Is there a way to list all hidden files in a directory? By hidden I mean files that start with ".". Thank you.

  • Adjustment of focus and the deletion of a field after the length control

    I have a form I'm working on that requires a few basic length checks but I have a problem with one of my fields. In the case of change, I have this:If (xfa, event.newText.match (/ [^ 0-9 /])! == null) {}this.rawValue = null;xfa.host.setFocus (this);}