Oracle Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesOracle Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 25th, 2005, 05:24 PM
alfatek alfatek is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2002
Posts: 6 alfatek User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 33 m 59 sec
Reputation Power: 0
dump data to a nice .sql file with full insert sql

Hi,

How can i export all the data in some tables i have to a nice .sql with full insert valid sql code??

i know about ext but it exports into some kind of binary format...

Reply With Quote
  #2  
Old May 26th, 2005, 11:31 AM
jim mcnamara jim mcnamara is offline
......@.........
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jun 2004
Posts: 1,308 jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level)jim mcnamara User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 3 Days 5 h 2 m 57 sec
Reputation Power: 48
That' usually not the standard solution to this problem- the main reason is that if you have a many records the insert file size becomes enormous. Anyway most of the file is taken up with sql statements, not data.

try sqlldr, that's what it is meant for.

You need to create two files - a sql extract script, and a ctl file, then run sqlldr
example:

Code:
/* sql script to extract a table into a | delimited format */
set pagesize 0
set linesize 2000
set heading off
set trimspool off
set echo off
set tab off
set colsep |   
spool textract_mytable.txt
SELECT 
    CUST_CODE,
    PREM_CODE,
    CHARGE_DATE,
    AR_TRANS,
    PRIORITY,
    SCAT_CODE,
    SRAT_CODE,
    DUE_DATE,
    REVENUE_IND
FROM 
    MYTABLE;
spool off


This is the control file textract_mytable.ctl:
Code:
OPTIONS (DIRECT=false)
LOAD DATA
INFILE 'textract_mytable.txt'
APPEND
INTO TABLE uimsmgr.uabopen
FIELDS TERMINATED BY '|'
TRAILING NULLCOLS
(
    CUST_CODE,
    PREM_CODE,
    CHARGE_DATE,
    AR_TRANS,
    PRIORITY,
    SCAT_CODE,
    SRAT_CODE,
    DUE_DATE,
    REVENUE_IND
)


create the ctl file, run the sql script, then :
Code:
sqlldr USER/PASSWORD control=textract_mytable.ctl errors=200 log=textract_mytable.log

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesOracle Development > dump data to a nice .sql file with full insert sql


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway