How do I export a 12c schema dump? - oracle

I have successfully imported an 11g dump into my local 12c installation like this:
-- CREATE DATA_DUMP_DIR and give priviledges to SYSTEM
CREATE DIRECTORY main_data_pump_dir as 'C:\ade\aime_v\oracle\admin\seeddata\dpdump';
GRANT READ, WRITE ON DIRECTORY main_data_pump_dir TO SYSTEM;
impdp system/Oracle_1#pdborcl directory=main_data_pump_dir dumpfile=myshema.dmp nologfile=Y
Now I am trying to export like this:
expdp myschema dumpfile=main_data_pump_dir:myschema.dmp reuse_dumpfiles=y nologfile=Y
or maybe this:
expdp myschema#pdborcl dumpfile=main_data_pump_dir:myschema.dmp reuse_dumpfiles=y nologfile=Y
But I can't seem to get it working.
Do I need to grant write to myschema?

This ended up working for me:
expdp System/Oracle_1#pdborcl schemas=myschema dumpfile=main_data_pump_dir:myschema.dmp nologfile=yes reuse_dumpfiles=yes

Related

Import Oracle DUMP file in oracle instance 19c

I have an oracle .dmp file and I do not know any other information about that, I want to import this dump file to my oracle 19c database.
When I use the imdb command like this:
impdp DIRECTORY=E:\Oracle19c\db_home\admin\sample\bdump DUMPFILE=tf20200325.dmp
I get these errors:
Connected to: Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-39087: directory name E:\ORACLE19C\DB_HOME\ADMIN\SAMPLE\BDUMP is invalid
When I use the imp command like this:
imp file=E:\Oracle19c\db_home\admin\sample\bdump\tf20200325.dmp full=y;
I get these errors:
IMP-00038: Could not convert to environment character set's handle
IMP-00000: Import terminated unsuccessfully
I tried after searching on the web, but not found any solution to help me.
notable: I am not creating any databases, I only create a user with all privileges.
The directory you specify is the name of a database directory object, not the actual directory. So, connect to your db as SYS, and do
create directory xyz as 'E:\Oracle19c\db_home\admin\sample\bdump\';
grant all on directory xyz to (put your user name);
and then you can use it like this:
impdp directory=xyz .....

How to restore database with impdp

I have Oracle 12c database and I execute expdp command to create dump file. Later I want to be able to restore database using this dump file, on the same location as where the dump was created from. I don't want to stop database, which is required to drop schema (or execute any 'shutdown immediate', which is required for doing the same with flashbacks).
If I execute impdp with remap_schema=myschema:myschema, I get many errors. When I try it with table_exists_action=replace, I also get errors (ORA numbers: 31684, 39111, 39083, 31085, 39325, 31061, 06512, 29329).
How can I restore database in the same location? Thanks!

Oracle 11g expdp or impdp DDL without compression

I'm trying to export some schemas DDL (no need for data) using expdp on Oracle 11.2.0.3.0. I need to try and find a way of either exporting these without compression enabled or importing ignoring the compression.
I understand you can remove compression on the import using the TRANSFORM param on 12 but I can't find anything similiar for 11.
export:
expdp /#schema_name DIRECTORY=DMP_FILES DUMPFILE=schema_name.dmp CONTENT=METADATA_ONLY exclude=STATISTICS log=schema_name.log;
import:
impdp /#schema_name DIRECTORY=DMP_FILES DUMPFILE=schema_name.dmp log=schema_name.log;
Looks like the only way in 11g was to use the sqlfile param as part of impdp to turn the existing dmp files into DDL files. I then ran these through SQLplus on the server.

How can I export Oracle schema from my local machine to Remote using expdp and impdp command

I want to take the back up of my local Oracle instance and want it to import on my remote server.
I have searched the web but couldn't find any solution. The solution I got is:
Export from local and import into only local.
Export from Remote and import into only remote server.
But my requirement is:
I have a schema in my local oracle instance. Now I want to take it's backup and import it on to my remote server.
Below are commands I am running for exporting and importing.
for Local--
expdp HR/HR#ORCL directory=Export SCHEMAS=MUKESH DUMPFILE=MUKESH.dmp LOGFILE=MUKESH.log
impdp HR/HR#ORCL directory=Export SCHEMAS=MUKESH DUMPFILE=MUKESH.dmp LOGFILE=MUKESH.log
for Remote--
expdp FASTAdmin/password#db-m3-medium.coplvukvijdo.us-east-1.rds.amazonaws.com:1521/ORCL network_link=to_rds directory=Data_pump_dir dumpfile=MUKESH.dmp logfile=MUKESH.log SCHEMAS='MUKESH'
impdp FASTAdmin/password#db-m3-medium.coplvukvijdo.us-east-1.rds.amazonaws.com:1521/ORCL directory=DATA_PUMP_DIR dumpfile=MUKESH.dmp logfile=MUKESH.log SCHEMAS=MUKESH
Note:Please give me the solution using expdp and impdp command only.
Three simple steps:
EXPDP on your local to generate the dump file.
Move the dump file to the remote server and place it in the required directory, by default from 10g and up you could use DATA_PUMP_DIR
EXPDP on the remote server using the dump file you placed in step 2.
In step 2, if you don't know the directory, you could do:
SELECT directory_path FROM dba_directories WHERE directory_name = 'DATA_PUMP_DIR';
See an example here.

Error while restoring oracle 10g .dmp file in oracle database 12c

I've got a .dmp file created with Oracle 10g containing the database of one of my clients. I can't for the life of me get it set up with my 12c installation. I can connect to my db using https://localhost:5500/em
I've created a user 'BOB' in my desired PDB and granted import, read and write permissions. Next I try to import using the following command:
impdp BOB/password#//localhost:1521/pdbname full=y directory=dpdump_dir dumpfile=BOB.dmp
However this gives me the following errors:
UDI-12541: operation generated ORACLE error 12541
ORA-12541: TNS:listener does not currently know of service requested in connect descriptor
In the listener.ora and tnsnames.ora i have EZCONNECTOR and ports 1521. Does anyone know how to get this to work?
Many thanks in advance,
Bob
First ensure that you can do tnsping for pdbname to ensure db connect :- $ tnsping bdbname
If you get details of connection string by tnsping, you can try command with following format:
impdp bob/password#127.0.0.1:1521/pdbname directory=dpdump_dir dumpfile=BOB.dmp
I have removed "full=y" as it's not required if you are not restoring full database, specially it used apply with imp/exp utility.
You should remember that pdbname is being specified as a dbname/service_name in your example. You can confirm service_name by following command:
$ lsnrctl services; /* You can get service name and put it on your impdp command. */
In addition, you can try without specifying ip,port and dbname as you are working in localhost itself:
$ impdp bob/password directory=dpdump_dir dumpfile=BOB.dmp
First of all, you should check the connection
sqlplus> BOB/password#localhost:1521/pdbname
If you cannot connect, please connect with sys / as sysdba
Then using command:
SQL> alter session set container=pdbname
SQL> alter pluggable database pdbname open
Then quit and try to your command again. :)

Resources