Exporting rows in Oracle - 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.

Related

Reading and Updating data of Oracle DB without License

I've got to update the data of an Oracle DB but I'm not the owner and ain't got any Oracle License.
The goal is to explain to my interlocutor how to create a dump from his Oracle DB, to find out how to restore this dump in a DB (a free version of Oracle or something else), update some data in some tables, and then make another dump to send it back to my interlocutor.
So the differents questions I have are:
1- Is it possible to create a dump (maybe in SQL format) without any specifics dependencies to Oracle ?
2- Is there a way to restore this dump in a free lightweight Oracle, or another kind of DB like Postgresql ?
3- Does Oracle, is able to handle any kind of dump et restore it in an Oracle DB or is there any constraints to respect ?
I am very new to Oracle and ain't got, on my personal computer, any possibility to try out the dump/restore by myself; that's why, any help will be appreciated !
1- Is it possible to create a dump (maybe in SQL format) without any specifics dependencies to Oracle ?
Oracle offers Data Pump utilities (export and import) for such purposes. You'd export table (or schema) - result is a ".dmp" file, readable by import utility. You'd then move that file to your own server (see #2 for the rest)
2- Is there a way to restore this dump in a free lightweight Oracle, or another kind of DB like Postgresql ?
On your own server (which could be a laptop; no problem), you'd install a free Oracle Express Edition (XE) database. Currently, the last version is 21c, but some others should still be available in Oracle Technology Network's Download section.
3- Does Oracle, is able to handle any kind of dump et restore it in an Oracle DB or is there any constraints to respect ?
XE database has its limits - from your point of view, the most important is that it can handle up to 12GB of user data. Therefore, if the .dmp file doesn't contain more data than that, you should be able to import it.
Another constraint is the compatibility. Not all exports can be imported into all databases. There's a matrix which shows which versions match; it is available on My Oracle Support site (but you have to have access to it, which you - as you said - don't. Though, generally speaking, "close" Oracle database versions can interchange .dmp files. It would be best if these two database versions match, of course.

How to generate DDL for all Users and privileges in Oracle

I'm trying to migrate a database instance from RDS Oracle to On-premise Oracle. I'm still pretty new to database scripting. I found this script that does the work for me for a single user that I pass via SQLDeveloper. However I have 200+ users on my RDS Oracle instance.
https://oracle-base.com/dba/script?category=script_creation&file=user_ddl.sql
I have tried removing the variable here for the user name and the rownum but this generates a lot of duplicate entries. Can someone guide me what is the best way to achieve the result set of the above script for all users.
Much appreciated!
I'd suggest another approach (if you can use it): data pump.
You'd perform export
using user SYSTEM or SYS as they own the database and can export ...
... FULL database
content would be METADATA_ONLY (so that you'd skip data; I understood you don't need that)
That would be something like
expdp system/pwd file=your_db.dmp full=y content=metadata_only
Import goes the same way, in the target database.

SQL Developer - default open specific tables after connection

does anyone know how to set up default "seeing" of specific tables after connecting to the DB? E.g. we have tables A,B,C,D and after connecting to the DB I want to see TAB with table A and TAB with table B.
Thank you
Sorry, this isn't possible today in Oracle SQL Developer.
You could submit an enhancement request to My Oracle Support or put in an idea to sqldeveloper.oracle.com

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)

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.

Resources