Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Server user id is not a valid user in database

4 posts in General Discussion Last posting was on 2010-10-28 13:02:07.0Z
Whatty Posted on 2010-10-26 18:24:16.0Z
From: "Whatty" <steven.whatmore@purefacts.com>
Newsgroups: sybase.public.ase.general
Subject: Server user id is not a valid user in database
Lines: 1
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4cc71cd0$1@forums-1-dub>
Date: 26 Oct 2010 11:24:16 -0700
X-Trace: forums-1-dub 1288117456 10.22.241.152 (26 Oct 2010 11:24:16 -0700)
X-Original-Trace: 26 Oct 2010 11:24:16 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29667
Article PK: 78897

Good afternoon,

I just restored a database and am receiving the following error

[Sybase][ODBC Driver][Adaptive Server Enterprise]Server user id 4 is not a
valid user in database

Is there a system function or stored procedure or some other SQL that I can
use to fix this issue - or do I have to create the master logins and redo
the restore.

Thanks in advance.

Whatty


Cory Sane [TeamSybase] Posted on 2010-10-27 04:28:41.0Z
From: "Cory Sane [TeamSybase]" <cory!=sane>
Newsgroups: sybase.public.ase.general
References: <4cc71cd0$1@forums-1-dub>
In-Reply-To: <4cc71cd0$1@forums-1-dub>
Subject: Re: Server user id is not a valid user in database
Lines: 30
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Windows Mail 6.0.6002.18197
X-MimeOLE: Produced By Microsoft MimeOLE V6.0.6002.18263
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4cc7aa79$1@forums-1-dub>
Date: 26 Oct 2010 21:28:41 -0700
X-Trace: forums-1-dub 1288153721 10.22.241.152 (26 Oct 2010 21:28:41 -0700)
X-Original-Trace: 26 Oct 2010 21:28:41 -0700, vip152.sybase.com
X-Authenticated-User: TeamSybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29668
Article PK: 78896

There is no magic wand...
This is for the experienced dba.
If you have a copy of master..syslogins in bcp native format then restore that too.
You may need to delete most logins except sa & probe.
use the "bcp -b1" to commit after ever record.


--
Cory Sane
[TeamSybase]
Certified Sybase Associate DBA for ASE 15.0

"Whatty" <steven.whatmore@purefacts.com> wrote in message news:4cc71cd0$1@forums-1-dub...
> Good afternoon,
>
> I just restored a database and am receiving the following error
>
> [Sybase][ODBC Driver][Adaptive Server Enterprise]Server user id 4 is not a
> valid user in database
>
> Is there a system function or stored procedure or some other SQL that I can
> use to fix this issue - or do I have to create the master logins and redo
> the restore.
>
> Thanks in advance.
>
> Whatty
>
>
>
>


Carl Kayser Posted on 2010-10-27 10:16:43.0Z
From: "Carl Kayser" <kayser_c@bls.gov>
Newsgroups: sybase.public.ase.general
References: <4cc71cd0$1@forums-1-dub>
Subject: Re: Server user id is not a valid user in database
Lines: 39
Organization: BLS
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2900.5931
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5994
X-RFC2646: Format=Flowed; Response
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4cc7fc0b$1@forums-1-dub>
Date: 27 Oct 2010 03:16:43 -0700
X-Trace: forums-1-dub 1288174603 10.22.241.152 (27 Oct 2010 03:16:43 -0700)
X-Original-Trace: 27 Oct 2010 03:16:43 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29670
Article PK: 78900


"Whatty" <steven.whatmore@purefacts.com> wrote in message
news:4cc71cd0$1@forums-1-dub...
> Good afternoon,
>
> I just restored a database and am receiving the following error
>
> [Sybase][ODBC Driver][Adaptive Server Enterprise]Server user id 4 is not a
> valid user in database
>
> Is there a system function or stored procedure or some other SQL that I
> can use to fix this issue - or do I have to create the master logins and
> redo the restore.
>
> Thanks in advance.
>
> Whatty
>

It depends upon what "the issue" is. You restored the database on the same
server that the backup was made from? (That's how most of us would
interpret your first sentence but I want to be sure.) In which case the
issue would be with logins created after the backup that are also added as a
user to the database. To find these run SQL like this in master:

select l.name, l.crdate
from syslogins l
where not exists (select u.name
from <db>..sysusers u
where u.suid = l.suid)
order by l.crdate

This will find candidate logins to add to the database via sp_adduser.
Ignore the rows that have crdates earlier than the backup. Or add the logic
to the above SQL. Figuring out the groups, if used, would require other
resources. The above query would also have to be augmented if there are new
aliases.


Whatty Posted on 2010-10-28 13:02:07.0Z
From: "Whatty" <steven.whatmore@purefacts.com>
Newsgroups: sybase.public.ase.general
References: <4cc71cd0$1@forums-1-dub> <4cc7fc0b$1@forums-1-dub>
In-Reply-To: <4cc7fc0b$1@forums-1-dub>
Subject: Re: Server user id is not a valid user in database
Lines: 1
MIME-Version: 1.0
Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=response
Content-Transfer-Encoding: 7bit
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Newsreader: Microsoft Windows Live Mail 14.0.8089.726
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8089.726
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <4cc9744f@forums-1-dub>
Date: 28 Oct 2010 06:02:07 -0700
X-Trace: forums-1-dub 1288270927 10.22.241.152 (28 Oct 2010 06:02:07 -0700)
X-Original-Trace: 28 Oct 2010 06:02:07 -0700, vip152.sybase.com
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.ase.general:29673
Article PK: 78899

Unfortunately no it is a different server that we restored the database too
and you are correct we logins were created after the backup and they are
also added as a user to the database.

"Carl Kayser" <kayser_c@bls.gov> wrote in message
news:4cc7fc0b$1@forums-1-dub...
>
> "Whatty" <steven.whatmore@purefacts.com> wrote in message
> news:4cc71cd0$1@forums-1-dub...
>> Good afternoon,
>>
>> I just restored a database and am receiving the following error
>>
>> [Sybase][ODBC Driver][Adaptive Server Enterprise]Server user id 4 is not
>> a valid user in database
>>
>> Is there a system function or stored procedure or some other SQL that I
>> can use to fix this issue - or do I have to create the master logins and
>> redo the restore.
>>
>> Thanks in advance.
>>
>> Whatty
>>
>
> It depends upon what "the issue" is. You restored the database on the
> same server that the backup was made from? (That's how most of us would
> interpret your first sentence but I want to be sure.) In which case the
> issue would be with logins created after the backup that are also added as
> a user to the database. To find these run SQL like this in master:
>
> select l.name, l.crdate
> from syslogins l
> where not exists (select u.name
> from <db>..sysusers u
> where u.suid = l.suid)
> order by l.crdate
>
> This will find candidate logins to add to the database via sp_adduser.
> Ignore the rows that have crdates earlier than the backup. Or add the
> logic to the above SQL. Figuring out the groups, if used, would require
> other resources. The above query would also have to be augmented if there
> are new aliases.
>
>