Re: Lost SA Password

From: Barry McAuslin (barry_mcauslin_at_yahoo.com.nospam)
Date: 09/17/03


Date: Wed, 17 Sep 2003 17:25:05 +1200


There is one other way to get reset your sa password to blank and reset the
database. But it is not supported. I have done it myself with no trouble
in the past. You should only do this if you have no other option.

You need to do the following steps. Warning! I am writing the script from
memory and can not test it at this time.

Shut down the SQL Server.
Take file copies of your master data file and log file. (Just in case you
need them back)
Copy the master data file and log file to another SQL Server. (Same version
and build!)
Attach the database as mastersa or some thing like that.
run the following

EXEC sp_configure 'allow updates', 'true'
RECONFIGURE WITH OVERRIDE

update dbo.sysxlogins
set password = NULL, -- Blank sa password
dbid = 1 -- Database id of master
WHERE sid = 0x01
AND serverid = NULL

Detach the database.
Copy back to your original SQL Server
Start SQL Server.

Hope this helps.

----------

Barry McAuslin

Look inside your SQL Server files with SQL File Explorer.
Go to http://www.sqlfe.com for more information.

"Sue Hoegemeier" <Sue_H@nomail.please> wrote in message
news:p5vbmv4kemo3m3blfl3uil8mvv4i8k25b5@4ax.com...
> If the builtin\adminstrators group has been deleted, you
> don't have the sa password, there are no other sysadmin
> logins and no one has Enterprise Manager registered with a
> sysadmin account, you are pretty much stuck. The only
> option I know of at this point would be to just backup
> everything, reinstall and restore.
> Did anyone try logging in on the workstation that previous
> admin used and try connecting?
>
> -Sue
>
> On Mon, 15 Sep 2003 09:58:53 -0700, "Bill Honeyman"
> <bhoneyman@oc-redcross.org> wrote:
>
> >Also don't have sa login, since the password is unknown.
> >The administrator login (not sa) had it's default database
> >removed. have tried using isql and osql but cannot login
> >at all. Any other suggestions?
> >
> >Thanks,
> >
> >Bill
> >
> >>-----Original Message-----
> >>If you mean you can't login and only have the sa login to
> >>use which is kicking you out due to the default database
> >>error, try logging in using isql instead. It typically
> >won't
> >>kick you out due to the default database issue. It will
> >just
> >>report something like: Cannot use default database. Using
> >>master instead.
> >>Once logged in through isql, you can change the default
> >>database for sa using sp_defaultdb.
> >>
> >>-Sue
> >>
> >>On Thu, 11 Sep 2003 16:04:35 -0700, "Bill Honeyman"
> >><bhoneyman@oc-redcross.org> wrote:
> >>
> >>>I reciently took over a site with SQL Server v7 running,
> >>>the previous admin apparently deleted the default
> >database
> >>>for the SA. Does anyone know how to recover this?
> >>
> >>.
> >>
>



Relevant Pages

  • Re: System Administrator Implied Permissions
    ... > sa login, it assigns it the System Administrator fixed ... > Now, given this, why does SQL Server ... in each database is always a member of the public and db_owner roles. ... Other sysadmin role members have the exact same ...
    (microsoft.public.sqlserver.security)
  • Re: No db access after publishing web site
    ... GRANT UPDATE TO ... If I detach and attach this database on a different PC (according that PC ... Cannot open database "pago" requested by the login. ... Are you detaching/attaching the SQL Server Express database correctly ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: cannot login to the db after...
    ... Jasper Smith (SQL Server MVP) ... I have created a new database, "db_1", using the "sa" ... I then created a new login, "sqluser1" and gave ...
    (microsoft.public.sqlserver.security)
  • Re: Cant view merge agent properties (trying again)
    ... In the List of Actions for the Snapshot Agent History I see this repeated: ... every single database listed. ... So, just now, I went to computername\Administrator Login ID (because it's ... On the computer running SQL Server, ...
    (microsoft.public.sqlserver.replication)
  • Re: Database security design with ASP.net and form-based authentication
    ... Since you already have forms-based security, why not use a single SQL login ... for all database access? ... data entry, guest/view only, admin, report viewer. ... so I'm using SQL Server authentication. ...
    (microsoft.public.sqlserver.security)