# Moving History from MS SQL to Oracle

**URL:** <https://forum.inductiveautomation.com/t/moving-history-from-ms-sql-to-oracle/22425>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [February 7, 2019, 6:47pm UTC](https://forum.inductiveautomation.com/t/moving-history-from-ms-sql-to-oracle/22425 "2019-02-07T18:47:42Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mr\_Joshua](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@Mr\_Joshua](https://forum.inductiveautomation.com/u/Mr_Joshua)\
**Post date:** [February 7, 2019, 6:47pm UTC](https://forum.inductiveautomation.com/t/moving-history-from-ms-sql-to-oracle/22425/1 "2019-02-07T18:47:42Z")

</div>

One of our clients wants us to migrate their Gateway, which I am totally up for doing.  
However, as part of it, we need to move all of our SQL tables…including the history, from MS SQL Server, to Oracle Server.

Now, there are automatic tools for copying a DB, but will this screw up the tables for how Ignition reads them? I mean, are the schemas for the table data going to stay in line?  
Or is there some tool in Ignition that does that kind of conversion?  
I feel like either there isn’t going to be any problem, or there are going to be huge problems…

Any thoughts here?

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 7, 2019, 10:03pm UTC](https://forum.inductiveautomation.com/t/moving-history-from-ms-sql-to-oracle/22425/2 "2019-02-07T22:03:15Z")

</div>

I’d worry more about quoted identifiers in your queries. Square brackets are MS-only. Oracle follows the standard (double-quotes for idenfiers, single quotes for strings). MS can be told to accept the standard (ANSI quotes), so you can start fixing them before you migrate.

---

<div class="post-metadata">

**Author:** ![Sanderd17](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/sanderd17/32/8735_2.png) [@Sanderd17](https://forum.inductiveautomation.com/u/Sanderd17)\
**Post date:** [February 8, 2019, 7:14am UTC](https://forum.inductiveautomation.com/t/moving-history-from-ms-sql-to-oracle/22425/3 "2019-02-08T07:14:21Z")

</div>

Also watch out for case sensitivity.

F.e. if you `SELECT MyColumn` in MsSQL, you get back a dataset with a `MyColumn` column name

But if you do the same in Postgres (and I believe it’s the same in Oracle), you get back a dataset with a lowercase `mycolumn` column name. This is not always a problem, but if you later use that dataset for processing, it might cause bugs.

In Oracle, you will need to `SELECT "MyColumn"` to get it back as `MyColumn` in the dataset.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [February 8, 2019, 1:20pm UTC](https://forum.inductiveautomation.com/t/moving-history-from-ms-sql-to-oracle/22425/4 "2019-02-08T13:20:57Z")

</div>

> [@Sanderd17](#):
>
> Also watch out for case sensitivity.

Yeah, MySQL and SQL Server are case-insensitive, case-preserving when identifiers are unquoted. PostgreSQL is case-sensitive, and lower-cases any unquoted identifiers. Oracle is also case-sensitive, and upper-cases unquoted identifiers. Oracle is the only SQL standard compliant implementation in this regard.

---

<div class="post-metadata">

**Author:** ![Kyle\_Chase](https://avatars.discourse-cdn.com/v4/letter/k/9de0a6/32.png) [@Kyle\_Chase](https://forum.inductiveautomation.com/u/Kyle_Chase)\
**Post date:** [February 8, 2019, 2:52pm UTC](https://forum.inductiveautomation.com/t/moving-history-from-ms-sql-to-oracle/22425/5 "2019-02-08T14:52:51Z")

</div>

MySQL is case sensitive on file systems that are case sensitive, at least for table names. On Linux, as an example. Column names are not case sensitive.

---

<div class="post-metadata">

**Author:** ![Mr\_Joshua](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@Mr\_Joshua](https://forum.inductiveautomation.com/u/Mr_Joshua)\
**Post date:** [March 13, 2019, 9:00pm UTC](https://forum.inductiveautomation.com/t/moving-history-from-ms-sql-to-oracle/22425/6 "2019-03-13T21:00:03Z")

</div>

Thanks for much good advice, folks!

I have managed to get most things running, but doing simple Oracle table reads seem impossible. I can only SELECT everything from the Oracle. “Why” is completely unclear. If I use this:  
SELECT \* FROM FAI\_FUEL\_HIST.DWA\_EVENT2 everything is fine  
If I try to just pull 2 columns, like this:  
SELECT ‘EventNum’, ‘SiteName’ FROM FAI\_FUEL\_HIST.DWA\_EVENT2  
It retrieves those 2 columns, but with all data overwritten as “EventNum” and “SiteName”.

Adding a WHERE clause that should be good, returns 0 rows every time.  
Trying to use ORDER BY does nothing.

If anybody has seen this bizarre behavior with Oracle, let me know.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 13, 2019, 9:01pm UTC](https://forum.inductiveautomation.com/t/moving-history-from-ms-sql-to-oracle/22425/7 "2019-03-13T21:01:49Z")

</div>

> [@Mr\_Joshua](#):
>
> `SELECT ‘EventNum’, ‘SiteName’ FROM FAI_FUEL_HIST.DWA_EVENT2`

Use double quotes - the single quotes are telling Oracle you want to retrieve the literal strings `EventNum` and `SiteName`

---

<div class="post-metadata">

**Author:** ![Mr\_Joshua](https://avatars.discourse-cdn.com/v4/letter/m/48db29/32.png) [@Mr\_Joshua](https://forum.inductiveautomation.com/u/Mr_Joshua)\
**Post date:** [March 14, 2019, 1:39pm UTC](https://forum.inductiveautomation.com/t/moving-history-from-ms-sql-to-oracle/22425/8 "2019-03-14T13:39:28Z")

</div>

That worked, although I could have sworn I tried the double quotes yesterday before I tried the single quotes. Not sure what happened there.  
thanks!
