Login to SQL Server using Command Prompt


  • Hi,

            One of my database became suspect. When i tried to attach the database "LSN passed to log scan in database 'XXX' is invalid" error message has been showed. I was searched in net to recover the error and i found a answer that execute DBCC CHECKDB command to repair it. I don't know how to execute the command. In SQL Query analyzer database name not found. So i tried to connect SQL Server in command prompt, but "Login failed for user 'User', DB-Library: Login incorrect" Message displayed. What to do? Please help me.
    • Moved by Papy Normand Saturday, May 26, 2012 4:32 PM not related to SQL Server Data Access but maybe to the use of DBCC (From:SQL Server Data Access)
    Saturday, May 26, 2012 7:02 AM


All replies

  • First of all: Check your backups. Then before working on your database, make an extra copy of the files when possible (SQL Server instance should be stopped).

    The key to your problem is the Emergency mode, e.g see this link.

    Saturday, May 26, 2012 8:53 AM
  • Hello,

    I think that you have found this link : but it is for SQL Server 2000

    I found this link ( for SQL Server 2012 )

    this link gives some explanations and solutions

    For SQL Server 2005

    Which is the full version of your SQL Server ( 2000,2005,2008,2008 R2,2012 + last installed service pack ) ?

    I will move your thread towards treating any questions or discussions around using AlwaysOn, backup/restore, DBCC, recovering from hardware issues, planning disaster recovery or high-availability strategies  because i think you will find a quicker answer in this forum.Moreover, i am away form my home for a week, so i will not be able afterwards to follow your thread, nor to move it.

    I hope you will find a full and quick answer in this new forum

    Have a nice day

    Mark Post as helpful if it provides any help.Otherwise,leave it as it is.

    Saturday, May 26, 2012 4:30 PM
  • If you are seeing "login failed for user" my suggestion would be to look at Errorlog and post complete message of login failure.

    Balmukund Lakhani | Please mark solved if I've answered your question, vote for it as helpful to help other user's find a solution quicker
    This posting is provided "AS IS" with no warranties, and confers no rights.
    My Blog | Team Blog | @Twitter

    Saturday, May 26, 2012 5:39 PM