對Oracle分割槽表進行表空間遷移並處理ORA-14511問題
1.因為工作需要,需要將CAMS_CORE使用者下的表做一次表空間遷移,生成遷移命令指令碼如下:
select 'alter table CAMS_CORE.'|| TABLE_NAME || ' move tablespace cams_core_tab;' from dba_tables where owner='CAMS_CORE';
2.將生成的語句進行遷移,其中有2個表為Interval Partition分割槽表,遷移時遇到了問題:
alter table CAMS_CORE.BP_VOUCHER_RECENT move tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move tablespace cams_core_tab;
提示錯誤
ORA-14511: cannot perform operation on a partitioned object
3.使用oerr檢視錯誤資訊
[oracle@XLJ181 dump]$ oerr ORA 14511 14511, 00000, "cannot perform operation on a partitioned object" // *Cause: An attempt was made to perform an operation that is not allowed // on partitioned tables or indexes. // *Action: Retry the command with correct syntax.
4.從錯誤提示上看,應該是分割槽表的遷移不能基於表遷移,需要基於分割槽進行遷移,特此改進操作,先檢視dba_tab_partitions表的欄位
SYS@cams> desc dba_tab_partitions Name Null? Type ----------------------------------------- -------- ---------------------------- TABLE_OWNER VARCHAR2(30) TABLE_NAME VARCHAR2(30) COMPOSITE VARCHAR2(3) PARTITION_NAME VARCHAR2(30) SUBPARTITION_COUNT NUMBER HIGH_VALUE LONG HIGH_VALUE_LENGTH NUMBER PARTITION_POSITION NUMBER TABLESPACE_NAME VARCHAR2(30) PCT_FREE NUMBER PCT_USED NUMBER INI_TRANS NUMBER MAX_TRANS NUMBER INITIAL_EXTENT NUMBER NEXT_EXTENT NUMBER MIN_EXTENT NUMBER MAX_EXTENT NUMBER MAX_SIZE NUMBER PCT_INCREASE NUMBER FREELISTS NUMBER FREELIST_GROUPS NUMBER LOGGING VARCHAR2(7) COMPRESSION VARCHAR2(8) COMPRESS_FOR VARCHAR2(12) NUM_ROWS NUMBER BLOCKS NUMBER EMPTY_BLOCKS NUMBER AVG_SPACE NUMBER CHAIN_CNT NUMBER AVG_ROW_LEN NUMBER SAMPLE_SIZE NUMBER LAST_ANALYZED DATE BUFFER_POOL VARCHAR2(7) FLASH_CACHE VARCHAR2(7) CELL_FLASH_CACHE VARCHAR2(7) GLOBAL_STATS VARCHAR2(3) USER_STATS VARCHAR2(3) IS_NESTED VARCHAR2(3) PARENT_TABLE_PARTITION VARCHAR2(30) INTERVAL VARCHAR2(3) SEGMENT_CREATED VARCHAR2(4)
5.拼寫自動生成遷移語句的sql
SYS@cams> set pages 1000 SYS@cams> set lines 200 SYS@cams> select 'alter table ' ||table_owner|| '.' || table_name || ' move partition ' || partition_name || ' tablespace cams_core_tab;' as move_sql from dba_tab_partitions where table_owner='CAMS_CORE' and table_name in ('BP_VOUCHER_RECENT','BP_VOUCHER_HISTORY'); MOVE_SQL ------------------------------------------------------------------------------------------------------------------------------------------------- alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition P0 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition P1 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition P2 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P118 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P119 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P120 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P121 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P122 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P123 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P124 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P125 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P126 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P127 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P128 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P129 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P130 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P131 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P132 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P133 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_HISTORY move partition SYS_P134 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_RECENT move partition P0 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_RECENT move partition P1 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_RECENT move partition P2 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_RECENT move partition P3 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_RECENT move partition P4 tablespace cams_core_tab; alter table CAMS_CORE.BP_VOUCHER_RECENT move partition P5 tablespace cams_core_tab; 26 rows selected.
6.將生成的sql重新執行,全部提示成功,表空間遷移順利完成。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31394774/viewspace-2221028/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 移動分割槽表和分割槽索引的表空間索引
- interval 分割槽表clob預設表空間指定問題
- oracle系統表空間過大問題處理Oracle
- Oracle中表空間、表、索引的遷移Oracle索引
- 刪除UNDO表空間並處理ORA-01548問題
- Oracle 12cbigfile表空間物件遷移Oracle物件
- oracle分割槽表和分割槽表exchangeOracle
- oracle 表移動表空間Oracle
- Oracle表移動表空間Oracle
- 分割槽表truncate慢處理
- oracle分割槽表和非分割槽表exchangeOracle
- mysql 進行表分割槽MySql
- 增加表分割槽時,為local分割槽索引指定不同表空間的方法索引
- 對oracle分割槽表的理解整理Oracle
- MySQL 遷移表空間,備份單表MySql
- MySQL分表後原分割槽表處理方案MySql
- table/index/LOBINDEX遷移表空間Index
- oracle 分割槽表move和包含分割槽表的lob moveOracle
- oracle sysaux表空間滿了處理辦法OracleUX
- oracle中undo表空間丟失處理方法Oracle
- oracle將表配置為分割槽表Oracle
- oracle 普通表-分割槽表改造流程Oracle
- [oracle] expdp 匯出分割槽表的分割槽Oracle
- ORACLE分割槽表梳理系列Oracle
- Oracle分割槽表基礎運維-04列表分割槽Oracle運維
- mysql分割槽表佔用大量容量處理(最佳化)及歸檔分割槽表MySql
- Oracle分割槽表基礎運維-07增加分割槽(3列表分割槽)Oracle運維
- 【效能】Oracle表並行對邏輯遷移後查詢效能的影響Oracle並行
- Oracle分割槽表基礎運維-06分割槽表索引Oracle運維索引
- [20210528]oracle大表空間預分配問題.txtOracle
- Oracle表空間Oracle
- oracle 表空間Oracle
- 18_深入解析Oracle undo原理(2)_undo表空間使用率100%問題處理Oracle
- Oracle分割槽表基礎運維-01分割槽表分類Oracle運維
- oracle 線上重新定義,普通表改變分割槽表,分割槽表可以更改型別、分割槽欄位等Oracle型別
- Oracle 12.2之後ALTER TABLE .. MODIFY轉換非分割槽表為分割槽表Oracle
- mysql共享表空間擴容,收縮,遷移MySql
- PostgreSQL/LightDB分割槽表之常見問題SQL