How to restore database with impdp - oracle

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!

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 .....

SQLPlus - Data Pump (expdp and impdp)

some time ago, I installed Oracle SQLPlus without full Oracle database package.
Now I need expdp and impdp utility. Is it possible to copy important files from a full Oracle installation and pasting them into SQLPlus directory?
Or maybe is there any other option to install only expdp and impdp? (Windows)
Regards,
Kamil
Not really.
But, you don't have to actually 'Install' the full client.
Our latest distribution includes an Instant Client with sql*loader and data pump utilities.
Grab this one
Instant Client Package - Tools: Includes Data Pump, SQLLoader and Workload Replay Client*
There's no installer. Just unzip it, and add the directory to your PATH. You should be good to go then.
I wouldn't dump the files into your existing directory where you have SQLPlus though, just put it in a fresh directory and use that instead of your old one.

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.

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. :)

Oracle Database Backup Error

Previously i have used oracle 10g version. but today i uninstalled oracle 10g version and installed oracle 11g version. after that i installed apex_4.1.1_en and create new workspace and install apex backups. then i tried to install database backup (i did backup as schema backup). but i couldn't install backup successfully. i couldn't create tables successfully. i got error saying tablespace does not exist as below.
tablespace 'APEX_11560722039238920' does not exist
how could i resolve this? how could i install my database backup ?
There are more ways to fix this, depending on how you made the export. If you used the old exp utility you could create a ddl script and change the tablespace name in the script, run the script and redo the imp. Use imp help=y to see the cmdline options, look for indexfile.
If you used expdp, the previous fix is valid but you could also use a remap tablespace directive to redirect the table/index creations to the tablespace of your choice. Use impdp help=y for the cmdline options needed.
Since this is you own database, the easiest way to handle this is to just create the tablespace that is missing.
create tablespace APEX_11560722039238920 datafile '/where/you/want/APEX_11560722039238920.dbf' size 512m autoextend on next 512m maxsize 2g;
alter user your_apex_owner quota unlimited on APEX_11560722039238920;

Resources