使用Oracle數據泵遷移數據庫
阿新 • • 發佈:2018-05-03
oracle一、準備目標數據庫
1、確保目標數據庫的字符集 NLS_CHARACTERSET 和源數據庫一致
select * from nls_database_parameters
2、創建要遷移數據庫表空間
select tablespace_name from dba_tablespaces
create tablespace BBGODB datafile ‘+DATA_VG‘ size 300m autoextend on
3、創建相應的schema
create user BBGO identified by BBGO default tablespace BBGODB
grant connect,resource to BBGO
4、創建目錄並授權
mkdir /home/oracle/oracleDump
sqlplus / as sysdba
create or replace directory dump_dir as ‘/home/oracle/oracleDump‘;
grant read,write on directory dump_dir to BBGO;
exit exit
2、導出數據
expdp "‘/ as sysdba‘" schemas=BBGO dumpfile=expdp.dmp DIRECTORY=dump_dir logfile=BBGO.log compression=all
1、確保目標數據庫的字符集 NLS_CHARACTERSET 和源數據庫一致
select * from nls_database_parameters
2、創建要遷移數據庫表空間
select tablespace_name from dba_tablespaces
create tablespace BBGODB datafile ‘+DATA_VG‘ size 300m autoextend on
3、創建相應的schema
create user BBGO identified by BBGO default tablespace BBGODB
grant connect,resource to BBGO
mkdir /home/oracle/oracleDump
sqlplus / as sysdba
create or replace directory dump_dir as ‘/home/oracle/oracleDump‘;
grant read,write on directory dump_dir to BBGO;
exit
二、導出源數據庫的schema
1、創建目錄並授權
mkdir /home/oracle/oracleDump
sqlplus / as sysdba
create or replace directory dump_dir as ‘/home/oracle/oracleDump‘;
grant read,write on directory dump_dir to BBGO;
2、導出數據
expdp "‘/ as sysdba‘" schemas=BBGO dumpfile=expdp.dmp DIRECTORY=dump_dir logfile=BBGO.log compression=all
三、將數據導入到目標數據庫中
impdp "‘/ as sysdba‘" directory=dump_dir dumpfile=expdp.dmp schemas=BBGO
註:如果schema不同,使用 remap_schema=BBGO:BBGOA 重新映射
使用Oracle數據泵遷移數據庫