Skip to Main Content
  • Questions
  • Database transfer from SQL Server to Oracle

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Rajesh.

Asked: November 14, 2000 - 2:42 am UTC

Last updated: June 04, 2009 - 2:40 pm UTC

Version: 8i

Viewed 1000+ times

You Asked

1. Before I go for Oracle database, I would like to know whether migrating the database(all objects and data as well) from SQL Server 7.0 to Oracle 8i is possible or not? If so how?

2. I would like to know how do I declare binary datatype? Like in SQL Server 7.0 I can say create table temp(uid binary(8)).

and Tom said...

It is possible -- every Orace8i database ships with a SQLServer migration kit to ease the process.

You can read about it at
</code> http://technet.oracle.com//tech/migration/workbench/ <code>


For #2, you would use the RAW type

create table temp( uid raw(8) );



Rating

  (18 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

A related question

John, April 16, 2003 - 9:24 am UTC

We need to transfer data from a SQL Server 7 database to an Oracle database on a daily basis. The solution I can think about is to generate text files from SQL Server database, and then load the text file into Oracle using SQL*Loader. I wonder can Oracle query the SQL Server database directly, or are there other ways of doing this?

We also need to take some data from Oracle database and update the SQL Server database. My plan again is to do it through text files. Any other better ways?


Tom Kyte
April 16, 2003 - 10:13 am UTC

</code> http://asktom.oracle.com/pls/asktom/f?p=100:11:::::P11_QUESTION_ID:4406709207206 <code>

set up generic connectivity, you can select from sqlserver and insert into sqlserver from Oracle -- giving sqlserver all of the power of Oracle functionality ;)

See you can upgrade SS without touching their software...

Thank you for your prompt response.

John, April 16, 2003 - 10:49 am UTC

It was eye opening. I'll be very much pleased if it works in our environment.

Reverse exist or not ( from Oracle to SQL server

Kumar, April 16, 2003 - 12:01 pm UTC

Tom,

If suppose any one wants to migrate the entire stuff from Oracle to SQLserver, how this can be achieved? Do we have any such utilities exist. My concern is in SQLSERVER no packages functionalities exist, if in such case of migrations, how those utilities would be doing this kind of stuff without fail?

Thanks
Kumar

Tom Kyte
April 16, 2003 - 6:22 pm UTC

that would be a good question for askBill@microsoft.com don't you think...

I don't "go that way"

kumar please use askbill.com

reader, April 16, 2003 - 12:58 pm UTC

oracle to sqlserver? why would oracle provide that?
why would anyone want to do that? why would tom even consider looking into that for you?

Ha..Ha..Funny!

Sunny Chakraborty, April 16, 2003 - 1:33 pm UTC

Yes go askbill.com [have to pay $$ thought?].. maybe buy a askbill support licence from microsoft- :)


Agreed but looking for info for such .......

kumar, April 16, 2003 - 4:58 pm UTC

Hi Folks,

I agree your point, why Oracle do that -- correct? In reality Oracle do a lot like whenver a new windows OS then Oracle releases happens on them. So this is the world of TECH. I am curious to ask this, what if a big Oracle shop ( like the one I have) might need some small other databases interfaces with SQLSERVER. In this kind of world there is no end boundaries for conversions, migrations etc. Hence I just posted if any information exist with any clue like things. However no way to think nor make the buisness down to Oracle.

Thnaks for suggestions and I am just investigating if any such gateways exist. I am also sure Bill.com did not setup any gate ways till date however some useful info published. I know this causes $$ to do this untill Bill.com emerges one day with some key.

sqlserver's tool should do that

A reader, April 16, 2003 - 7:30 pm UTC

You need to look at the tools that come with sqlserver. Database system software would generally provide "inbound" migrations (i.e. mirgate *to* my rdbms), but not "outbount" migrations (i.e. migrate *from* my rdbms). Therefore you should really explore what sqlserver (the target database you want to migrate to) has to offer.

SQL server to oracle 9i

Shankar, February 27, 2004 - 3:42 pm UTC

I have been asked to migrate SQL server database to oracle 9i. I am thinking about using the migration workbench tool. I am posting in this thread to see if anyone had used this utility to do the migration before and if there are any issues I may face and should be considered in performing the migration, it would be appreciated if the readers or you could share. Thanks.

Import from Oracle to Sql server (vice versa)

Dawar Naqvi, March 31, 2005 - 1:54 pm UTC

Tom,

My Database serevr version is 10.1.0.3.0.

Is it possible to import data from sql server to oracle database?

Also other way around.

I mean import data from Oracle to sql server.

Regards,
Dawar

How To - Database Migration

VIKAS SNGAR, July 13, 2005 - 5:04 am UTC

Dear Mr. Kyte

I am having a Database which was being run and managed on MS SQL server, but now we are required to migrate the same to Oracle 9i Server.

