Error during data migration while upgrading to AX 2009


When you're upgrading your existing AX 3.0 SP6 environment to AX 2009 you may run into following error:

Object Server 01: The database reported (session 5 (Admin)): [Microsoft][SQL Native Client][SQL Server]The specified schema name "DOMAIN\COMPUTERNAME$"
either does not exist or you do not have permission to use it.. The SQL statement was: "CREATE FUNCTION [DOMAIN\COMPUTERNAME$].FN_FMT_NUMBERSEQUENCE

This is caused by getSchemaName() method in ReleaseUpdateDB class. This method executes SELECT current_user SQL statement to retrieve name of user connected to SQL Server. This returns name of the account running AOS service. This name is then used as name of schema in which the database object is being created. To create the object always in DBO schema you need to modify the getSchemaName() method to call xSession::getDbSchema() method that always returns DBO for SQL Server database. The method will look like follows:

protected static str getSchemaName(Connection _con = null)
{
    ResultSet   resultSet;
    str         sql_Current_user = 'SELECT current_user';
    str         schemaName;
    SqlStatementExecutePermission sqlStatementExecutePermission;
    ;

    switch (SqlSystem::databaseBackendId())
    {
        case DatabaseId::Oracle:
            schemaName = '';
            break;
        case DatabaseId::MS_Sql_Server:
            schemaName = xSession::getDbSchema();
            break;
    }
    return schemaName;
}

Martin F

Skip to main content