Re: How to change password for sa?

From: Daan Stam (stam.JustSomeText@awvn.nl)
Date: 11/06/02


From: "Daan Stam" <stam.JustSomeText@awvn.nl>
Date: Wed, 6 Nov 2002 15:27:28 +0100


This is a more friendly way to fix logins after a restore of database of
another server
Run it in the analyzer and the result grid gives you the commands for fixing
the found problems. (Just put the go command on a new line)

select 'sp_change_users_login @Action = ' + char(39) + 'auto_fix' +
char(39) + ', @usernamepattern = ' + char(39) + name + char(39) + char(13) +
'go'
from sysusers
where issqluser = 1 and (sid is not null and sid <> 0x0)
and suser_sname(sid) is null
order by name

Daan
stam.leavesomeout@awvn.nl

"Dan Guzman" <danguzman@nospam-earthlink.net> wrote in message
news:OQYv#YOhCHA.1392@tkmsftngp12...
> The error message is a bit misleading. The problem is that a database
> was restored/attached and the database owner recorded in sysdatabases is
> out-of-sync with sysusers. This confuses the EM GUI.
>
> You can run a script like the following to correct the mismatch.
>
> USE MyDatabase
> EXEC sp_addlogin 'TempOwner'
> EXEC sp_changedbowner 'TempOwner'
> EXEC sp_changedbowner 'sa'
> EXEC sp_droplogin 'TempOwner'
> GO
>
> See http://support.microsoft.com/default.aspx?scid=KB;EN-US;Q218172& for
> details.
>
> --
> Hope this helps.
>
> Dan Guzman
> SQL Server MVP
>
> -----------------------
> SQL FAQ links (courtesy Neil Pike):
>
> http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
> http://www.sqlserverfaq.com
> http://www.mssqlserver.com/faq
> -----------------------
>
> "Ivan D." <idych@yahoo.com> wrote in message
> news:#hX3XROhCHA.1736@tkmsftngp11...
> > Hello,
> >
> > I'm beginner with SQL administration, so probably this question is
> trivial
> > but... When I'm trying to change password for sa in "SQL Server Login
> > Properties - sa" window, I get the message:
> >
> > Error 21776: [SQL-DMO]The name 'dbo' was not found in the Users
> > collection... and the password's change fails.
> >
> > But this name does exist in every database_name\Users box. So what's
> wrong?
> >
> > Thanks. Ivan.
> >
> >
>
>



Relevant Pages

  • Re: Problem with disable msde connection pool
    ... 'ALTER DATABASE TestDB SET single_user WITH ROLLBACK after 10 ... ' Restart the server... ... ' Execute query through SQLDMO to run the restore TSQL command ... the connection pool must be disabled. ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Restore public folders and companyweb
    ... I understand that the Public Folder Store ... > database cannot be mounted due to integrity problems, ... > the pub.edb database from your backup of the old Server, ... please try the following steps to restore your public ...
    (microsoft.public.windows.server.sbs)
  • RE: Restore public folders and companyweb
    ... The new server must have the same domain name as the original server ... where the backup of the database. ... For the detailed steps to restore the SharePoint Services databases, ... Microsoft CSS Online Newsgroup Support ...
    (microsoft.public.windows.server.sbs)
  • Re: SQL 2000 SP4 on 2003 Server - Single User Mode
    ... I found the section where you list the filename to restore to. ... rename the SQL Server the same as what is listed below Courthouse? ... Once you've created your database (simply right click on the Database ...
    (microsoft.public.sqlserver.setup)
  • RE: How to restore edb & stm files from bkf backup file on another exc
    ... copied to a different storage group on the same server or to a different ... On production server successfully backup information ... Restore Status ... Failed to find a database to restore to from the Microsoft ...
    (microsoft.public.exchange.admin)