0% found this document useful (0 votes)
93 views20 pages

MSSQL To Tibero Migration

Uploaded by

ddqcwk2cpn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
93 views20 pages

MSSQL To Tibero Migration

Uploaded by

ddqcwk2cpn
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 20

MSSQL to Tibero Migration

1. Overview
An Indonesia securities company offers complete capital market investment services for both
individual and institutional customers with more than 20 years of experience.

Tmax had the opportunity to migrate front office system from MSSQL (SQL Server 2016) to our
Tibero. The goal of this project is functional, performance, and scalability.

2. High-level Architecture
a. High-level Design
To-be Diagram

Blue Area : Database using Tibero Database

Grey Area : Database using MSSQL (existing)

Front Office Area : Application area where end-customer and front office user connected.
Main tasks in Front office are get, show , and generate financial data / report; Modify account/
user data.

Back Office Area : Application area where back office user connected. Main tasks in Back
Office are generate financial calculation , generate regulatory reporting, generate complex
report.
Sync data between front office and backoffice happened twice a day. 1st time before market
open (Market open at 8.30 AM, GMT+7) and at midday (break 1 at 11.30 AM, GMT+7).

b. Tibero Database Design


• Tibero Standby Cluster design

• Tibero Active Cluster Design (2 Nodes)

3. Migration Strategy
Migration from MSSQL to Tibero using following method:

MSSQL -> Oracle DB 11gR2 -> Tibero 6 DB


4. Migration Detail
a. Pre-requisites
Virtual Machines with following specification

OS CentOS 7.9
Oracle DB Version Oracle 11gR2
Redo log size 500M x 3
CPU 2
Memory / RAM 8GB

OS Windows
SQL Developer SQL Developer 22.2.1
CPU 8
Memory / RAM JVM 4 GB – 8 GB , OS RAM 16GB

Tibero Database with following specification

Tibero Version
Tibero6 – FS07_CS_2005 - build (257082)
CPU: 8 VCPU / Node
RAM : 250 GB / Node

Total Objects to-be Migrated


Schemas 2
Table 377
View 8
Index 184
Sequence 14
Trigger 29
Procedure 223
Function 13
Packages 1
Job 4

b. Required Software
SQL Developer

Integrated development environment that simplifies the development and management of


Oracle Database in both traditional and Cloud deployments

T-UP Migration Tools

T-Up is a compatibility analysis and migration utility provided by Tibero DB. This utility
provides functions for analyzing compatibility before migration and migrating all or partial
database schema objects to Tibero. Compatibility analysis determines if the source database's
schema objects, SQL statements, and APIs related to database used in applications can be
supported in Tibero, and analyzes causes for any unsupported items.The migration function
migrates schema objects, such as tables, indexes, and views, and PSM programs from the
source database to Tibero so that they can be used as before.

Network Communication

MSSQL -> Oracle -> Tibero

Need to be in same network (treated as LAN connectivity)

Feature Required (SQL) :

ROWVERSION

Usage: To search the newly updated / inserted data in one table

Create ROWVERSION in Tibero using

- Sequence
- Trigger

- Add additional column for ROWVERSION (now ROWVTBR)


ROWTBR column added in the table using number data type

Example Usage in Application:

Procedure above has main purpose to search the newly updated / inserted data.

DATEDIFF

Create a datediff function on Tibero


SQL> create or replace function datediff( p_what in varchar2,
p_d1 in date,
p_d2 in date ) return number
as
l_result number;
begin
select (p_d2-p_d1) *
decode( upper(p_what),
'SS', 24*60*60, 'MI', 24*60, 'HH', 24, NULL )
into l_result from dual;

return l_result;
end;
/

c. Step-by Step
1. Create Oracle Database instance on Virtual machine
2. Install Oracle SQL Developer
a. SQL Developer
Create a connection from SQL Developer to MSSQL using MSSQL JDBC Driver
Connection created and connected to MSSQL retrieve data
Create Repository Database on Oracle
Create the target migration Database on Oracle

Start to migrate DB

