Solved

SQL Server Error Cannot connect to local

Posted on 2011-02-17
11
1,310 Views
Last Modified: 2012-05-11
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.
0
Comment
Question by:Favorable
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 4
11 Comments
 
LVL 26

Assisted Solution

by:tigin44
tigin44 earned 100 total points
ID: 34921445
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
 

Author Comment

by:Favorable
ID: 34921520
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
 
LVL 15

Assisted Solution

by:pateljitu
pateljitu earned 400 total points
ID: 34921570
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
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:Favorable
ID: 34921598
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
 
LVL 15

Assisted Solution

by:pateljitu
pateljitu earned 400 total points
ID: 34922794
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
 

Author Comment

by:Favorable
ID: 34923037
SQL is running on Windows Server 2008
0
 
LVL 15

Assisted Solution

by:pateljitu
pateljitu earned 400 total points
ID: 34927597
Please confirm if:
1. TCP and Name Pipes enable
2. Disable firewall.

and trying running SQLCMD as trusted connection

SQLCMD -S Localhost -E
0
 

Author Comment

by:Favorable
ID: 34927786
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
 
LVL 15

Assisted Solution

by:pateljitu
pateljitu earned 400 total points
ID: 34928882
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
 

Accepted Solution

by:
Favorable earned 0 total points
ID: 34929642
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
 

Author Closing Comment

by:Favorable
ID: 34959214
Everyone was really helpful.

Thanks.
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

After restoring a Microsoft SQL Server database (.bak) from backup or attaching .mdf file, you may run into "Error '15023' User or role already exists in the current database" when you use the "User Mapping" SQL Management Studio functionality to al…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question