impdp error with two excluded tables - oracle

I am trying to import a dump with the following:
echo "exit" | sqlplus sys/pass as sysdba #ABC_STAGE_V2.sql
impdp ABC_STAGE_V2/ABC_STAGE_V2 remap_schema=abc_def_live:abc_stage_v2 remap_tablespace=ABC_DEF_LIVE:ABC_STAGE_V2 table_exists_action=replace REUSE_DATAFILES=N EXCLUDE=TABLE:"IN('AUDITTRACKING','TABLE_STATISTICS')" nologfile=Y dumpfile=abc_def.dmp directory=abc_v2
But it complains about:
LRM-00116: syntax error at ')' following 'TABLE_STATISTICS'
I have tried with a parfile with the following content:
root#ts1:/opt/import# cat parfile.par
remap_schema=abc_def_live:abc_stage_v2
remap_tablespace=ABC_DEF_LIVE:ABC_STAGE_V2
table_exists_action=replace
REUSE_DATAFILES=N
EXCLUDE=TABLE:"IN('AUDITTRACKING','TABLE_STATISTICS')"
nologfile=Y
dumpfile=abc_def.dmp
directory=abc_v2
And then I execute:
echo "exit" | sqlplus sys/pass as sysdba #ABC_STAGE_V2.sql
impdp ABC_STAGE_V2/ABC_STAGE_V2 PARFILE=filename.par
And the result is the same... it doesn't work.

Have you tried using a parfile? I've had instances where it just hated the CLI syntax but putting it in a parfile cleans it right up.

Related

how can i export oracle tables that have a prefix in oracle?

I know the command line to export is:
expdp '/ as sysdba' directory=EXPORT DUMPFILE=FILE.DMP TABLES=nametable
There is such a thing as query type:
export all tables starting with the prefix "table_"
There is such a thing as query type:
export all tables starting with the prefix "table_"
i resolve this whit the command include:
expdp hr INCLUDE=TABLE: like('g%') DUMPFILE=dpump_dir1:exp_inc.dmp NOLOGFILE=YES

How to format oracle connection string and output query to file

I am trying to connect to a oracle database, query it, and send results to a txt file. When I run my statement, this shows in the .txt file:
In reality, it should be values from my sql script.
Here is the string i am running:
sql_file1=Cb.sql
sqlplus -s "username/pwd#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=my_host)(Port=1521))(CONNECT_DATA=(SERVICE_NAME=my_ser_name))))" #sql/$sql_file1 > /home/path/to/my/files/'cb.txt'
Any reasons as to why my 'cb.txt' file shows the screenshot from above instead of any date from the query inside my sql file?
You have extra ) in your connection string:
(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=my_host)(Port=1521))(CONNECT_DATA=(SERVICE_NAME=my_ser_name))))
should be
sqlplus -s "username/pwd#(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=my_host)(Port=1521))(CONNECT_DATA=(SERVICE_NAME=my_ser_name)))" #sql/$sql_file1 > /home/path/to/my/files/cb.txt
But even easier to use EZConnect string:
sqlplus -s "username/pwd#//my_host:1521/my_ser_name" #sql/$sql_file1

How to import dmp file to oracle DB via SqlDeveloper or CMD in windows?

