Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions reverse_engineering/helpers/oracleHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,18 +385,21 @@ const logEntitiesWithLimit = ({ entities, entityType, logger, limit = 1000 }) =>
}
};

// Oracle returns rows in no set order; sort them so every reverse-engineering lists entities the same way.
const ORDER_BY_OWNER_AND_NAME = ' ORDER BY 1, 2';

const selectEntities = (selectStatement, includeSystemCollection, schemaName) => {
let stmt = '';
if (schemaName) {
stmt = `T.OWNER = '${schemaName}'`;
}
if (includeSystemCollection) {
return execute(`${selectStatement}${stmt ? ` WHERE ${stmt}` : ''}`);
return execute(selectStatement + (stmt ? ' WHERE ' + stmt : '') + ORDER_BY_OWNER_AND_NAME);
} else {
return execute(
`${selectStatement} INNER JOIN ALL_USERS U ON T.OWNER = U.USERNAME WHERE U.ORACLE_MAINTAINED = 'N'${
stmt ? ` AND ${stmt}` : ''
}`,
}${ORDER_BY_OWNER_AND_NAME}`,
);
}
};
Expand All @@ -415,14 +418,14 @@ const selectEntitiesWithFallback = async ({
stmt = `T.OWNER = '${schemaName}'`;
}
if (includeSystemCollection) {
const result = await execute(dbaSelectStatement + (stmt ? ' WHERE ' + stmt : ''));
const result = await execute(dbaSelectStatement + (stmt ? ' WHERE ' + stmt : '') + ORDER_BY_OWNER_AND_NAME);
logger.info({ message: `Successfully retrieved ${entityType} using DBA_* tables` });
return result;
} else {
const result = await execute(
`${dbaSelectStatement} WHERE T.OWNER NOT IN ('SYS', 'SYSTEM', 'DBSNMP', 'SYSMAN', 'OUTLN', 'MGMT_VIEW', 'FLOWS_FILES', 'MDSYS', 'ORDSYS', 'EXFSYS', 'WMSYS', 'APPQOSSYS', 'APEX_030200', 'APEX_PUBLIC_USER', 'SPATIAL_CSW_ADMIN_USR', 'SPATIAL_WFS_ADMIN_USR', 'XS$NULL', 'ORACLE_OCM', 'XDB', 'ANONYMOUS', 'CTXSYS', 'ORDDATA', 'SI_INFORMTN_SCHEMA', 'DVF', 'DVSYS', 'DBSFWUSER', 'FLOWS_040100', 'APEX_040100', 'DIP', 'OWBSYS_AUDIT', 'OWBSYS', 'SYSDG', 'SYSBACKUP', 'SYSKM', 'LBACSYS', 'GSMADMIN_INTERNAL', 'MDDATA', 'SYSRAC', 'GGSYS', 'WKPROXY', 'WK_TEST', 'WKUSER', 'REMOTE_SCHEDULER_AGENT', 'SYS$UMF', 'GSMCATUSER', 'GSMUSER', 'SYSRMAN', 'EJBCA_USER', 'AUDSYS', 'SSOXDSDB', 'PDBADMIN', 'ORDS_PUBLIC_USER', 'ORDS_METADATA')${
stmt ? ` AND ${stmt}` : ''
}`,
}${ORDER_BY_OWNER_AND_NAME}`,
);
logger.info({ message: `Successfully retrieved ${entityType} using DBA_* tables` });
return result;
Expand Down