Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 default database

Author  Topic 

mdhingra01
Posting Yak Master

179 Posts

Posted - 2004-05-04 : 14:37:58
I am running a local SQL server on my machine, I was going to transfer a Database from production to my local server, however in creating the package, the database was not available to check, so I deleted the destination database from my local. It now turns out that I deleted the Default database for the local server and I can not sign onto the local server. Is there a way to correct this?

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-05-04 : 14:39:24
You'll need to sign on with a sysadmin account (sa or a windows account that has local admin) and then run sp_defaultdb to fix the default database for the user.

sp_defaultdb 'UserName', 'master'

or

change master to whatever default database you want it to have.

Tara
Go to Top of Page

mdhingra01
Posting Yak Master

179 Posts

Posted - 2004-05-04 : 14:41:46
I was logged into my local with sa, so I can't even connect to the local SQL Server. I recall changing the default database to the one I deleted. Is there a 'higher' account than sa?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-05-04 : 14:43:17
No there isn't but sysadmin accounts are equivalent. So, you can still fix it with a local admin account. Does your windows account have local admin privileges? If so, connect to the server in Query Analyzer using Windows Authentication. Then run sp_defaultdb.

Why did you change the default database for the sa account?

Let's hope you didn't remove the BUILTIN\Administrators group from the sysadmin fixed server role.

Tara
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-05-04 : 21:26:41
If you're still having problems with this, just run an ossql command to change it. It doesn't validate your defaultdb. If you need help with this, let us know. It's explained pretty well in BOL though.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page
   

- Advertisement -