-->

Reset Default Database from Command Line

Post a Comment

During a recent consolidation exercise I was migrating one database at a time and then taking the old copy offline, unfortunately one of the DBs had (un-knowingly) been my default database and next time I tried to log in I received the dreaded "Cannot open user default database. Login Failed." Message.

In my case it was to execute the sp_defaultdb stored procedure using the OSQL utility, for example…

osql -Sservername -E -dmaster -Q"sp_defaultdb 'username','master'"


 

Related Posts

There is no other posts in this category.

Post a Comment

Subscribe Our Newsletter