SQL & PL/SQL :: Export GB Data In Flat File
Nov 25, 2011
Database: Oracle 8i
My query is:
I have large data in the one table(approx. 2GB and above). I want to load the data in one flat file.
When i use spool - it is loading half data and remaining it is corrupting. In UNIX, i kept .sql file and with that i am exporting in .dat file. How to export the large data into flat file(.dat). is there any way to load command which wil be used in UNIX.
View 8 Replies
Aug 14, 2012
I am migrating data from a Solid Database to Oracle, I am using Flat Files to do that.
1.- I download the data to flat files from Solid
2.- I move the files to Oracle server
3.- I upload the data to Oracle
Now, I have done the 90% of the data base, but I have found some tables that has description columns and in this description the users writes enters, so when I try to upload the data to Oracle SQL loader cannot recognize this characters.
Example:
'25','0.','5.','0.','0.','0.','0.','0.','0.','0.','0.','0.','0.','',''
'26','0.','2.','0.','0.','0.','0.','3.','0.','0.','0.','0.','0.','',''
'27','0.','1.','0.','0.','0.','0.','0.','0.','0.','0.','0.','0.','',''
'28','0.','1.','0.','0.','0.','0.','0.','0.','0.','0.','0.','0.','',''
'29','0.','38.','0.','0.','0.','0.','0.','0.','0.','0.','0.','0.','',''
'30','0.','13.','0.','0.','0.','0.','0.','6.','0.','6.','0.','0.','|SE RECHAZA B20CS50SNW ^M
^M
SE RECHAZAN CINCO PZAS ^M
DOS MOD. HSC15I41EH,DOS MOD. HSK15I41EH |Agregó: 06/06/2009 12:22:50
|','DEV. A PROV.'
'31','0.','50.','0.','0.','0.','0.','0.','0.','0.','0.','0.','0.','',''
'32','0.','9.','0.','0.','0.','0.','0.','0.','0.','0.','0.','0.','',''
'33','0.','2.','0.','0.','0.','0.','0.','0.','0.','0.','0.','0.','',''
How can I solve this ?
View 3 Replies
View Related
May 2, 2012
I am trying to build a data warehouse for Consumer Price Index and so I have downloaded data from the Bureau of Statistics.It is in excel format and since I am working with Oracle Warehouse Builder I have converted it to .csv file so that I can use it as a data source.
Question1: Is it practical to use single .csv file as a source of data for a data warehouse?
Question2: I have 3 dimensions tables and a fact table.The dimensions are one for the Region(as the date is organized in region,states etc),two is the consumer goods and services (as the data is organized in groups of goods and services, services/goods types) and finally time(year and month),
Now how am I going to do the mapping here?Is it possible to do a one to one mapping here as all data required by the dimensions is located in the .csv file.
View 4 Replies
View Related
Nov 20, 2012
Just wanted to export a clob field to .txt file, the maximum length of the clob field exceeds the limit 32767. So only partial data is exported to flat file. is there any way to export the entire data available in clob field irrespective of the size or lenght.
Length of the clob is 301829
l_file := UTL_FILE.fopen('LOCALDIR', '3.txt', 'w', 32767);
LOOP
DBMS_LOB.read (v_text_exp, l_amount, l_pos, l_buffer);
UTL_FILE.put(l_file, l_buffer);
l_pos := l_pos + l_amount;
END LOOP;
View 14 Replies
View Related
Jul 3, 2012
working on loading the data from flat file into table and below given is the validation condition given.I checked the UTL_FILE build in package but not able to figure out, how to identify the column header in flat file.
1. Skip the header, if any. The header is the first record, and starts with '000'
2. Skip the trailer, if any. The Trailer is the last record, and starts with '999'
3. Log an error, but continue if a line exceeds 512 characters
4. Log an error, but continue if a line is blank
View 5 Replies
View Related
Sep 28, 2011
Issue: Unable to load a flat file through Oracle Loader
Below is the script that is being used:
drop table dl_fact_fac_data_xtern;
create table dl_fact_fac_data_xtern
(
[Code].....
After rnning this script, it prompts that table has been created; but once I fire the select command on the table I receive the following errors :
ORA-29913: error in executing ODCIEXTTABLEOPEN callout
ORA-29400: data cartridge error
KUP-00554: error encountered while parsing access parameters
KUP-01005: syntax error: found "data": expecting one of: "double-quoted-string, identifier, single-quoted-string"
KUP-01007: at line 10 column 11
ORA-06512: at "SYS.ORACLE_LOADER", line 19
29913. 00000 - "error in executing %s callout"
*Cause: The execution of the specified callout caused an error.
*Action: Examine the error messages take appropriate action.
View 2 Replies
View Related
Jan 11, 2013
In one of my projects I am exporting a couple of views into a flat file. The export utility is generic and uses dynamic sql to generate a flat file. We have a test environment and a production environment. On both the code is the same. We noticed that the output is different between the environments although it is supposed to be the same. If I export a view in the production I will get a record like this:
0020110107O0000000001|OTHER|07.01.11 08:06:00,296000|07.01.11 08:04:41,008000||0|0|EUR||NOT_FROZEN|MVOIP||IS_NORMAL_VERSION|MODIFIED|6863475590797607166|8648564326455689103|8011808169304472215|||CCP||||10000580||||DEKA|PS
In the test environment it will be like this:
0020110107O0000000001|OTHER|07-JAN-11 08.06.00.296000 AM|07-JAN-11 08.04.41.008000 AM||0|0|EUR||NOT_FROZEN|MVOIP||IS_NORMAL_VERSION|MODIFIED|6863475590797607166|8648564326455689103|8011808169304472215|||CCP||||10000580||||DEKA|PS
The code I am running is not changing any settings explicitly. It looks like this and it will be run as EXECUTE IMMEDIATE:
DECLARE
v_sql VARCHAR2 (32000);
v_sql_count NUMBER := 0;
v_error VARCHAR2 (4000);
v_new_file UTL_FILE.file_type;
BEGIN
[code]........
I also tried to do the following on production in order to get it equal to the test environment:
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET NLS_LANGUAGE = AMERICAN '
|| 'NLS_NUMERIC_CHARACTERS = ''.,'''
|| 'NLS_TIMESTAMP_FORMAT = ''DD-MON-RR HH.MI.SSXFF AM''';
END;
This would change the formatting for the timestamp columns for almost all files. Almost. Two of those files remain unchanged and still show the decimal separator from the old setting:
0020110107O0000000001|OTHER|07-JAN-11 08.06.00,296000 AM|07-JAN-11 08.04.41,008000 AM||0|0|EUR||NOT_FROZEN|MVOIP||IS_NORMAL_VERSION|MODIFIED|6863475590797607166|8648564326455689103|8011808169304472215|||CCP||||10000580||||DEKA|PSAny
[URL]......
[URL]......
[URL].....
[URL]......
View 2 Replies
View Related
Jul 5, 2013
I have a text file called ReturnedFile.txt. This is a comma separated text file that contains records for two fields.... Envelope and Date Returned.
At the same time, I have a table in Oracle called Manifest. This table contains the following fields:
Envelope
DateSentOut
DateReturned
I need to write something that imports the ReturnedFile.txt into a temporary Oracle table named UploadTemp, and then compares the data in the Envelope field from UploadTemp with the Envelope field in Manifest. If it's a match, then the DateReturned field in Manifest needs updated with the DateReturned field in UploadTemp.
I've done this with SQL Server no problem, but I've been trying for two days to make this work with Oracle and I can't figure it out. I've been trying to use SQL*Loader, but I can't even get it to run properly on my machine.
I did create a Control file, saved as RetFile.ctl. Below is the contents of the CTL file:
LOAD DATA
INFILE 'C:OracleTestReturnedFile.txt'
APPEND
INTO TABLE UploadTemp
FIELDS TERMINATED BY "'"
(
ENVELOPE,
DATERETURNED
)
If I could get SQL*Loader running, below is the code I came up with to import the text file and then to do the compare to the Manifest table and update as appropriate:
sqlldr UserJoe/Password123 CONTROL=C:OracleTestRetFile.ctl LOG=RetFile.log BAD=RetFile.bad
update Manifest m set m.DateReturned =
(select t.DateReturned
from UploadTemp t
where m.Envelope = t.Envelope
*)
That's all I got. As I said, I can't find a way to test it and I have no idea if it's even close.
View 2 Replies
View Related
Jan 4, 2012
I am trying to import data from below content.
Flat File
PARENTCHILDALIAS
PLAN_PCOTDefaultPlanning Customer
1001_BTPCOTDefaultGeneral Planning Customer
2000_BTPCOTDefaultNational Account Planning Customer
3000_BTPCOTDefaultDistributor Planning Customer
3010_BTPCOTDefaultEducation Planning Customer
3020_BTPCOTDefaultResearch Planning Customer
OPT1_PCOTDefaultOption 1 Planning customer
OPT2_PCOTDefaultOption 2 Planning customer
OPT3_PCOTDefaultOption 3 Planning customer
The problem here is , When you try to import to a table which has same columns . I skipped the first line when loading . The issue here is the second field is getting split in to the two columns . for e.g. :- Default goes to Child and Remaining goes to the Alias.
infarct there is a tab at the end of the each line. How to set the Sql loader settings correctly so that I can populated the end column in CHILD column only.!!!!
OPTIONS ( SKIP=1)
LOAD DATA
INFILE 'FlatFile.txt'
BADFILE ''FlatFile.bad'
DISCARDFILE ''FlatFile.dsc'
INTO TABLE "table"
FIELDS TERMINATED BY X'9'
OPTIONALLY ENCLOSED BY "''" TRAILING NULLCOLS
(PARENT,
CHILD,
ALIAS CONSTANT '')
View 5 Replies
View Related
Oct 23, 2012
I am trying to spool data from tables into flat files. I am using the following scripts to accomplish it
1. A cmd file (windows) that makes a call to a sql file
2. The SQL file which generates another query file at the run time, depending upon the table name passed to it
3. The run time query file , that executes the final query and spools the data into a txt file | delimited
For e.g. :
Actual command passed C:Spool_utilityspool_utility TABLE_NAME
E.g. of the spool utility file :
@echo off
SET dbuser=XX@YY
SET dbpw=xxxx
echo %date% - %time% - Start > %1%log.txt
echo START
sqlplus -s %dbuser%/%dbpw% @spool_utility.sql %1>%1.txt
echo %date% - %time% - Done >> %1%log.txt
echo DONE
E.g. of the spool_utility.sql
set echo off
SET newpage 0
SET feedback off
SET linesize 32767
set pagesize 0
[code]........
The above file generates a table_name.sql file with the actual table name at run time and gets executed and the output is written to the table_name.txt file.
This works perfectly fine. But the issue is when someone passes some wrong table name or if there is a actual run time error while executing the query , the error with details itself itself gets written to the end spool file.
For e.g. : if i do this just to generate an error and execute it from command line, the query generates an error and writes the error to the spool file , but at the command prompt where I executed the command I do not see any error and the process seems to have run perfectly well
set xxx on xxx off as above
spool &1.sql;
Prompt Select * from &1 where rownum><10---this will cause the issue
spool off
set termout ON
@ &1
EXIT
Eg of spool file generated :
from table_name WHERE rownum><=10 *
ERROR at line 62:
ORA-00936: missing expression
My question is, is there any way i can capture this runtime error and return this error to my calling sql script spool_utility.sql and then propagate it to the calling command file and do some tasks for eg removing the spool file and writing the actual error to a log file . Basically any way to know at my OS calling level that the entire spooling operation was unsuccessful.
View 8 Replies
View Related
Apr 5, 2013
I have countries, sites, states tables (total 3) in database (i have user id and password to connect to this database).
every week i need to extract data from these tables into excel files and i need to save those in shared drive for team use.
Currently i am connecting to database every time running sql query and manually exporting that latest data to excel and saving that as excel files in (G: eamcommon) folder with specific name.
output format should be :
excel (.xls)
file names should - countries.xls,sites.xls,states.xls
server name : ap21
output location : G: eamcommon ( G is shared drive).
i heard that we could create batch file to do this task and also we could use oracle procedure to do this task. but not sure which one is the best option.
View 3 Replies
View Related
Apr 22, 2013
I am struggling with a simple data load using sqlldr
Ref: I am running Oracle 11.2 on Linux 5.7.
===========================
Here is my table:
SQL> desc ntwkrep.CARD
Name Null? Type
[code]...
Looking at the actual data and counting the characters for the "REALIZES" column data, I see that it is roughly slightly over 1000 characters.
So, attempting various ideas to fix the problem, I tried changing nls_length_semantics to "char" and recreating the table, but this still didn't work and still got the same data load errors on the same rows.
Then, I changed nls_length_semantics back to byte and recreated the table again.This time, I altered the table manually as:
SQL> ALTER TABLE ntwkrep.CARD MODIFY (REALIZES VARCHAR2(4000 char));
Table altered.
SQL> desc ntwkrep.card
Name Null? Type
----------------------------------------------------------------- -------- --------------------------------------------
CIM_DESCRIPTION VARCHAR2(255)
CIM_NAME NOT NULL VARCHAR2(255)
COMPOSEDOF VARCHAR2(4000)
[code]...
Here is a copy of the first row of data which fails to load every time no matter how I change the "REALIZES" column in the table.
other(1)`CARD-mes-fhnb-bldg-137/1` `other(1)`CARD-mes-fhnb-bldg-137/1 [other(1)]`HwVersion:C0|SwVersion:12.2(40)SE|Serial#:FOC1302U2S6|` Chassis::CHASSIS-mes-fhnb-bldg-137, Switch::mes-fhnb-bldg-137 ` Port::PORT-mes-fhnb-bldg-137/1.23, Port::PORT-mes-fhnb-bldg-137/1.21, Port::PORT-mes-fhnb-bldg-137/1.5, Port::PORT-mes-fhnb-bldg-137/1.7, Port::PORT-mes-fhnb-bldg-137/1.14, Port::PORT-mes-fhnb-bldg-
[code]...
View 5 Replies
View Related
Aug 22, 2013
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit ProductionPL/SQL Release 11.2.0.3.0 - ProductionCORE 11.2.0.3.0 ProductionTNS for Solaris: Version 11.2.0.3.0 - ProductionNLSRTL Version 11.2.0.3.0 - Production I'm trying to load a table, small in size (110 rows, 6 columns). One of the columns, called NOTES is erroring when I run the load. It is saying that the column size exceeds max limit. As you can see here, the table column is set to 4000 Bytes)
CREATE TABLE NRIS.NRN_REPORT_NOTES
(
NOTES_CN VARCHAR2(40 BYTE) DEFAULT sys_guid() NOT NULL,
REPORT_GROUP VARCHAR2(100 BYTE) NOT NULL,
AREACODE VARCHAR2(50 BYTE) NOT NULL,
ROUND NUMBER(3) NOT NULL,
NOTES VARCHAR2(4000 BYTE),
[code]....
View 2 Replies
View Related