Populating a load-status table from SQL*Loader
Hello,
I am using SQL*LDR to load a table and once I'm done with this load I am supposed to populate a status table which will capture the 'SYSDATE', and the total number of rows I loaded in the other table.
Can anybody help me?
Thanks
BTW, the load-status table would take the error-record-count as well as the load-count?
Sorry missed that earlier!
Similar Messages
-
Create oracle table from sql server
Dear Gurus,
I need to create some tables from sql server 2008 to a oracle 11g database. Some tables contain vbinary datatype. Now my queries are
1. How can I do that?
2. If DB link is a solution then would you please provide me a step by step process to do so?
3. Is there any issue with datatype?
SQL Server db is on windows 2008 R2
Oracle is in RHEL 5.5
Will appreciate ur help.well suppose i generate flat files from sql server and load in oracle by sqlloader then will there be any issue with vbinary datatype? what should be the equivalent data type in oracle table?
-
How to delete/drop all the tables from SQL Server Database without using Enterprise Manager?
I tried using DROP Tables, Truncate Database, Delete and many more but it is not working. I want to delete all tables using Query Analyzer, i.e. through SQL Query.
Please help me out in this concern.
Nishith ShahInformative thread indeed. Wish I saw it early enough. Managed to come up with the code below before I saw this thread.
declare @TTName Table
(TableSchemaTableName
varchar
(500),
[status] int
default 0);
with AvailableTables
(TableSchemaTableName)
as
(select
QUOTENAME(TABLE_SCHEMA)
+
+
QUOTENAME(TABLE_NAME)
from
INFORMATION_SCHEMA.TABLES)
insert into @TTName
(TableSchemaTableName)
select *
from AvailableTables
declare @TableSchemaTableName varchar
(500)
declare @sqlstatement nvarchar
(1000)
while 1=1
begin
set @sqlstatement
=
'DROP TABLE '
+ @TableSchemaTableName
exec
sp_executeSQL
@sqlstatement
print
'Dropped Table : '
+ @TableSchemaTableName
update @TTName
set [status]
= 1
where TableSchemaTableName
= @TableSchemaTableName
if
(select
count([Status])
from @TTName
where [Status]
= 0)
= 0
break
end -
Problem in Import of Tables from SQL Server.
Hi Forum,
I m new to OWB.
I m facing a prob regarding the import of tables.
I m importing tables from SQL server through ODBC DB Link..
It imports the tables fine, but without key constraints..
Can u tell me, Why? and How can I import that info as well?Hi David,
The things I said are not a fix for this problem.
If your RCU installation worked, then you do not have to worry about modifying the createfr.sql.
Edit:
I've just tracked the problem. It appears that when using the query builder, BI forgets to add the " sign.
For example:
This query will give the hyperion error.
select "table"."field"
from "database.user"."table"
To correct it write it like this:
select "table"."field"
from "database"."user"."table"
Edited by: EBA on Nov 14, 2011 10:21 AM -
Migration of table from sql server to oracle
Hi,
I had to export few tables from SQL Server to Oracle. After the migration, I am checking to see all the tables in Oracle that have been migrated from Sql Server. I am executing select * from tab; and am seeing all the the tables (including those have been exported) from the output list of tables. However, when I am doing a select * from x; where x is one of the few tables that have been migrated, it says table or view does not exist. This is the problem with all other migrated tables. Any help is appreciated in advance. Thanks.
[email protected]Try select * from "x"
-
Migrating a table from SQL server 2005 to oracle 9i
Hi
I need to migrate a table from SQL server to oracle, both of which are on different machines, I tried using SQL server DTS export functionality selected the Oracle driver, created a DSN, but it gave error message box as shown below
Error Source: Microsoft OLE DB Provider for ODBC Drivers
"ORA 12560 :TNS protocol adapter error"
Context:Error During initialization of the provider
While i was successfully able to migrate the table from SQL SERVER to MS-ACCESS and from MS ACCESS to Oracle
thanks
abhishekHi
thanks warren, i just figured out that the DSN i had created while migrating data from Access to oracle was User DSN, i just created a system DSN of the similar kind and was successfully able to export the data from SQL server to oracle, the only problem being the column names in SQL server are longer than the limit of 30 characters we have in ORACLE..
Regards
Abhishek -
Insert data file name into table from sql loader
Hi All,
I have a requirement to insert the data file name dynamically into table using sql loader.
Example:
sqlldr userid=username/passwword@host_string control=test_ctl.ctl data=test_data.dat
test_ctl.ctl
LOAD DATA
FILED TERMINATED BY ','
INTO TABLE test
(empid number,
ename varchar2(20),
file_name varchar2(20) ---------- This should be the data file name which can be dynamic (coming from parameter)
test_data.dat
1,test
2,hello
3,world
4,end
Please help..
Thanks in advance.
Regards
Anujyou'll probably have to write your control file on the fly, using a .bat or .sh file
rem ===== file : test.bat ========
rem
rem ============== in pseudo speak =============
rem
rem
echo LOAD DATA > test.ctl
echo FILED TERMINATED BY ',' >> test.ctl
echo INTO TABLE test >> test.ctl
echo (empid number, >> test.ctl
echo ename varchar2(20), >> test.ctl
echo file_name constant %1% >> test.ctl
echo ) >> test.ctl
rem
rem
rem
sqlldr userid=username/passwword@host_string control=test.ctl data=test_data.dat
rem =============== end of file test.bat =======================
http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/ldr_field_list.htm#i1008664 -
Transfer tables from sql server 2008 to oracle 11g
Hi ,
I have to transfer 2-3 tables (5 Lacs records each) from sql server 2008 to oracle Ent. 11g (platform Linux)
i have to upload data with some conditions.
not allowed to install oracle client on sql server for link server. i can get data in csv file
which will be the best possible way
1) using Db link on oracle server
2) get data into csv file and load using SQL loader
3) get data into csv and load using external table
4) using tool - sql developer
Thanx,user10188639 wrote:
Hi ,
I have to transfer 2-3 tables (5 Lacs records each) from sql server 2008 to oracle Ent. 11g (platform Linux)
i have to upload data with some conditions.
not allowed to install oracle client on sql server for link server. i can get data in csv file
which will be the best possible way
1) using Db link on oracle server
2) get data into csv file and load using SQL loader
3) get data into csv and load using external table
4) using tool - sql developer
Thanx,
>which will be the best possible way
which metric measures best? is higher or lower value better?
How will you, I or anyone recognize which option is best solution? -
Required to take periodic backup status report from SQL server
Dear All,
I need to take periodic database backup status of all sql server instance in different domain. But, i am doing it by logging into all sql server manually.
We can do it through option called ' Managed server' in sql server by connecting required server.
But, I want to know the script and any other option in sql server to connect all sql instance in different domain group to take backup status report in single run.
I need your help here and share the experience if you implemented ever in your environment.see
http://www.mssqltips.com/sqlservertip/1601/script-to-retrieve-sql-server-database-backup-history-and-no-backups/
You can use above scripts to capture the information
For automated execution wrap it in a procedure with INSERT statement to dump the results onto a table and call the procedure from sql agent job to execute it based on a predefined schedule.
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs -
Insert and update tables from SQL server to oracle database tables
Hi,
I am having problem while update data from sql server to oracle database tables.
I am doing one way insert +updates that is from SQL Server tables ==> Oracle database tables
I am using tools Sql server Integration service. I can insert data from sql server to oracle but update can't. Please help me how can I update + insert from sql server to oracle database tables easily.
Thanks in advance.Hi,
What about using Oracle SQL Developer for migration
http://www.oracle.com/technetwork/database/migration/sqlserver-095136.html
HTH -
Migrating Functions that return TABLE from SQL Server to Oracle
I have some functions in SQL Server that return a TABLE datatype. When these functions are moved to Oracle 9i using Migration Workbench, they give compilation errors. In the migrated function it says that the DDL stmt is passed to the ddl file, but the table is not created. I checked the ddl stmt for temporary tables and it is wrong. Its a create table stmt with no size for varchars and we can't even edit these stmts in the workbench.
Also the migrated function has the table name for return type, which doesn't works in Oracle. Oracle needs a datatype to be returned from Oracle.
How do we return a table from a function?Yes.
If you do not enclose the object names (table/view/index etc) in double-quotes, they are stored in uppercase format in the data dictionary.
If you enclose them in quotes, they are stored in the same case ans you entered. As such, while accessing such objects, you need to tell Oracle not to convert the names to uppercase, hence the requirement to supply the names in quotes. -
How to transfer database tables from sql server 2000 to oracle 10g
Hi,
I have a database and tables in sql server 2000. I have to transfer those data to Oracle 10g. I have installed Oracle warehouse Builder ETL Tool. Using this how can i transfer data. Any help is vary helpful for me.
Thanks in advance.you have to do it using ODBC HS.
1. Configure ODBC connection through gateway.
2. Create a initxxx.ora file with HS config.
restart gateway listener services
3. on target o/s add entries to your tnsnames.ora
4. On your target o/s create a db link
restart listener on target
cheeck this out.Non-Oracle connection through HS issue
Edited by: Darthvader-647181 on Jan 29, 2009 2:02 AM -
Importing to a Oracle Table from SQL Loader Fails
Hi ,
When I try to upload one xml file from my server to my table in oracle server using sql loader it fails at times.Some times it works perfectly.
This is a daily process which automatically dumps data to my oracle.
Please find the error log :
SQL*Loader: Release 10.2.0.4.0 - Production on Thu Dec 5 04:07:32 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Control File: xmlFeedDelta.ctl
Data File: xmlFileNames_Delta.txt
Bad File: xmlFileNames_Delta.bad
Discard File: none specified
(Allow all discards)
Number to load: ALL
Number to skip: 0
Errors allowed: 1000
Bind array: 50000 rows, maximum of 256000 bytes
Continuation: none specified
Path used: Conventional
Table XMLFEEDDELTA, loaded from every logical record.
Insert option in effect for this table: APPEND
Column Name Position Len Term Encl Datatype
FILENAME FIRST 4000 , CHARACTER
FILECONTENT DERIVED * EOF CHARACTER
Dynamic LOBFILE. Filename in field FILENAME
value used for ROWS parameter changed from 50000 to 63
SQL*Loader-643: error executing INSERT statement for table XMLFEEDDELTA
ORA-03113: end-of-file on communication channel
SQL*Loader-2026: the load was aborted because SQL Loader cannot continue.
Table XMLFEEDDELTA:
0 Rows successfully loaded.
0 Rows not loaded due to data errors.
0 Rows not loaded because all WHEN clauses were failed.
0 Rows not loaded because all fields were null.
Space allocated for bind array: 252378 bytes(63 rows)
Read buffer bytes: 1048576
Total logical records skipped: 0
Total logical records read: 1
Total logical records rejected: 0
Total logical records discarded: 0
Run began on Thu Dec 05 04:07:32 2013
Run ended on Thu Dec 05 04:08:42 2013
Elapsed time was: 00:01:10.05
CPU time was: 00:00:00.28
My Control File Looks like this :
LOAD DATA
INFILE xmlFileNames_Delta.txt
INTO TABLE xmlFeedDelta APPEND
fields terminated by ','
filename CHAR(4000),
filecontent LOBFILE(filename) terminated by eof
My Database version :
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for Linux: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
I am not sure why this is happening at times . Any help would be appreciated.Hi,
have you tried with the FILLER command like
LOAD DATA
INFILE xmlFileNames_Delta.txt
INTO TABLE xmlFeedDelta APPEND
fields terminated by ','
filename FILLER CHAR(4000),
filecontent LOBFILE(filename) terminated by eof -
Get the Last Value of Status Field from SQL TABLE using SQL 2008
I have a table with Fields such as
UploadstartTime, UploadEndtime, STATUS From TBLA.
The STATUS Field, has values =7 and 11 are failed and 12 is SUCCESS. I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get STATUS For that record. How can I do that using 1 SQL Query?
My current code is: The issue is
select
TBLNAME
MaxUploadstarttime
=
max(UploadStartTime),
MaxUploadEndtime
=
max(UpLoadEndTime),
Status=max(status)
from DB.DBO.LOGTABLE
p1Please post DDL, so that people do not have to guess what the keys, constraints, Declarative Referential Integrity, data types, etc. in your schema are. Learn how to follow ISO-11179 data element naming conventions and formatting rules. You failed! Temporal
data should use ISO-8601 formats. Code should be in Standard SQL as much as possible and not local dialect.
This is minimal polite behavior on SQL forums.
>> I have a table with Fields such as <<
Fields are not columns! There is no generic status in RDBMS. Putting “tbl-” in a table name is called tibbling and we make fun of people who do it (Google Phil Factor's humor columns. If you were polite is this what you wanted to post?
CREATE TABLE Something_Uploads
(upload_source_name CHAR(15) NOT NULL,
upload_start_timestamp DATETIME2(0) NOT NULL,
PRIMARY KEY (upload_source_name, upload_start_timestamp),
upload_end_timestamp DATETIME2(0),
CHECK(upload_start_timestamp < upload_end_timestamp),
upload_status INTEGER NOT NULL
CHECK (upload_status IN (7,11,12, ..))
>> I cannot do a max, since it will always show 12, I need to get the MAX(UPLOADENDTIME, and get upload_status For that record [sic]. How can I do that using 1 SQL Query? <<
Since you told us nothing and gave no sample data, want to correct this postign?
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
in Sets / Trees and Hierarchies in SQL -
Populating JTable table from sql statement.
Trying to teach myself a combanation of things. Since Oracle is my background java to oracle is only a natural. Now this code I'm trying to select some rows and then display those rows in a table. Simple concept as a teaching aid to me. I won't go into what I went through to get this far, just say there have been quite a few fall starts. Now this code works; however it returns ten rows (one for each tablespace) and displays row 1 ten times. Not quite what I had in mind.
I have got a simple select statment in my code:
select tablespace_name,initial_extent,next_extent,pct_increase, status
from dba_tablespaces order by tablespace_name
package TableTest;
// java imports
import java.util.Vector;
import java.awt.event.*;
import java.awt.Toolkit;
import java.awt.*;
import javax.swing.*;
// sql imports
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.PreparedStatement;
import java.sql.Connection;
import java.sql.DriverManager;
public class TableTest extends JFrame
Connection conn; // database connection object
Statement stmt; // statement object
ResultSet rslt; // result set object
//private vars
private String userName = "bubbalouie";
private String password = "helpmeimsinking";
private String sid = "rob";
private String port = "1521";
private String server = "w2sd001";
private String connectString = "jdbc:oracle:thin:@"+server+":"+port+":"+sid;
private int numCols = 5;
private String sqlStmt = null;
private String status = null;
public TableTest()
// Get content pane
Container contentPane = getContentPane();
// set layout manager
contentPane.setLayout(new BorderLayout());
// create some places to put dat
Vector data = new Vector();
Vector columns = new Vector();
Vector colHeads = new Vector();
colHeads.addElement("tablespace name"); // this is ugly fix later
colHeads.addElement("initial extent");
colHeads.addElement("next extent");
colHeads.addElement("pct increase");
colHeads.addElement("status");
// construct a simple sql statement
sqlStmt = "select tablespace_name, initial_extent, next_extent, pct_increase, status";
sqlStmt = sqlStmt+" from dba_tablespaces order by tablespace_name";
try
// connect to database
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
Connection conn = DriverManager.getConnection(connectString, userName, password);
// select data into object
stmt = conn.createStatement();
rslt = stmt.executeQuery(sqlStmt);
while (rslt.next())
for ( int i=0; i<numCols; i++ )
columns.addElement(rslt.getObject(i+1)); // get the i+1 object
} // end for
data.addElement(columns);
} // end while
// create the table
JTable table = new JTable(data,colHeads);
// add table to scroll pane
int v = ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h = ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
JScrollPane jsp = new JScrollPane(table,v,h);
// Add scroll pane to content pane
contentPane.add(jsp, BorderLayout.CENTER);
} catch (SQLException ex)
String msg = "SQL error: "+ex.toString();
} catch (Exception ex)
String msg = "Error: "+ex.toString();
} // end constructor
public static void main(String[] args) {
TableTest frame = new TableTest();
frame.setSize(500, 400);
frame.setTitle("TableTest");
frame.setVisible(true);
} // TableTest end classif you are interested here is a generic table model for displaying ResultSets in a JTable. The resultset needs to support calling resultset meta data and the basic methods in there but then it should support anything you give it.
import java.sql.*;
import java.util.*;
import javax.swing.table.*;
public class ResultSetTableModel extends AbstractTableModel{
Vector rows;
int[] types;
String[] names;
public ResultSetTableModel(ResultSet rs)throws SQLException{
ResultSetMetaData rsmd = rs.getMetaData();
types = new int[rsmd.getColumnCount()];
names = new String[rsmd.getColumnCount()];
for(int n=0;i<types.length;n++){
types[n] = rsmd.getColumnType(n+1);
names[n] = rsmd.getColumnName(n+1);
rows = new Vector();
while(rs.next()){
Vector aRow = new Vector();
for(int j=0;j<types.length;j++){
switch(types[j]){
case Types.TINYINT:
aRow.addElement(new Byte(rs.getByte(j+1)));
break;
case Types.SMALLINT:
aRow.addElement(new Short(rs.getShort(j+1)));
break;
case Types.INTEGER:
aRow.addElement(new Integer(rs.getInt(j+1)));
break;
case Types.BIGINT:
aRow.addElement(new Long(rs.getLong(j+1)));
break;
case Types.REAL:
aRow.addElement(new Float(rs.getFloat(j+1)));
break;
case Types.FLOAT:
aRow.addElement(new Double(rs.getDouble(j+1)));
break;
case Types.DOUBLE:
aRow.addElement(new Double(rs.getDouble(j+1)));
break;
case Types.DECIMAL:
aRow.addElement(rs.getBigDecimal(j+1));
break;
case Types.NUMERIC:
aRow.addElement(new Long(rs.getLong(j+1)));
break;
case Types.BIT:
aRow.addElement(new Boolean(rs.getBoolean(j+1)));
break;
case Types.BINARY:
aRow.addElement(rs.getBytes(j+1));
break;
case Types.DATE:
aRow.addElement(rs.getDate(j+1));
break;
case Types.TIME:
aRow.addElement(rs.getTime(j+1));
break;
case Types.TIMESTAMP:
aRow.addElement(rs.getTimestamp(j+1));
break;
default:
aRow.addElement(rs.getString(j+1));
rows.addElement(aRow);
public Class getColumnClass(int column){
switch(types[column]){
case Types.BIT:
return Boolean.class;
case Types.DATE:
return java.sql.Date.class;
case Types.TIME:
return java.sql.Time.class;
case Types.TIMESTAMP:
return java.sql.Timestamp.class;
default:
return Object.class;
public int getRowCount(){
return rows.size();
public int getColumnCount(){
return types.length;
public Object getValueAt(int row, int column){
Vector aRow = (Vector) rows.elementAt(row);
return aRow.elementAt(column);
public String getColumnName(int column){
return names[column];
}
Maybe you are looking for
-
Adobe Edge Animate CC Language korea Versions ??
Adobe Edge Animate CC Language korea Versions ?? korea? ( PSY Gangnam Style OK? ^^* ) 한국어 버전은 출시되지 않나요? 한국어 버전도 출시 부탁드립니다.
-
Classes and JSPs in Tomcat-4.1.24
Where to put the class files and how to call them in the jsps in Tomcat-4.1.24. <br>In Tomcat-3.2.4 I used to put them in WEB-INF/classes and call them. The same jsp's working in Tomcat-3.x are not working in 4.1.24 version. Any idea??? Thanx in adva
-
Changing process orders in ecc
hi gurus, my issue is, whenever i change the process order dates in ecc(the date is changed to date that is outside my planning horizon) they dont show in the APO and instead the APO is overriding the changes to the original date. can
-
Problem connecting external monitor to Macbook Pro
I have a late 2008 Macbook Pro and I can't attach my external monitor. When I go into displays arrangements does not appear. I am using LG w2753. My Macbook: Processor 2.4 Intel Core 2 Duo,Memory 2 GB 1067 MHz DDR3,NVIDIA 9400m 256, Osx 10 0.7.5 I ha
-
Modify existing excel file (POI API)
Hi All, Can anybody give me a reference to an example to update/modify an exsiting excel file in java. For creation of excel file I am using POI API. But not getting how to update an existing excel file using POI API. I'll be thankful for your help.