In today’s article, I will talk about Schema Export/Import In Oracle Container Database.
We import and export a schema in Oracle 19C Container database as follows.
Export Process Steps:
1. We learn the size of the schema to be exported.
1 2 | SELECT (Sum(bytes)/1024/1024) AS total_size_MB FROM dba_segments WHERE owner ='TEST_USER'; |
2. We create a directory in the database for the directory where the export will be taken.
1 2 3 4 5 | SQL> alter session set container=ORCL; SQL> create directory EXP_DIR as '/backup/export/'; SQL> grant exp_full_database to melek; SQL> grant read , write on directory EXP_DIR to melek; SQL> SELECT * FROM dba_directories; |
3. We check the CPU count of the server before exporting. Parallelism is adjusted according to the number of CPUs.
1 | $ lscpu |
4. We start the export process.
1 2 3 | $ expdp melek/<password>@ORCL SCHEMAS=TEST_USER DIRECTORY=EXP_DIR DUMPFILE=TEST_USER_%U.dmp PARALLEL=6 LOGFILE=TEST_USER.log compression=all EXCLUDE=STATISTICS |
Import Process Steps:
1. We create a directory for export/import operations on the server to be imported.
1 2 3 4 5 6 | SQL> alter session set container=TESTDB; SQL> create directory DUMP_DIR as '/backup/export/'; SQL> grant exp_full_database to melek; SQL> grant imp_full_database to melek; SQL> grant read , write on directory DUMP_DIR to melek; SQL> SELECT * FROM dba_directories; |
2. We check the CPU number of the server to be imported.
1 | $ lscpu |
3. We start the import process.
1 2 | $ impdp melek/<password>@TESTDB directory=EXP_DIR dumpfile=TEST_USER_%U.dmp parallel=4 logfile=imp_TEST_USER.log |