How To Move Or Rebuild A Lob Partition
2010-11-11 10:09
507 查看
How To Move Or Rebuild A Lob Partition [ID 761388.1]
修改时间 29-JUN-2010 类型 HOWTO 状态 MODERATED
In this Document
Goal
Solution
References
Platforms: 1-914CU;
This document is being delivered to you via Oracle Support's Rapid Visibility (RaV) process and therefore has not been subject to an independent technical review.
Applies to:
Oracle Server - Enterprise Edition - Version: 9.2.0.8 to 11.1.0.7 - Release: 9.2 to 11.1
Information in this document applies to any platform.
Goal
How to move or rebuild a LOB partition since if use traditional syntax, it will fail.
SQL> alter table SHOW_LOB_STORAGE move lob(DDD)
2 store as (tablespace PARTFORLOB03);
alter table SHOW_LOB_STORAGE move lob(DDD)
*
ERROR at line 1:
ORA-14511: cannot perform operation on a partitioned object
Solution
The syntax to move a LOB partition is the following.
alter table <table name> move partition <table partition name>
lob (<lob column name>) store as <optional lob partition name> (tablespace <lob tablespace name>);
-or-
alter table <table name> move partition <table partition name>
lob (<lob column name>) store as (tablespace <lob tablespace name>);
A working example.
SQL> connect testlob/testlob
Connected.
1. Create a partitioned table that contains a LOB.
SQL> create table show_lob_storage
2 (aaa number(5),
3 bbb varchar2(10),
4 ccc number(5),
5 ddd CLOB )
6 PARTITION BY RANGE(aaa)
7 (PARTITION p1 VALUES LESS THAN (50) tablespace part01
8 LOB (ddd) STORE AS (tablespace partforlob01),
9 PARTITION p2 VALUES LESS THAN (100) tablespace part02
10 LOB (ddd) STORE AS (tablespace partforlob02),
11 PARTITION p3 VALUES LESS THAN (MAXVALUE) tablespace part03
12 LOB (ddd) STORE AS (tablespace partforlob03));
Table created.
2. Show objects created on DB from above SQL.
SQL> set pagesize 10000
SQL> col segment_name format a25
SQL> col segment_type format a16
SQL> col tablespace_name format a13
SQL> col partition_name format a15
SQL> select segment_name, segment_type, tablespace_name,
2 partition_name from user_segments
3 order by segment_name, partition_name;
SEGMENT_NAME SEGMENT_TYPE TABLESPACE_NA PARTITION_NAME
------------------------- ---------------- ------------- ---------------
SHOW_LOB_STORAGE TABLE PARTITION PART01 P1
SHOW_LOB_STORAGE TABLE PARTITION PART02 P2
SHOW_LOB_STORAGE TABLE PARTITION PART03 P3
SYS_IL0000054529C00004$$ INDEX PARTITION PARTFORLOB01 SYS_IL_P150
SYS_IL0000054529C00004$$ INDEX PARTITION PARTFORLOB02 SYS_IL_P151
SYS_IL0000054529C00004$$ INDEX PARTITION PARTFORLOB03 SYS_IL_P152
SYS_LOB0000054529C00004$$ LOB PARTITION PARTFORLOB01 SYS_LOB_P147
SYS_LOB0000054529C00004$$ LOB PARTITION PARTFORLOB02 SYS_LOB_P148
SYS_LOB0000054529C00004$$ LOB PARTITION PARTFORLOB03 SYS_LOB_P149
9 rows selected.
3. Show the partition name corresponding to each LOB partition.
SQL> select partition_name, lob_partition_name, tablespace_name
2 from user_lob_partitions where table_name = 'SHOW_LOB_STORAGE';
PARTITION_NAME LOB_PARTITION_NAME TABLESPACE_NA
--------------- ------------------------------ -------------
P1 SYS_LOB_P147 PARTFORLOB01
P2 SYS_LOB_P148 PARTFORLOB02
P3 SYS_LOB_P149 PARTFORLOB03
4. Move LOB partition SYS_LOB_P147 to tablespace PARTFORLOB3.
SQL> alter table SHOW_LOB_STORAGE move partition P1 tablespace PART01
2 lob(DDD) store as SYS_LOB_P147 (tablespace PARTFORLOB03);
Table altered.
5. Show location of LOB partition after the move.
SQL> select partition_name, lob_partition_name, tablespace_name
2 from user_lob_partitions where table_name = 'SHOW_LOB_STORAGE';
PARTITION_NAME LOB_PARTITION_NAME TABLESPACE_NA
--------------- ------------------------------ -------------
P1 SYS_LOB_P147 PARTFORLOB03
P2 SYS_LOB_P148 PARTFORLOB02
P3 SYS_LOB_P149 PARTFORLOB03
6. Show the LOB index partition followed the LOB partition to new tablespace.
SQL> select partition_name, tablespace_name, status from user_ind_partitions;
PARTITION_NAME TABLESPACE_NA STATUS
--------------- ------------- --------
SYS_IL_P151 PARTFORLOB02 USABLE
SYS_IL_P152 PARTFORLOB03 USABLE
SYS_IL_P154 PARTFORLOB03 USABLE
7. Syntax if just want to rebuild a LOB partition on the existing tablespace.
SQL> alter table SHOW_LOB_STORAGE move partition P2
2 lob(DDD) store as (tablespace PARTFORLOB02);
Table altered.
相关文章推荐
- How To Move Or Rebuild A Lob Partition
- How to move between two or more forms?
- How to move LOB Data to Another …
- How to move between two or more forms?
- How to Move or Copy a Tablespace to Another Database【每日一译】--2012-11-03
- How to Move Magento to a New Server or Domain
- How to switch workspaces Or move window to a workapce
- how to deal with fdisk error: Re-reading the partition table failed with error 16: Device or resource busy.
- How to Convert AVFrame from NSImage or UIImage
- How to Check Device UUID or File System UUID. (文档 ID 1505398.1)
- How to Backup Partition of Range Partitioned Table with Local Indexes
- how to install a vncserver or vncviewer in Ubuntu
- How to Setup AssociatedOwnerGroup / AssociatedMemberGroup / AssociatedVisitorGroup
- How to change the default run level of a RedHat 9.0 or Fedora Core Linux system
- Howto Setup yum repositories to update or install package from ISO CDROM Image
- Move or migrate user accounts from old Linux server to a new Linux server
- How to Move ListBox Items with the Mouse
- how to get the default maximum heap size for Sun's JVM from Java SE 6 or 7
- How to find user who ran DROP or DELETE statements on your SQL Server Objects
- How to find if native dll is compiled as x64 or x86?