Can you pls render your valuable advice and instructions, as if, how this task can be achieved easily in the most effective manner? I want to migrate all my applications, triggers, stored procedures etc, along with my Database.

Pls suggest me which is the right way and tool (Import/Export, Sql *Loader, Workbench)to achieve this task using ODBC specifications.

How can i minimise the in-compatibilities that will arise due to Datatype mismatch.

What care should i take while handling the Null and Blank records in the various feilds of my SQL Database while migrating the it to Oracle 9i Database.

Thanx with kindest regards,
Vikas



Tom Kyte
July 13, 2005 - 12:38 pm UTC

well, ODBC would be the microsoft API and Oracle native tools use Oracle's API, so ODBC and imp/exp/sqlldr don't "compute"

You might be interested in the migration workbench. It is available on otn.oracle.com

It will make a first pass on rewriting tsql into plsql -- but you will have to look at each and every piece of converted code and "fix it", you are not changing databases, you are changing programming languages and programming constructs.

It would be of great benefit for you to add to your team someone with Oracle experience, you'll find it to go much smoother (as it would going from Oracle to MS to have a sqlserver savvy person on board)

be prepared to PORT your application, this is not a migration like "we will migrate from version 1 to version 2", this is a PORT, there will be portions of your application that will be rewritten, some might PORT easily others will have to be very much reworked.

Migration - Workbench

VIKAS SANGAR, July 15, 2005 - 2:43 am UTC

Dear Mr. Kyte,

Thanks for the above information.

Certainly, i would like to use OMWB. But, now the question arises while capturing the database, OMWB creates two Models of the database that is to be migrated, one the source model(MS SQL) and another is the target model(oracle 9i).

What i would like to know here is, Will it be better to make changes (incompatibilities/error corrections)to the source model or target model before migrating the Database or, it is better to migrate the Database first and then make the neccessary changes.

Are there any tools that can achieve, or help in achieving this (Code correction)task.

Would Jdeveloper work to achieve this purpose or is there any other tool that can be used for the same task.

Thanx with regards...
Vikas.

Tom Kyte
July 15, 2005 - 7:41 am UTC

I'd migrate and fix (because you are going to spend the bulk of your time "fixing" anyway, call it "redevelopment")

Code correction is going to be something you do, the software will take the first wack at it for you, but after that -- you.

jdeveloper is an IDE (integrated development environment) for building java, plsql applications. It can be useful as a source code debugger for plsql absolutely, so it will help you in that regards.

I reiterate:
It would be of great benefit for you to add to your team someone with Oracle
experience, you'll find it to go much smoother (as it would going from Oracle to
MS to have a sqlserver savvy person on board)


Database Migration

VIKAS SANGAR, July 15, 2005 - 9:04 am UTC

Dear Mr. Kyte

Thanx for the prompt reply.

I'll certainly keep your valuable suggestions as top priorities in mind, and make them handy when the need arises and circuimstances allows me to do so. At the moment we are carrying out things safely on trial basis using dummy Database, so as to minimise problems in near future at the time when things get realize.

This is just to get an idea of how it is actually done in Oracle and who else is better than you, to to look up for when it comes to Oacle and Databases. I have recently completed my oracle education (9i DBA - although, learning is a never ending process) but that was very basic of what we actually do in real life.

So i'll keep bothering you and hope to get the valuable peice of knowlegde on my queries from you as u always do.

Take care, with regards....
Vikas.

Data Migration

Banumaran, November 07, 2005 - 4:03 am UTC

Hi Tom

I would like to know whether migrating the
database(all objects and data as well) from Oracle 9i to Oracle 10g is possible or not? If so pl list the tools available.
Does Oracle own any GUI based tool like Microsoft-DTS to Extract & transform data from one Oracle DB to other Oracle DB ?

Thanks
Banumaran


Tom Kyte
November 07, 2005 - 8:53 am UTC

Just upgrade. You don't need to "migrate".

Read this:

</code> http://docs.oracle.com/docs/cd/B19306_01/server.102/b14238/toc.htm <code>

DATA MIGRATION

banumaran, November 07, 2005 - 9:54 am UTC

Hi Tom,

I do agree with you in scenarious where there are no structural changes.

what is your advice if there are structural changes in targer db.
i.e) The source DB (oracle 9i) is not properly normalized , the data from source is moved to a Normalized 10g DB with new attributes added(based on new requirements)to these tables . Some tables from source are split into 2 or more tables in the target (oracle 10g) database.

i have scenarious like

1) A single row in SOURCE be migrated to multiple rows across one or more tables in TARGET.
2) A multiple rows in single column in SOURCE be migrated to single row and multiple columns in TARGET

For the above mentioned scenario sql*loader /external table/export & import or transportable tablespaces can be used,but considering the ease of use and the complexity what GUI tool does oracle have for data migration from oracle db to oracle db.