Migration
Check all Tables, procedures, and functions migrated to Oracle DB
If no, re-execute the migration process

After all needed objects migrated,


Perform T-UP migration from Oracle to Tibero
Check the Tibero side for objects : table counts, procedures counts, function
counts.
d. Challenges

1) Data Type Conversion


NCHAR usage will cause internal error when filtering in select statement.

Change to NVARCHAR / VARCHAR2 will resolve the issue.

Note:

Most of MSSQL to Tibero will have this NCHAR data type.

Use Uniform datatype for varchar

o Choosing NVARCHAR or VARCHAR2 at the first time of migration, since if not


define correctly the data cannot be union in complex query.

2) Not all procedures successfully migrated


Many built in function need to re-write to Tibero version

a. Define variable from column using


v_CompanyID company.code%type;
v_CompanyName company.name%type;
v_CompanyAddress company.address%type;
b. Advanced Filtering in SP
OPEN v_cursor1 FOR SELECT mc.ClientID, C.ClientName, mc.OrderDate, mc.BuySell, mc.StockID,
mc.OrderVolume,
datediff('ss',to_timestamp(mc.entrytime,'dd-mon-yyyy hh24:mi:ss'), to_timestamp( to_char(sysdate, 'dd-
mon-yyyy') || ' 14:50:00', 'dd-mon-yyyy hh24:mi:ss') ) ,
mc.OrderID, mc.MatchTime, mc.OrderPrice,
mc.EntryBy,
v_CompanyID as CompanyID, v_CompanyName as CompanyName,
v_CompanyAddress as CompanyAddress
FROM S21_RT_HISTORY.ViewOrder mc
LEFT JOIN Client C ON C.ClientID = mc.ClientID
WHERE
(CAST(mc.OrderDate as DATE) BETWEEN v_Datefrom AND v_Datefrom )
AND mc.OrderVolume >= v_Volume
and
datediff('ss',to_timestamp(mc.entrytime,'dd-mon-yyyy hh24:mi:ss'), to_timestamp( to_char(sysdate, 'dd-
mon-yyyy') || ' 14:50:00', 'dd-mon-yyyy hh24:mi:ss') ) < v_Second
AND (mc.StockID BETWEEN v_StockIDFrom AND v_StockIDTo)
AND mc.Donevolume > 0
ORDER BY mc.OrderDate ASC;
cur := v_cursor1;
return;

c. NVL null will result data anomaly

Replace with space


CounterpartUserID = NVL(v_CounterpartUserID, ' '),

d. UTILS.CONVERT_TO_CHAR function not change in SP

Need to change manually to to_char()

e. Not converted correctly for long procedures (estimated 1000 lines)


Cause:
Nested conditional not correct , hard to debug.

Solution:
Rewrite the stored procedure started with conditional (if-elsif- else)
And put the statement inside one by one

3) Output with dbms_sql.return_result


Client application using ODBC cannot spool dbms_sql.return_result’s result.

Change the SP with following example


CREATE OR REPLACE PROCEDURE S21_RT_PLUS_CP.Broker_GetAllData
(csr out sys_refcursor)
AS
v_cursor SYS_REFCURSOR;
BEGIN

OPEN v_cursor FOR


SELECT *
FROM Broker
ORDER BY BrokerID ;
-- DBMS_SQL.RETURN_RESULT(v_cursor);
csr := v_cursor;
END;

Add csr as out sys_refcursor

Assign csr with v_cursor

4) Sequence caching between 2 nodes Cluster


Sequence not result right sequence due to cache between node 1 and node 2 in cluster

Solution to sync the sequence is to make sequence cache = 0

Note:

It will increase the resource consumption.

5) Character set from MSSQL -> Oracle -> Tibero


6) Date and timestamp format
NLS_DATE_FORMAT

Date format Function – Need to create a date conversion function


CREATE OR REPLACE FUNCTION S21_RT_PLUS_CP.DATEPART(dt IN DATE) return DATE
IS
BEGIN
return to_date(to_char(dt,'YYYYMMDD'),'YYYYMMDD');
END ;

You might also like