for the sa signon and now I can't sign into the SQL Server, because although
I have the correct sa password, the default database is not there anymore so
I can't pass the authentication in order to change the default sa database t
o
one that exists. I am in a catch-22. Seems when I changed the database
name, it should have changed it in the default logins as well. At this
point, I have only one other login to the SQL Server and it also defaults to
the database that doesn't exist anymore

Please help me get access to my SQL Server again,
TerryJust specify which DB to use when you connect with sqlcmd.exe (the
commandline SQL client that replaces osql.exe). Get a DOS prompt, cd to
the \Program Files\Microsoft SQL Server\90\Tools\Binn (if it's not on
your path), and run "sqlcmd -S <servername> -U sa -P <password> -d
master". (The -d option specifies the DB to use.) That should log you
into your SQL instance with your 'sa' login and start you off in the
master database. From there just change your default DB for 'sa' with
"exec sp_defaultdb 'sa', 'master'". Or you could just run the whole
command on the cmdline like:
sqlcmd -S <servername> -U sa -P <password> -d master -Q "exec
sp_defaultdb 'sa', 'master'"
This leads to a couple points:
1) why are you using your 'sa' login anyway (this should pretty much be
a last resort).
2) why did you need to change the default DB for this login.
3) why aren't you using trusted logins? (although the SQL login in SQL
2005 are more secure that with SQL 2000)
Anyway, good luck with it.
*mike hodgson*
http://sqlnerd.blogspot.com
Terry wrote:
>In SQL Server 2005, I renamed a database that is also the default database
>for the sa signon and now I can't sign into the SQL Server, because althoug
h
>I have the correct sa password, the default database is not there anymore s
o
>I can't pass the authentication in order to change the default sa database
to
>one that exists. I am in a catch-22. Seems when I changed the database
>name, it should have changed it in the default logins as well. At this
>point, I have only one other login to the SQL Server and it also defaults t
o
>the database that doesn't exist anymore

>Please help me get access to my SQL Server again,
>Terry
>
>
No comments:
Post a Comment