Chuyển schema test_owner bằng file_transfer
1. Export dữ liệu
SQL> SELECT * FROM dba_directories;
SQL> create or replace directory GW='+reco_gold/dbaviet/dump';
-- create or replace directory subs as '/u03/subs/';
expdp userid=\"/ as sysdba\" dumpfile=test_owner_%u.dmp schemas=test_owner parallel=16 directory=GW NOLOGFILE=y
2. Chuyển file dump tới DB dest bằng dblink
• C1: Chuyển file dump tới DB dest bằng dblink
BEGIN
DBMS_FILE_TRANSFER.put_file(
source_directory_object => 'DB_FILES_DIR1',
source_file_name => 'USERS01.DBF',
destination_directory_object => 'DB_FILES_DIR2',
destination_file_name => 'USERS01.DBF',
destination_database => 'REMOTE');
END;
/
--REMOTE: ten db_link
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_01.dmp','dbaviet', 'test_owner_01.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_02.dmp','dbaviet', 'test_owner_02.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_03.dmp','dbaviet', 'test_owner_03.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_04.dmp','dbaviet', 'test_owner_04.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_05.dmp','dbaviet', 'test_owner_05.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_06.dmp','dbaviet', 'test_owner_06.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_07.dmp','dbaviet', 'test_owner_07.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_08.dmp','dbaviet', 'test_owner_08.dmp','dbaviet' );
END;
/
BEGIN
--
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_09.dmp','dbaviet', 'test_owner_09.dmp','dbaviet' );
END;
/
BEGIN
--
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_10.dmp','dbaviet', 'test_owner_10.dmp','dbaviet' );
END;
/
BEGIN
--
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_11.dmp','dbaviet', 'test_owner_11.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_12.dmp','dbaviet', 'test_owner_12.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_13.dmp','dbaviet', 'test_owner_13.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_14.dmp','dbaviet', 'test_owner_14.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_15.dmp','dbaviet', 'test_owner_15.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_16.dmp','dbaviet', 'test_owner_16.dmp',
'dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_17.dmp','dbaviet', 'test_owner_17.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_18.dmp','dbaviet', 'test_owner_18.dmp','dbaviet' );
END;
/
BEGIN
DBMS_FILE_TRANSFER.PUT_FILE('gw', 'test_owner_19.dmp','dbaviet', 'test_owner_19.dmp','dbaviet' );
END;
/
• C2: Chuyển bằng SCP
scp /u01/binhtv/* oracle@192.168.1.10:/export/home/oracle/binhtv
3. Import dữ liệu
impdp userid=\"/ as sysdba\" directory=tmpdump DUMPFILE=test_owner_%U.dmp parallel=16 TABLE_EXISTS_ACTION=APPEND DATA_OPTIONS=SKIP_CONSTRAINT_ERRORS