How do you move a partitioned table from one tablespace to another in Oracle 11g?

后端 未结 6 885
清酒与你
清酒与你 2021-02-04 15:16

I have a partitioned table that belongs to tablespace report. I want to move it to tablespace record instead.

One possibility is to drop the table and

6条回答
  •  刺人心
    刺人心 (楼主)
    2021-02-04 15:32

    You can either do it with PL/SQL or generate the statements with sql. I decided to generate the alter table statements with simple SQL:

    --set linesize
    set lines 100
    
    --This Query generates the alter table statements:
    SELECT 'ALTER TABLE '
           ||table_name
           ||' MOVE PARTITION '
           ||partition_name
           ||' TABLESPACE REPORT;'
    FROM   all_tab_partitions
    WHERE  table_name = 'requestLog'; 
    

    You can execute the output from the previous statement.

    Every user has a default tablespace. New database objects are created in that default tablespace if nothing else is specified on creation/alteration

提交回复
热议问题