Importing a dump file in Oracle 12C
Database Version: Oracle 12c
To start with, Create a pluggable(container) before you import your data.
(You have to be logged in to your database)
eg.
Use the command below to create pluggable
Note:
username oracle in this case is the admin user for your database that you configured during installation.
Step 2:
Run these commands in order:
execute this on a new terminal tab to create pdb folder manually:
Step 3:
Execute the following 7 commands inside your container in their order:
>> at this point the command may throw an error with the missing path trying to locate your file.
>> In this case create the directory and move your file there
>> mkdir -p <the complaining path :)>
>> you may need to change the permissions eg. sudo chmod -R 777 <the complaining path :)>
To start with, Create a pluggable(container) before you import your data.
(You have to be logged in to your database)
eg.
sqlplus sys as sysdba
Step 1:Use the command below to create pluggable
CREATE PLUGGABLE DATABASE <your_container_name> ADMIN USER PDB_ADMIN IDENTIFIED BY oracle FILE_NAME_CONVERT = ('/oradata/orcl/pdbseed/','/oradata/orcl/<your_container_name>');
Note:
username oracle in this case is the admin user for your database that you configured during installation.
Step 2:
Run these commands in order:
alter session set container=<your_container_name>;
startup;
execute this on a new terminal tab to create pdb folder manually:
mkdir -p /oradata/orcl/<your_container_name>
Step 3:
Execute the following 7 commands inside your container in their order:
01. CREATE OR REPLACE DIRECTORY PLUGGABLE_DATA_PUMP_DIR as '/oradata/orcl/<your_container_name>';
02. GRANT READ, WRITE ON DIRECTORY PLUGGABLE_DATA_PUMP_DIR TO SYSTEM;
03. create tablespace <YOUR_TABLESPACE_NAME> datafile '/oradata/orcl/<your_container_name>/<YOUR_TABLESPACE_NAME>.DBF' SIZE 1024m AUTOEXTEND ON NEXT 200M;
04.create temporary tablespace TEMP_<YOUR_TABLESPACE_NAME> tempfile '/oradata/orcl/<your_container_name>/TEMP_<YOUR_TABLESPACE_NAME>' SIZE 512m;
05.create tablespace USERS datafile '/oradata/orcl/<your_container_name>/USERS.DMP' SIZE 1024m AUTOEXTEND ON NEXT 200M;
06. create user <db_username> identified by <db_password> default tablespace <YOUR_TABLESPACE_NAME> TEMPORARY tablespace TEMP_<YOUR_TABLESPACE_NAME> QUOTA UNLIMITED ON <YOUR_TABLESPACE_NAME>;
07. Grant dba to <db_username>;
MUST READ:
#import (Put the ! symbol or exit from sqlplus then run the command without !)
08. !impdp <db_username>/<db_password>@<db_hostip>/<your_container_name> file=<your_dump_file_name>.dmp metrics=y transport_datafiles='/oradata/orcl/<your_container_name>/<YOUR_TABLESPACE_NAME>.dbf', '/oradata/orcl/<your_container_name>/<YOUR_TABLESPACE_NAME>.dbf' version=12 schemas=<db_username> directory=PLUGGABLE_DATA_PUMP_DIR
>> at this point the command may throw an error with the missing path trying to locate your file.
>> In this case create the directory and move your file there
>> mkdir -p <the complaining path :)>
>> you may need to change the permissions eg. sudo chmod -R 777 <the complaining path :)>
Comments
Post a Comment