How to selectively export oracle to dump - minus some procedures or packages - oracle

We need to export an 11g database to get it into an 10g system. But we need to leave out a package, or at least some functions and procedures, that were accidentally implemented using 11g-only features.
Thankfully, the 10g is just a reporting database and we need only a few of the procedures that were implemented in 10g.
Any thoughts? I've seen some options for table-only exports, or selectively exporting certain tables. But we do need some of the procedures to come along.

I would recommend using expdp (data pump export) on the 11g database specifying the VERSION and INCLUDE parameters:
expdp dumpfile=10g.dmp directory=data_pump_dir version=10.2 INCLUDE=PROCEDURE:"LIKE '%XXX'"
This will produce a data pump export file that is compatible with the 10g version of data pump import and includes procedures ending in XXX.
Alternatively, you can use the EXCLUDE parameter instead of include to if you have just a few objects to exclude.
If you use INCLUDE, only those items you specify will be exported.
There are a lot of options for filtering objects using data pump export/import via the INCLUDE/EXCLUDE parameters.

Related

Oracle DB Export does not preserve order or dependencies

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.

Export & Import in SQL DEVELOPER without datapump

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.

Exporting PL/SQL Packages Through TTS

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

How to export database from Oracle Application Express

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.

exporting oracle database (creating a .sql file of data )

I have an Oracle database on one PC. I have to migrate it to my other PC. Both use separate oracle installations. Now how can I export it from my one PC and then import it into other PC?
What are the commands for exporting and then importing it?
I want structure as well as data to be exported and then imported. I am using Oracle db.
You can export the data from your source database and import it into your new one.
A good link demonstrating the usage of these commands can be found here
It boils down to something like the following for exporting a full database:
%> exp USERID=<username>/<password> FULL=Y FILE=dbExport.dmp
%> imp USERID=<username>/<password> FILE=dbExport.dmp FULL=Y
There are a multitude of options for both commands to tailor it to your needs. For example, you can restrict the import command to only import certain tables via the TABLES parameter or you can move database object between users with TOUSER, FROMUSER parameters. There are also options on whether to export or import constraints, indexes, etc. You can find all the valid parameters for both commands by executing either:
%> exp help=Y
%> imp help=Y
You don't say which version of the database you are using. This is important information, because new features get added to Oracle with every release. For instance, in 10g Oracle introduced a new utility, DataPump, which replaces the older IMP and EXP (those utilities are still included in the install, they are just deprecated).
One of the neat things about DataPump is that we can execute from inside the database as well as from an OS command line. I recently posted an example of using DataPump from PL/SQL in this SO thread. `Oracle provide comprehensive documentation.
edit
Neither old fashioned IMP/EXP nor DataPump generate an SQL file (*). If that is really what you want (as opposed to just porting the schema and data somehow) then things get a bit trickier. Oracle has a package DBMS_METADATA which we can use to generate DDL scripts, but that won't deal with the data. To generate actual INSERT statements, your best bet is to use an IDE; Quest's TOAD will do this as will Oracle's (free) SQL Developer tool. Both IDEs will also generate DDL scripts for us.
(*) A Datapump import can derive the DDL statements from a prior Datapump export file, using the SQLFILE= parameter. But that is just the structure not the data.

Resources