【IMPDP】使用 TRANSFORM選項去掉表空間和儲存子句
使用IMPDP工具完成資料匯入時,會按照dump檔案中有關的儲存的引數資訊完成資料的匯入。很多情況下我們希望按照被匯入使用者的預設引數完成資料的匯入,此時我們可以使用IMPDP的TRANSFORM引數輔助完成。
1.IMPDP的TRANSFORM引數描述
secooler@secDB /expdp$ impdp help=y
……省略……
TRANSFORM
Metadata transform. to apply to applicable objects.
Valid keywords are: OID, PCTSPACE, SEGMENT_ATTRIBUTES and STORAGE.
……省略……
2.建立一個測試表T
sec@11gR2> create table t (x varchar2(8));
Table created.
sec@11gR2> insert into t values ('secooler');
1 row created.
sec@11gR2> commit;
Commit complete.
3.使用EXPDP生成表T的邏輯備份檔案
secooler@secDB /expdp$ expdp sec/sec directory=expdp_dir dumpfile=sec_expdp.dmp logfile=sec_expdp.log tables=t
Export: Release 11.2.0.1.0 - Production on Thu May 13 09:32:44 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
Starting "SEC"."SYS_EXPORT_TABLE_01": sec/******** directory=expdp_dir dumpfile=sec_expdp.dmp logfile=sec_expdp.log tables=t
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "SEC"."T" 5.007 KB 1 rows
Master table "SEC"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_TABLE_01 is:
/expdp/sec_expdp.dmp
Job "SEC"."SYS_EXPORT_TABLE_01" successfully completed at 09:32:57
4.生成dump檔案中的SQL語句
1)使用SQLFILE引數生成SQL建立語句
secooler@secDB /expdp$ impdp sec/sec directory=expdp_dir dumpfile=sec_expdp.dmp sqlfile=sec_expdp.sql
Import: Release 11.2.0.1.0 - Production on Thu May 13 09:33:23 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
Master table "SEC"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
Starting "SEC"."SYS_SQL_FILE_FULL_01": sec/******** directory=expdp_dir dumpfile=sec_expdp.dmp sqlfile=sec_expdp.sql
Processing object type TABLE_EXPORT/TABLE/TABLE
Job "SEC"."SYS_SQL_FILE_FULL_01" successfully completed at 09:33:26
2)檢視sec_expdp.sql檔案獲得SQL建立語句
secooler@secDB /expdp$ cat sec_expdp.sql
-- CONNECT SEC
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 "SEC"."T"
( "X" VARCHAR2(8 BYTE)
) 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 "TBS_SEC_D" ;
可見,此時包含了大量的儲存引數及表空間引數。
5.使用TRANSFORM去掉表空間和儲存子句
secooler@secDB /expdp$ impdp sec/sec directory=expdp_dir dumpfile=sec_expdp.dmp sqlfile=sec_expdp.sql TRANSFORM=segment_attributes:n
Import: Release 11.2.0.1.0 - Production on Thu May 13 09:34:12 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
Master table "SEC"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
Starting "SEC"."SYS_SQL_FILE_FULL_01": sec/******** directory=expdp_dir dumpfile=sec_expdp.dmp sqlfile=sec_expdp.sql TRANSFORM=segment_attributes:n
Processing object type TABLE_EXPORT/TABLE/TABLE
Job "SEC"."SYS_SQL_FILE_FULL_01" successfully completed at 09:34:14
再次檢視生成的穿件SQL語句:
secooler@secDB /expdp$ cat sec_expdp.sql
-- CONNECT SEC
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 "SEC"."T"
( "X" VARCHAR2(8 BYTE)
) ;
此時生成的表T建立語句非常的簡介,沒錯,就是這麼簡單。
6.小結
使用TRANSFORM選項可以完成去掉表空間和儲存子句的目的,這樣我們便可以控制匯入時按照目標預設的引數。
我們的目標:所有要完成的任務都要在自己的掌控之中,UNDER CONTROL!
Good luck.
secooler
19.05.12
-- The End --
1.IMPDP的TRANSFORM引數描述
secooler@secDB /expdp$ impdp help=y
……省略……
TRANSFORM
Metadata transform. to apply to applicable objects.
Valid keywords are: OID, PCTSPACE, SEGMENT_ATTRIBUTES and STORAGE.
……省略……
2.建立一個測試表T
sec@11gR2> create table t (x varchar2(8));
Table created.
sec@11gR2> insert into t values ('secooler');
1 row created.
sec@11gR2> commit;
Commit complete.
3.使用EXPDP生成表T的邏輯備份檔案
secooler@secDB /expdp$ expdp sec/sec directory=expdp_dir dumpfile=sec_expdp.dmp logfile=sec_expdp.log tables=t
Export: Release 11.2.0.1.0 - Production on Thu May 13 09:32:44 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
Starting "SEC"."SYS_EXPORT_TABLE_01": sec/******** directory=expdp_dir dumpfile=sec_expdp.dmp logfile=sec_expdp.log tables=t
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
. . exported "SEC"."T" 5.007 KB 1 rows
Master table "SEC"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SEC.SYS_EXPORT_TABLE_01 is:
/expdp/sec_expdp.dmp
Job "SEC"."SYS_EXPORT_TABLE_01" successfully completed at 09:32:57
4.生成dump檔案中的SQL語句
1)使用SQLFILE引數生成SQL建立語句
secooler@secDB /expdp$ impdp sec/sec directory=expdp_dir dumpfile=sec_expdp.dmp sqlfile=sec_expdp.sql
Import: Release 11.2.0.1.0 - Production on Thu May 13 09:33:23 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
Master table "SEC"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
Starting "SEC"."SYS_SQL_FILE_FULL_01": sec/******** directory=expdp_dir dumpfile=sec_expdp.dmp sqlfile=sec_expdp.sql
Processing object type TABLE_EXPORT/TABLE/TABLE
Job "SEC"."SYS_SQL_FILE_FULL_01" successfully completed at 09:33:26
2)檢視sec_expdp.sql檔案獲得SQL建立語句
secooler@secDB /expdp$ cat sec_expdp.sql
-- CONNECT SEC
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 "SEC"."T"
( "X" VARCHAR2(8 BYTE)
) 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 "TBS_SEC_D" ;
可見,此時包含了大量的儲存引數及表空間引數。
5.使用TRANSFORM去掉表空間和儲存子句
secooler@secDB /expdp$ impdp sec/sec directory=expdp_dir dumpfile=sec_expdp.dmp sqlfile=sec_expdp.sql TRANSFORM=segment_attributes:n
Import: Release 11.2.0.1.0 - Production on Thu May 13 09:34:12 2010
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Oracle Label Security, OLAP, Data Mining,
Oracle Database Vault and Real Application Testing options
Master table "SEC"."SYS_SQL_FILE_FULL_01" successfully loaded/unloaded
Starting "SEC"."SYS_SQL_FILE_FULL_01": sec/******** directory=expdp_dir dumpfile=sec_expdp.dmp sqlfile=sec_expdp.sql TRANSFORM=segment_attributes:n
Processing object type TABLE_EXPORT/TABLE/TABLE
Job "SEC"."SYS_SQL_FILE_FULL_01" successfully completed at 09:34:14
再次檢視生成的穿件SQL語句:
secooler@secDB /expdp$ cat sec_expdp.sql
-- CONNECT SEC
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 "SEC"."T"
( "X" VARCHAR2(8 BYTE)
) ;
此時生成的表T建立語句非常的簡介,沒錯,就是這麼簡單。
6.小結
使用TRANSFORM選項可以完成去掉表空間和儲存子句的目的,這樣我們便可以控制匯入時按照目標預設的引數。
我們的目標:所有要完成的任務都要在自己的掌控之中,UNDER CONTROL!
Good luck.
secooler
19.05.12
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-662584/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 如何刪除 Mac 儲存空間的其他選項?Mac
- 【儲存管理】表空間概念
- 【儲存管理】建立永久表空間
- innodb表空間儲存結構
- Mac蘋果儲存空間的其他選項該如何刪除?Mac蘋果
- 【儲存管理】建立臨時表空間組、建立臨時表空間組及使用
- expdp/impdp 遷移表空間
- oracle 修改表空間儲存路徑Oracle
- 表在表空間中的儲存情況
- 透過xtts遷移單例項檔案系統表空間到RAC ASM儲存表空間TTS單例ASM
- 通過xtts遷移單例項檔案系統表空間到RAC ASM儲存表空間TTS單例ASM
- [DB2]表空間之DMS、自動儲存的DMS表空間DB2
- Oracle 傳輸表空間-EXPDP/IMPDPOracle
- PostgreSQL儲存智慧-空間聚集儲存SQL
- 【傳輸表空間】使用 EXPDP/IMPDP工具的傳輸表空間完成資料遷移
- IMPDP 多個表空間物件匯入到一個表空間中物件
- 【傳輸表空間】使用 EXPDP/IMPDP工具的傳輸表空間完成資料遷移[轉]
- IMPDP匯入沒有某個表空間的處理方法__加上引數TRANSFORM就可以了ORM
- 得到表的記錄數和佔用的儲存空間指令碼指令碼
- Synology群暉NAS儲存正確建立儲存池和儲存空間的方法
- impdp匯入資料後,system 表空間整理
- oracle expdp、impdp匯入從原表空間更換到其他表空間 ----匯入到另個表空間測試Oracle
- 使用oracle procedure儲存過程自動擴充套件表空間空間tablespace_自動化運維Oracle儲存過程套件運維
- 臨時表空間和回滾表空間使用率查詢
- 禪道 - 儲存空間釋放
- 查詢表空間已使用空間和空閒空間的簡單檢視
- IBM DS8700儲存維護和管理二:儲存空間劃分IBM
- 遷移表結構時儲存空間過大問題
- 2 Day DBA-管理Oracle例項-管理資料庫儲存結構-關於表空間Oracle資料庫
- oralce 壓縮表與heap表儲存空間與查詢效能比較
- oracle 建立表空間和使用者Oracle
- Oracle建立表空間和使用者Oracle
- MySQL InnoDB 共享表空間和獨立表空間MySql
- MySQL InnoDB 共享表空間和獨立表空間MySql
- dbms_space 評估儲存空間
- Oracle的表空間的儲存管理與最佳化技術Oracle
- Shell磁碟空間和表空間告警程式
- 刪除表空間和表空間包含的檔案