2026-03-12 20:23:15

This commit is contained in:
root
2026-03-12 21:23:47 +01:00
parent eab4b36eca
commit 93039b8489
3332 changed files with 699614 additions and 0 deletions

42
vdh/move_lobs.sql Normal file
View File

@@ -0,0 +1,42 @@
DECLARE
l_tablespace varchar2(30) := 'TEST';
l_owner varchar2(30) := 'FREEK';
l_str varchar2(32000);
BEGIN
for r_tab in
( select distinct owner, table_name
from dba_lobs
where owner = l_owner
)
loop
l_str := 'alter table "' || r_tab.owner || '"."' || r_tab.table_name || '" move ';
for r_lob in
( select column_name
from dba_lobs
where owner = r_tab.owner
and table_name = r_tab.table_name
)
loop
l_str := l_str || 'lob("' || r_lob.column_name || '") store as (tablespace "' || l_tablespace || '") ' ;
end loop;
l_str := l_str || ' tablespace "' || l_tablespace || '"';
dbms_output.put_line('moving table ' || r_tab.table_name);
execute immediate l_str;
for r_ind in
( select index_name
from dba_indexes
where owner = r_tab.owner
and table_name = r_tab.table_name
and ( tablespace_name != l_tablespace
or status = 'UNUSABLE'
)
)
loop
l_str := 'alter index "' || r_tab.owner || '"."' || r_ind.index_name || '" rebuild tablespace "' || l_tablespace || '"';
dbms_output.put_line('rebuilding index ' || r_ind.index_name || ' for table ' || r_tab.table_name);
execute immediate l_str;
dbms_output.put_line(l_str);
end loop;
end loop;
END;
/