I have a table in SQL Server 2008 R2. It contains 1M or more records. Now I want to create a table in oracle with the same content that is in SQL Server 2008 R2.
You can use the Microsoft SQL Server Management Studio to connect your Oracle data to an SQL Server instance. Linked Server is a tool of MS SQL Server that allows to execute distributed queries to refer tables stored on non-SQL Server datbase in a single query.
Question: How can I create an Oracle table from another table without copying any values from the old table? Answer: To do this, the Oracle CREATE TABLE syntax is: CREATE TABLE new_table AS (SELECT * FROM old_table WHERE 1=2);
The name of the table that you wish to create. The columns that you wish to create in the table. Each column must have a datatype. The column should either be defined as "null" or "not null" and if this value is left blank, the database assumes "null" as the default.
There are several ways of doing that. You can first look on the following tutorial: Migrating a Microsoft SQL Server Database to Oracle Database 11g
I have done this task in the past using the following steps:
The Oracle SQL*Loader utility is a command line tool that allows you to load data from files to Oracle. It uses control file that specifies the source file, its structure and the loading strategy.
The advantage of using the tool vs. loading using INSERT statements is the speed of loading. Since this tool bypass the log files it is extreamly fase.
Here is the link to the SQL Loader tutorial: SQL*Loader FAQ
From this tutorial:
Usage:
sqlldr username/password@server control=loader.ctl
Control file sample:
(1) load data
(2) infile 'c:\data\mydata.csv'
(3) into table emp
(4) fields terminated by "," optionally enclosed by '"'
(5) ( empno, empname, sal, deptno )
Line 1: Speciefies that you want to load data into the table
Line 2: Specifies the source file that contains the data
Line 3: Specifies the destination table
Line 4: Specifies the columns delimiter (Comma in the example) and that string values might be enclosed by " char.
Line 5: Specifies the order of columns in the file
Data files sample (Corresponds to the control file above):
10001,"Scott Tiger", 1000, 40
10002,"Frank Naude", 500, 20
Hope it helped.
Koby
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With