ORA-01841 Converting SQL Server DateTime to Oracle Date
I have Oracle 11gR2 x64 running on my Win7 Enterprise x64 personal system. I'm trying to convert the TSQL to create a database in SQL Server 2008 Express for my C# class to Oracle, and I've run into a "interesting" problem loading date data.
The SQL Server 2008 TSQL InvoiceDate column in the Invoices table has datatype DATETIME:
*[InvoiceDate] [datetime] NOT NULL,*
which Oracle does not support. The Oracle InvoiceDate column in the MMAB_Invoices table has datatype DATE:
InvoiceDate DATE NOT NULL,
The fun begins with the TSQL INSERT statements (for example):
INSERT [dbo].[Invoices] ([InvoiceID], [CustomerID], [InvoiceDate], [ProductTotal], [SalesTax], [Shipping], [InvoiceTotal]) VALUES (18, 20, CAST(0x00009CFD00000000 AS DateTime), 151.0000, 11.3300, 6.2500, 168.5800)
As you can see, whoever wrote the load script thought it would be totally awesome to convert hex (binary?) data to generate a date, instead of using data readable by a human being.
BTW, the date generated is 2010-01-13 00:00:00.000.
After Reading The Fabulous Manual and searching the OTN Discussion Fora, what I came up with is
INSERT INTO MMAB_Invoices (CustomerID, InvoiceDate, ProductTotal, SalesTax, Shipping, InvoiceTotal) VALUES (20, TO_DATE(UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000')), 'YYYY-MM-DD HH:MI:SS'), 151.0000, 11.3300, 6.2500, 168.5800);
which returned
Error starting at line 846 in command:
INSERT INTO MMAB_Invoices (CustomerID, InvoiceDate, ProductTotal, SalesTax, Shipping, InvoiceTotal) VALUES (20, TO_DATE(UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000')), 'YYYY-MM-DD HH:MI:SS'), 151.0000, 11.3300, 6.2500, 168.5800)
Error report:
SQL Error: ORA-01841: (full) year must be between -4713 and +9999, and not be 0
*01841. 00000 - "(full) year must be between -4713 and +9999, and not be 0"*
**Cause: Illegal year entered*
**Action: Input year in the specified range*
The PK InvoiceID is automatically generated by a BEFORE INSERT trigger that uses a sequence.
Suggestions?
Thanks.
P.S. Happy New Year!!!
Your hex conversion is certainly not returning a date format:
sql> select UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000')) from dual;
UTL_RAW.CAST_TO_VARCHAR2(HEXTORAW('00009CFD00000000'))
┐²To convert the hex number to decimal, simply use to_number:
sql> select to_number('00009CFD00000000', 'xxxxxxxxxxxxxxxx') from dual;
TO_NUMBER('00009CFD00000000','XXXXXXXXXXXXXXXX')
1.7261E+14Now, before you can make any further calculations with that number, you need to know how it represents the date of 2010-01-13. Luckily, we've got Google nowadays. ;-)
Sql server representation seems to be an 8 byte field. The first 4 bytes stores the number of days since SQL Server's epoch (1st Jan 1900). The second 4 bytes stores the number of milliseconds after midnight.
sql> select to_number('00009CFD', 'xxxxxxxxxxxxxxxx') from dual;
TO_NUMBER('00009CFD','XXXXXXXXXXXXXXXX')
40189
sql> select to_date('1900-01-01','yyyy-mm-dd') + 40189 from dual;
TO_DATE('
13-JAN-10So, the conversion would be something like this:
sql> select to_date('1900-01-01','yyyy-mm-dd') + to_number(substr('00009CFD00000000',1,8), 'xxxxxxxx') + to_number(substr('00009CFD00000000',9,8), 'xxxxxxxx') / (24*60*60*1000) from dual;
TO_DATE('
13-JAN-10Note: Oracle DATE format specifies a datetime up to the second, whereas the sqlserver DATETIME format specifies a datetime up to the millisecond; if that precision is needed, use Oracle's TIMESTAMP instead.
Note: using an internal representation is risky, implementation details may change. In this case, it seems pretty unlikely that Microsoft will ever change the datetime internal representation, since that would break lots and lots of code.
Edited by: theoa on 2-jan-2012 9:14
Similar Messages
-
Convert SQL SERVER DATETIME into ORACLE TIMESTAMP
I have to convert a column's datatype.
The source column's datatype is DATETIME which is in SQL Server to TIMESTAMP(datatype in target which is oracle)
Can anyone help me pleaseJust issue ALTER TABLE MODIFY:
SQL> create table tbl(c date)
2 /
Table created.
SQL> insert into tbl values(sysdate)
2 /
1 row created.
SQL> select to_char(c,'mm/dd/yyyy hh24:mi:ss') from tbl
2 /
TO_CHAR(C,'MM/DD/YY
12/26/2009 20:50:58
SQL> alter table tbl modify c timestamp
2 /
Table altered.
SQL> select c from tbl
2 /
C
26-DEC-09 08.50.58.000000 PM
SQL> SY. -
Convert Sql server Storeprocedure to Oracle Storeprocedure
Hi I vant to convert a sql server storeprocedures to oracle storeprocedure .
I need a convertor if anybody know a aplication that performed it please tell me.Hi Hoek,
I have tried this:
1. Get the DATETIME into a VARCHAR2 variable.
2a. Then, I use a TIMESTAMP variable and TO_TIMESTAMP like this:
v_tmst := TO_TIMESTAMP (r_typ.date1, 'DD.MM.YYYY HH24');2b. Or the function CAST:
v_tmst := CAST (r_typ.date1 AS TIMESTAMP);Same result, I lose the HH:MI:SS.FFF just in the moment the DATETIME from SQL Server is copied into an Oracle VARCHAR2 variable.
I also read the article you linked (I also read it before I wrote the 1st posting, but not with deep detail).
I'm afraid this cannot help me, or at least I'm not able to find out how.
They talk about ODI, but I'm not using that tool.
Moreover, they talk about creating a table, but they don't say anything regarding the conversion itself and how to get the miliseconds.
Don't know whether there is something I can take from here or not.
Anyway, thank you for the repply.
Francisco.
Edited by: FranBlanes on 30.08.2012 04:27 -
Convert Sql server database into oracle
hi friends
i have a very smal database of sql server containing 8 tables
i want to convert my databse into oracle plz tell me in detail coz i dont know any thing about it.
plz help me
take care
byeIf the amount of data is small, you might look into Microsoft Data Transformation Services (DTS), which comes with SQL Server. This provides an easy to use GUI for mapping data between two sources.
A few warnings:
- If you let DTS create your Oracle tables, beware that that table / column names may be created as case-sensitive and data types may not be what you expect
- If you are transferring a lot of data (e.g. millions of rows), performance will be terrible. -
Converting SQL Server 2000 to Oracle 9i
Hi,
I am working on the migration of stored procs from a SQL Server 2000 database to Oracle 9i. The sqlsrvr db contains 75 relatively complex procs using temporary tables to create intermediate resultsets for further processing.
The Oracle 9i environment has very strictly standards and temporary tables are not allowed.
Is it standard practice to use PL/SQL tables to simulate the functionality of temp tables?
I understand you can now use SQL against PL/SQL tables under certain circumstances.
I would envisage using the PL/SQL tables in multi-table joins with schema tables.
Any ideas whether I am going down the wrong path.
Thanks in advance,
Garrett DonnellyGarrett,
Note that there is also an parser option to 'Generate8i temp tables', where the data in the permanent tables is seperated from other sessions by the use of an extra Session id colum.
Please post the results of your PL/SQL table experiences.
Regards,
Turloch
Oracle Migration Workbench Team -
Converting SQL Server Query to Oracle
Hello TechFriends,
Can any one of u please tell me equivalent of following SQL Server Query?
The same query runs in Oracle but givesa same reocrds in different order!! I want such an equivalent oracle query that gives records in same order as Sql Server does.
select
ProfValue_ProfScaleFK ProfScale,
ProfValue_Value ProfValue,
isnull(ProfValueDesc.name, ProfValue_name) ProfName
from
ProfValueDesc inner join TBL_LMS_Lang
on lang_fk = lang_pk and langid = 'en'
right outer join ProfValue
on ProfValue_ProfScaleFK = ProfScale_fk and ProfValue_Value = ProfValue_FK ;
Regards & TIA.
Anand.If you want a specific ordering why don't you add an ORDER BY clause?
Donal -
Can I define a SQL Server View to Oracle data?
So I have a subset of data whose source of truth resides in an Oracle Database. Can I define a SQL Server View to retrieve this subset of data and make it available on the SQL Server side for say Reporting and SSRS? I think I also saw where they tend to
prefer User-Defined functions as opposed to a view. If I define the view using an OPENQUERY, I have noticed that it seems to run FOREVER on the SQL Server side and returns pretty timely if I run in Oracle SQL Developer. Is there anything I can tweak to improve
this timeliness or lack there of?
And the whole reason I'd like to create a view of this Oracle data is so that I can take advantage of all the views and functions that we have created on the SQL Server side.
Has anyone gone down this path and can offer some advice and web sites or YouTubes as to the best way to approach this?
Thanks for your review and am hopeful for a reply while I keep Googling this.There are couple of ways by which you can connect and fetch the data
OPENQUERY - which you are already using [uses linked server] -
runs on remote server
OPENROWSET - I would like to avoid this because it requires crenditials
OPENDATASET - Similar issue like OPENROWSET
Directly access linked server like LINKEDSERVER.DATABASE.SCHEMA.TABLE -
runs on your local server
Now, performance
basically, they have the same performance advantages and disadvantages when connecting to remote server. But you can enhance it by
Avoiding data conversion
Using procedure on Oracle and then call it from SQL Server (due to compiled plan your result will be faster)
Avoiding dealing with complex data types
If you are dealing with large number of records, try using Oracle connector in SSIS. I found it working much better than SQL sometimes.
Hope this will help
Glad to help! Please remember to accept the answer if you found it helpful. It will be useful for future readers having same issue.
My Profile on Microsoft ASP.NET forum -
I'm converting SQL Server Tables to Oracle using MWB 9.2. The tables contain images (data type "image"). I get the following error from the MWB generated scripts:
SQL*Loader-309: No SQL string allowed as part of DISPLAY_IMAGE field specification
The column definition in the .ctl file is:
DISPLAY_IMAGE NEXT ***** CHARACTER
Maximum field length is 2000000
Terminator string : '<ec>'
SQL string for column : "HEXTORAW (:DISPLAY_IMAGE)"Kelly,
The OMWB only supports inline data transfer of image types to LONG RAW via SQL*Loader.
You should be ablr to use TO_LOB() to convert the LONG to LOB.
The error you have is what you get when you try yo migrate to BLOB. TO use SQL*Loader
with BLOB you would need to have unload each image into a seperate file and the OMWB
doen't help you do this. bcp dumps the image data in hex (hence the HEXTORAW sql function),
I don't know how bcp would dump this as binary.
Jim. -
Error converting SQL Server text field to Oracle CLOB
I am trying to convert an SQL Server DB to Oracle DB using DB link. The issue I am facing is one of the SQL Server table contains text field and we are trying to convert the text field to CLOB.
The error I am getting is "SQL Error: ORA-00997: illegal use of LONG datatype"
The statement is something like this.
Insert into oracle_table
Select col_1,col_2,col_3,col_4,col_5 from sql_table@sqldblink;
Please help.Hi,
This is a known restriction involving long columns -
(1) LONG datatype not supported with use of DBLINK when insert or update involves a select statement
(2) LONG datatype cannot be used in a WHERE clause, in INSERT into ... SELECT ... FROM
constructs, and in snapshots.
The workround is to use a PL/SQL procedure or try the SQLPLUS COPY command.
If you have access to My Oracle Support then review these notes -
Cannot Move A Long From non Oracle database Ora-00997: Illegal Use Of Long Datatype (Doc ID 1246594.1)
How To Workaround Error: Ora-00997: Illegal Use Of Long Datatype (Doc ID 361716.1)
Regards,
Mike -
Convert this sql server query to Oracle?
I've some SQL Server queries that I need to make a copy for to run against Oracle databases. (10G), any help would be appreciated.
SELECT COUNT(*) COUNT, CONVERT(DATETIME, CONVERT(VARCHAR(8), M.START_DATE, 1)) [DATE]
FROM OPTC.ORD_M_ORDER M
INNER JOIN OGEN.GEN_M_PATIENT_MAST P ON M.PAT_NUMBER = P.PAT_NUMBER
INNER JOIN OPTC.ORD_C_ORDER_TYPE C ON C.ORDER_TYPE_KEY = M.ORDER_TYPE_KEY
WHERE OGEN.DATEONLY(END_DATE)- OGEN.DATEONLY(START_DATE) < '1900/03/01'
--AND OGEN.DATEONLY(CREATED_ON) = OGEN.DATEONLY(CURRENT_TIMESTAMP)
AND ORDER_STATUS IN (4,7,8)
AND M.FACILITY_KEY IN (SELECT VALUE FROM OGEN.COMMA_TO_TABLE(@FACILITYKEY))
AND [START_DATE] BETWEEN @STARTDATE AND @ENDDATE
AND CAST(M.ORDER_FLAGS AS BIGINT) & 64 <> 64 AND P.DISCHARGE_DATE IS NULL
GROUP BY CONVERT(DATETIME, CONVERT(VARCHAR(8), [START_DATE], 1))Hi,
You could use the 'Translation Scratch Editor' in SQL*Developer to translate SQL*Server statements to Oracle.
SQL*Developer is free and can be downloaded from here -
http://www.oracle.com/technetwork/developer-tools/sql-developer/overview/index.html
Once installed start it up, then go to 'Tools' - 'Migration' - 'Translation Scratch Editor'
I did run the statement you have posted here through it but it gave errors so looks like there may be a problem with the syntx in any case.
Does this query run as it is in SQL*Server ?
Regards,
Mike
Edited by: mkirtley on Jan 5, 2012 12:45 PM -
Error converting SQL Server DDL and views to Oracle
I am trying to convert SQL Serve 2008 on windows to Oracle 11g using SQL Developer 3.2.20.09. I am using the jtds-1.2.7 drivers to connect to SQL Server.
I have made several attempts to run the conversion and am getting the tables, indexes, and triggers converted with no issue. However, my Procedures and views are not coming across. All of them are giving similar errors as:
"Failed To Convert Stored Procedure get_compvision > esp3.dbo.get_compvision:unexpected end of subtree: Line 0 Column 0"
When I log into the source SQL Server environment using SQL Developer, I get an empty SQL Editor window with "null" when I try to {right-click -> "Open"} on the Procedure.
Logging into SQL Server Administrator as the same user I can see the source code, so the issue appears to be related to SQL Developer and not my user privleges. I am a dbo alias in SQL Server.
In addition, if I click on a view, I can see the data and metadata, but not the SQL that defines the view. I see tabs for column, data, triggers, and details.
In addition, if I go to the "capture" for my Migration project and drill down to procedures, I can see them listed, but each and every procedure gives me a "/* DDL not accesible */" error. I get teh same results for views, triggers and indexes.
Can someone help me? I have been googling for days!
Edited by: user4714217 on Jan 24, 2013 12:54 PMSELECT v.vnd_c, CASE v.use_parent_addr_flg WHEN 0 THEN a.str_1 ELSE pa.str_1 END AS str_1,
CASE v.use_parent_addr_flg WHEN 0 THEN a.str_2 ELSE pa.str_2 END AS str_2,
CASE v.use_parent_addr_flg WHEN 0 THEN a.str_3 ELSE pa.str_3 END AS str_3,
CASE v.use_parent_addr_flg WHEN 0 THEN a.city ELSE pa.city END AS city,
CASE v.use_parent_addr_flg WHEN 0 THEN a.state ELSE pa.state END AS state,
CASE v.use_parent_addr_flg WHEN 0 THEN a.zipcode ELSE pa.zipcode END AS zipcode,
CAST((CASE v.use_parent_addr_flg WHEN 0 THEN (CASE a.foreign_flg WHEN 1 THEN 'Y' ELSE 'N' END)
ELSE (CASE pa.foreign_flg WHEN 1 THEN 'Y' ELSE 'N' END) END) AS char(1)) AS foreign_flg,
CASE v.use_parent_addr_flg WHEN 0 THEN a.country ELSE pa.country END AS country,
CASE v.use_parent_addr_flg WHEN 0 THEN a.cre_d ELSE pa.cre_d END AS cre_d,
CASE v.use_parent_addr_flg WHEN 0 THEN a.mod_d ELSE pa.mod_d END AS mod_d,
CASE v.use_parent_addr_flg WHEN 0 THEN a.mod_by ELSE pa.mod_by END AS mod_by
FROM dbo.om_vendor AS v LEFT OUTER JOIN
dbo.om_address AS a ON a.vnd_id = v.vnd_id AND a.addr_c = 1 INNER JOIN
dbo.om_owner AS o ON v.owr_id = o.owr_id INNER JOIN
dbo.om_address AS pa INNER JOIN
dbo.primary_vendors AS pv ON pa.vnd_id = pv.vnd_id ON o.part_id = pv.part_id
WHERE (pa.addr_c = 1)
WHICH TRANSLATES TO
SELECT v.vnd_c ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.str_1
ELSE pa.str_1
END str_1 ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.str_2
ELSE pa.str_2
END str_2 ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.str_3
ELSE pa.str_3
END str_3 ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.city
ELSE pa.city
END city ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.STATE
ELSE pa.STATE
END STATE ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.zipcode
ELSE pa.zipcode
END zipcode ,
(CASE v.use_parent_addr_flg
WHEN 0 THEN (CASE a.foreign_flg
WHEN 1 THEN 'Y'
ELSE 'N'
END)
ELSE (CASE pa.foreign_flg
WHEN 1 THEN 'Y'
ELSE 'N'
END)
END) foreign_flg ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.country
ELSE pa.country
END country ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.cre_d
ELSE pa.cre_d
END cre_d ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.mod_d
ELSE pa.mod_d
END mod_d ,
CASE v.use_parent_addr_flg
WHEN 0 THEN a.mod_by
ELSE pa.mod_by
END mod_by
FROM om_vendor v
LEFT JOIN om_address a
ON a.vnd_id = v.vnd_id
AND a.addr_c = 1
JOIN om_owner o
ON v.owr_id = o.owr_id
JOIN om_address pa
JOIN primary_vendors pv
ON pa.vnd_id = pv.vnd_id
ON o.part_id = pv.part_id
WHERE ( pa.addr_c = 1 );
Edited by: user4714217 on Jan 24, 2013 1:43 PM -
How to convert SQL Server hierarchical query (CTE) to Oracle?
How to convert SQL Server hierarchical query (CTE) to Oracle?
WITH cte (col1, col2) AS
SELECT col1, col2
FROM dbo.[tb1]
WHERE col1 = 12
UNION ALL
SELECT c.col1, c.col2
FROM dbo.[tb1] AS c INNER JOIN cte AS p ON c.col2 = p.col1
DELETE a
FROM dbo.[tb1] AS a INNER JOIN cte AS b
ON a.col1 = b.col1See: http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_10002.htm#i2129904
Ah, just spotted it's a delete statement - you won't be able to do it using subquery factoring in Oracle.
I had a go at trying to convert for you, but notice that you reference the cte from inside the cte... I can only assume you have a table called cte too...
DELETE FROM dbo.tb1
WHERE col1 = 12
OR col2 IN (SELECT col1 FROM cte)
Edited by: Boneist on 22-Jun-2009 09:19 -
Migrating SQL Server DB to Oracle DB - probably EASY answer
I completed the tutorial on migrating SQL Server DB to Oracle. When I try on my own database, it all migrated well except anything containing a datetime. When I run the oracle_ctl.bat file and view any of the log files, I see Record 1: Rejected - Error on table DBO_RIVERSIDEDB_NCWCD_TEST.TS6HOUR_TAIN, column DATE_TIME.
ORA-01843: not a valid month. Do I need to change the first line of the file set NLS_DATE_FORMAT=Mon dd YYYY HH:mi:ssAM ? In the .dat file created from the unload_script.bat, the data starts out 1275<EOFD>2007-05-11 00:00:00.000<EOFD>74.900000000000006<EOFD><EOFD><EORD>1275<EOFD>. So my questions is about the date_format - is that the same for all SQL Server databases or do I need to enter something based on MY database? I am definitely a newbie so this is probably a super easy question. Thanks so much for any help!Hello,
There are two different date format in SQL Server.
1] DateTime : 2010-08-03 12:48:15.170
2] SmallDateTime: 2010-08-03 12:48:00
Both the date will be inserted in Oracle Date column.
Is there any automated way to generate datamove script to tackle these differences? I've around 200 tables to be migrated and there may be many such cases.
The issue with Oracle SQL Developer setting i.e. Tools >Preferences> (Under) Migration> Data Move Option, there are two masks we can specify, one for Date Mask and other for Timestamp. How can I set both of these for converting data into Date, not in timestamp.
Below is my .CTL file, none of below fields are timestamp, but since incoming data in in timestamp format, it is applying timestamp mask and eventually failing to insert data into table
load data
infile '[PARTSORDER].dat'
"str '<EORD>'"
into table admin.PARTSORDER
fields terminated by '<EOFD>'
trailing nullcols
ORDERID ,
GenDate "TO_TIMESTAMP(:GenDate, 'YYYY-MM-DD.HH24.MI.SS.ff3')",
Status "DECODE(:Status, CHR(00), ' ', :Status)",
StatusBy ,
StatusDate "TO_TIMESTAMP(:StatusDate, 'YYYY-MM-DD.HH24.MI.SS.ff3')",
Approved ,
ApprovedBy ,
ApprovedDate "TO_TIMESTAMP(:ApprovedDate, 'YYYY-MM-DD.HH24.MI.SS.ff3')",
TrackingNumber "DECODE(:TrackingNumber, CHR(00), ' ', :TrackingNumber)",
SVOther "DECODE(:SVOther, CHR(00), ' ', :SVOther)",
ShippedVia "DECODE(:ShippedVia, CHR(00), ' ', :ShippedVia)",
ShippedBy "DECODE(:ShippedBy, CHR(00), ' ', :ShippedBy)",
ShippedDate "TO_TIMESTAMP(:ShippedDate, 'YYYY-MM-DD.HH24.MI.SS.ff3')",
CompletedBy "DECODE(:CompletedBy, CHR(00), ' ', :CompletedBy)",
CompletedDate "TO_TIMESTAMP(:CompletedDate, 'YYYY-MM-DD.HH24.MI.SS.ff3')",
ORDERType "DECODE(:ORDERType, CHR(00), ' ', :ORDERType)",
RMAID ,
RMANumber "DECODE(:RMANumber, CHR(00), ' ', :RMANumber)",
BackOrdered ,
XORDERID ,
PARTSORDERSENT "DECODE(:PARTSORDERSENT, CHR(00), ' ', :PARTSORDERSENT)",
SHIPMENTID "DECODE(:SHIPMENTID, CHR(00), ' ', :SHIPMENTID)"
Any help in this regard will be highly appreciated!
Thanks
Vinod -
My Experiences re: Migrating SQL Server Database to Oracle
I am using SQL Developer EA4 for thsi conversion, best attempt yet.
I had numerous problems with this conversion.
1. The wizard asked me to specify the new Oracle database; instead it just ignored this information and created an Oracle database similarly named as the SQL Server database. I also noticed a file name "Migration.out" was produced; it contained errors such as:
Error starting at line 3 in command:
CREATE USER Emulation IDENTIFIED BY Emulation DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP
Error at Command Line:3 Column:36
Error report:
SQL Error: ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges" and
Error starting at line 4 in command:
GRANT CREATE SESSION, RESOURCE, CREATE VIEW, CREATE MATERIALIZED VIEW, CREATE SYNONYM,CREATE PUBLIC SYNONYM TO Emulation
Error report:
SQL Error: ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges" and
Error starting at line 7 in command:
CREATE USER dbo_COREv13 IDENTIFIED BY dbo_COREv13 DEFAULT TABLESPACE USERS TEMPORARY TABLESPACE TEMP
Error at Command Line:7 Column:38
Error report:
SQL Error: ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges" and
Error starting at line 8 in command:
GRANT CREATE SESSION, RESOURCE, CREATE VIEW, CREATE MATERIALIZED VIEW, CREATE SYNONYM TO dbo_COREv13
Error report:
SQL Error: ORA-01031: insufficient privileges
01031. 00000 - "insufficient privileges".
I followed all of the steps listed in the "Help" section re: Migrations but still ended up with these errors.
2. My schema consists of 1000+ tables; approximately 10 tables were NOT created. When I copied the SQL from Migration.sql making NO changes and pasted it into the new Oracle database it created without issues.
3. While the conversion is taking place, different objects (constraints, indexes, foreign keys, etc) are shown to be copied; their appears to be ordering of these items. Shouln't a dependancy tree be established, and object converted based on this?
4. Several tables, in my case about 250 tables did NOT get any data copied across. No reasons given.
5. A log of all activities should be produced for review and completeness.
6. I tried to use the "Migrate select tables" option but met with no success. Apparently, it makes an assumption that both the "source" and "target" databases wil be of the same type (ie both SQL Server or both Oracle); this does not make any sense to me since the point of the exercise is to migrate data from one database vendor to another. Obviously, different database vendors use differing datatypes for similar data (ie dates).
7. I noticed in the "Migration" sql that the "Connect" statements are not correct; they were missing the "instance name" portion.
8. Also, when I looked in the "MIGRATION" sql, I could not find any entries for the last step of the conversion - the movement of data from SQL Server to Oracle. Is this intentional or an oversight.
I dont want to appear negative on this Migration; I have used SQL Developer since it inception; in my opinion this is the best attempt to date.
Murray SobolHi Murray,
Thanks for this feedback.
There is a lot of questions here, I think some of it boils down to misunderstandings, which we should clarify in the doc.
Hopefully Ill get a video of a migration online soon as well.
But here is a brief break down.
*1.*
"The wizard asked me to specify the new Oracle database; instead it just ignored this information and created an Oracle database similarly named as the SQL Server database."
So this relates to Step 7 of the Migration Wizard. Where you can select the target connection.
SQL Developer doesn't ignore the Target Connection you selected, It just uses it to connect to the target database , not the target schema.
SQL Developer generates a new target schema for the migrated objects. It standard approach is not to generate objects directly into an existing Schema.
The Target Connection is used to create all the migrated objects (including new Oracle Schemas) in your target oracle database. So you should choose an Oracle Target Connection which has enough privileges to create new Schemas and Objects.
But as you have found, it doesn't generate the migrate objects , like tables, ... , directly into your chosen Target Connection.
From the errors you encountered it doesn't sound like the Target Connection (and the underling Oracle Schema) doesn't have the privileges to create other Schemas.
If you use something like a connection to the SYSTEM schema on your target database, it should run OK.
It wont create any objects in SYSTEM, rather it will use SYSTEM privileges to create a new schema (ex: dbo_Northwind) and populate it.
You don't have to use SYSTEM, but you do need a schema with enough privileges to create other schemas.
That is the straight forward way. But if you really need to generate into an existing schema the following steps can be taken.
a)rename the schema under the Converted Database Objects
b)Right click "Converted Databases Objects" and choose generate. it will kick off the Migration Wizard in the correct place
*2.*
My schema consists of 1000+ tables; approximately 10 tables were NOT created. When I copied the SQL from Migration.sql making NO changes and pasted it into the new Oracle database it created without issues.
When you say Migration.sql , is the entire generation file , which can be found in your <outputspecified>/generated/<projectname.modelname>.sql ?
When your say "pasted it into the new Oracle database" , are you running it in SQL Developers SQL Worksheet using the Target Connection.
Basically your migration is all out of shape once the target Schemas are not created. So the above issues (insufficient privileges) has to be resolved first.
Please post back if it is still an issue.
*3.*
While the conversion is taking place, different objects (constraints, indexes, foreign keys, etc) are shown to be copied; their appears to be ordering of these items. Shouln't a dependancy tree be established, and object converted based on this?
Objects are converted in a particular order and their dependencies are persisted so that they can be generated in the correct order.
Are you seeing an issue?
*4.*
Several tables, in my case about 250 tables did NOT get any data copied across. No reasons given.
I'm surprised any tables were populated with data due to the target schema not being created.
The online data move is pretty simple and it does not report or recover very well from issues.
If you are having difficulties once item 1. is resolved, please post an example of the source table and I will give it a go.
For better control of the data move with much more powerful tweaking, error handling, reporting and performance try the offline data move.
SQL Developer can created a suite of scripts which use SQL Servers BCP tool to dump out the data to dat files, and Oracle SQL*Loader tool to insert the data in the dat file into Oracle.
*5.*
A log of all activities should be produced for review and completeness.
The output/generated/<projectname.modelname>.out provides the output of running the generation script.
The migration reports http://dermotoneill.blogspot.com/2010/11/migration-reports-30.html outline what happens during the migration.
Apart from online data move issues, is there any other data missing?
*6.*
I tried to use the "Migrate select tables" option but met with no success. Apparently, it makes an assumption that both the "source" and "target" databases wil be of the same type (ie both SQL Server or both Oracle); this does not make any sense to me since the point of the exercise is to migrate data from one database vendor to another. Obviously, different database vendors use differing datatypes for similar data (ie dates).
Do you mean "Copy To Oracle" ? This option is intended to migrate tables from non Oracle databases like SQL Server to Oracle.
Can you give more details on what issue you are seeing.
*7.*
I noticed in the "Migration" sql that the "Connect" statements are not correct; they were missing the "instance name" portion.
The generation script is meant to be run using SQL Developers SQL Worksheet. I think you only get this "instance name" issue if running from SQL*Plus.
Can you confirm
8. Also, when I looked in the "MIGRATION" sql, I could not find any entries for the last step of the conversion - the movement of data from SQL Server to Oracle. Is this intentional or an oversight.
The online data move is performed separately from creating the objects. It is not script based, it uses JDBC to pump the data from the source database to the target database.
In summary , I would
a) Create a connection to your Target database using your SYSTEM schema
b) Right click on your "Converted Database Objects" and choose "Generate Target"
c) Choose your new "System" connection as the Target Connection
d) Follow the Migration Wizard to the end.
You will end up with a new target Schema and the migrated objects in it.
Check the .out file to see the errors
and the migration reports http://dermotoneill.blogspot.com/2010/11/migration-reports-30.html
Regards,
Dermot
SQL Developer Team. -
I am trying to have access tables of the Sql Server through the Oracle
I am trying to have access tables of the Sql Server through the Oracle and this being occurred the error:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message: [Generic Connectivity using ODBC][H006] The init parameter <HS_FDS_CONNECT_INFO> is not set.
Please set it in init <orasid>.ora file.
ORA-02063: preceding 2 lines from HSMSQL
I created the ODBC with name HSMSQL.
I made all the configurations in the archives
tnsnames.ora:
HSMSQL=
(DESCRIPTION=
(ADDRESS= (PROTOCOL = tcp)(HOST = wsus)(PORT = 1521))
(CONNECT_DATA =
(SID = HSMSQL)
(HS = OK)
listener.ora:
(SID_DESC = (SID_NAME=HSMSQL)
(ORACLE_HOME= C:\oracle\ora92)
(PROGRAM =hsodbc)
initHS_SID.ora:
HS_FDS_CONNECT_INFO = HSMSQL
HS_FDS_TRACE_LEVEL = OFF
-- Create database link
create database link HSMSQL.US.ORACLE.COM
connect to TESTE identified by TESTE2
using 'HSMSQL';
But when I execute query the error occurs:
Select * from TabTeste@HSMSQL
ORA-28500: connection from ORACLE to a non-Oracle system returned this message: [Generic Connectivity using ODBC][H006] The init parameter <HS_FDS_CONNECT_INFO> is not set.
Please set it in init <orasid>.ora file.
ORA-02063: preceding 2 lines from HSMSQL
Please they help me, thanks, Paulo.Hi,
It seems that your configuration is Ok. By the way, the workaround for this error is:
ORA-28500: connection from ORACLE to a non-Oracle system returned this message:
[Transparent gateway for ODBC][H001] The environment variable <HS_FDS_CONNECT_INFO> is not set.
* Set HS_FDS_CONNECT_INFO in the hs{sid}init.ora file to the data source name.
Example: HS_FDS_CONNECT_INFO = <ODBC DataSource Name>
* Make sure the hs{sid}init.ora file exists in the ORACLE_HOME/hs/admin directory and has the same name as the SID in the LISTENER.ORA.
Example: If SID=hsodbc in the listener.ora file, then the hs{sid}init.ora file would be named ORACLE_HOME/hs/admin/inithsodbc.ora
For more information see if this [url http://forums.oracle.com/forums/thread.jspa?forumID=61&threadID=576975]thread can help you.
Cheers
Maybe you are looking for
-
Every time I try to update my Nano, it says that the software to communicate with the iPod is installed incorrectly. I've tried installing the software so many different times that I can't even begin to count the attpempts and still, it doesn't updat
-
How do I reference a dynamically created MovieClip from another MovieClip?
Hi, I'd be grateful for any pointers to the following problem: I'm having trouble referencing dynamically created MovieClips (links in a side panel on a Flash website, created from an XML file) from the current MovieClip (the currently selected
-
Each time i close firfox my 'new tab' button disapears off my toolbar
I usuall customise my toolbar by dragging the new tab box there. However recently each time i have closed firefox its disappeared? I have to add it again every time. Does anyone know how can I stop this happening? Thanks in advance :D
-
Quick Mask selecting entire photo, not just the area I've painted - CS4
Out of the blue, my Quick Mask selecting has stopped working. Normally I enter QM and paint the area I'm interested in with the brush tool. The selected zone appears in red. When I exit QM the red zone is replaced by a dotted line. But now, when
-
Table Log in Consolidation Module (EC-CS)
Dear Gurus, Does anybody knows in which table are stored changes in consolidation units, or deletion of them?? I have checked in transaction SCU3 but it doesn´t appear... Is it because log is not activated for table TF160? Or there is any other trans