After importing an exported APM database configuration into a new schema using the configimport script the following errors are observed in the Enterprise Manger log file:
1/11/16 10:01:40.083 AM CET [ERROR] [Thread-ModelSynchronization] [Manager.AppMap] Unable to complete model synchronization with storage!
org.springframework.dao.DataIntegrityViolationException: PreparedStatementCallback; SQL [INSERT INTO appmap_edges(source_id, target_id, transaction_id, start_time, end_time) VALUES (?, ?, ?, ?, ?)]; ORA-02291: integrity constraint (APMDB.APPMAP_TRANSACTIONS_FK3) violated - parent key not found ; nested exception is java.sql.SQLIntegrityConstraintViolationException: ORA-02291: integrity constraint (APMDB.APPMAP_TRANSACTIONS_FK3) violated - parent key not found
This problem occurs when using APM 10.1 configimport script against an Oracle APM Database on either Windows or Linux
The configimport script does not insert the required rows in tables APPMAP_ID_MAPPINGS and APPMAP_VERTICES when initialising the tables.
1. Using SQLPlus or similar tool logon to the Oracle system as the schema owner
Oracle Database 11g Enterprise Edition Release 188.8.131.52.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
2. Verify that both tables are empty using the following SQL
SQL> SELECT * FROM APPMAP_ID_MAPPINGS;
no rows selected
SQL> SELECT * FROM APPMAP_VERTICES;
no rows selected.
3. Create the missing rows using the following SQL and commit the change
SQL> INSERT INTO appmap_id_mappings (vertex_id, external_id, type)
SELECT 0, 'CA_APM_INTERNAL', 'V' FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM appmap_id_mappings WHERE vertex_id = 0) ;
1 row created.
SQL> INSERT INTO appmap_vertices (vertex_id, start_time, end_time, business_service)
SELECT 0, TIMESTAMP '1979-1-1 0:0:0', TIMESTAMP '1979-1-1 0:0:0', 'CA_APM_INTERNAL' FROM DUAL WHERE NOT EXISTS(SELECT 1 FROM appmap_vertices WHERE vertex_id = 0);
1 row created.
The error messages will now stop.
This has been raised as a bug with engineering to be addressed in a future release.