【LOB】使用資料泵時 LOB 欄位存放位置
在遷移過程中,我們很多時候透過資料泵方式遷移(expdp/impdp),方便快捷,那麼如果涉及到含有LOB欄位的表呢,他們是怎麼存放呢?
下面 我們就做一個簡單的測試,測試環境,Oracle11.2.0.4, redhat6.7 x64
建立一個含有lob欄位的表,如下:
點選( 此處)摺疊或開啟
-
SQL
> conn
test
/
test
-
Connected
.
-
SQL
>
Create table testlob
(
A number
,
B clob
)
LOB
(
b
)
STORE AS
(
TABLESPACE users
);
--注意,此處已指定表空間為USERS(當然,不建議使用USERS表空間,這裡僅僅測試 )
-
-
Table created
.
-
-
SQL
> insert
into testlob select object_id
,object_name from dba_objects where object_id is
not null
;
-
-
86387 rows created
.
-
-
SQL
> commit
;
-
- Commit complete .
檢視一下相關資訊, TESTLOB表對應的表空間為TEST 其lob欄位所在表空間為USERS
點選( 此處)摺疊或開啟
-
SQL
> set lines 2000
-
SQL
> col owner
for a15
-
SQL
> col table_name
for a15
-
SQL
> col column_name
for a10
-
SQL
> col segment_name
for a15
-
SQL
> col index_name
for a15
-
SQL
> select owner
,table_name
,column_name
,segment_name
,index_name
,tablespace_name from dba_lobs where table_name
=
'TESTLOB'
;
-
-
OWNER TABLE_NAME COLUMN_NAM SEGMENT_NAME INDEX_NAME TABLESPACE_NAME
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
TEST TESTLOB B SYS_LOB00000880 SYS_IL000008802 USERS
-
26C00002$$ 6C00002$$
-
-
-
SQL
>
-
SQL
> select table_name
,owner
,tablespace_name from dba_tables where table_name
=
'TESTLOB'
;
-
-
TABLE_NAME OWNER TABLESPACE_NAME
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TESTLOB TEST TEST
在當前庫中建立一個新的表空間FIRSOULER,使用者FIRSOULER
並執行匯入匯出操作
點選( 此處)摺疊或開啟
-
oracle@mystandby dump
]
$ expdp
test
/
test directory
=sh_dmp DUMPFILE
=testlob_ddl
.dmp tables
=testlob logfile
=testlob
.log content
=METADATA_ONLY
-
-
Export
: Release 11
.2
.0
.4
.0
- Production on Fri Sep 29 15
:32
:00 2017
-
-
Copyright
(c
) 1982
, 2011
, Oracle
and
/
or its affiliates
. All rights reserved
.
-
-
Connected to
: Oracle Database 11g Enterprise Edition Release 11
.2
.0
.4
.0
- 64bit Production
-
With the Partitioning
, OLAP
, Data Mining
and Real Application Testing options
-
Starting
"TEST"
.
"SYS_EXPORT_TABLE_01"
:
test
/
*
*
*
*
*
*
*
* directory
=sh_dmp DUMPFILE
=testlob_ddl
.dmp tables
=testlob logfile
=testlob
.log content
=METADATA_ONLY
-
Processing object
type TABLE_EXPORT/TABLE/TABLE
-
Master table
"TEST"
.
"SYS_EXPORT_TABLE_01" successfully loaded/unloaded
-
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
*
-
Dump file set
for
TEST
.SYS_EXPORT_TABLE_01 is
:
-
/backup/dump/testlob_ddl
.dmp
- Job "TEST" . "SYS_EXPORT_TABLE_01" successfully completed at Fri Sep 29 15 :32 :11 2017 elapsed 0 00 :00 :11
下面生成建表語句:
點選( 此處)摺疊或開啟
-
[oracle@mystandby dump
]
$ impdp firsouler/abc directory
=sh_dmp dumpfile
=testlob
.dmp sqlfile
=testlob01
.sql
-
-
Import
: Release 11
.2
.0
.4
.0
- Production on Fri Sep 29 15
:33
:52 2017
-
-
Copyright
(c
) 1982
, 2011
, Oracle
and
/
or its affiliates
. All rights reserved
.
-
-
Connected to
: Oracle Database 11g Enterprise Edition Release 11
.2
.0
.4
.0
- 64bit Production
-
With the Partitioning
, OLAP
, Data Mining
and Real Application Testing options
-
Master table
"FIRSOULER"
.
"SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
-
Starting
"FIRSOULER"
.
"SYS_SQL_FILE_FULL_01"
: firsouler/
*
*
*
*
*
*
*
* directory
=sh_dmp dumpfile
=testlob
.dmp sqlfile
=testlob01
.sql
-
Processing object
type TABLE_EXPORT/TABLE/TABLE
- Job "FIRSOULER" . "SYS_SQL_FILE_FULL_01" successfully completed at Fri Sep 29 15 :33 :54 2017 elapsed 0 00 :00 :01
LOB 還是原來的表空間
點選( 此處)摺疊或開啟
-
CREATE TABLE
"TEST"
.
"TESTLOB"
-
(
"A" NUMBER
,
-
"B" CLOB
-
) SEGMENT CREATION IMMEDIATE
-
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
-
NOCOMPRESS LOGGING
-
STORAGE
(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
-
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
-
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
)
-
TABLESPACE
"TEST"
-
LOB
(
"B"
) STORE AS BASICFILE
(
-
TABLESPACE
"FIRSOULER" ENABLE STORAGE
IN ROW CHUNK 8192
-
NOCACHE LOGGING
-
STORAGE
(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
-
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
- BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT ) )
下面再測試一下,lob使用預設表空間情況;
點選( 此處)摺疊或開啟
-
SQL
> conn
test
/
test
-
Connected
.
-
SQL
>
-
SQL
>
-
SQL
> Create table testlob
(A number
, B clob
) LOB
(b
) STORE AS
(enable storage
in row
)
;
-
-
Table created
.
-
-
SQL
> insert
into testlob select object_id
,object_name from dba_objects where object_id is
not null
;
-
-
86390 rows created
.
-
-
SQL
> commit
;
-
-
Commit complete
.
-
-
SQL
> set lines 2000
-
SQL
> col owner
for a15
-
SQL
> col table_name
for a15
-
SQL
> col column_name
for a10
-
SQL
> col segment_name
for a15
-
SQL
> col index_name
for a15
-
SQL
> select owner
,table_name
,column_name
,segment_name
,index_name
,tablespace_name from dba_lobs where table_name
=
'TESTLOB'
;
-
-
OWNER TABLE_NAME COLUMN_NAM SEGMENT_NAME INDEX_NAME TABLESPACE_NAME
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
TEST TESTLOB B SYS_LOB00000882 SYS_IL000008821
TEST
-
13C00002$$ 3C00002$$
-
-
-
SQL
>
-
SQL
> select table_name
,owner
,tablespace_name from dba_tables where table_name
=
'TESTLOB'
;
-
-
TABLE_NAME OWNER TABLESPACE_NAME
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- TESTLOB TEST TEST
檢視建表語句,如下,在建立lob欄位表時,如果預設,那麼後續在遷移也會找當時的預設表空間:
點選( 此處)摺疊或開啟
-
[oracle@mystandby dump
]
$ impdp firsouler/abc directory
=sh_dmp dumpfile
=testlob01
.dmp sqlfile
=testlob001
.sql
-
-
Import
: Release 11
.2
.0
.4
.0
- Production on Fri Sep 29 15
:42
:11 2017
-
-
Copyright
(c
) 1982
, 2011
, Oracle
and
/
or its affiliates
. All rights reserved
.
-
-
Connected to
: Oracle Database 11g Enterprise Edition Release 11
.2
.0
.4
.0
- 64bit Production
-
With the Partitioning
, OLAP
, Data Mining
and Real Application Testing options
-
Master table
"FIRSOULER"
.
"SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
-
Starting
"FIRSOULER"
.
"SYS_SQL_FILE_FULL_01"
: firsouler/
*
*
*
*
*
*
*
* directory
=sh_dmp dumpfile
=testlob01
.dmp sqlfile
=testlob001
.sql
-
Processing object
type TABLE_EXPORT/TABLE/TABLE
-
Job
"FIRSOULER"
.
"SYS_SQL_FILE_FULL_01" successfully completed at Fri Sep 29 15
:42
:13 2017 elapsed 0 00
:00
:01
-
-
[oracle@mystandby dump
]
$ cat testlob001
.sql
-
-
- CONNECT FIRSOULER
-
ALTER SESSION SET EVENTS
'10150 TRACE NAME CONTEXT FOREVER, LEVEL 1'
;
-
ALTER SESSION SET EVENTS
'10904 TRACE NAME CONTEXT FOREVER, LEVEL 1'
;
-
ALTER SESSION SET EVENTS
'25475 TRACE NAME CONTEXT FOREVER, LEVEL 1'
;
-
ALTER SESSION SET EVENTS
'10407 TRACE NAME CONTEXT FOREVER, LEVEL 1'
;
-
ALTER SESSION SET EVENTS
'10851 TRACE NAME CONTEXT FOREVER, LEVEL 1'
;
-
ALTER SESSION SET EVENTS
'22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 '
;
-
-
- new object
type path
: TABLE_EXPORT/TABLE/TABLE
-
CREATE TABLE
"TEST"
.
"TESTLOB"
-
(
"A" NUMBER
,
-
"B" CLOB
-
) SEGMENT CREATION IMMEDIATE
-
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
-
NOCOMPRESS LOGGING
-
STORAGE
(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
-
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
-
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
)
-
TABLESPACE
"TEST"
-
LOB
(
"B"
) STORE AS BASICFILE
(
-
TABLESPACE
"TEST" ENABLE STORAGE
IN ROW CHUNK 8192
-
NOCACHE LOGGING
-
STORAGE
(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
-
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
-
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
)
)
;
- [oracle@mystandby dump ] $
簡單測試,提醒,在遷移過程中,一定確認lob欄位所在表空間
下面是沒有LOB欄位所在表空間的情況
點選( 此處)摺疊或開啟
-
[oracle@mystandby dump
]
$ impdp firsouler/abc directory
=sh_dmp dumpfile
=testlob01
.dmp remap_tablespace
=firsouler
:
test logfile
=implob
.log
-
-
Import
: Release 11
.2
.0
.4
.0
- Production on Fri Sep 29 15
:52
:58 2017
-
-
Copyright
(c
) 1982
, 2011
, Oracle
and
/
or its affiliates
. All rights reserved
.
-
-
Connected to
: Oracle Database 11g Enterprise Edition Release 11
.2
.0
.4
.0
- 64bit Production
-
With the Partitioning
, OLAP
, Data Mining
and Real Application Testing options
-
ORA
-31626
: job does
not exist
-
ORA
-31633
: unable to create master table
"FIRSOULER.SYS_IMPORT_FULL_05"
-
ORA
-06512
: at
"SYS.DBMS_SYS_ERROR"
, line 95
-
ORA
-06512
: at
"SYS.KUPV$FT"
, line 1038
- ORA -00959 : tablespace 'FIRSOULER' does not exist
那麼改變表空間呢,透過expdp remap_tablespace 改變,lob也會改變。原來LOB 欄位在USERS表空間中,表的表空間為TEST表空間
點選( 此處)摺疊或開啟
-
[oracle@mystandby dump
]
$ impdp firsouler/abc directory
=sh_dmp dumpfile
=testlob01
.dmp remap_schema
=
test
:firsouler remap_tablespace
=
test
:firsouler sqlfile
=testlob001
.sql
-
-
Import
: Release 11
.2
.0
.4
.0
- Production on Fri Sep 29 16
:04
:23 2017
-
-
Copyright
(c
) 1982
, 2011
, Oracle
and
/
or its affiliates
. All rights reserved
.
-
-
Connected to
: Oracle Database 11g Enterprise Edition Release 11
.2
.0
.4
.0
- 64bit Production
-
With the Partitioning
, OLAP
, Data Mining
and Real Application Testing options
-
Master table
"FIRSOULER"
.
"SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
-
Starting
"FIRSOULER"
.
"SYS_SQL_FILE_FULL_01"
: firsouler/
*
*
*
*
*
*
*
* directory
=sh_dmp dumpfile
=testlob01
.dmp remap_schema
=
test
:firsouler remap_tablespace
=
test
:firsouler sqlfile
=testlob001
.sql
-
Processing object
type TABLE_EXPORT/TABLE/TABLE
-
Job
"FIRSOULER"
.
"SYS_SQL_FILE_FULL_01" successfully completed at Fri Sep 29 16
:04
:25 2017 elapsed 0 00
:00
:01
-
-
[oracle@mystandby dump
]
$ cat testlob0
-
testlob001
.sql testlob01
.dmp
-
[oracle@mystandby dump
]
$ cat testlob001
.sql
-
-
- CONNECT FIRSOULER
-
ALTER SESSION SET EVENTS
'10150 TRACE NAME CONTEXT FOREVER, LEVEL 1'
;
-
ALTER SESSION SET EVENTS
'10904 TRACE NAME CONTEXT FOREVER, LEVEL 1'
;
-
ALTER SESSION SET EVENTS
'25475 TRACE NAME CONTEXT FOREVER, LEVEL 1'
;
-
ALTER SESSION SET EVENTS
'10407 TRACE NAME CONTEXT FOREVER, LEVEL 1'
;
-
ALTER SESSION SET EVENTS
'10851 TRACE NAME CONTEXT FOREVER, LEVEL 1'
;
-
ALTER SESSION SET EVENTS
'22830 TRACE NAME CONTEXT FOREVER, LEVEL 192 '
;
-
-
- new object
type path
: TABLE_EXPORT/TABLE/TABLE
-
CREATE TABLE
"FIRSOULER"
.
"TESTLOB"
-
(
"A" NUMBER
,
-
"B" CLOB
-
) SEGMENT CREATION IMMEDIATE
-
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255
-
NOCOMPRESS LOGGING
-
STORAGE
(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
-
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
-
BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT
)
-
TABLESPACE
"FIRSOULER"
-
LOB
(
"B"
) STORE AS BASICFILE
(
-
TABLESPACE
"FIRSOULER" ENABLE STORAGE
IN ROW CHUNK 8192
-
NOCACHE LOGGING
-
STORAGE
(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
-
PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1
- BUFFER_POOL DEFAULT FLASH_CACHE DEFAULT CELL_FLASH_CACHE DEFAULT ) )
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29487349/viewspace-2145607/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORACLE LOB大欄位維護Oracle
- [20181020]lob欄位的索引段.txt索引
- Oracle資料庫高水位釋放——LOB欄位空間釋放Oracle資料庫
- [20181031]lob欄位與布隆過濾.txt
- [20181022]lob欄位的lobid來之那裡.txt
- [20210208]lob欄位與查詢的問題.txt
- 【LOB】Oracle Lob管理常用sqlOracleSQL
- LOB欄位相關概念(自動建立LOB索引段和重建索引方法)索引
- 【LOB】Oracle lob管理常用語句Oracle
- ORACLE 資料匯出LOB欄位報錯ORA-31693,ORA-02354,ORA-22924Oracle
- 【ORA-01555】Oracle LOB欄位匯出 報錯 ORA-01555Oracle
- [重慶思莊每日技術分享]-重建LOB欄位上的IndexIndex
- trigger+lob+ora-22275
- [20231008]bbed探究lob段.txt
- [20181021]臨時表lob段建立在哪裡.txt
- [20180905]lob與direct path read.txt
- MySQL8.0 新特性:Partial Update of LOB ColumnMySql
- [20190531]lob型別pctversion 和 retention.txt型別
- Oracle資料庫出現ORA-19566 LOB壞塊的處理記錄Oracle資料庫
- dbms_lob儲存過程導致臨時表空間100%儲存過程
- 要複製的LOB資料的長度超出了配置的最大值65536
- Lob:2024年直郵消費者洞察報告
- 系統移植存放位置
- 資料泵重建使用者
- [探索]在使用模型時,關於資料表欄位的一個思考?模型
- 模型資料追加欄位模型
- 為什麼資料庫欄位要使用NOT NULL?資料庫Null
- oracle 分割槽表move和包含分割槽表的lob moveOracle
- 什麼是LOB(業務線line-of-business)應用程式?
- MacOS & Linux 的命令程式存放位置MacLinux
- Laravel 自定義函式存放位置Laravel函式
- 配置conda建立環境存放位置
- 使用資料泵(expdp、impdp)遷移資料庫流程資料庫
- 如何檢視ORACLE的LOB(BLOB和CLOB)物件佔用的大小Oracle物件
- JPA使用pg資料庫時,bool欄位不能跨庫遷移的解決方案資料庫
- 使用impdp,expdp資料泵進入海量資料遷移
- 自定義元件-純資料欄位元件
- 本地儲存VS雲端儲存:區別不只是資料存放位置
- Oracle 20c 新特性:Online SecureFiles Defragmentation 線上的 LOB 碎片整理OracleFragment