After all, I managed to solve the problem. Probably it may be even better, but here's how I solved it:
we exported to a text file (internal_id.txt) the paths of all bitstreams using the following query:
select
substring(b.internal_id for 2) || '/' || substring(b.internal_id from 3 for 2) || '/' || substring(b.internal_id from 5 for 2) || '/' || b.internal_id as bitstream_path
from
bitstream b
After that I checked the existence of those bistreams in the assetstore with this little script:
#!/bin/sh
homedspace=/home/dspace
assetd=$homedspace/assetstore
for i in `cat $homedspace/internal_id.txt`;
do
bitstr="$assetd/$i"
if [ ! -f $fbitstr ]; then
echo "$i"
fi;
done
To get details about the records that have missing bitstreams I used the following query
select
ob.uuid
,h.handle
,i.item_id
,bfr.short_description
,mv.text_value
,substring(b.internal_id for 2) || '/' || substring(b.internal_id from 3 for 2) || '/' || substring(b.internal_id from 5 for 2) || '/' || b.internal_id as bitstream_path
from
dspaceobject ob
left join handle h on
ob.uuid = h.resource_id
left join item i on
i.uuid = ob.uuid
left join bitstream b on
b.uuid = ob.uuid
left join bitstreamformatregistry bfr on
bfr.bitstream_format_id = b.bitstream_format_id
join metadatavalue mv on
mv.dspace_object_id = ob.uuid
and b.internal_id in
('114010604776142507469236848335815822008',
'144380007015254523440612284014079661640',
'72819755632666247567002874213191474609')
order by b.internal_id
I hope this can helps somebody...