||Information about the ArcSDE error codes can be found in the sdehelp.chm file in one of the standard ArcSDE doc directories. The path IN the help file is:
developer interfaces --> C API function reference --> return codes.
And if you look in the error codes list you will find that the (-51) error is the least informative of all. (-51) means that something went wrong in the underlying RDBMS.... .
Start tracing in the database and check the trace files
Add the SDEVERBOSE=TRUE entry to the dbinit.sde and check out the giomgr.log and sde.errlog files. Check them out anyway.