Solved

How do I grant execute permission on sp_oacreate in the master db?

Posted on 2007-03-29
6
21,195 Views
Last Modified: 2012-06-27
Hi everyone
I am trying to run the sp_oacreate master procedure from within a trigger on a sql 2005 database table. So far the only solution i have found that works is to add my database role and user roles just as they are in my current database to the master database as well. I am using NT authentication.

The error I'm getting when i update the table with the trigger in vb is:
42000: [Microsoft][ODBC SQL Server Driver][SQL Server]EXECUTE permission denied on object 'sp_OACreate', database 'mssqlsystemresource', schema 'sys'.

Any help would be appreciated
Effie
0
Comment
Question by:tiseffies
6 Comments
 
LVL 20

Expert Comment

by:Sirees
ID: 18815391
For you to execute the sp_oacreate stored procedures you need to be in the system admin group, or you can go into master database and give your self exec permissions on each procedure in extend stored procedures section.

use master
go

grant exec on sp_OACreate to yourUserLogin
GO

0
 
LVL 16

Expert Comment

by:rboyd56
ID: 18816072
According to Books on Line and y persona experience sirees is correct that you ahve to be a sysamin in order to rus sp_oacreate. However, I do not believe you can grant execute on that procedure to other users that are not members of the sysadmin role.
0
 

Author Comment

by:tiseffies
ID: 18822280
Yes I know of the sysadmin mentioned. Though I'm not sure how to do that in sql2005.
The other thing is this would be rejected by my client because it would pose a security issue... messing around with the master database. So i was hoping to use another method.. Unfortunately i'm stuck for ideas.

thanks for you reply
0
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 6

Accepted Solution

by:
DantheDBA earned 500 total points
ID: 19285183
Using the sysadmin fixed server role will allow access to these SPs, but is generally a bad idea due to the security risks. You may consider an alternate approach such as a certificate.

In any case to add a login to the server level sysadmin role execute the following:

use master
exec sp_addsrvrolemember 'loginname', 'sysadmin'

Contrary to rboyd56's statement, it is possible (I have done it successfully myself)  to grant permissions on these system stored procedures to a user that is not a member of the sysadmin role. Run the following to grant the group of system stored procedures to a specific username

use master
grant exec on sp_OACreate to username
grant exec on sp_OAGetErrorInfo to username
grant exec on sp_OAMethod to username
grant exec on sp_OAGetProperty to username
grant exec on sp_OADestroy to username

You will want to map the existing login for your username to a user in Master because the permission cannot be directly addressed to the login.

Thanks,
Dan
0
 

Author Comment

by:tiseffies
ID: 19288548
To All

I have completed this task finally, I had to give guest permission to the above sp's, apparently mandatory when referencing a second database with an Application role connection on the first.
0
 
LVL 3

Expert Comment

by:kworks
ID: 25824326
@tiseffies:

Since I'm having similar problem, I'm just wondering about the sentence "give guest permission to the above sp's". What would that be, precisely?

And, if that is the case, what is the difference between it and the accepted solution??

Your help is much appreciated.
0

Featured Post

Control application downtime with dependency maps

Visualize the interdependencies between application components better with Applications Manager's automated application discovery and dependency mapping feature. Resolve performance issues faster by quickly isolating problematic components.

Join & Write a Comment

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

757 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now