I believe the error is related to items in the repository that have some
items have been corrupted and don't have a handle. 
Some items have entries in some tables and not in others. 

The GUI either fails to delete these items so I need to erase all
entries related to a specific item_id using SQL. 

The SQL code below should erase everything in the database related to an
item code. 
I am not sure what to do about the physical files .
Is it best to leave them in place or should they be removed?
What happens about the sequence id in the bitstream table - is it a
problem to just leave a hole?

I would appreciate it if anyone can see a problem with the code and make
any comments or suggestions

--------------------------------------------------------------------------------



# Clean DSpace based on itemId
# Give IRMA id returns handle for that publication
# Run as id dspace

[ $# -eq 0 ] && { echo "Usage: $0 <item_id>"; exit 1; }

itemId=$1
echo "Erasing all records referencing item: $itemId"
echo  -n "Do you wish to continue y/n  "
read ans
if [ "$ans" != "y" ]
then
   exit 1
fi

# Delete bundles associated with item_id
# Delete bitstreams associated with item_id

# Get list of bundle ids associated with item
bundleList=$(psql -A -t -c "select bundle_id from item2bundle where
item_id='$itemId';")

# For each bundle id delete the bitstream and delete the bundle to
bitstream entry
for bundle in $bundleList
do
     btStmIdList=$(psql -A -t -c "select bitstream_id from
bundle2bitstream where bundle_id=(select bundle_id from item2bundle
where item_id='$itemId');")
     for bstrmId in $btStmIdList
     do
          # Do something with files
          filenames=$( psql -A -t -c "select name,internal_id from
bitstream where bitstream_id =$bstrmId;")
          for fn in filenames
          do
              # do something with files maybe
          done
          psql -A -t -c "select * from bitstream where bitstream_id =
$bstrmId;"

   done
   psql -A -t -c "select * from bundle2bitstream where
bundle_id='$bundle';"
   psql -A -t -c "select * from bundle where bundle_id='$bundle';"
   psql -A -t -c "select * from bundle2bitstream where
bundle_id='$bundle';"
   psql -A -t -c "select * from bundle where bundle_id='$bundle';"
done


for tableName in collection2item metadatavalue item item2bundle
community2item collection2item workflowitem
do
     psql -A -t -c "delete  from $tableName where item_id='$itemId';"
done



On Fri, 2014-10-10 at 11:42 +1100, Keir Vaughan-Taylor wrote:

> I have two Dspace 4.0 instances installed both using Solr Statistics and
> all appears to be working.
> In both cases the generic statistics appears okay.
> 
> The academics love it when they see how many accesses there have been by
> going to the item in the repository and clicking on the nearby
> statistics button.
> 
> An upgrade from 1.8.2 to 4.0 recently took place on one of the machines.
> With the 1.8.2 version all the statistics features were working. Now
> however, on the upgraded machine although the overall statistics still
> appear, the button associated with a publication item no longer renders
> statistics information. 
> The statistic page appears okay but there is no data presented.
> 
> The other separate instance of DSpace 4.0 for a different database does
> work. So i know its not a Dspace 4.0 bug.
> I cannot find what is different about the two.
> DSpace.cfg are the same, solr.cfg is the same.
> The logs don't reveal anything I can identify as a problem.
> The running of nightly Discovery indexing is the same.
> 
> Please can anyone suggest a list of places I should be looking at to get
> this going.
> 
> 
> 


-- 
Keir Vaughan-Taylor
ERA DSpace Administrator
Rm:123 Fisher Library University of Sydney
[email protected]
ph:+61 2 9351 7408
mb:+61 434 606 885
------------------------------------------------------------------------------
Meet PCI DSS 3.0 Compliance Requirements with EventLog Analyzer
Achieve PCI DSS 3.0 Compliant Status with Out-of-the-box PCI DSS Reports
Are you Audit-Ready for PCI DSS 3.0 Compliance? Download White paper
Comply to PCI DSS 3.0 Requirement 10 and 11.5 with EventLog Analyzer
http://p.sf.net/sfu/Zoho
_______________________________________________
DSpace-tech mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dspace-tech
List Etiquette: https://wiki.duraspace.org/display/DSPACE/Mailing+List+Etiquette

Reply via email to