Thứ Hai, 19 tháng 1, 2026

Export/Import từ Oracle 12c xuống 11g cùng Version Parameter

Mục đích: Export/Import từ Oracle 12c xuống 11g cùng Version Parameter
Source DB Server:
OS: OEL 7.5
Database Name: ORCL
Pluggable DB Name: ORCLPDB
DB Version: 12.2.0.1
Schema: C##RUPESH   => Local User
Tablespace: USERS

Target DB Server:
OS: OEL 7.5
Database Name: CLONE
DB Version: 11.2.0.4
Schema: RUPESH
TABLE: EMP
Tablespace: TEST


Bước 1:  Kiểm tra phiên bản hiện tại của cả cơ sở dữ liệu nguồn và đích.

Source:
[oracle@test oracle]$ sqlplus / as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Sun Jun 10 19:47:43 2018

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> select banner from v$version;

BANNER
---------------------------------------------------------------------------
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production
PL/SQL Release 12.2.0.1.0 - Production
CORE   12.2.0.1.0        Production
TNS for Linux: Version 12.2.0.1.0 - Production
NLSRTL Version 12.2.0.1.0 - Production

You can check whether pluggable feature is enabled or not using below command.

SQL> show pdbs

CON_ID CON_NAME    OPEN MODE  RESTRICTED
------ ----------- ---------- ----------
     PDB$SEED    READ ONLY  NO
     ORCLPDB     READ WRITE NO

Target:
[oracle@clone oracle]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Jun 10 19:47:17 2018

Copyright (c) 1982, 2013, Oracle.  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

SQL> select banner from v$version;

BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
PL/SQL Release 11.2.0.4.0 - Production
CORE   11.2.0.4.0        Production
TNS for Linux: Version 11.2.0.4.0 - Production
NLSRTL Version 11.2.0.4.0 - Production


Bước 2:  Lấy thông tin chi tiết về siêu dữ liệu (metadata) bảng từ cơ sở dữ liệu đích.
SQL> set lines 300 pages 3000
SQL> col directory_name for a13
SQL> col directory_path for a34
SQL> col owner for a13
SQL> select * from dba_directories where directory_name='DIR';

OWNER                 DIRECTORY_NAM DIRECTORY_PATH
------------- ------------- ----------------------------------
SYS            DIR     /u01/app/oracle/

SQL> select username,account_status,default_tablespace from dba_users where username='C##RUPESH';

USERNAME    ACCOUNT_STATUS  DEFAULT_TABLESPACE
---------- ---------------- -------------------
C##RUPESH  OPEN             USERS

SQL> conn c##rupesh
Enter password:
Connected.

SQL> select * from dept;

            ID NAME
---------- ------------
             1 A
             1 A
             1 A
             1 A

Bước 3: Xuất bảng từ cơ sở dữ liệu nguồn. 

[oracle@test oracle]$ expdp directory=DIR dumpfile=version_expdp_dept.dmp logfile=version_expdp_dept.log tables=C##RUPESH.dept version=11.2

Export: Release 12.2.0.1.0 - Production on Sun Jun 10 20:14:37 2018

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

Username: system@ORCLPDB
Password: 

Connected to: Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

Warning: Oracle Data Pump operations are not typically needed when connected to the root or seed of a container database.


Warning: Oracle Data Pump is exporting from a database that supports long identifiers to a version that does not support long identifiers.

