Download IBM Database Conversion Workbench 2.0 Oracle to DB2 Conversion Guide IBM Software

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Entity–attribute–value model wikipedia , lookup

Microsoft SQL Server wikipedia , lookup

Extensible Storage Engine wikipedia , lookup

IMDb wikipedia , lookup

SQL wikipedia , lookup

Open Database Connectivity wikipedia , lookup

Concurrency control wikipedia , lookup

Navitaire Inc v Easyjet Airline Co. and BulletProof Technologies, Inc. wikipedia , lookup

Microsoft Jet Database Engine wikipedia , lookup

Functional Database Model wikipedia , lookup

PL/SQL wikipedia , lookup

Relational model wikipedia , lookup

Database wikipedia , lookup

Oracle Database wikipedia , lookup

Database model wikipedia , lookup

Clusterpoint wikipedia , lookup

ContactPoint wikipedia , lookup

Transcript
IBM Software
Information Management
IBM Database Conversion Workbench 2.0
Oracle to DB2 Conversion Guide
Version: 2.0.0
Last Updated: July 10th, 2013
IBM Software
Information Management
Table of Contents
1. Introduction .................................................................................................................................................................... 4
2. Prerequisites................................................................................................................................................................... 5
3. Overview of the Oracle to DB2 Conversion Process ................................................................................................. 6
4. Set Up Your DCW Environment .................................................................................................................................... 7
4.1.
Create a new DCW Conversion Project................................................................................................................. 7
4.2.
Create a new connection profile to the source database ....................................................................................... 8
5. The Oracle to DB2 LUW Task Launcher ...................................................................................................................... 9
6. DDL Extraction ............................................................................................................................................................. 10
6.1.
Overview of the process....................................................................................................................................... 10
6.2.
Extract DDL using a Connection .......................................................................................................................... 10
6.2.1. Prerequisites.......................................................................................................................................... 10
6.2.2. Extract DDL through a Connection ..................................................................................................... 10
6.3.
Extract DDL by generating a custom extraction script ......................................................................................... 13
6.3.1. Generate a custom DDL extraction script .......................................................................................... 13
6.3.2. Run the custom extraction script on your source Oracle database ................................................ 13
6.4 Import DDL .............................................................................................................................................................. 14
6.4.1 Import an existing DDL file ................................................................................................................... 14
7. Compatibility Evaluation ............................................................................................................................................. 15
7.1
Format of the Compatibility Evaluation Report..................................................................................................... 15
7.2
Running the Compatibility Evaluation .................................................................................................................. 15
7.2.1 Prerequisites.......................................................................................................................................... 15
7.2.2 Run the compatibility evaluation......................................................................................................... 15
7.2.3 Submitting your Compatibility Evaluation Report to IBM................................................................. 15
7.3.
Using the Compatibility Evaluation Report........................................................................................................... 16
7.3.1. Prerequisites.......................................................................................................................................... 16
7.3.2. View through your web browser.......................................................................................................... 16
7.3.3. Executive Summary .............................................................................................................................. 16
7.3.4. Technical Summary .............................................................................................................................. 16
7.3.5. Detailed Technical Report .................................................................................................................... 17
7.3.6. Unrecognized lines of code.................................................................................................................. 18
7.4
Using the Compatibility Evaluation Report........................................................................................................... 18
7.4.1. Prerequisites.......................................................................................................................................... 18
7.4.2. View through your web browser.......................................................................................................... 18
7.4.3. Executive Summary .............................................................................................................................. 19
7.4.4. Technical Summary .............................................................................................................................. 19
7.4.5. Detailed Technical Report .................................................................................................................... 19
7.4.6. Unrecognized lines of code.................................................................................................................. 20
8. Code Conversion ......................................................................................................................................................... 21
8.1.
Auto-convert Oracle syntax to DB2 compatible syntax ........................................................................................ 21
8.1.1. Pre-requisites ........................................................................................................................................ 21
8.1.2. Run the auto-conversion ...................................................................................................................... 21
8.2.
Split DDL Function ............................................................................................................................................... 21
8.2.1. Pre-requisites ........................................................................................................................................ 21
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 2 of 38
IBM Software
Information Management
8.2.2. Run the Split DDL Function.................................................................................................................. 21
8.3.
Reviewing the converted code ............................................................................................................................. 22
9. Create the Target DB2 Database ................................................................................................................................ 25
9.1.
Enable the Oracle Compatibility mode ................................................................................................................. 25
9.2.
Create and set up the target DB2 database......................................................................................................... 25
10. Prepare the Target DB2 Database for Data Movement ............................................................................................ 26
10.1. Deploy Objects for Data Movement ..................................................................................................................... 26
10.1.1.
10.1.2.
Pre-requisites................................................................................................................................... 26
Execute the DDL statements to create table spaces and tables ................................................ 26
11. Data Movement............................................................................................................................................................. 28
11.1. Overview of the process....................................................................................................................................... 28
11.2. Extract and Load Data from Files......................................................................................................................... 28
11.2.1.
11.2.2.
11.2.3.
11.2.4.
11.2.5.
Pre-requisites................................................................................................................................... 28
Extract data to flat files ................................................................................................................... 28
Load data from flat files .................................................................................................................. 29
Resuming your data load................................................................................................................ 29
Verifying your data load.................................................................................................................. 30
11.3. Data movement using pipes................................................................................................................................. 31
11.3.1.
11.3.2.
11.3.3.
11.3.4.
Pre-requisites................................................................................................................................... 31
Starting the data movement using pipes ...................................................................................... 31
Resuming your data movement ..................................................................................................... 34
Verifying your data movement ....................................................................................................... 34
11.4. Data movement using federation ......................................................................................................................... 35
11.4.1.
11.4.2.
11.4.3.
11.4.4.
11.4.5.
11.4.6.
Pre-requisites................................................................................................................................... 35
Set-up the target DB2 database for federation ............................................................................. 35
Configure Oracle client software ................................................................................................... 35
Data movement using Federation .................................................................................................. 35
Resuming your data movement ..................................................................................................... 36
Verifying your data movement ....................................................................................................... 36
12. Deploy Remaining Objects.......................................................................................................................................... 37
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 3 of 38
1. Introduction
The IBM® Database Conversion Workbench (DCW) integrates many of the tools used for database conversions into a
single integrated development environment. Whether converting to IBM DB2 for Linux, UNIX and Windows version
(referred as DB2 in this document) from another relational database management system (RDBMS), or migrating from
one version of DB2 to another, DCW provides an easy to use framework to take you through the conversion or migration
process.
DCW is provided as a plug-in to IBM Data Studio, a no-charge graphical tool based on an Eclipse® platform. IBM Data
Studio helps database developers and administrators manage, administer, and develop heterogeneous database
environments for increased productivity and collaboration. For more information, visit:
http://www.ibm.com/software/data/optim/data-studio/
As an integrated workbench, DCW provides the following benefits to the user:
-
Common graphical interface with uniform look and feel for all phases of the conversion
A consolidated process with well defined steps based on best practices
Faster enablement for client and partner teams in conversion methodology
Wizards that guide users through all steps of the conversion
DCW offers a variety of tools for Oracle® conversion or DB2 migration is comprised of several tools that can be used
together to take a user through all the steps of a database conversion. Conversely, each tool can also be used separately
based on user preference and need.
DCW offers the following step-by-step functions to facilitate the process.
1. DCW Task Launcher - An integrated help guide, which provides step by step instructions through the conversion
process.
2. DDL Extraction - Extracts objects in the source database, used by DCW to analyze the source database and
provide compatibility assessment and work effort.
3. Compatibility Evaluation – Provides a report of the estimated compatibility ratio of Oracle SQL and PL/SQL
statements with DB2 10.1 or DB2 10.5, outlining the major issues of the conversion, code that was autoconverted, as well as code that must be fixed manually.
4. Code Conversion - Auto-converts Oracle syntax to DB2 compatible syntax. This streamlines a time consuming
process.
5. Split DDL – splits a single DDL file into multiple files, organized by object types, which can then be executed
against the target DB2 database to create the required objects.
6. Package Visualizer - Generates a dependency graph of objects in the source database.
7. Data Movement - Extracts and loads data from the source Oracle database to the target DB2 database. Various
methods are available.
IBM Software
Information Management
2. Prerequisites
The IBM Database Conversion Workbench is a plug-in for Data Studio. Data Studio must first be installed on your
machine before installing DCW.
For the DCW 2.0 plug-in, the following requirements must be met:
•
IBM Data Studio 4.1 full client
o Available for download at: http://www.ibm.com/developerworks/downloads/im/data/
o DCW 2.0 is also compatible with IBM Data Studio 3.2 but the latest version 4.1 is recommended
For installation requirements and instructions, see the IBM DCW 2.0 Plug-In Installation Guide:
http://www.ibm.com/developerworks/data/ibmdcw
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 5 of 38
IBM Software
Information Management
3. Overview of the Oracle to DB2 Conversion Process
This guide assumes that the reader has fundamental knowledge of DB2 databases. For references and training, see:
http://www.software.ibm.com/data/db2
A standard conversion consists of the following steps:
The Database Conversion Workbench provides an integrated environment to help facilitate the Oracle to DB2 conversion
process. It includes many functions that help take the user through the conversion steps described in this diagram.
It is highly recommended for novice users to follow the process from beginning to end. While DCW supports the use of the
various conversion functions separately, this approach is beyond the scope of this guide and recommended only for more
advanced users.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 6 of 38
IBM Software
Information Management
4. Set Up Your DCW Environment
4.1.
Create a new DCW Conversion Project
In order to access the functions of the Database Conversion Workbench, you need to create a new DCW project.
i.
ii.
From Data Studio, navigate to menu File > New > Project7 then select the DCW Project wizard.
Enter the Project Name, type of Source Database and Target Database. For an Oracle to DB2
conversion, select “Oracle” as the Source Database and the appropriate DB2 version as the
Target Database.
iii.
Click Finish. You might be asked to switch to the Database Conversion perspective. Click Yes
to confirm the switch, and note that the following views are available:
•
•
•
•
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Project Explorer view – lists all projects and relevant files.
Data Source Explorer view – lists all existing database connection profiles.
Administration Explorer view – lists all existing database connection profiles and
provides access to DB2 administration functions.
DCW Oracle to DB2 Task Launcher – launches the various wizards and help topics.
Page 7 of 38
IBM Software
Information Management
4.2.
Create a new connection profile to the source database
If you can directly connect to the source database from your local machine, you can set up a connection profile for the
source database. This information is stored by Data Studio and provides quick and easy access to the source
database.
i.
ii.
iii.
In the Data Source Explorer view, right click on Database Connections and select New. The
New Connection wizard opens.
Select “Oracle” as the database manager and choose the appropriate JDBC driver. If this is the
first time you connect to an Oracle source, you will need to edit the location of the Oracle JDBC
driver JAR files.
Enter the connection information for the source database then select Finish. You will see the new
database connection listed in the Data Source Explorer view.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 8 of 38
IBM Software
Information Management
5. The Oracle to DB2 LUW Task Launcher
The Database Conversion Workbench comes with a built in “Task Launcher”, which acts as an assistant to launch the
various steps of the conversion process.
The Task Launcher is available after a DCW project has been created, and can be accessed at any time through the
‘Help’ menu. Included with the task launcher are the DCW Help Topics which offer directions on how to access the
various functions through your Project Explorer view, as well as helpful hints and step-by-step guidelines to follow for
your conversion project. These help topics are automatically displayed when a process step is selected in the task
launcher.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 9 of 38
IBM Software
Information Management
6. DDL Extraction
6.1.
Overview of the process
The Database Conversion Workbench can extract the DDL for the source Oracle database objects through an online
connection, or by generating a custom DDL extraction script that can be manually executed by the user.
The DDL extraction process can be accessed using the DDL Extraction wizard.
i.
6.2.
In the Project Explorer view, right-click on your DCW Project and navigate to Database
Conversion > Extract DDL. The DDL Extraction Wizard opens.
Extract DDL using a Connection
This is the recommended method if it is possible to directly connect to the source database through Data Studio.
6.2.1.
Prerequisites
• Ensure that you have a connection profile of the source database as outlined in section 4.2
6.2.2. Extract DDL through a Connection
The Database Conversion Workbench can extract the objects from an entire database or select schemas.
i.
From the DDL Extraction wizard, select Extract DDL using a connection. Click Finish. The
Extract DDL through a connection wizard opens.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 10 of 38
IBM Software
Information Management
i.
On the first page, select the connection profile of your source Oracle database. Click Next.
ii.
On the second page, select the schemas that you want to extract. Click Next.
Note: The DDL Extraction will create a single file for all extracted objects. You might want to run
the process separately for batches of schemas.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 11 of 38
IBM Software
Information Management
iii.
iv.
On the third page, select the elements that you want to include in the DDL file. Click Next.
On the fourth page, select the objects types that you want to extract. Click Next.
v.
On the fifth page, select your DCW Project and specify the name of the script file. Verify the
preview of the DDL script and specify the terminator you want to use. Click Next.
IMPORTANT NOTE: If you are extracting application objects (stored procedures, UDFs, triggers,
etc), you must change the terminator character to “/” then click Apply to avoid conflicts with the
default terminator “;”.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 12 of 38
IBM Software
Information Management
vi.
vii.
6.3.
On the sixth page, verify the summary of the wizard. Click Finish.
The DDL file is saved under the selected DCW Project in the Project Explorer view.
Extract DDL by generating a custom extraction script
6.3.1. Generate a custom DDL extraction script
If a connection to the source Oracle database is unavailable, DCW can still help you extract the DDL from the
source Oracle database. This is done by using DCW to generate a custom DDL extraction script, which can then
be manually run on your source Oracle database. Note that the Generate Custom DDL Extraction Script wizard
can also be accessed through the Oracle to DB2 LUW Task Launcher.
i.
From the DDL Extraction wizard, select Generate DDL extraction script. Click Finish. The
Generate Custom DDL Extraction Script wizard opens.
ii.
Complete the steps of the wizard.
a. On the first page, specify the name of the DDL files that are to be generated as a result of the
extraction script. Specify the name of the script file and the directory to which you want to save.
It is recommended that you select Exclude all system schemas, so that the script extracts all
the user generated schemas except for the Oracle default system schemas. Click Finish.
The custom extraction script can be found in the directory that you specified.
iii.
6.3.2. Run the custom extraction script on your source Oracle database
You can execute the custom extraction script through Oracle SQL*Plus from a machine that has access to the
source Oracle database server. Manually running the script is outside of the scope of this guide.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 13 of 38
IBM Software
Information Management
6.4 Import DDL
6.4.1 Import an existing DDL file
If you already have a DDL file of your source Oracle database (from the custom script or other sources), you can
import the file into your DCW project.
i.
ii.
iii.
In the Project Explorer view, right-click on your DCW Project and navigate to Database
Conversion > Import a DDL file. The Import wizard opens.
Specify the directory of the DDL file and select the DDL file you want to import. Select the folder
(DCW project) into which you want to import the DDL file. Click Finish.
The DDL file is imported into your DCW Project, and automatically converted to a .sql extension.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 14 of 38
IBM Software
Information Management
7. Compatibility Evaluation
With a simple click of a button, the IBM Database Conversion Workbench can analyze Oracle DDL and PL/SQL
statements and create an assessment report which outlines the compatibility of a source Oracle database with DB2. The
compatibility evaluation report includes an executive summary and a detailed list of DDL and PL/SQL incompatibilities, as
well as some suggested workarounds to fix the incompatible code. These issues can be addressed once the code
conversion has been run in section 8.
7.1
Format of the Compatibility Evaluation Report
By default, the report is saved in an encrypted format in a file with .xmle extension. Section 7.3 explains how to
decrypt and visualize the report.
NOTE: IBMers can authenticate using their IBM Intranet ID and DCW will save the report directly as an HTML file.
You will be able to see the results right away without the need to submit the .xmle file for decryption. This can be
done by navigating to Window > Preferences > Database Conversion Workbench. This will allow you to
authenticate and generate the decrypted report automatically.
7.2
Running the Compatibility Evaluation
The Compatibility Evaluation is done by analyzing the DDL file of the source Oracle database.
7.2.1
Prerequisites
• Ensure that you have a DDL file of the source Oracle database as outlined in section 6.
7.2.2
i.
Run the compatibility evaluation
Right-click on the .sql file containing the Oracle DDL. Navigate to Database Conversion > Evaluate
Compatibility. The Compatibility Evaluation wizard opens.
Hint: You can run the compatibility evaluation on multiple DDL files at once.
ii.
iii.
7.2.3
Select the Source SQL dialect as Oracle and the Target SQL dialect as the DB2 version you are
converting to then click Finish.
The Evaluation Report (.xmle file) is saved to your project folder.
Submitting your Compatibility Evaluation Report to IBM
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 15 of 38
IBM Software
Information Management
The Compatibility Evaluation generates an encrypted .xmle report as < file_name>-<timestamp>_report.xmle. This
encrypted report must be sent to IBM, and the decrypted report is emailed back to you.
NOTE: The .xmle file does not contain any source code. It only contains the list of incompatibilities found and the
number of occurrences in the original source code.
Using your desired email client, submit the .xmle file to [email protected]
An email response is sent back containing the HTML version of the Evaluation Report, which can be viewed through
your web browser.
7.3.
Using the Compatibility Evaluation Report
The Evaluation Report is a key part of the conversion process, and outlines the various compatibility issues in the
syntax between Oracle and DB2. This section outlines how to use the Evaluation Report to correctly address any
issues that are reported, once the code conversion has been run.
7.3.1.
Prerequisites
• Ensure that you have the HTML version of the Evaluation Report. Please see section Error!
Reference source not found. for more details.
7.3.2. View through your web browser
You can open the Evaluation Report using your preferred browser by double clicking on the file. You can also
import the Evaluation Report into Data Studio, and use the native browser in Data Studio.
i.
ii.
iii.
iv.
v.
Right-click on your DCW Project and select Import. The Import wizard opens.
Expand the General folder and select File System. Click Next.
Select Browse, and navigate to the directory in which the HTML Evaluation Report is located. Once
the folder is open, select the HTML Evaluation Report. Click Finish.
The report is now in your DCW Project.
In your DCW Project, right-click on the HTML Evaluation Report and select Open With > Web
Browser. The Evaluation Report opens.
7.3.3. Executive Summary
This section of the report shows the compatibility percentage of all PL/SQL and DDL statements that can run
natively on a DB2 database, which has been enabled for Oracle compatibility.
7.3.4. Technical Summary
Under Technical Summary section, the PL/SQL and DDL summary provides statistics on the number of
statements analyzed, and the number of statements that require attention.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 16 of 38
IBM Software
Information Management
Total Number is the total count of statements and objects that was detected.
The Number that Require Attention is the count of Oracle statements/objects that are not immediately
transferrable to DB2 and require attention.
NOTE: Statements and objects that can be auto-converted by DCW are not included in the count of “Number
that Require Attention”.
7.3.5. Detailed Technical Report
Near the bottom of the report is a link to expand the Evaluation Report to show a detailed analysis of the
statements. The unsupported Oracle statements that require attention are listed here. These statements must be
altered or removed since DB2 does not recognize the syntax used. This can be done after the code conversion
has been run in section Error! Reference source not found..
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 17 of 38
IBM Software
Information Management
You can expand or collapse each incompatible feature by clicking on the statement. For each issue identified, the
report provides a list of all occurrences with the corresponding line number of the statement in the original DDL
code, the portion of the syntax that contains the error, and a recommended solution.
7.3.6. Unrecognized lines of code
The very last section of the report contains lines of code that the Compatibility Evaluation was not able to
recognize. These statements might or might not be compatible with DB2.
You can check the code by referring to the line number that is listed.
7.4
Using the Compatibility Evaluation Report
The Compatibility Evaluation Report is a key part of the conversion process, and outlines the various compatibility
issues in the syntax between Oracle and DB2. This section outlines how to use the report to correctly address any
issues identified, once the code conversion has been run.
7.4.1.
Prerequisites
• Ensure that you have the HTML version of the report. Please see section 7.2 for more details.
7.4.2. View through your web browser
You can open the Evaluation Report using your preferred browser by double clicking on the file. You can also
import the Evaluation Report into Data Studio, and use the native browser in Data Studio.
vi.
vii.
viii.
Right-click on your DCW Project and select Import. The Import wizard opens.
Expand the General folder and select File System. Click Next.
Select Browse, and navigate to the directory in which the HTML Evaluation Report is located. Once
the folder is open, select the HTML Evaluation Report. Click Finish.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 18 of 38
IBM Software
Information Management
ix.
x.
The report is now in your DCW Project.
In your DCW Project, right-click on the HTML Evaluation Report and select Open With > Web
Browser. The Evaluation Report opens.
7.4.3. Executive Summary
This section of the report shows the compatibility percentage of all PL/SQL and DDL statements that can run
natively on a DB2 database, which has been enabled for Oracle compatibility.
7.4.4. Technical Summary
Under Technical Summary section, the PL/SQL and DDL summary provides statistics on the number of
statements analyzed, and the number of statements that require attention.
Total Number is the total count of statements and objects that was detected.
The Number that Require Attention is the count of Oracle statements/objects that are not immediately
transferrable to DB2 and require attention.
NOTE: Statements and objects that can be auto-converted by DCW are not included in the count of “Number
that Require Attention”.
7.4.5. Detailed Technical Report
Near the bottom of the report is a link to expand the Evaluation Report to show a detailed analysis of the
statements. The unsupported Oracle statements that require attention are listed here. These statements must be
altered or removed since DB2 does not recognize the syntax used. This can be done after the code conversion
has been run in section .
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 19 of 38
IBM Software
Information Management
You can expand or collapse each incompatible feature by clicking on the statement. For each issue identified, the
report provides a list of all occurrences with the corresponding line number of the statement in the original DDL
code, the portion of the syntax that contains the error, and a recommended solution.
7.4.6. Unrecognized lines of code
The very last section of the report contains lines of code that the Compatibility Evaluation was not able to
recognize. These statements might or might not be compatible with DB2.
You can check the code by referring to the line number that is listed.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 20 of 38
IBM Software
Information Management
8. Code Conversion
The IBM Database Conversion Workbench offers a powerful tool that can auto-convert well known Oracle syntax to
DB2 compatible syntax.
8.1.
Auto-convert Oracle syntax to DB2 compatible syntax
8.1.1.
Pre-requisites
• Ensure that you have a DDL file of the source Oracle database as outlined in section 6 - DDL
Extraction.
8.1.2.
Run the auto-conversion
Right-click on the DDL file of your source Oracle database in your DCW Project. Navigate to
Database Conversion > Convert Code7 The Code Conversion wizard opens.
ii.
Select the Source SQL dialect and Target SQL dialect. Click Finish.
iii.
The converted DDL file is located in your DCW Project folder, named “<originalfilename><timestamp>_converted.sql”
i.
Note: The code conversion automatically changes all statement terminators to ‘@’
8.2.
Split DDL Function
After the Code Conversion has been run, DCW has an optional, yet useful, function to convert a single DDL file into
multiple files organized by object type. This function helps to stream-line your Oracle to DB2 conversion process by
providing a much more intuitive code organization. Furthermore, it breaks down a large DDL file into smaller and more
manageable components, which allows multiple team members to work on various files.
*NOTE: Subsequent sections of this guide assumes that the Split DDL function has been run.
8.2.1.
Pre-requisites
• Ensure that you have a DDL file of the source Oracle database as outlined in section 6
• Ensure that you have run the Code Conversion as outlined in section 8.1
8.2.2.
Run the Split DDL Function
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 21 of 38
IBM Software
Information Management
i.
ii.
iii.
iv.
v.
8.3.
Right-click on the converted DDL File of your source Oracle database in your DCW Project.
Navigate to Database Conversion > Split DDL Files7 The Split SQL Files wizard opens.
Select the appropriate Statement terminator. It is recommended that you use “@” since the code
conversion has automatically changed all terminators to ‘@’. Click Next.
View the list of objects. Click Next.
View the summary. Click Finish.
A new folder is created in your DCW Project that contains the split code.
Reviewing the converted code
You can review the converted code in Data Studio by double clicking on the SQL file.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 22 of 38
IBM Software
Information Management
DCW does one of the following four things:
• Remove code fragment – DCW comments out fragments of code that are not required on DB2. These
are tagged in the converted code with “Code Fragment”.
• Auto-convert code – DCW automatically makes updates to code to make it compatible with DB2 while
maintaining the semantics of the original code. These statements are not tagged.
• Requires Attention – Code is marked as “requires attention” and is converted to DB2 compatible syntax
so that the statement can compile and execute successfully. Although due to differences in behavior
between DB2 and Oracle, it might raise issues during runtime in very specific scenarios. For instance,
DCW converts any NUMBER(N) where N is greater than 31 (max precision in DB2) to NUMBER(31)
which works for a great majority of scenarios.
• Evaluation Issue – DCW highlights statements that were identified in the Evaluation Report as being a
potential issue. These are tagged in the converted code as “DCW Evaluation Issue”
At this point, you must manually edit the converted code to be fully compatible with DB2.
1. Review code that requires attention.
a. You can search the string “requires attention” by using CTRL+F.
b. In the following example, the MAXVALUE statement was auto-converted from 28 digits to 27 digits,
since DB2 only accepts up to 27 digits. In most cases, this is not a problem. However, DCW has
identified it as requiring attention so that the user is aware that this change has been made, and
might become an issue if 28 digits are required.
c.
You can search the remaining converted code for the next statement that “requires attention” and
review it appropriately.
2. Review code with Evaluation Issue
a. You can search the string “DCW Evaluation Issue” by using CTRL+F.
b. In the following example, the BEFORE trigger must be invoked with a FOR EACH ROW statement.
This was also outlined in the Evaluation Report.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 23 of 38
IBM Software
Information Management
You can add the FOR EACH ROW statement to the converted code, so that it can run on DB2.
c.
You can search the remaining converted code for other statements with “DCW Evaluation Issue”
and review it appropriately.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 24 of 38
IBM Software
Information Management
9. Create the Target DB2 Database
Creation and set up of the target DB2 database require manual steps that are not supported by DCW. Complete the
following steps to create and set up the target database.
9.1.
Enable the Oracle Compatibility mode
i.
ii.
9.2.
In the DB2 command line, start DB2 and enter the command db2set
DB2_COMPATIBILITY_VECTOR=ORA. This will enable the Oracle Compatibility feature.
Stop and restart DB2 using db2stop and db2start.
Create and set up the target DB2 database
Run the CREATE DATABASE command at the target server to create your target database. For more information
about this command, see:
http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.cmd.doc%2Fdoc%2Fr00
01941.html
Alternatively, you can use Data Studio to create the database. These topics can be accessed by selecting Help
Contents from the Data Studio Help menu.
After the database is created, you can adjust the database configuration parameters according to your needs using
the UPDATE DATABASE CONFIGURATION command. For more information about this command, see:
http://pic.dhe.ibm.com/infocenter/db2luw/v10r5/topic/com.ibm.db2.luw.admin.cmd.doc/doc/r0001987.html
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 25 of 38
IBM Software
Information Management
10.
Prepare the Target DB2 Database for Data Movement
This step involves executing the extracted DDL statements against the target DB2 database to re-create the Oracle
database objects.
10.1. Deploy Objects for Data Movement
Before transferring data from the source Oracle database to the target DB2 database, the target tables and other
required objects must first be created.
In this step, you use the DDL files from the Split DDL function to create table spaces and tables on the target DB2
database.
10.1.1. Pre-requisites
• Ensure that you have extracted the DDL statements from the source Oracle database.
• Ensure that the Split DDL function has been executed on the extracted DDL file.
• If applicable, ensure that you reviewed and fixed any incompatibilities highlighted in the Evaluation
Report and Code Conversion.
• Ensure that the target DB2 database has been created and it is set up properly.
10.1.2. Execute the DDL statements to create table spaces and tables
i. Using the Project Explorer view, navigate to [DCW_project] > [folder_with_split_DDL_files] >
Base Objects.
ii. Execute the DDL statements in DDL_tablespace.sql and DDL_table.sql.
This can be done by using the SQL Editor in Data Studio, accessible by double clicking
on any SQL file to open it.
1. Select the target DB2 database in the Connection field.
2. Select RUN, by selecting the green play button on the top right corner.
3. The results and status are displayed in the SQL Results tab.
Alternatively, you can use the DCW Run SQL Files7 command to execute multiple files
at once.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 26 of 38
IBM Software
Information Management
1. Select the SQL file(s) that you want to run. You can also select the folder to run
all of the SQL files in a folder.
2. Right-click and navigate to Database Conversion > Run SQL FilesT
3. Set your Statement delimiter to ‘@’. Click Finish.
4. Select the Connection profile of your target database. Click Finish.
5. The scripts execute.
Note: The files listed above are only an example. Some of these files might not be present in
your project because the objects were not extracted, or they do not exist in the source database.
Note: You might also need to execute DDL statements to create objects required by your table
definitions, such as user-defined types.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 27 of 38
IBM Software
Information Management
11.
Data Movement
After the target DB2 database has been created and properly set up, you are now ready to move your data from the source
Oracle database to the target DB2 database.
11.1. Overview of the process
The Database Conversion Workbench provides multiple methods to transfer data from one database to another. The
Data Movement wizard provides an easy to use method that takes the user step-by-step to transfer the data for entire
schemas.
11.2. Extract and Load Data from Files
11.2.1. Pre-requisites
• Ensure that a connection to the source Oracle database exists
• Ensure that the target DB2 database is created and properly set up
• Ensure that the tables receiving the data have been created on the target DB2 database
• You may need the appropriate database admin privileges (DATAACCESS)
• You may need the appropriate OS admin privileges
11.2.2. Extract data to flat files
Note that this wizard is accessible from the Oracle Task Launcher.
i.
ii.
Right-click on the DCW Project and navigate to Database Conversion > Extract Data... The
Extract Data to Flat Files wizard opens.
Complete the steps of the wizard.
a. Select the source Oracle database. Click Next.
b. Select the schema that you want to move. Enter the output directory for the flat files and logs.
Click Next.
c.
Select the tables you want to move. Click Next.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 28 of 38
IBM Software
Information Management
d. Specify the data movement configuration parameters. For novice users, this can be left as
default. Click Next.
e. View the summary. Click Finish.
f. The extraction log is automatically displayed in Data Studio. The data is extracted to the
directory specified in step c with the file extension “.tables”.
g. You can copy the specified directory to a desired storage medium and transfer it to a different
computer.
11.2.3. Load data from flat files
Note that this wizard is also accessible from the Oracle Task Launcher.
i.
ii.
Right-click on the DCW Project and navigate to Database Conversion > Load Data... The Load
Data wizard opens.
Complete the steps of the wizard.
a. Select the target DB2 database. Click Next.
b. Select the directory containing the extracted flat files. Click Next.
c. View the summary. Click Finish.
d. The wizard runs the deployment process and shows a progress dialog until the process is
complete.
11.2.4. Resuming your data load
You can stop the data movement process at anytime by pressing the Cancel button and resume it later.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 29 of 38
IBM Software
Information Management
To resume a data movement job, start the Data Movement wizard again. If the previous job was
cancelled by the user, or errors occurred so that data was not transferred for all tables, DCW will prompt
you to resume the pending job or start a new one.
11.2.5. Verifying your data load
You can check the log and message files located in the Data Movement folder in your DCW project,. If
the data transfer was successful, these files provide a row count of each table, which can be used to
ensure that all of the data has been moved correctly. In case of failure, the log files contain detailed
information about the errors that occurred.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 30 of 38
IBM Software
Information Management
11.3. Data movement using pipes
When a simultaneous connection with the source Oracle database and target DB2 database is available, DCW can
move data through a connection, without the need to save to a separate storage media.
11.3.1. Pre-requisites
• Ensure that a connection to the source Oracle database exists
• Ensure that the target DB2 database is created and properly set up
• Ensure that the tables receiving the data have been created on the target DB2 database
• Ensure that the DB2 user has admin privileges (DATAACCESS)
• Ensure that the user that started Data Studio is able to execute the “db2” command from the
command line
o On Windows 7, you need to start Data Studio with Administrator privileges
o On Linux, the user must have the DB2 profile set up. To verify, open a command
prompt and execute the “db2”. The command should execute without errors.
11.3.2. Starting the data movement using pipes
Note that this wizard is also accessible from the Oracle Task Launcher.
i.
ii.
iii.
Right-click on the DCW Project and navigate to Database Conversion > Move Data... The Move
Data wizard opens.
Select Data movement using pipes. The Data Movement Using Pipes wizard opens.
Complete the steps of the wizard.
a. On the first page, either select an existing Oracle database connection or create a new
connection by clicking New.... Continue to the next page.
b. On the second page, select an existing target DB2 database connection or create a new
connection by clicking New.... Continue to the next page.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 31 of 38
IBM Software
Information Management
c.
On the third page, select the Schema that you want to extract. Click Next.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 32 of 38
IBM Software
Information Management
d. On the fourth page, select the Tables that you want to extract. Click Next.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 33 of 38
IBM Software
Information Management
e. On the fifth page, specify the data movement configuration parameters. For novice users, this
can be left as default. Click Next.
f. View the summary. Click Finish.
g. The extraction starts and the progress is displayed. A log is automatically displayed in Data
Studio after the process is finished. These logs are also created in your DCW Project under the
Data Movement Folder.
11.3.3. Resuming your data movement
You can stop the data movement process at anytime and resume it later by repeating the first step. DCW will
automatically pick up where it left off.
11.3.4. Verifying your data movement
You can check the log and message files located in the Data Movement folder in your DCW project. If
the data transfer was successful, these files provide a row count of each table, which can be used to
ensure that all of the data has been moved correctly. In case of failure, the log files contain detailed
information about the errors that occurred.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 34 of 38
IBM Software
Information Management
11.4. Data movement using federation
DCW also supports the movement of data by leveraging DB2 federation capabilities.
11.4.1. Pre-requisites
• Ensure the target DB2 system is capable of federation to Oracle data sources. Some DB2 editions
have this capability built in. For the others, IBM InfoSphere Federation Server must be installed on
the target DB2 system.
• Ensure that a connection to the source Oracle database exists
• Ensure that the target DB2 database is created and properly set up
• Ensure that the tables receiving the data have been created on the target DB2 database
• Oracle client software must be installed on the system hosting the target DB2 database.
11.4.2. Set-up the target DB2 database for federation
The FEDERATED parameter needs to be enabled on the target DB2 instance before you can move objects into
the target DB2 database. This is done by updating the database manager configuration.
i.
ii.
iii.
From the DB2 CLP, ensure that the instance has been started
Type the following command to enable federation: db2 update dbm cfg using federated yes
Restart the instance.
*Note: Your database might have federation enabled by default. You can use the following command in your DB2
CLP to verify this: db2 get database manager configuration
11.4.3. Configure Oracle client software
•
•
•
•
In the case of a Linux or UNIX operating system, set the ORACLE_HOME environment variable on
your target environment. In the case of a Windows environment, this is automatically done.
Insert the ORACLE_HOME variable into \$DB2PATH$\cfg\db2dj.ini file.
Set up the Oracle client configuration file "tnsnames.ora" located in
"\$ORACLE_HOME$\NETWORK\ADMIN".
Add the following lines and change the specified values:
alias_name =
(DESCRIPTION =
(ADDRESS =
(PROTOCOL = TCP)
(HOST = oracle_host)
(PORT = host_port)
)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oracle_sid)
)
)
Test the Oracle connection:
Run the command "tnsping alias_name" on the command line prompt.
Connect to the Oracle database through SQL Plus: sqlplus user/password@alias_name
11.4.4. Data movement using Federation
i.
Using the Project Explorer view, right-click on your DCW project and navigate to Database
Conversion > Move Data... Select Data movement using federation. Click Finish.
ii.
Complete the steps of the Move Data Using Federation wizard.
a. Review the requirements on the first page of the wizard. Click Next.
b. On the second page of the wizard, select the source Oracle database. Click Next.
c. On the third page of the wizard, select the target DB2 database. Click Next.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 35 of 38
IBM Software
Information Management
d. On the fourth page of the wizard, specify the name (alias) of the source Oracle database as
listed in your tnsnames.ora file.
e. Provide the user ID and password that is to be used to run the data load. The wizard
automatically populates these fields with the same values from the source database connection
profile, but you can change them as appropriate.
f. Select the schema(s) that you want to move. Click Next.
g. DCW creates wrappers for your objects, and provides a summary.
h. Click Finish to start the data movement.
11.4.5. Resuming your data movement
You can stop the data movement process at anytime and resume it later by repeating the first step. DCW will
automatically pick up where it left off.
11.4.6. Verifying your data movement
You can check the log and message files located in the Data Movement folder in your DCW project. If
the data transfer was successful, these files provide a row count of each table, which can be used to
ensure that all data has been moved correctly. In case of failure, the log files contain detailed
information about the errors that occurred.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 36 of 38
IBM Software
Information Management
12.
Deploy Remaining Objects
After moving data from the source Oracle database to the target DB2 database, execute the remaining DDL scripts
against the target DB2 database to complete the creation of database objects.
Note: Ensure that you have completed the data transfer from all tables in the scope of your project.
1. Using the Project Explorer view, navigate to [DCW_project] > [folder_with_split_DDL_files] > Base Objects
and execute all of the DDL files.
•
•
You can open each individual file using the SQL Editor then press the Run SQL button to execute the
DDL statements.
Alternatively, right-click on the .sql file and select Database Conversion > Run SQL files...
2. Repeat the previous steps for all folders inside [DCW_project] > [folder_with_split_DDL_files].
Note: Depending on the order that DDL statements are executed and the dependencies between the database
objects, you might have to execute the DDL statements more than once until all of the dependencies are satisfied.
Database Conversion Workbench
© Copyright IBM Corp. 2013. All rights reserved
Page 37 of 38
© Copyright IBM Corporation 2013
All Rights Reserved.
IBM Canada
8200 Warden Avenue
Markham, ON
L6G 1C7
Canada
IBM, the IBM logo, ibm.com and Tivoli are trademarks or registered
trademarks of International Business Machines Corporation in the
United States, other countries, or both. If these and other
IBM trademarked terms are marked on their first occurrence in this
information with a trademark symbol (® or ™), these symbols indicate
U.S. registered or common law trademarks owned by IBM at the time
this information was published. Such trademarks may also be
registered or common law trademarks in other countries. A current list
of IBM trademarks is available on the Web at “Copyright and
trademark information” at ibm.com/legal/copytrade.shtml
Other company, product and service names may be trademarks or
service marks of others.
References in this publication to IBM products and services do not
imply that IBM intends to make them available in all countries in which
IBM operates.
No part of this document may be reproduced or transmitted in any form
without written permission from IBM Corporation.
Product data has been reviewed for accuracy as of the date of initial
publication. Product data is subject to change without notice. Any
statements regarding IBM’s future direction and intent are subject to
change or withdrawal without notice, and represent goals and
objectives only.
THE INFORMATION PROVIDED IN THIS DOCUMENT IS
DISTRIBUTED “AS IS” WITHOUT ANY WARRANTY, EITHER
EXPRESS OR IMPLIED. IBM EXPRESSLY DISCLAIMS ANY
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE OR NON-INFRINGEMENT.
IBM products are warranted according to the terms and conditions of
the agreements (e.g. IBM Customer Agreement, Statement of Limited
Warranty, International Program License Agreement, etc.) under which
they are provided.