Rename LOB Segments in Oracle Database 23ai/26ai
The article demonstrates how to rename a LOB segment in Oracle 23ai/26ai.
oracle 23configurationintermediate
by OracleDba
15 views
The article demonstrates how to rename a LOB segment in Oracle 23ai/26ai.
123456
drop table if exists t1 purge;
create table t1 (
id number generated always as identity primary key,
blob_data blob
);1234567891011121314151617181920212223242526272829303132
column table_name format a15
column column_name format a15
column segment_name format a30
column tablespace_name format a15
select table_name,
column_name,
segment_name,
tablespace_name
from user_lobs
where table_name = 'T1';
TABLE_NAME COLUMN_NAME SEGMENT_NAME TABLESPACE_NAME
--------------- --------------- ------------------------------ ---------------
T1 BLOB_DATA SYS_LOB0000089326C00002$$ USERS
SQL>
alter table t1 move lob(blob_data) store as t1_blob_data_segment online;
select table_name,
column_name,
segment_name,
tablespace_name
from user_lobs
where table_name = 'T1';
TABLE_NAME COLUMN_NAME SEGMENT_NAME TABLESPACE_NAME
--------------- --------------- ------------------------------ ---------------
T1 BLOB_DATA T1_BLOB_DATA_SEGMENT USERS
SQL>1234567891011121314151617181920212223
alter table t1 rename lob(blob_data) t1_blob_data_segment to t1_blob_data_new_segment;
select table_name,
column_name,
segment_name,
tablespace_name
from user_lobs
where table_name = 'T1';
TABLE_NAME COLUMN_NAME SEGMENT_NAME TABLESPACE_NAME
--------------- --------------- ------------------------------ ---------------
T1 BLOB_DATA T1_BLOB_DATA_NEW_SEGMENT USERS
SQL>
-- Table
alter table table_name rename lob(column_name) old_segment_name to new_segment_nane;
-- Partition
alter table table_name rename lob(column_name) partition old_segment_name to new_segment_nane;
-- Subpartition
alter table table_name rename lob(column_name) subpartition old_segment_name to new_segment_nane;Please to add comments
No comments yet. Be the first to comment!