I'm trying to export an Oracle DB using Oracle SQL Developer having tables, sequences, view, packages, etc. with dependencies on each other.
When I use Tools -> Database Export and select all DDL options, unfortunately the exported SQL file does not preserve the other that is some DB objects should be created before some other.
Is there a way to make the DB export utility preserve object dependencies/order? Or Is there any other tool do you use for this task?
Thank you
Normally expdp does a pretty good job. Problems arise when there are dependencies on objects/users that are not part of the dump. This is because the counter part, impdp, does not add grants on objects that are not created by impdp. I call that the 'not created by me syndrome' that impdp has.
If you have no external dependencies (external meaning to schema's that are not part of the dump), expdp/impdp do a good job for you. You might not be able to use it if you can not have access to the database server since expdp writes it's files on the database server.
If you happen to have access to a database server that is able to connect to the original database, you could pull the data over into your local database using a database link.
Related
I want to export below things from SQL developer
1-Only schema (tables structure)
2-Only data in excel form
3-Schema with data
after exporting this i want to import the same to the another database
So what steps should i follow for export and import?
I can not use DATA PUMP as i don't have DBA privilege
As you use Oracle 11g, I'd suggest you to forget about SQL Developer and use the original EXP and IMP utilities. Doing so, you'd avoid DBA-related-problems as these utilities don't require access to the directory (an Oracle object which points to (usually database server's) filesystem directory, and - in order to be able to use it - you'd need to have read/write privileges on it).
So - if you don't already have these, install Oracle Client which contains EXP/IMP and use them.
I need to create a copy of DDL and Data from an Oracle 12cR1 schema.
I can't use the SYS or other High Privileges user.
I can only use SQL DEVELOPER using the schema credentials.
The rights I have are:
Create and alter object privileges within the schema (such as CREATE
TABLE).
Insert, read, update and delete data privileges on the tables
within the schema.
Execute privileges on the stored procedures,
functions and packages within the schema.
I can use Oracle SQL Developer or other third party tool.
I have used the "Database Export" functions, but I ahve found no way to get both the DDL and the INSERT queries in the correct order. Some table have dependencies, so I need to respect a logic order for both DDL and Queries.
In my opinion, you should use a tool which is designed to do such a task, and that's Data Pump (Export & Import). It requires you to acquire privileges on a directory which resides on the database server, and that's something that a privileged (SYS) user creates and grants. If there's a DBA there, ask them to provide it for you.
If there's none, you can still use the Original EXP utility which creates a DMP file on your own computer.
The advantage of the export is that Oracle handles everything that seems to bother you.
If I were you, I wouldn't do it manually, there's really no need to do it that way. Apart from the fact that it is time-consuming, you'll have to take care about foreign key constraints, create slow INSERT INTO statements ... shortly, don't do it. Use (Data Pump) export and import.
You can disable all the constraints and triggers first, then insert the data. After data loaded, enable them all.
You can also try to use PL/SQL Developer to export the objects first. This tool exports objects in dependency order. Then export the data, but not sure it exports the data in dependency, you can try if there are disable constraints/triggers option when export.
I have an Oracle 12c Instance with a scheme 'wadmin' user, this instance has tables, view, data, triggers, sequences etc.
For quick spinning of docker images, I need to clone the db schema as fast as possible , so that I can create another user 'wadmin1' link it to new docker and start my testing.
Any CLI/tools for the same, does oracle provide any options?
I do not know if this is exacly what you are looking for but you can export your Oracle schema using ORACLE DataPump tool. This involves storing exported schema in the Oracle directory. While exporting schema to file you can transform the schema name, omit unnecessary tables or data etc. Exported files with database schema can be later used for imported to new database instance. More information regarding Oracle DataPump you can find here. https://oracle-base.com/articles/10g/oracle-data-pump-10g#SchemaExpImp.
Alternatively you can have scripts that create the database stored in the Git repository and integrate your builds with too called Flyway https://flywaydb.org/ which can be used to automatize of database schema creation. This is also really convenient from source control point of view. All changes on the schema are pull requested.
In my team we use OracleDataPump when we want to recreate the database together with the data, Flyway is used as a part of our continues integration.
Really would appreciate any help whatsoever on this one.
How to generate DDL from Application Express... including the actual data.
I can create a DDL; but one which contains none of the necessary inserts into the database tables. :<
There is no command console in Application Express.
You could use another tool, such as SQL Developer, which can export the data as INSERT statements; alternatively, use Oracle's schema export utility (expdp) which can either export just the data or the entire schema if you like.
i am newbie to oracle and i like to export database from remote database and import it on local machine. eOn both machines i have oracle 10.2.
I need to know how to export/import schema and data from oracle 10.2 using SQLDeveloper 3.0.0.4.
To export from remote database, i have used export Tool-> Database Export -> export wizard.
and at the end i have got only sql file with DDL and DML statements but somewhere in file it is written
"Cannot render Table DDL for object XXX.TABLE_NAME with DBMS_METADATA attempting internal generator error.
I have ignored previously mentioned message and tried to run those DDL and DML statements but all this ended up with errors.
Is it possible that all this tied with read-only database user? More over, i dont find any table under tables but also tables under other users in SqlDeveloper.
Thanks in advance
As a test, can you select one object in the tree, and navigate to the script panel? SQLDEV also uses DBMS_METADATA to generate those scripts.
Also, as a work-around, try using DataPump to export and import your data. It will be much more efficient for moving around larger schemas.
Your note about not seeing tables under indicates your schema doesn't actually own any tables. You may be working with synonyms that allow you to query objects as if they are in your account. You could be running into a privilege issue, but your error message doesn't indicate that. Error messages often come in bunches, and the very first one is usually the most important.
If you could try using the EXPORT feature say against a very simple schema like SCOTT as a test, this should indicate whether there is a problem with your account settings or with the software.
I'm not sure with SQL Developer 3.0 but with version 3.1 you can follow this:
SQL Developer 3.1 Data Pump Wizards (expdp, impdp)