Error: Unique constraint violated

Error Message

Building a pyramid with the 'sderaster' command yields a unique constraint violation error. For example:

"Updating pyramid...
Error: SE_stream_execute (-51)
Error: Underlying DBMS error
Error: DBMS error code (1)
Error: ORA-00001: unique constraint (VEGDIR.SDE_BLK_3_UK) violated".


This error is caused by pyramid blocks left behind by a mosaic or a previously failed attempt to build the pyramid.

Solution or Workaround

Option 1: Remove the pyramid blocks left behind by a failed pyramid build. Use the pyramid operation of the 'sderaster' command set to level zero.

Option 2: Use the raster column identifier to determine the number of pyramid blocks that may have been left behind by a mosaic.

  1. Use a SQL utility specific to the relational database management system to query the sde.raster_column table to obtain a raster column identifier.
    select rastercolumn_id
    from sde.raster_columns
    where table_name =
    '<business table name>';

  2. Replace the <N> in the sde_blk_<N> with the raster column id of your raster.
    select count(*) from sde_blk_<N>
    where rasterband_id < 0;

  3. Delete the pyramid blocks through SQL, if they exist.
    delete from sde_blk_<N>
    where rasterband_id < 0