Tuesday, 8 May 2012

SQLCMD helps DBAs at the time of crisis

We do set default DB for logins other than master database in SQL server for security reasons. There is a scenario if default database gets offline or corrupts. 

Suppose default database is XYZ that goes offline or corrupts then SQL does not allow connection to all logins those having XYZ as a default database. Because it tries to connect the default database first. 

Thanks to SQLCMD that has a way to get in, using to -d switch

sqlcmd -S<servername> -d <Other_database_Name_ABC> -U<login> -P<password>

It  is helpful in case we disable Built-In logins, SA and don't have choice of other logins to connect to SQL server.

No comments:

Post a Comment

Popular Posts

Search This Blog