轉移LOB欄位的表空間

2021-08-24 21:53:36 字數 1181 閱讀 9440

--部署時若要匯入的表空間名稱和開發機上的不一致,而你的表中有lob欄位,那頭就大了。--能治好這種頭大症的**如下:

create or replace procedure volumechangetableandindex

(tablespacename in varchar2)as

cursor tablecur is select table_name from user_all_tables;

cursor indexcur is select index_name,tablespace_name from user_indexes order by index_name;

cursor lobtables is select table_name,column_name from user_tab_cols t where t.data_type like '%lob%';

begin

--修改當前使用者所有表的表空

for tablesname in tablecur loop

execute immediate 'alter table '||tablesname.table_name ||' move tablespace '||tablespacename;

end loop;

--修改當前使用者所有lob欄位的表空間

for lobtable in lobtables loop

execute immediate 'alter table '||lobtable.table_name||' move lob('||lobtable.column_name||') store as(tablespace '||tablespacename||')';

end loop;

--重建索引

for indexsname in indexcur loop

if indexsname.tablespace_name <> upper(tablespacename) then

dbms_output.put_line(indexsname.index_name);

execute immediate 'alter index '||indexsname.index_name ||' rebuild tablespace '||tablespacename;

end if;

end loop;

end;

轉移表空間步驟

轉移表空間步驟 一 轉移表空間 alter table tab name move tablespace tabspace name 分割槽表alter table table name move partition para name tablespace tablespace name 批量生成...

Oracle 使用外部表匯入含有LOB欄位的資料

假設,你需要將某個路徑下的全部檔案txt檔案匯入資料庫,並保留對應的檔名。外部檔案中lob欄位的位置,應該存放檔名。for n in ls txt do echo n n done test load.txt 兩邊不要留空,否則外部表讀取檔案時會報錯,說找不到該檔案 cat test.txt q10...

Oracle中的LOB欄位解讀

lob欄位是oracle資料庫用於儲存大資料物件的字段型別,包括blob clob nlob bfile 當lob欄位大小超過4k時,資料庫會單獨為該lob欄位分配額外的blob segments儲存blob物件,儲存在lobsegment中的lob預設不在緩衝區快取,對於lob的讀寫都是物理io,...