I have an Oracle dump file that got exported from an unfamiliar database.
I need to import it to my Oracle DB with either SqlDeveloper or command line in windows.
When using Data Pump Import Wizard in SqlDeveloper I'm getting the below error:
ORA-00942: table or view does not exist
When using the CMD I'm getting the below error:
ORA-39002: invalid operation ORA-39070: Unable to open the log file. ORA-29283: invalid file operation ORA-06512: at "SYS.UTL_FILE", line 536 ORA-29283: invalid file operation
My command line:
impdp USER/password DUMPFILE=c:\folder_name\file_name.dmp TABLES=All LOG=dump_log.log
I tried different variations and each time the same error.
Thank you for your help.
The command is missing the directory or the files in the proper directory on the db server. The default is DATA_PUMP_DIR which can be found from the DB as follow.
SQL> SELECT directory_name, directory_path FROM dba_directories
2 WHERE directory_name='DATA_PUMP_DIR';
DIRECTORY_NAME DIRECTORY_PATH
_________________ _________________________________________________________________
DATA_PUMP_DIR /opt/oracle/admin/ORCL/dpdump/8967C87908440D12E053020011AC6F8A
To make a new directory:
CREATE DIRECTORY MY_DIR AS 'c:\folder_name\';
Then add the directory and remove the path from the file parameter.
impdp USER/password directory=MY_DIR DUMPFILE=file_name.dmp TABLES=All LOG=dump_log.log
ref:
IMPDP > https://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_import.htm#SUTIL907
Create directory > https://docs.oracle.com/cd/E11882_01/server.112/e41084/statements_5007.htm#SQLRF01207

Oracle 12 import - imp command

This is how my database was exported :
exp system/password#host owner=(ifs_owner,sis_owner,emu_owner) file=file1.dmp log=file1.log direct=Y
I am trying to import it using the following commands :
1) In Oracle Developer:
create user CLIENT_TEST identified by client_test_password;
grant connect, unlimited tablespace, resource to CLIENT_TEST;
2) Next, in command line:
imp system/sys FROMUSER=(ifs_owner,sis_owner,emu_owner) TOUSER=client_test file=e:\oradata\file1.dmp
This works up to a point, (some tables are imported, however it fails with the following mesages):
. importing IFS_OWNER's objects into CLIENT_TEST
. importing SIS_OWNER's objects into SIS_OWNER
IMP-00003: ORACLE error 1435 encountered
ORA-01435: user does not exist
. importing EMU_OWNER's objects into EMU_OWNER
IMP-00003: ORACLE error 1435 encountered
ORA-01435: user does not exist
. importing IFS_OWNER's objects into CLIENT_TEST
How can i solve the errors ?
Use parfile. I mean create a parfile for your imp command and write to line as:
fromuser=ifs_owner touser=CLIENT_TEST
fromuser=sis_owner touser=CLIENT_TEST
fromuser=emu_owner touser=CLIENT_TEST
imp system/sys parfile=parfilename file=e:\oradata\file1.dmp
You can use parfile to set oracle exp and imp parameters, all parameters like as fromuser,touser,file and ... . I mean you should write a parfile (using vi or other linux editor tools) in a directory for example /home/oracle with name par1 and put your parameters like below. for each user write a line:
fromuser=ifs_owner touser=CLIENT_TEST
fromuser=sis_owner touser=CLIENT_TEST
fromuser=emu_owner touser=CLIENT_TEST
and use of this parfile in imp command:
imp system/sys parfile=/home/oracle/par1 file=e:\oradata\file1.dmp

Error while importing a DUMP file

SQL> impdp Fossil_ARSENAL/Fossil_ARSENAL#ARIF Dumpfile=FOSSIL_PLM_AUG_11.dmp transfo
rm=SEGMENT_ATTRIBUTES:N:INDEX REMAP_TABLESPACE=FOSSIL_PLM:Fossil_ARSENAL REMAP_SCH
EMA=FOSSIL_PLM:Fossil_ARSENAL LOGFILE=dp.log;
Error Msg Below:
SP2-0734: unknown command beginning "impdp Foss..." - rest of line ignored.
USERNAME : Fossil_ARSENAL
PASSWORD : Fossil_ARSENAL
DataBase Name : ARIF
Dumpfile NAme : FOSSIL_PLM_AUG_11.dmp
TableSpace Name : Fossil_ARSENAL
impdp is a separate executable; you call it from your operating system's command line, not from within SQL*Plus. The documentation describes expdp and impdp as command-line clients. The command looks reasonable, apart from noot seeming to have a directory argument; you're just issuing it in the wrong place.

Resources