使用expdp、impdp遷移資料庫
expdp、impdp在Oracle10g中才開始使用,
下面的源資料庫為Oracle10.2,目標資料庫為Oracle11.2
1、在源資料庫伺服器A上建立expdp的匯出目錄
$ pwd
/home/oraoms
$ mkdir exp_dir
SQL> create or replace directory exp_dir as '/home/oraoms/exp_dir';
Directory created.
2、在源資料庫A上查詢比較大的表,不影響系統執行的大表不匯入到目標資料庫B中
select *
from (select table_name,
round((blocks * 8192 / 1024 / 1024 ), 2) "MB"
from user_tables
where blocks is not null
order by blocks desc)
where rownum < 21
下面這些表很大可以不匯出來:
'MLOG_ENGI_GTB','MLOG_ENGI_MUDV','MLOG_ENGI_HYD'
3、在源資料庫A中匯出
expdp A_user/A_user directory=exp_dir dumpfile=20100506.dump logfile=20100506.log schemas=A_user exclude=table:\"IN\(\'MLOG_ENGI_GTB\',\'MLOG_ENGI_MUDV\',\'MLOG_ENGI_HYD\'\)\"
在匯出是想單引號,括號,需要“\”作為轉化符。
匯出的資料大概8GB多,共用了18分鐘左右。
4、在源資料庫A檢視該使用者物件數量,用力驗證匯入是否成功
select count(*) from user_objects
7532個物件
5、在源資料庫A中檢視錶空間,在目標庫B中也建立相應的表空間
select tablespace_name, count(*)
from user_tables
group by tablespace_name
order by 2;
MLOG_NORM_SPACE
在目標資料庫B建立相關的表空間:
檢視目標資料庫的資料檔案位置
select name from v$datafile;
如:
create tablespace MLOG_NORM_SPACE
datafile '/oratest/app/oracle/oradata/orcl/MLOG_NORM_SPACE.dbf'
size 5M autoextend on
建立相應的使用者並授權
create user test
identified by test
default tablespace PUB_NORM_SPACE
grant dba to test;
6、在目標資料庫B建立匯入目錄
>mkdir /oratest/imp_dir
把該目錄授權給oracle使用者
>chown -R oracle:dba /oratest/imp_dir
7、把匯出的資料ftp到目標資料庫B中
ftp 目標資料庫ip
put 20100506.dump
8、在目標資料庫B建立匯入目錄
SQL>create or replace directory imp_dir as '/oratest/imp_dir';
9、在目標資料庫B中匯入資料
>su - oracle
impdp test/test DIRECTORY=imp_dir DUMPFILE=20100506.dump logfile=20100506imp.log REMAP_SCHEMA=A_user:test
10、在目標資料庫B中建立 沒有匯出源資料庫A的大表的結構。
可以把表結構複製到目標資料庫B中。
或者在目標資料庫B中建立db_link,然後再建立相應的表結構
11、在目標資料庫B檢視該使用者物件數量,用來驗證物件是否齊全
select count(*) from user_objects
注:
如果有些表中的欄位用到了Oracle的關鍵字,需要用雙引號括起來。如time date,換成"time" date.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12778571/viewspace-662116/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 使用資料泵(expdp、impdp)遷移資料庫流程資料庫
- 使用impdp,expdp資料泵進入海量資料遷移
- oracle資料庫的impdp,expdpOracle資料庫
- 【Datapump】Oracle資料泵遷移資料命令參考(expdp/impdp說明)Oracle
- Oracle使用資料泵expdp,impdp進行資料匯出匯入Oracle
- 資料庫遷移資料庫
- Oracle資料泵匯出匯入(expdp/impdp)Oracle
- Laravel migration (資料庫遷移) 的使用Laravel資料庫
- redis資料庫遷移Redis資料庫
- 資料庫遷移 :理解資料庫
- laravel資料庫遷移Laravel資料庫
- Oracle impdp遷移資料後主鍵丟失故障處理Oracle
- linux mysql資料庫遷移LinuxMySql資料庫
- django資料庫遷移-15Django資料庫
- 用rman遷移資料庫資料庫
- 資料庫遷移手記資料庫
- 遷移MySQL 5.7資料庫MySql資料庫
- 資料庫遷移神器——Flyway資料庫
- dm資料庫遷移命令資料庫
- SQL Server資料庫遷移SQLServer資料庫
- 資料泵datapump(expdp/impdp)的parfile用法,避免跳脫字元字元
- 雲資料庫管理與資料遷移資料庫
- dnf資料庫備份&遷移資料庫
- OGG資料庫遷移方案(一)資料庫
- OGG資料庫遷移方案(二)資料庫
- OGG資料庫遷移方案(三)資料庫
- OGG資料庫遷移方案(四)資料庫
- 資料庫邏輯遷移方案資料庫
- 遷移資料庫資料考慮問題資料庫
- Oracle資料庫(資料泵)遷移方案(上)Oracle資料庫
- Oracle資料庫(資料泵)遷移方案(下)Oracle資料庫
- [20200620]expdp impdp exclude引數.txt
- expdp/impdp變慢 (Doc ID 2469587.1)
- 【Data Pump】expdp/impdp Job基本管理
- 無外網Oracle資料庫遷移Oracle資料庫
- Oracle資料庫(DataGuard)遷移方案(上)Oracle資料庫
- Oracle資料庫(DataGuard)遷移方案(中)Oracle資料庫
- Oracle資料庫(DataGuard)遷移方案(下)Oracle資料庫
- 騰訊雲 雲資料庫遷移資料庫