def _get_last_scn(connection):

    """
    Obtains last SCN from the database or raises an Exception if anything wrong happened.
    """
    try:
        return str(connection.execute('select CURRENT_SCN from V$DATABASE').first()[0])
    except:
        raise Exception('Error retrieving last SCN from Oracle database.')