TOM, with Microsoft DTS we are able to migrate from one Oracle DB to other oracle DB, though it is not a recommended approach i had just tried a sample.

i am looking for an ORACLE tool which is similar to Microsoft-DTS which should be very easy to use.


your advice will be much help to me.




Tom Kyte
November 07, 2005 - 11:55 am UTC

then your developers would have created insert into as select scripts already - they would have developed the migration scripts as part of their natural development process. IF they did not, YOU have a complete mess on your hands already (eg: they've never tested against an existing database of data, they have no idea if the funtionality is the same, if it'll scale or anything)

To me - having to build a "migration framework" AFTER the application is developed means "there is a huge problem here"

Oracle and microsoft access

A reader, March 01, 2007 - 10:04 am UTC

Hi tom,

Sorry to ask you this question here. I hope you can help me.

We've developed a package(pkg_1) on oracle 8.1.7.4.

We've another application developed in microsoft Access and wich connect to another oracle database 9i. Within this 9i session we want the connected user to connet to our oracle 8.1.7.4 and calls our package (pkg_1).

This means that this user is first connected to his 9i database and
1. will connect to our 8i database
2. call our package pkg_1 ===> which gives him output parameters

3. disconnet from our 8i database
4. use the output parameters in his oracle 9i application

Is this possible?

Kind Regards


Tom Kyte
March 02, 2007 - 11:44 am UTC

they connect to 9i and from 9i they will use a dblink to 8i to execute the package. as far as they are concerned, the package will be in 9i.


create database link other_database connect to .....;

create synonym pkg_1 for pkg_1@other_database;



do that in 9i, then it will be as if pkg_1 is local.

SQL Server timestamp equivalent in Oracle

IvyFlora, June 03, 2009 - 3:32 am UTC

Hi Tom
We are migrating SQL Sever Database to Oracle10g.
Can you tell me. What equivalent of SQL Server timestamp datatype in Oracle. Or how I can
implement similar behavior in 10g.
Tom Kyte
June 03, 2009 - 12:08 pm UTC

your choices are:

a) ora_rowscn, create the table with rowdependencies and a magic column will be maintained for you. Note: you must CREATE the table with rowdependencies option - you cannot alter it in later.
http://www.oracle.com/pls/db102/search?remark=quick_search&word=ora_rowscn&tab_id=&format=ranked

b) maintain it yourself.

create or replace trigger x before insert or update of t for each row
begin
select some_seq.nextval into :new.ts_column from dual;
end;


c) my preference - have the application (which only uses a stored procedure to access this data of course) maintain it - they seed it with 0 upon insert, they increment by 1 with each update - I'm assuming you are using this for optimistic concurrency control.... Or use a TIMESTAMP datatype and update it with systimestamp during each insert/update (so you can tell when the row was last updated)

SQL Server "timestamp" -> ORA_ROWSCN

Duke Ganote, June 03, 2009 - 4:27 pm UTC

Who'd've guessed?! SQL Server 2000 "introduces a rowversion synonym for the timestamp data type"
http://tinyurl.com/ofh7tg (link to MSDN)

SQL Server timestamp equivalent in Oracle

A reader, June 04, 2009 - 2:40 am UTC

Thanks Tom..

Followup   June 3, 2009 - 12pm US/Eastern:
your choices are:
http://www.oracle.com/pls/db102/search?remark=quick_search&word=ora_rowscn&tab_id=&format=ranked

This link doesn't work for me... 

Ok... When i use rowdependencies it gave error ..

SQL> select ORA_ROWSCN,USERID,USERNAME from aduser;

ORA_ROWSCN     USERID USERNAME
---------- ---------- --------------------------------------------------
   3348654          1 sysman
   6089889          2 ANWER

SQL> 
SQL> 
SQL> SELECT scn_to_timestamp(ORA_ROWSCN),USERID,USERNAME from aduser where USERID = 2;

SCN_TO_TIMESTAMP(ORA_ROWSCN)                                                    USERID USERNAME
--------------------------------------------------------------------------- ---------- -------------------
02-JUN-09 02.54.23.000000000 PM                                                      2 ANWER

SQL> 
SQL> SELECT scn_to_timestamp(ORA_ROWSCN),USERID,USERNAME from aduser where USERID = 1;
SELECT scn_to_timestamp(ORA_ROWSCN),USERID,USERNAME from aduser where USERID = 1
       *
ERROR at line 1:
ORA-08181: specified number is not a valid system change number
ORA-06512: at "SYS.SCN_TO_TIMESTAMP", line 1

Tom Kyte
June 04, 2009 - 2:40 pm UTC

that link works ok for me (and others...) something wrong on your end there - but just search the documentation, that is obviously a search in the documentation for ORA_ROWSCN


you did not give me an example I can work with - all I can say is the scn for userid = 1 is too far in the past to turn into a timestamp (The timestamp stuff is only good for about 5 days into the past)