這篇文章主要講解了“如何對Oracle分區(qū)表進行表空間遷移并處理”,文中的講解內(nèi)容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“如何對Oracle分區(qū)表進行表空間遷移并處理”吧!
創(chuàng)新互聯(lián)自成立以來,一直致力于為企業(yè)提供從網(wǎng)站策劃、網(wǎng)站設計、成都做網(wǎng)站、網(wǎng)站設計、電子商務、網(wǎng)站推廣、網(wǎng)站優(yōu)化到為企業(yè)提供個性化軟件開發(fā)等基于互聯(lián)網(wǎng)的全面整合營銷服務。公司擁有豐富的網(wǎng)站建設和互聯(lián)網(wǎng)應用系統(tǒng)開發(fā)管理經(jīng)驗、成熟的應用系統(tǒng)解決方案、優(yōu)秀的網(wǎng)站開發(fā)工程師團隊及專業(yè)的網(wǎng)站設計師團隊。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分區(qū)表,遷移時遇到了問題:
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.從錯誤提示上看,應該是分區(qū)表的遷移不能基于表遷移,需要基于分區(qū)進行遷移,特此改進操作,先查看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重新執(zhí)行,全部提示成功,表空間遷移順利完成。
感謝各位的閱讀,以上就是“如何對Oracle分區(qū)表進行表空間遷移并處理”的內(nèi)容了,經(jīng)過本文的學習后,相信大家對如何對Oracle分區(qū)表進行表空間遷移并處理這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關知識點的文章,歡迎關注!
文章題目:如何對Oracle分區(qū)表進行表空間遷移并處理-創(chuàng)新互聯(lián)
文章網(wǎng)址:http://vcdvsql.cn/article14/iidge.html
成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供定制開發(fā)、微信公眾號、網(wǎng)站收錄、ChatGPT、面包屑導航、搜索引擎優(yōu)化
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容