Starting "SYSTEM"."SYS_EXPORT_TABLE_01":  system/********@ORCLPDB directory=DIR dumpfile=version_expdp_dept.dmp logfile=version_expdp_dept.log tables=C##RUPESH.dept version=11.2 
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Processing object type TABLE_EXPORT/TABLE/TABLE

. . exported "C##RUPESH"."DEPT"                          5.507 KB       4 rows
Master table "SYSTEM"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for SYSTEM.SYS_EXPORT_TABLE_01 is:
  /u01/app/oracle/version_expdp_dept.dmp

Job "SYSTEM"."SYS_EXPORT_TABLE_01" successfully completed at Sun Jun 10 20:15:12 2018 elapsed 0 00:00:22

Copy exported dump file sang target server.

[oracle@test oracle]$ scp version_expdp_dept.dmp oracle@clone:/u01/app/oracle/
oracle@clone's password:
version_expdp_dept.dmp                                                                                                   100%  140KB  24.1MB/s   00:00   

Import exported dump ở target db.

[oracle@clone oracle]$ impdp directory=DIR dumpfile=version_expdp_dept.dmp logfile=version_impdp_dept.log tables=C##RUPESH.dept remap_schema=C##RUPESH:RUPESH remap_tablespace=USERS:TEST

Import: Release 11.2.0.4.0 - Production on Sun Jun 10 20:16:32 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Username: / as sysdba

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 "SYS"."SYS_IMPORT_TABLE_01" successfully loaded/unloaded
Starting "SYS"."SYS_IMPORT_TABLE_01":  /******** AS SYSDBA directory=DIR dumpfile=version_expdp_dept.dmp logfile=version_impdp_dept.log tables=C##RUPESH.dept remap_schema=C##RUPESH:RUPESH remap_tablespace=USERS:TEST
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "RUPESH"."DEPT"                             5.507 KB       4 rows
Job "SYS"."SYS_IMPORT_TABLE_01" successfully completed at Sun Jun 10 20:16:38 2018 elapsed 0 00:00:02


SQL> conn rupesh
Enter password:
Connected.

SQL> select * from tab;

TNAME   TABTYPE  CLUSTERID
------- ------- ----------
DEPT    TABLE
EMP     TABLE


SQL> select * from dept;

            ID NAME
---------- ------------
             1 A
             1 A
             1 A
             1 A
=============================
TƯ VẤN: Click hoặc Hotline/Zalo 090.29.12.888
=============================
Website không chứa bất kỳ quảng cáo nào, mọi đóng góp để duy trì phát triển cho website (donation) xin vui lòng gửi về STK 90.2142.8888 - Ngân hàng Vietcombank Thăng Long - TRAN VAN BINH
=============================
Nếu bạn không muốn bị AI thay thế và tiết kiệm 3-5 NĂM trên con đường trở thành DBA chuyên nghiệp hay làm chủ Database thì hãy đăng ký ngay KHOÁ HỌC ORACLE DATABASE A-Z ENTERPRISE, được Coaching trực tiếp từ tôi với toàn bộ bí kíp thực chiến, thủ tục, quy trình của gần 20 năm kinh nghiệm (mà bạn sẽ KHÔNG THỂ tìm kiếm trên Internet/Google) từ đó giúp bạn dễ dàng quản trị mọi hệ thống Core tại Việt Nam và trên thế giới, đỗ OCP.
- CÁCH ĐĂNG KÝ: Gõ (.) hoặc để lại số điện thoại hoặc inbox https://m.me/tranvanbinh.vn hoặc Hotline/Zalo 090.29.12.888
- Chi tiết tham khảo:
https://bit.ly/oaz_w
=============================
2 khóa học online qua video giúp bạn nhanh chóng có những kiến thức nền tảng về Linux, Oracle, học mọi nơi, chỉ cần có Internet/4G:
- Oracle cơ bản: https://bit.ly/admin_1200
- Linux: https://bit.ly/linux_1200
=============================
KẾT NỐI VỚI CHUYÊN GIA TRẦN VĂN BÌNH:
📧 Mail: binhoracle@gmail.com
☎️ Mobile/Zalo: 0902912888
👨 Facebook: https://www.facebook.com/BinhOracleMaster
👨 Inbox Messenger: https://m.me/101036604657441 (profile)
👨 Fanpage: https://www.facebook.com/tranvanbinh.vn
👨 Inbox Fanpage: https://m.me/tranvanbinh.vn
👨👩 Group FB: https://www.facebook.com/groups/DBAVietNam
👨 Website: https://www.tranvanbinh.vn
👨 Blogger: https://tranvanbinhmaster.blogspot.com
🎬 Youtube: https://www.youtube.com/@binhguru
👨 Tiktok: https://www.tiktok.com/@binhguru
👨 Linkin: https://www.linkedin.com/in/binhoracle
👨 Twitter: https://twitter.com/binhguru
👨 Podcast: https://www.podbean.com/pu/pbblog-eskre-5f82d6
👨 Địa chỉ: Tòa nhà Sun Square - 21 Lê Đức Thọ - Phường Mỹ Đình 1 - Quận Nam Từ Liêm - TP.Hà Nội

=============================
cơ sở dữ liệu, cơ sở dữ liệu quốc gia, database, AI, trí tuệ nhân tạo, artificial intelligence, machine learning, deep learning, LLM, ChatGPT, DeepSeek, Grok, oracle tutorial, học oracle database, Tự học Oracle, Tài liệu Oracle 12c tiếng Việt, Hướng dẫn sử dụng Oracle Database, Oracle SQL cơ bản, Oracle SQL là gì, Khóa học Oracle Hà Nội, Học chứng chỉ Oracle ở đầu, Khóa học Oracle online,sql tutorial, khóa học pl/sql tutorial, học dba, học dba ở việt nam, khóa học dba, khóa học dba sql, tài liệu học dba oracle, Khóa học Oracle online, học oracle sql, học oracle ở đâu tphcm, học oracle bắt đầu từ đâu, học oracle ở hà nội, oracle database tutorial, oracle database 12c, oracle database là gì, oracle database 11g, oracle download, oracle database 19c/21c/23c/23ai, oracle dba tutorial, oracle tunning, sql tunning , oracle 12c, oracle multitenant, Container Databases (CDB), Pluggable Databases (PDB), oracle cloud, oracle security, oracle fga, audit_trail,oracle RAC, ASM, oracle dataguard, oracle goldengate, mview, oracle exadata, oracle oca, oracle ocp, oracle ocm , oracle weblogic, postgresql tutorial, mysql tutorial, mariadb tutorial, ms sql server tutorial, nosql, mongodb tutorial, oci, cloud, middleware tutorial, docker, k8s, micro service, hoc solaris tutorial, hoc linux tutorial, hoc aix tutorial, unix tutorial, securecrt, xshell, mobaxterm, putty

ĐỌC NHIỀU

Trần Văn Bình - Oracle Database Master