Migration guide: Oracle to Azure SQL Database
Applies to: Azure SQL Database
This guide teaches you to migrate your Oracle schemas to Azure SQL Database by using SQL Server Migration Assistant (SSMA) for Oracle.
For other migration guides, see Azure Database Migration Guides.
Important
Try the Database Migration Assessment for Oracle extension > for Oracle to Azure SQL pre-assessment and workload categorization. This extension is useful:
- if you're in the early phase of Oracle to Azure SQL migration and need to do a high level workload assessment
- if you're interested in sizing your Azure SQL target for the Oracle workload
- if you want to understand feature migration parity
For detailed code assessment and conversion, continue with SSMA for Oracle.
Prerequisites
Before you begin migrating your Oracle schema to SQL Database:
Verify that your source environment is supported.
Download SSMA for Oracle.
Have a target Quickstart: Create a single database - Azure SQL Database instance.
Obtain the necessary permissions for SSMA for Oracle and provider.
Pre-migration
After you meet the prerequisites, you're ready to discover the topology of your environment and assess the feasibility of your Azure cloud migration. This part of the process involves conducting an inventory of the databases that you need to migrate, assessing those databases for potential migration issues or blockers, and then resolving any items you might have uncovered.
Assess
By using SSMA for Oracle, you can review database objects and data, assess databases for migration, migrate database objects to SQL Database, and then finally migrate data to the database.
To create an assessment:
Open SSMA for Oracle.
Select File, and then select New Project.
Enter a project name and a location to save your project. Then select Azure SQL Database as the migration target from the dropdown list and select OK.
Select Connect to Oracle. Enter values for Oracle connection details in the Connect to Oracle dialog box.
Select the Oracle schemas you want to migrate.
In Oracle Metadata Explorer, right-click the Oracle schema you want to migrate and then select Create Report to generate an HTML report. Instead, you can select a database and then select the Create Report tab.
Review the HTML report to understand conversion statistics and any errors or warnings. You can also open the report in Excel to get an inventory of Oracle objects and the effort required to perform schema conversions. The default location for the report is in the report folder within SSMAProjects.
For example, see
drive:\<username>\Documents\SSMAProjects\MyOracleMigration\report\report_2020_11_12T02_47_55\
.
Validate the data types
Validate the default data type mappings and change them based on requirements if necessary. To do so, follow these steps:
In SSMA for Oracle, select Tools, and then select Project Settings.
Select the Type Mapping tab.
You can change the type mapping for each table by selecting the table in Oracle Metadata Explorer.
Convert the schema
To convert the schema:
(Optional) Add dynamic or ad hoc queries to statements. Right-click the node, and then select Add statements.
Select the Connect to Azure SQL Database tab.
In SQL Database, enter connection details to connect your database.
Select your target SQL Database instance from the dropdown list, or enter a new name, in which case a database will be created on the target server.
Enter authentication details, and select Connect.
In Oracle Metadata Explorer, right-click the Oracle schema and then select Convert Schema. Or, you can select your schema and then select the Convert Schema tab.
After the conversion finishes, compare and review the converted objects to the original objects to identify potential problems and address them based on the recommendations.
Compare the converted Transact-SQL text to the original stored procedures, and review the recommendations.
In the output pane, select Review results and review the errors in the Error List pane.
Save the project locally for an offline schema remediation exercise. On the File menu, select Save Project. This step gives you an opportunity to evaluate the source and target schemas offline and perform remediation before you publish the schema to SQL Database.
Migrate
After you assess your databases and address any discrepancies, the next step is to run the migration process. Migration involves two steps: publishing the schema and migrating the data.
To publish your schema and migrate your data:
Publish the schema by right-clicking the database from the Databases node in Azure SQL Database Metadata Explorer and selecting Synchronize with Database.
Review the mapping between your source project and your target.
Migrate the data by right-clicking the database or object you want to migrate in Oracle Metadata Explorer and selecting Migrate Data. Or, you can select the Migrate Data tab. To migrate data for an entire database, select the check box next to the database name. To migrate data from individual tables, expand the database, expand Tables, and then select the checkboxes next to the tables. To omit data from individual tables, clear the checkboxes.
Enter connection details for both Oracle and SQL Database.
After the migration is completed, view the Data Migration Report.
Connect to your SQL Database instance by using Download SQL Server Management Studio (SSMS), and validate the migration by reviewing the data and schema.
Or, you can also use SQL Server Integration Services to perform the migration. To learn more, see:
- Getting started with SQL Server Integration Services
- SQL Server Integration Services for Azure and Hybrid Data Movement
Post-migration
After you successfully complete the migration stage, you need to complete a series of post-migration tasks to ensure that everything is functioning as smoothly and efficiently as possible.
Remediate applications
After the data is migrated to the target environment, all the applications that formerly consumed the source need to start consuming the target. Accomplishing this task requires changes to the applications in some cases.
The Data Access Migration Toolkit is an extension for Visual Studio Code that allows you to analyze your Java source code and detect data access API calls and queries. The toolkit provides you with a single-pane view of what needs to be addressed to support the new database back end. To learn more, see the Migrate your Java applications from Oracle blog post.
Perform tests
The test approach to database migration consists of the following activities:
Develop validation tests: To test the database migration, you need to use SQL queries. You must create the validation queries to run against both the source and the target databases. Your validation queries should cover the scope you define.
Set up a test environment: The test environment should contain a copy of the source database and the target database. Be sure to isolate the test environment.
Run validation tests: Run validation tests against the source and the target, and then analyze the results.
Run performance tests: Run performance tests against the source and the target, and then analyze and compare the results.
Validate migrated objects
Microsoft SQL Server Migration Assistant for Oracle Tester (SSMA Tester) allows you to test migrated database objects. The SSMA Tester is used to verify that converted objects behave in the same way.
Create test case
In SSMA for Oracle, navigate to Tester > New Test Case.
Provide the following information for the new test case:
Name: Enter the name to identify the test case.
Creation date: Today's current date, defined automatically.
Last Modified date: This value is filled in automatically, and shouldn't be changed.
Description: Enter any additional information to identify the purpose of the test case.
Select the objects that are part of the test case from the Oracle object tree located in the left side.
In this example, the stored procedure
ADD_REGION
, and tableREGION
, are selected.To learn more, see Selecting and Configuring Objects to Test (OracleToSQL)
Next, select the tables, foreign keys, and other dependent objects from the Oracle object tree in the left window.
To learn more, see Selecting and Configuring Affected Objects (OracleToSQL)
Review the evaluation sequence of objects. Change the order by selecting the buttons in the grid.
Finalize the test case by reviewing the information provided in the previous steps. Configure the test execution options based on the test scenario.
For more information on test case settings,Finishing Test Case Preparation (OracleToSQL)
Select finish to create the test case.
Run test case
When SSMA Tester runs a test case, the test engine executes the objects selected for testing and generates a verification report.
Select the test case from test repository and then select run.
Review the launch test case and select run.
Next, provide Oracle source credentials. Select connect after entering the credentials.
Provide target SQL Server credentials and select connect.
On success, the test case moves to initialization stage.
A real-time progress bar shows the execution status of the test run.
Review the report after the test is completed. The report provides the statistics, any errors during the test run and a detail report.
Select details to get more information.
Example of positive data validation.
Example of failed data validation.
Optimize
The post-migration phase is crucial for reconciling any data accuracy issues, verifying completeness, and addressing performance issues with the workload.
For more information about these issues and the steps to mitigate them, see the Post-migration validation and optimization guide.
Migration assets
For more assistance with completing this migration scenario, see the following resources. They were developed in support of a real-world migration project engagement.
Data Workload Assessment Model and Tool
This tool provides suggested "best fit" target platforms, cloud readiness, and application or database remediation level for a given workload. It offers easy calculation and report generation, which helps to accelerate large estate assessments by providing an automated and uniform target platform decision process.
Oracle Inventory Script Artifacts
This asset includes a PL/SQL query that hits Oracle system tables and provides a count of objects by schema type, object type, and status. It also provides a rough estimate of raw data in each schema and the sizing of tables in each schema, with results stored in a CSV format.
Automate SSMA Oracle Assessment Collection & Consolidation
This set of resources uses a .csv file as entry (sources.csv in the project folders) to produce the XML files that are needed to run an SSMA assessment in console mode. The source.csv is provided by the customer based on an inventory of existing Oracle instances. The output files are
AssessmentReportGeneration_source_1.xml
,ServersConnectionFile.xml
, andVariableValueFile.xml
.Oracle to SQL DB - Database Compare utility
SSMA for Oracle Tester is the recommended tool to automatically validate the database object conversion and data migration, and it's a superset of Database Compare functionality.
If you're looking for an alternative data validation option, you can use the Database Compare utility to compare data down to the level of the row or column, in all or selected tables, rows, and columns.
The Data SQL Engineering team developed these resources. This team's core charter is to unblock and accelerate complex modernization for data platform migration projects to Microsoft's Azure data platform.
Related content
- Services and tools for data migration
- What is Azure SQL Database?
- Azure Total Cost of Ownership (TCO) Calculator
- Cloud Adoption Framework for Azure
- Best practices for costing and sizing workloads for migration to Azure
- Cloud Migration Resources
- Overview of the migration journey and the tools and services recommended for performing assessment and migration