Showing posts with label MSSQL to Oracle Migration. Show all posts
Showing posts with label MSSQL to Oracle Migration. Show all posts

Tuesday 17 January 2023

MSSQL ( 2008 , 2012 , 2014, 2016 , 2019)   to Oracle ( 19c , 21 c ) Migration using Oracle SQL developer offline method 


Follw the below detailed steps i have used for the migration of complete schema from MSSQL databsae to Oracle database, there is no clear documentation from oracle on this. This is based on my personal troubleshooting. 

1) Install oracle 19C 


2) Install Oracle SQL developer 


3) Create a new schema/user( here name is  xxcs_clob you can use any name)  in oracle (you will have to login using SYSTEM user to oracle DB to create new user) 

Note: Below xxcs_clob is higher level of permissions user this will be used to create the ECM export and import and a new user will be created, this xxcs_clob user can be deleted later once migration is successful
CREATE USER xxcs_clob
  IDENTIFIED BY xxcs_clob 
DEFAULT TABLESPACE users 
TEMPORARY TABLESPACE temp
  PROFILE DEFAULT
  ACCOUNT UNLOCK
  ENABLE EDITIONS;

GRANT ALTER ANY OUTLINE TO xxcs_clob;
GRANT ALTER SESSION TO xxcs_clob;
GRANT ANALYZE ANY TO xxcs_clob;
GRANT SELECT ANY TABLE TO xxcs_clob;
GRANT CREATE ANY EDITION TO xxcs_clob;
GRANT CREATE ANY PROCEDURE TO xxcs_clob;
GRANT CREATE ANY TABLE TO xxcs_clob;
GRANT CREATE ANY TRIGGER TO xxcs_clob;
GRANT CREATE ANY TYPE TO xxcs_clob;
GRANT CREATE SEQUENCE TO xxcs_clob;
GRANT CREATE SESSION TO xxcs_clob;
GRANT CREATE TABLE TO xxcs_clob;
GRANT CREATE TRIGGER TO xxcs_clob;
GRANT CREATE TYPE TO xxcs_clob;
GRANT CREATE VIEW TO xxcs_clob;
GRANT DROP ANY EDITION TO xxcs_clob;
GRANT DROP ANY OUTLINE TO xxcs_clob;
GRANT EXECUTE ANY PROCEDURE TO xxcs_clob;
GRANT QUERY REWRITE TO xxcs_clob;
GRANT ALL PRIVILEGES to xxcs_clob;

grant connect,resource,create view,create materialized view to  xxcs_clob with admin option;
grant resource  to  xxcs_clob with admin option ;
alter user xxcs_clob quota unlimited on users;
grant CREATE ROLE, CREATE USER,  ALTER ANY TRIGGER to xxcs_clob with  admin  option;

grant ALTER ANY ROLE  to xxcs_clob;
grant ALTER ANY SEQUENCE TO xxcs_clob;
grant ALTER ANY TABLE TO xxcs_clob;
grant ALTER TABLESPACE TO xxcs_clob;
grant ALTER ANY TRIGGER TO xxcs_clob;
grant cOMMENT ANY TABLE TO xxcs_clob;
grant CREATE ANY SEQUENCE TO xxcs_clob;
grant  CREATE ANY TABLE TO xxcs_clob;
grant CREATE ANY TRIGGER TO xxcs_clob;
grant CREATE VIEW TO xxcs_clob  WITH ADMIN OPTION;
grant CREATE MATERIALIZED VIEW TO xxcs_clob WITH ADMIN OPTION ;
grant CREATE PUBLIC SYNONYM TO xxcs_clob WITH ADMIN OPTION ;
grant CREATE ROLE TO xxcs_clob;
grant CREATE USER TO xxcs_clob;
grant DROP ANY SEQUENCE TO xxcs_clob;
grant DROP ANY TABLE  TO xxcs_clob;
grant DROP ANY TRIGGER TO xxcs_clob;
grant DROP USER TO xxcs_clob;
grant DROP ANY ROLE TO xxcs_clob;

grant INSERT ANY TABLE TO xxcs_clob;
grant SELECT ANY TABLE TO xxcs_clob;
grant UPDATE ANY TABLE TO xxcs_clob;

4) Login to xxcs_clob schema and click on the migration repository then click on associate migration repository
 



 
If you are getting any error in creating associate migration repository 
Provide below grant from system user and try recreating the migration repository 
            GRANT ALL PRIVILEGES to xxcs_clob;

You may need to truncate first and then delete the migration repository before recreating it using below option 
 



5) Connect to ECM  MSSQL database in Oracle SQL Sever , if you don’t see database type as MSSQL , download the jtds 1.3.1  jar file from https://sourceforge.net/projects/jtds/files/jtds/1.3.1/

Copy it to oracle SQL server installation directory 



 
Go to third party JDBC drivers and add the entry for this jar file 
 


6) Once connected to MSSQL database right click on DB and select migrate to oracle as below 
 



7) Click next select oracle DB connection 
 

 


 


 


 


Sequences are not migrated by default , click on next 









Wait until database migration is complete in the new poupup window as below x




 
If migration is successful you can see below message 
 
Below folders datamove and generated  will be created along with migration files
 


8) Navigate to generated  and run below master.sql file from oracle session connected with  xxcs_clob schema 
 



 
This will ask to enter the password for the new schema which will be Oracle schema where MSSQL DB will be migrated, keep the schema name default, you can change schema name and password later when DB migration is completed successfully 



 
This steps will create lot of migration files in below directory 
5_Migration(Documentation)\ECMMIG\datamove\2023-01-17_01-51-20\CSUserDatabase\csadmin_CSUserDatabase\data

9) Run the oracle_loader.bat file to  export the data generated in above script , this will migrate all the data to newly created user , this will take significant time depending on DB size 
 



10) Once the above step is complete try logging into new schema, schema name is mentioned in master.sql , if you are not able to login , login to system user and reset the password of the schema and unlock the schema (user)  
ALTER  USER  CSADMIN_CSUSERDATABASE   ACCOUNT UNLOCK;

ALTER USER CSADMIN_CSUSERDATABASE IDENTIFIED BY livelink;


11) Connect the new schema CSADMIN_CSUSERDATABASE   to OpenText ECM 

12) By default, Sequences are not migrated you will have to create it manually by creating new oracle schema and create CS tables inside it, and then whatever sequences that database has move it to the migrated database, current sequence value must match the source MSSQL db sequence value so that new ids generated are correct 

13) If you are coming across any unknown error check the thread logs and see if its pointing to any database object, you will have to resolve those errors manually.
14) After migration perform sanity check by comparing the database objhects , count of data in each table, please note that the newly created database will have more table and other objects than the source schema to hold the metadata information generated during migration . 


select * From user_objects where object_type='TABLE';

select * From user_objects where object_type='VIEW';

select * From user_objects where object_type='INDEX';

------ list of objects created in oracle DB------
select distinct object_type From user_objects;

for MSSQL objects statistics you  can use information_schema