I am using dbunit 2.5.4 with junit 4, Java 8, and an oracle db (11 something). I successfully downloaded my test db to a flat file (xml) following online tutorials. I now want to do a CLEAN_INSERT but I get a CyclicTablesDependencyException. The solution appears to be to turn off the foreign key checks but I am not sure how to do this. How can I disabled foreign key checks in my dbunit test when I am doing a clean_insert?
I don't know what all that (up to "Oracle") is (yes, I know, Google is my friend, but only if I use it).
However, if you want to move that "test DB" (is it really a database? Or is it a schema? I presume the latter, but - even if it is a former, no problem), I'd suggest you to use
Data pump Export (and Import), or
original EXP (and IMP) utilities
The first one is more powerful, but EXP & IMP are somewhat simpler to use (don't require access to DB server, you don't have to create a directory (an Oracle object), DMP file resides on your computer).
What is the export/import benefit? In your case Oracle will take care about constraints. Besides, you'd export all objects by default (tables, views, procedures, triggers, packages, sequences, ... - everything) in a simple manner. I'd suggest you to look at it.
Documentation is, as usual, on OTN (pick your 11 something version, although - for such a simple requirements - any version will do).
Here's a short demonstration: I'm exporting MIKE's objects (not that many of them) and importing them into SCOTT's schema.
M:\>exp mike/lion#orcl file=mike.dmp
Export: Release 11.2.0.2.0 - Production on Uto Tra 10 07:11:42 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export done in EE8MSWIN1250 character set and AL16UTF16 NCHAR character set
. exporting pre-schema procedural objects and actions
. exporting foreign function library names for user MIKE
. exporting PUBLIC type synonyms
. exporting private type synonyms
. exporting object type definitions for user MIKE
About to export MIKE's objects ...
. exporting database links
. exporting sequence numbers
. exporting cluster definitions
. about to export MIKE's tables via Conventional Path ...
. . exporting table DEPT 4 rows exported
. exporting synonyms
. exporting views
. exporting stored procedures
. exporting operators
. exporting referential integrity constraints
. exporting triggers
. exporting indextypes
. exporting bitmap, functional and extensible indexes
. exporting posttables actions
. exporting materialized views
. exporting snapshot logs
. exporting job queues
. exporting refresh groups and children
. exporting dimensions
. exporting post-schema procedural objects and actions
. exporting statistics
Export terminated successfully without warnings.
M:\>imp scott/tiger#orcl file=mike.dmp full=y
Import: Release 11.2.0.2.0 - Production on Uto Tra 10 07:13:51 2018
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Tes
Export file created by EXPORT:V11.02.00 via conventional path
Warning: the objects were exported by MIKE, not by you
import done in EE8MSWIN1250 character set and AL16UTF16 NCHAR character set
. importing MIKE's objects into SCOTT
. . importing table "DEPT" 4 rows imported
Import terminated successfully without warnings.
M:\>
Try disabling useSequenceFiltering: useSequenceFiltering = false
Related
I am trying to use the exp tool to backup the whole DB.
The command is "exp userid=system/manager#test inctype=complete buffer=65535 file=/home/oracle/backup/exp_full.dmp log=/home/oracle/backup/exp_full.log full=y".
But from the exp log, it can only export some user tables, not all, even though those tables cannot exported indeed have content. Only these users can be exported from the log as below:
. about to export SYSTEM's tables via Conventional Path ...
. about to export OUTLN's tables via Conventional Path ...
. about to export ORDDATA's tables via Conventional Path ...
. about to export OLAPSYS's tables via Conventional Path ...
etc.
But when I try to use expdp with command expdp system/manager dumpfile=expdp_full.dmp logfile=expdp_full.log full=y, it can export all user tables successfully.
The ORACLE DB version is 11.2.0.1.0.
Appreciate for your help.
you need to specify which schema you want to export , by expdp user/password schema=abc dumpfile=abc.dmp logfile=abc.log directory=abcdirectory
Oracle Database Online Documentation Library, 11g Release 2 (11.2)
Original Export is desupported for general use as of Oracle Database
11g. The only supported use of original Export in Oracle Database 11g
is backward migration of XMLType data to Oracle Database 10g release 2
(10.2) or earlier. Therefore, Oracle recommends that you use the new
Data Pump Export and Import utilities, except in the following
situations which require original Export and Import: You want to
import files that were created using the original Export utility
(exp).
You want to export files that will be imported using the original
Import utility (imp). An example of this would be if you wanted to
export data from Oracle Database 10g and then import it into an
earlier database release.
We have a 2 current Oracle 10G(10.2.0.1) production databases, and we are planning to migrate to a new database server with Oracle 12C. Since data is for each database is only around 5GB, the best way to create a new instance and use data pump to transfer data. To achieve this, I created a database link from the Oracle 12C database to the 10G, and use that to expdp the data from the 12C database. However when I import the exported data I have around tables that have an error like this:
ORA-39083: Object type TABLE:"USER"."WH_SEARCH_ACT" failed to create with error:
ORA-00406: COMPATIBLE parameter needs to be 12.2.0.0.0 or greater
ORA-00722: Feature "Partition Read Only"
Is there any solution to this other than adding the COMPATIBLE parameter in the production database? This is production so I can't really just update/modify the current production database. Any other solutions here, because i don't like just create the tables before importing the data pump file.
Use the version parameter in the data pump utility. For example:
expdp hr/hr TABLES=hr.employees VERSION=10.2
DIRECTORY=data_pump_dir DUMPFILE=emp10g.dmp LOGFILE=emp.log
Just make sure the version of the export utility is 10g and import utility is 12G. Hope this helps.
In the production database . you can use exp program
exp username/password buffer=64000 file=/path/to/path.dmp full=y
copy exp dump file to oracle 12c and use
imp username/password buffer=64000 file=/path/to/path.dmp full=y
I am very new to dba tasks. I can export PL/SQL packages, functions, procedures from one database to another with expdp and impdp. But I need to export these objects(functions, procedures) by Transporting the tablespace(TTS) . I searched in different threads but didn't get any help. I heard there is a way of exporting packages through TTS (even though I read in many forums that "packages cannot be exported through TTS" ). But how? I already tried TTS but packages were not exported,only tables were exported.
If you have Oracle 10 g or later, then you can use the INCLUDE parameter of the Data Pump to export packages, as below:
expdp system/password#db10g directory=TEST_DIR dumpfile=DB10G.dmp logfile=expdpDB10G.log INCLUDE=PACKAGE
References:
Oracle Data Pump (expdp and impdp) in Oracle Database 10g on ORACLE-BASE
Parameters Available in Export's Command-Line Mode on Oracle® Database Utilities
I used to run commands to get Oracle database backup in the old way using 'exp' and 'imp fromuser touser. Now, I am trying to user new command to take backup 'expdp' and 'impdp'.
Steps:
Got backup using expdp with schema parameter on the production server. my username is 'xxx' (Not sure it's fully exported with procedures, function, and view).
Now, on my dev server first I made another user called 'yyy'. I gave directory access to user 'yyy' and trying to run command impdp as below.
C:\impdp yyy/yyy remap_schema=xxx:yyy directory=abc dumpfile=123.dmp logfile=123.log
Now, I am getting an error like the below.
Import: Release 11.1.0.6.0 - Production on Thursday, 24 January, 2013 9:53:58
Copyright (c) 2003, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production
With the Partitioning, OLAP, Data Mining, and Real Application Testing options
ORA-31626: job does not exist
ORA-31633: unable to create master table "yyy.SYS_IMPORT_FULL_05"
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 95
ORA-06512: at "SYS.KUPV$FT", line 978
ORA-01031: insufficient privileges
Do I miss any steps? like I have to create a job or anything, not sure. basically, I got backup from one user and need to restore on another user in Oracle.
Please help me.
User yyy will need appropriate privledges necessary to create the objects.
See: privileges required to import objects into your own schema.
http://docs.oracle.com/cd/E11882_01/server.112/e22490/original_import.htm#BABFHCBI
Also:
http://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_overview.htm#CJAIBFJG
Many Data Pump Export and Import operations require the user to have the DATAPUMP_EXP_FULL_DATABASE role and/or the DATAPUMP_IMP_FULL_DATABASE role. These roles are automatically defined for Oracle databases when you run the standard scripts that are part of database creation. (Note that although the names of these roles contain the word FULL, these roles are actually required for all export and import modes, not only Full mode.)
The DATAPUMP_EXP_FULL_DATABASE role affects only export operations. The DATAPUMP_IMP_FULL_DATABASE role affects import operations and operations that use the Import SQLFILE parameter. These roles allow users performing exports and imports to do the following:
•Perform the operation outside the scope of their schema
I believe, import user donot have permission on import database directory.
In the Import db,
select directory_name,directory_path from dba_directories;
It will show the directory names
sql>grant read,write on directory abc to ;
Robertson
Oracle Database SME
+91-9886321339
I have an Oracle (10.2.0.4) database table with a column which is encrypted by dbms_obfuscation_toolkit.DESEncrypt tool kit.
Some of our data has been messed up by it getting re-encrypted with another key.
I want to do some testing on this data to try and recover it. Therefore, I want to copy the data from our live system and into a test system.
I've tried simply exporting the data from SQL Developer (in various text based formats), but the "binary" nature of the encrypted data seems to break the file format.
I tried exp, but this reported errors (although I'm not sure if this is to do with the encrypted data or not).
How can I copy just this one table's data from one database to another?
Thanks.
The errors I got when exporting the table are below. I was doing this from my local machine connecting to a remote database:
c:\>exp <user>/<password>#<sid> FILE=export.dmp TABLES=(TABLE1)
Export: Release 11.1.0.6.0 - Production on Thu Oct 14 20:46:51 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit
Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Export done in WE8ISO8859P1 character set and AL16UTF16 NCHAR character set
server uses WE8ISO8859P15 character set (possible charset conversion)
About to export specified tables via Conventional Path ...
. . exporting table TABLE1
EXP-00008: ORACLE error 904 encountered
ORA-00904: "MAXSIZE": invalid identifier
I would try with a database link. If you can't create a database link, you could try the COPY command of SQL*Plus, although I'm not sure if it would work with encrypted columns (it looks like this command is deprecated in the newest releases).
If this fails, the best tool to export/import data from Oracle to Oracle would probably be Data Pump (included in the DB).
It turned out that my Windows test database had a slightly different character set encoding when compared to our live (unix) system - WE8ISO8859P1 -v- WE8ISO8859P15. I did a character set conversion on my test database, using the instructions here and then I was able to import the data.