14
Server user id %d is not a valid user in database '%.*s'
When a user tries to open a database, Adaptive Server performs the following checks to determine the validity of the user:
Looks for the suid (Adaptive Server user ID, copied from syslogins) of the process in sysusers to find the corresponding uid (user ID, unique in this database) and gid (group ID to which this user belongs).
Looks for a “guest” row in sysusers (the suid for “guest” is -1).
Looks for the user ID in sysalternates.
Checks sysusers to determine whether the user has “sso” role if the user does have an suid in the database. This check is related to Adaptive Server auditing.
Error 916 occurs when a user tries to open a database and Adaptive Server finds that the user ID is not valid.
Decide whether you want the user to access the database with:
A normal login and user ID
A guest user ID
An alias to another user ID
If you want the user to access the database with a normal login and user ID, determine whether the Adaptive Server user ID exists in the current database:
1> use <database_name> 2> go
1> select * from sysusers 2> where suid = <Server_user_ID> 3> go
Where <Server_user_ID> is the Adaptive Server user ID displayed in the error message. If the user is not found, use sp_adduser to add them.
If the user is found and you are getting error 916 for that user, run dbcc checkdb on the database to find out whether it is corrupt. If dbcc checkdb returns error messages, corruption has occurred. Follow the directions in this manual for recovering from those errors.
If you want the user to access the database as guest, determine whether there is a “guest” row in sysusers of the database being opened:
1> use <database_name> 2> go
1> select * from sysusers 2> where suid = -1 3> go
Where <database_name> is the name of the database in the error message. If guest is not found, use sp_adduser to add it.
If guest is found, run dbcc checkdb on the database the user is trying to access to find out whether it is corrupt. If dbcc checkdb returns error messages, corruption has occurred. Follow the directions in this manual for recovering from those errors.
If you want the user to access the database with an alias to another user, determine whether the user ID exists in sysalternates of the database being opened:
1> use <database_name> 2> go
1> select * from sysalternates 2> where suid = <Server_user_ID> 3> go
If the user ID is not found, use sp_addalias to add an alias for them.
If the user ID is found and you are getting error 916 for that user, run dbcc checkdb on the database the user is trying to access to find out whether it is corrupt. If dbcc checkdb returns error messages, corruption has occurred. Follow the directions in this manual for recovering from those errors.
If the database is being accessed due to a referential constraint, make sure the user ID exists in each database.
If error 916 occurs after the above actions have been taken, call Sybase Technical Support.
Refer to Reference Manual: Procedures for information about sp_addlogin, sp_adduser, and sp_addalias.
Have the information listed in “Reporting errors” ready when you call Sybase Technical Support, including the output from:
syslogins
sysusers and sysalternates for the database being opened
All versions