• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Export of database in Oracle

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
I am using Oracle 8.1.6
I need to send only the seed data to my client, which is in my deployment server.
Is there any way wherein i can just extract the data(only rows) from the DB but not the entire DB.
By use of "exp"(Generates .dmp file) I get the entire DB dump
I need something similar to .sql file with only insert statements
Any help would be greatful
Thanks
Mrutyunjay
 
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mrutyunjay
exp utility also allows to export a particular table in a schema instead of whole database, or you can also export particular rows with help of parameter file as, for example:
--contents of par file customer.par
userid=scott/tiger
file=customer.dmp
log=customer.log
Tables=(scott.customer, scott.customer_address)
QUERRT="where cust_id IN('A01, B02')"
If the name of the par file is customer.par, execute it as
exp parfile=customer.par
This is just an example, tailor it according to your need.
If you want to write a sql file with insert statements, you have to run a querry like this, first
spool c:/file_name.sql --it will create a sql file
select 'insert into test values(' || empno ||')' from scott.emp
--this is just an example , you should modify it according to your specific needs
HIH,
 
Mrutyunjay Hanchinal
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Thanks for the reply
I think the second approach suits me
I want to bother U one more time...
Is there a any way where in I can put only the output to file and not the commands that I have executed.
I am getting the contents of the file as this
=================================================
SQL> select 'insert into test values(' || empno ||')' from scott.emp;
'INSERTINTOTESTVALUES('||EMPNO||')'
-----------------------------------------------------------------
insert into test values(7369)
insert into test values(7499)
insert into test values(7521)
insert into test values(7566)
insert into test values(7654)
insert into test values(7698)
insert into test values(7782)
insert into test values(7788)
insert into test values(7839)
insert into test values(7844)
insert into test values(7876)
'INSERTINTOTESTVALUES('||EMPNO||')'
-----------------------------------------------------------------
insert into test values(7900)
insert into test values(7902)
insert into test values(7934)
14 rows selected.
SQL> spool off
=================================================
Thanks
Mrutyunjay
 
Muhammad Farooq
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mrutyunjay
I think thats the only way, you have to do little editing and it is better than writting the querry for all records, I wish I could be more helpful.
 
Muhammad Farooq
Ranch Hand
Posts: 356
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Mrutyunjay
You can further minimize editing with these command before using spool
SQL>Set echo off pagesize 0 head off feed off veri off
Then...
SQL>spool c:\file_name.sql
Then...
QUERY
Then...
SQL>Spool off
see the result of the querry in c:\file_name.sql
HIH
 
Ranch Hand
Posts: 145
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I thnk that you can start sqlplus with the -silent option, so that some of the commands that we type in will not be displayed.
Mathew
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic