How change tablespace

Hi to All,
In a schema I have some table as this:
CREATE TABLE MY_TABLE
T_CODE VARCHAR2(4 BYTE) NOT NULL,
T_DESC VARCHAR2(50 BYTE),
T_NAME VARCHAR2(25 BYTE),
T_ZONE VARCHAR2(4 BYTE)
TABLESPACE USERS
PCTUSED 0
PCTFREE 10
INITRANS 1
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
LOGGING
NOCOMPRESS
NOCACHE
NOPARALLEL
MONITORING;
CREATE UNIQUE INDEX MYTABLE_PK ON MY_TABLE
(T_CODE)
LOGGING
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
BUFFER_POOL DEFAULT
NOPARALLEL;
ALTER TABLE MY_TABLE ADD (
CONSTRAINT MYTABLE_PK
PRIMARY KEY
(T_CODE)
USING INDEX
TABLESPACE USERS
PCTFREE 10
INITRANS 2
MAXTRANS 255
STORAGE (
INITIAL 64K
MINEXTENTS 1
MAXEXTENTS 2147483645
PCTINCREASE 0
ALTER TABLE MY_TABLE ADD (
CONSTRAINT MYTABLE_ZONE_FK
FOREIGN KEY (T_CODE)
REFERENCES D_ZONE (T_CODE));
This table use tablespace USERS. I need to change to MYTABLESPACE
I have tried with this script:
ALTER TABLE MY_TABLE MOVE TABLESPACE MYTABLESPACE;
but only Table Tablespace is changed; other element (index and constains) remain USERS.
Please, exist a method in order to assign each element of my schema to new tablespace?
Thank You and Best Regards
Gaetano

Do you mean to MOVE all the tables to new tablespace?
You can generate this script using USER_TABLES based on TABLESPACE_NAME.
SELECT 'ALTER TABLE '||Table_Name||' MOVE TABLESPACE NEWTS;'
FROM User_Tables
WHERE Tablespace_Name = 'OLDTS';
SELECT 'ALTER INDEX '||INDEX_NAME||' REBUILD TABLESPACE NEWTS';
FROM User_Indexes WHERE Table_Name IN (SELECT Table_Name FROM User_Tables WHERE Tablespace_Name = 'OLDTS');
** Not Tested **
Spool the output of these commands and execute them using SQL*Plus or whichever tool you prefer.
Note:
1. These tables would not available to users during the time when MOVE & REBUILD operations are in progress.
2. Make sure that you have enough UNDO segments to hold the table data (and undo data required by current ongoing queries against the database, if this is a production database) during MOVE otherwise you might end up with ORA-01555.

Similar Messages

  • How to change tablespace for a table in 10g?

    Does anyone know how to change tablespace for a table (like changing tablespace for an index [alter index ... rebuild tablespace ... ])? Many thanks in advance.

    alter table tablename move tablespace newtsname;
    You need to rebuild the indexes after the move.

  • How i can change tablespace of a table in oracle 8.04

    Dear I want to move tablespace of a table in oracle 8.04 version but it is not working my statement is
    ALTER TABLE ACCOUNTING_ENTRY MOVE TABLESPACE EDI_TSPACE;
    and got the following error message:
    ORA-14004: missing PARTITION keyword
    how i can change tablespace of a table

    Hi,
    It seems that the move tablespace feature is available on 8.1 or higher versions of Oracle. In your case you can try one of the foll....
    Option 1:
    Step 1:CREATE TABLE T1
    TABLESPACE NEWTBS
    AS(SELECT * FROM T);
    Step 2: Rename or Drop the old table.
    Step 3: Rename the new table to the old table name.
    Option 2:
    Step 1: Export the old table.
    Step 2: Rename or Drop the old table.
    Step 3: Create the table in the new tablespace. You may use the INDEXFILE from the imp command here.
    Step 4: Import the old table and use IGNORE=Y
    Reply back if you need assistance on syntax.
    Regards.

  • Change Tablespace

    Hi,
    I was trying to insert into a table created by me and got an error message, which implies my schema doesn't have enough space available on the default tablespace USERS.
    I was told to try another tablespace for that table and check.
    I don't know how to do that and dropped the table and created table again on another tablespace.
    Is there any option in ALTER TABLE to change the tablespace.
    Thanks
    Rajiv

    Hi,
    Alter table <table> move tablespace <new tablespace>;
    How to find it?
    Just google: change tablespace table
    --Klaus                                                                                                                                                                                                                                                                   

  • HTTP 404 error after changed tablespace and password of schema FLOWS_FILES

    Hi I have a problem of having HTTP 404 not found error for file upload in my apex app by submiting a page. When it goes to http://xxx.xxx.xxx:8080/apex/wwv_flow.accept after unlocked , changed password and change tablespace for the account FLOWS_FILES.
    Is there anyone can help ?
    Thanks in advance.

    Hi Scott,
    Yes, I have modified the bug tracker application to support file upload by using a file browser object and created a "file_upload" table under the workspace schema to keep the linkage with the table WWV_FLOW_FILE_OBJECTS$. The application works fine before but after I realize that the FLOWS_FILES schema can be unlocked and the free space in default tablespace SYSAUX has almost been used up more than 99%, so I first unlock the account FLOWS_FILES, then changed the password and move the table WWV_FLOW_FILE_OBJECTS$ to tablespace FLOW_1 and changed the default tablespace and then rebuilt the index. I have moved the table back to SYSAUX tablespace now and have rebuilt the index also. However, upload a file and then press 'apply change' in the 'create issue log details' page, it gets the error HTTP 404 but if I do not attach any file. It goes without an error. The only thing I changed is on the database side of the FLOWS_FILES schema, so I think the problem resides on it but I don't know why even I moved the table WWV_FLOW_FILE_OBJECTS$ back to SYSAUX, rebuilt the index but still it doesn't work.
    Is that good even explanation ?
    btw, I am using IIS and how can I see the webserver error ?
    Regards,
    Edward

  • How change length name in legend on chart

    Hello.
    version:OBIEE 10.1.3.4.1.090414.1900
    source: Essbase
    I use hierarchy Essbase on the chart.
    And i can't see full name product in legend and i don't understand,
    how change length name in legend?

    user8995811 wrote:
    I don't understand your solve.
    What mean cast(product as Int), it's not work
    I also use drill down in legend, and I should see full name.
    And I have other problem, now drill down work only products name, which length <11http://img693.imageshack.us/img693/8193/pic130.jpg
    will this helpful?
    Thanks,
    Saichand.v

  • How change the graph dynamically based on pivot table.

    Hi,
    My Report having pivot table and bar chart. Organization Name column set as pivot table prompts in pivot table.So Organization Name is appear as dropdown list.If i choose the diffrent Organization Names the pivot table data is according to the Organization Name but no changes in chart.How change the Graph dynamically based on pivot table.
    Please help on this.

    ok.I created pivot table with 4 columns and created chart using pivot table chart options but all 4 columns are displaying chart.But I need only 2 column in chart ..unable to edit the only chart in pivot table.Please help on this.Thank you..

  • HT5312 I forgot the answers of my security questions but I cannot find out how changing them,

    I forgot the answers of my security questions but I cannot find out how changing them,

    Call Apple Care for your country and request help resetting the questions.

  • How change country of my Apple id online

    how change country of my Apple id online

    Change country App Store?
    1. Tap "Settings"
    2. Tap "iTunes & App Stores"
    3. Tap on your Apple ID
    4.Tap "View Apple ID"
    5. Enter your user name and password.
    6. Tap "Country/Region."
    7. Tap "Change Country/Region"
    8. Select the country/region where you are located; re-select country/region even if it is correct
    9. Tap "Done".
    Note: If the change doesn't take effect, sign out of account and sign in again.

  • How change color on form SAP 7.5

    How change color on the form when the form load (Form Partners or Invoice form). I can use SDK UI-API programing interface.
    OR
    how change color cell on matrix (matrix chose PH)

    You can use something like this as the custom validation script of the
    drop-down:
    if (event.value=="Customer A") event.target.textColor = color.red;
    else event.target.textColor = color.black;
    Make sure you tick the option to commit the selected value immediately
    (under Properties - Options), so that it will change as soon as a selection
    is made.

  • How change font size when typing on iPad air

    How change font size when typing on iPad Air

    You can change the font size for apps that use the large text feature in Settings>General>Accessibility>Larger Text>On.

  • I forggoten frequently asked question in my ID, how change it

    i forggoten frequently asked question in my ID, how change it
    i need buy in itunes store

    Try this Discussion...
    https://discussions.apple.com/thread/4305745

  • How change the name of iPod?

    How change the name of iPod?

    When you plug the iPod into iTunes you should see it along the sidebar (the list Library, Store, Shared, Genius and Playlists). Just click on the iPod in that list and it should allow you to edit it

  • IOS7 how change background color in menus?

    Hi,
    Brain new user of IOS7,  I'm wory about Battery time: all gackground menus are full white, witch seem's high consumsion curent....
    Please advise how change this;-)
    Le_Jeannot

    No, the white does not use more battery life.

  • How change the report graph color in teststand

    how change the report graph color in teststand?

    Michael,
    You might also be able to customize the style sheet associated with the report. The TestStand Help provides some information about how to customize ATML or XML style sheets to change report colors based on the status of test steps.
    Please take a look at the following topics; are these helpful?
    ATML Report Style Sheets
    Modifying Cell Background Color Based on Step Status in ATML Test Results 5.0 Reports
    XML Report Style Sheets
    Modifying Cell Background Color Based on Step Status in XML Reports
    Tom
    TestStand Documentation

Maybe you are looking for