Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In SQL Server 2008 R2 error occurred while start debugging, Error HRESULT E_FAIL has been returned from a call to a COM component. (mscorlib)

I am working on SQL Server 2008 R2 Express, when I am using SQL Server debugging feature from client pc, this error occurs:

The EXECUTE permission was denied on the object 'sp_enable_sql_debug', database 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)

My user name is 'HALI' and permission is assigned to me is 'public' and 'db_Owner',

now after this error I have assigned all permissions available. And all server roles.

Now at this time I got new error message,

Error HRESULT E_FAIL has been returned from a call to a COM component. (mscorlib)

Now what the solution would be for this error.

like image 549
Haider Ali Wajihi Avatar asked Mar 25 '13 11:03

Haider Ali Wajihi


3 Answers

I am not sure if disabling firewall is enough. if the user has sysadmin permissions and still getting this error means client is not able to connect to server in debugging mode. check this TCP and UDP ports are correctly open.

SQL remote debugging configuration

EDIT:1

I am sure you must have also googled a lot and tried to find out about the error messages. What I have found so far is the Error in the OP you mentioned is misleading and from that error, we cannot tell what exactly is wrong or what to look next. But as you replied in the comments, after making changes to enable Remote Debugger; the mentioned error is more clear and I feel that proper permission is still an issue. Plenty of other suggestion you also might have tried so far, but if you haven’t done this, let's try one more time:

In one of the comments I mentioned you to try login using the windows user.

Now Keep the settings you already did for TCP ports, Firewall Exception, etc… explained in the above link. you have windows 2012 server where you installed DB server. and windows 8 Prof where you have DB client and you connecting through SSMS. Now I believe both machines are in the same domain. Let’s say domain XYZ. You must have windows login on server, let’s say it is “XYZ\HALI” using which you can login to the Windows Server. log in and make sure that login also exists in SQL SERVER with sysadmin permission. Because client machine is also in same domain make sure you have logged in into the client machine using same user “XYZ\HALI”. Now start SSMS and choose windows authentication instead of SQL SERVER authentication. Try to start Debugging T-SQL code now.

if client and server machines are not in the same domain then we have to register server name on client machine as Linked Server, impersonate the login/user as local and then try the debugging.

Edit:2

Login to SSMS using Windows Authentication

like image 156
Anup Shah Avatar answered Nov 14 '22 06:11

Anup Shah


I encountered this problem after generating a SQL 2012 script and running it in a SQL 2008 R2 database.

After some research, I found out that my target SQL 2008 R2 was running on a 32-bit OS which supports a file of up to 2GB in size. So I saved the script as C:\myScript.sql and successfully executed it in a command prompt with these steps:

  1. Open a command prompt window.

  2. In the command prompt window, type:

    sqlcmd -S myServer\instanceName –U yourUserName –P yourPassword -i C:\myScript.sql
    

    where myServer\instanceName is the instance name. Supply the user name and password for SQL server login, and finally the path of the file as indicated.

  3. Press Enter.

References:

  • sqlcmd Utility | Microsoft Docs

  • Use the sqlcmd Utility | Microsoft Docs

like image 34
Marto Avatar answered Nov 14 '22 05:11

Marto


The few times I've run across that error, it's always been firewall related. Are you working on a remote server, or your local machine? (Parenthetically, be careful assigning all possible roles. Some of them are ones you absolutely don't want. The one you need for SQL debugging is sysadmin - try disabling the rest of the roles you checked off and just assigning that one.)

Debugging procs is always a pain. This ASP.NET post helped me out substantially awhile ago.

like image 1
antinescience Avatar answered Nov 14 '22 04:11

antinescience