The image url is store in wp_posts as an attachment post_type with their corresponding posts(s) as parents. From Codex, see Template Tags Show All Attachments
I believe something like this would retrieve all attachments in DB outside of a loop:
global $post;
$args = array(
'post_type' => 'attachment',
'posts_per_page' => -1,
'post_status' => 'any',
'post_parent' => null
);
$attachments = get_posts( $args );
if ( $attachments ) {
foreach ( $attachments as $post ) {
setup_postdata( $post );
the_title();
the_attachment_link( $post->ID, false );
the_excerpt();
}
wp_reset_postdata();
Perhaps something like this could find and clear those no longer available in /uploads/ directory:
$args = array(
'post_type' => 'attachment',
'numberposts' => -1
);
$attachments = get_posts( $args );
foreach( $attachments as $attch ){
$file = get_attached_file( $attch->ID );
if( !file_exists( $file ) ){
wp_delete_post( $attch->ID, false );
}
}
Reference for get_attached_file()
Reference for wp_delete_post()
Look into those those and it should be rather straightforward how to achieve the cleanup you need.