Oracle: exporting only schema - oracle

I have an Oracle 10g database, and now I need to export, if possible, only the schema.
(Only table structures with index etc... without data!)
Is this possible with exp/imp or do I need expdp/impdp?
Greets

It is possible with exp, using parameter ROWS=N.
10g documentation is here.
Data pump is preferred these days though; the equivalent parameter is CONTENT=METADATA_ONLY.

Check scheme2ddl tool from oracle-ddl2svn bundle.
scheme2ddl is command line utility for export oracle schema in set of ddl scripts. provide lot of configurations via basic command line options or advanced XML configuration

If you are only interested in the table definitions with their constraints and indexes you can also do an export using Oracle's SQL Developer.
In SQL Developer 4.0, this is under Tools | Database Export... On the first page of the wizard, ensure that "Export DDL" is checked and "Export Data" is not. Note that this allows you to export all types of database objects; you can limit it to just tables and indices if you like on the "Object Types" page.

Related

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.

Import and Export Data plus schema using SQLDeveloper 3.0.04

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)

Exporting rows in Oracle

I need to export a number of rows (from different tables- ie, all the related information about an entity - for eg: a Customer) to another DB in Oracle. How do we do this? I am using a windows OS. Please help.
Thank you all,
Pradeep
While connected to database 1 you could also create a database link to database 2 (if you have rights to do so - there were no assumptions on this) and insert to your tables by selecting from your link e.g. like this
CREATE DATABASE LINK foo
CONNECT TO <user> IDENTIFIED BY <password>
USING '<connect string>';
select * from table1#foo;
Further information:
A database link is a connection
between two physical database servers
that allows a client to access them as
one logical database.
See Dabtabase links at Oracle Database Administrator's Guide.
You can use Oracle's export and import utilities
You might want to give Data Pump a try as well (depending on your version). Many options for moving around data from Oracle -> Oracle dbs
Another option is the SQL*Plus copy command. It's not very fast, but it can be very convenient in certain contexts.
Oracle's SQL developer tool has the option to export data as insert statements.

clone oracle database without data

I want to clone my existing oracle database structure without data including packages, users, tablespaces etc. I read some methods but they all copied data as well. Is there anyway out in order to do this?
Thanks in advance.
Use SQL Developer > Tools > Database Export..
On "Specify Data" do not include any tables.
Omit packages etc here,
Fine tune your selection here,
My trial export has not finished yet but I expect this will work.
Use Oracle exp.exe utility for export. E.g.
EXP.EXE login/password#TNSNAME file=entire_db.dmp owner=(scott, my_user, user2) rows=n grants=y triggers=y
Only rows=n option in command above make sense for your task.
You can import to target database with imp.exe utility.
Look for detailed option list and definition by running this utilities with help=y option.
BUT tablespaces and users on target databases must be created manually before running import.
There are no standard tablespace cloning tools (including SQL Developer), but some queries exists for generating such cloning scripts.
Examples can be found here and here.
P.S. This question better fits to ServerFault than to StackOverflow ...
You can do it in toad but its not free tool. (Database Tab->Export->Export DDL)
Try Oracle Export command with ROWS=N
exp SCOTT/TIGER ROWS=N TRIGGERS=N
Use SQL Developer, Tools > Database Export.
You will need to specify at least one table in the 'data' option because you cannot choose to NOT export any data. Pick a table that has a small number of rows or create a dummy table without any rows beforehand as a workaround.

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