The SQL mapping feature of Advanced Database & Application Migration (ADAM) can automatically capture SQL statements that do not conform to the PolarDB for Oracle syntax in a PolarDB for Oracle database. Then, the SQL mapping feature can intelligently convert the incorrect SQL statements by mapping the incorrect SQL statement to correct SQL statements. For SQL statements that cannot be intelligently converted, you can manually configure mapping to convert these SQL statements. This feature can prevent a PolarDB for Oracle database from returning incorrect results to applications due to incorrect SQL statements. This topic describes how to create an SQL mapping task.
Prerequisites
- The database for which you want to enable the SQL mapping feature is a PolarDB for Oracle database.
- The polar_sql_mapping extension is created in the database. For more information, see polar_sql_mapping.
- The database is added to ADAM by using the database management feature. For more information, see Add a PolarDB for Oracle database to ADAM.
Feature description
The SQL mapping feature can not only capture existing incorrect SQL statements sent by an application but can also capture incremental incorrect SQL statements that are generated after the application runs for a period of time. You must enable SQL mapping again to capture and convert incremental incorrect SQL statements.
Scenarios
In scenarios in which an application sends an incorrect SQL statement and the statement cannot be immediately modified, you can use the SQL mapping feature to map the incorrect SQL statement to a correct statement.
Procedure
- Log on to the ADAM console.
- Create an SQL mapping task.
- After the task is complete, click Details in the Actions column to view the details of the incorrect SQL statements that are captured and configure mapping.
- Optional:Click the Error SQL List tab to view the details of the incorrect SQL statements, including the statements, error messages, and the number of times that each statement is executed.
- Click the SQL Mapping Information List tab.
- Perform SQL mapping.
Add a PolarDB for Oracle database to ADAM
- Log on to the ADAM console.
- In the left-side navigation pane, click Database Management.
- Click Create Database.
- In the Create Database Record panel, configure the following parameters.
Section Parameter Required Description N/A Archive Name Yes Enter a name for the database. We recommend that you specify a descriptive name that is easy to identify. Database Type Yes Select PolarDB-O Engine from the drop-down list. Destination Database POLARDB-OInstance Region Yes Select the region in which your PolarDB for Oracle cluster resides. POLARDB-OConnected VPC Yes Select the VPC in which your PolarDB for Oracle cluster resides You can log on to the PolarDB console and view the VPC information on the details page of the cluster. POLARDB-OInstances Yes Select your PolarDB for Oracle cluster from the drop-down list. .After you configure the POLARDB-OConnected VPC parameter, the system searches for the clusters that reside in the VPC and displays the clusters in the drop-down list. POLARDB-OHost IP Address Yes You do not need to configure this parameter. After you select a PolarDB for Oracle cluster, the IP address is automatically obtained. Database Name Yes Enter the name of the database that you want to add to ADAM. Encoding Method No Select the encoding method that corresponds to the character set of the database. Port Number Yes You do not need to configure this parameter. After you select a PolarDB for Oracle cluster, the port number is automatically obtained. Username Yes Enter the username of the database account. Security Token Yes Enter the password of the database account. - Click Test Connectivity.
- If the test is successful, click Create.