SQL Server Error Cannot connect to local

Somebody please help me.

Unable to connect to my local instance on my machine.
The situation started after I deleted one of my database and log out, now that I'm trying to log back in it generating a logon failed for login -----------due to trigger execution.
Changed database context to 'master'.
Changed language setting to us_english. (Microsoft SQ Server, Error: 17892)

Second:  Even when I tried to login through SQLCMD it closes out automatically.
FavorableAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
FavorableConnect With a Mentor Author Commented:
Although, SQLCMD wouldn't start, I have to run windows cmd and follow Pinal steps as indicated in the following site.
However, issue was resolved by visiting:

http://blog.sqlauthority.com/2009/06/27/sql-server-fix-error-17892-logon-failed-for-login-due-to-trigger-execution-changed-database-context-to-master/#comment-119222

Anyway, everyone tried and I appreciate all your help.

0
 
tigin44Connect With a Mentor Commented:
You have deleted your default database.
What you can do is set your default database using the sp_defaultdb system stored procedure. Log in as you have done and then click the New Query button. After that simply run the sp_defaultdb command as follows:

Exec sp_defaultdb @loginame=yourLlogin', @defdb='master'
0
 
FavorableAuthor Commented:
I am unable to login even with DAC privelleges.

When issued login permission I get the following error:
logon failed for login -----------due to trigger execution.
Changed database context to 'master'.
Changed language setting to us_english. (Microsoft SQ Server, Error: 17892)

0
Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

 
pateljituConnect With a Mentor Commented:
There was logon TRIGGER associated with database you dropped, you would need to drop the TRIGGER using SQLCMD.

Please follow these steps:
SQLCMD -S Localhost -d master -A

1> Drop TRIGGER <triggername> on ALL SERVER
2> GO

0
 
FavorableAuthor Commented:
You won't believe that even SQLCMD wouldn't open, issue unknown to me.  I've tried run as administrator, still it won't open.
0
 
pateljituConnect With a Mentor Commented:
Have to checked event viewer and trace what error gets captured when you try to run SQLCMD, also what OS are you running SQL on.
0
 
FavorableAuthor Commented:
SQL is running on Windows Server 2008
0
 
pateljituConnect With a Mentor Commented:
Please confirm if:
1. TCP and Name Pipes enable
2. Disable firewall.

and trying running SQLCMD as trusted connection

SQLCMD -S Localhost -E
0
 
FavorableAuthor Commented:
This is a night mare for me.

Both TCP and Named Pipes are enable
Windows firewalls ---- disabled


Just found out from profiler trace that I have deleted AuditDB which probably, but don't know is tired or have a trigger that deleted my tempdb.  

Even when I run cmd and entered sqlcmd, I get similar error.  

It appears like, I have to uninstall and do a fresh install?  Since the trigger won't allow me to login by using DAC or SQLCMD.  Good lesson for me.  
0
 
pateljituConnect With a Mentor Commented:
Have you tried restarting SQL-Services (services.msc), once services are restarted check for tempDB (.mdf / .ldf) file created in default location as MASTER.

If that's the case try steps as mentioned earlier.

Thats true if default DB created by SQL is missing it will break and not allow any access.
0
 
FavorableAuthor Commented:
Everyone was really helpful.

Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.