Permissions needed for sql server job to execute stored procedure on linked server?

Hi all
I have a job step which attempts to call a stored procedure on a linked server.
This step is failing with a permission denied error. How can I debug or resolve this?
The job owner is sysadmin on both servers so should have execute permission to the database/proc I'm calling, right?
The error is:
The EXECUTE permission was denied on the object 'myProc', database 'myDatabase', schema 'dbo'. [SQLSTATE 42000] (Error 229).  The step failed.
My code is:
EXEC [LinkedServer].myDatabase.dbo.myProc
Also tried:
SELECT * FROM OPENQUERY([LinkedServer], 'SET FMTONLY OFF EXEC myDatabase.dbo.myProc')
With the same result.
Any help appreciated.

The job owner may be sysadmin on the remote server. The service account for SQL Server Agent may not. And it is the latter that counts, since the it the service accounts that logs in and impersonates the job owner. But the impersonation inside SQL Server
does not count much in Windows, and it is through Windows connection is made to the other site.
One way to resolve this is to set up a login mapping for the job owner. The login mapping must be for an SQL login on the remote server.
You can verify the theory, but running this query from the job:
   SELECT * FROM OPENQUERY([LinkedServer], 'SELECT SYSTEM_USER')
By the way, putting SET FMTONLY OFF in OPENQUERY is a terrible idea. This has the effect that the procedure is executed twice. (Unless both servers are SQL 2012 or higher in which case FMTONLY has no effect at all.)
Erland Sommarskog, SQL Server MVP, [email protected]

Similar Messages

  • Execute Oracle procedure via Linked server takes very long

    Exec ('Begin [procedurename]; End;') at OracleLinkedServer
    I used this statement to execute store procedure on Oracle database via linked server. It keeps running and never ends.
    However, if I run this procedure Begin [procedurename]; End; in TOAD, it completes in 10s. 
    This procedure is just simply to merge data between two tables.
    Is there any bug or limit on SQL Server Oracle linked server? I am using SQL SERVER 2012 and Oracle 11g client.

    See if this link helps you
    http://markmal.blogspot.co.il/2008/01/it-is-really-pain-if-you-need-to-call.html
    select * from openquery(MYORADB, '{CALL SCOTT.PROC4MS({resultset 25, OUTPUT})}');
    SELECT * FROM OPENQUERY(<linked server name>, '{CALL <oracle sp>}')
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • Execute stored procedures + database link

    Hi,
    I have a stored procedure named "proc1" in the "user1" schema in the "db1" database.
    I have another database "db2".
    I have a public database link named "db2_to_db1", which connects from the "db2" database to "db1" database connecting with the user "user1" from "db1". I tested the database link.... is OK.
    I have a public synonym for "user1"."proc1"@"db1" named "p_proc1"
    So, I want to execute the stored procedure "proc1" from "db2".
    I tried this from Forms and SQLPLUS...
    (1)
    DECLARE
    BEGIN
    p_proc1(...,...,...);
    END;
    (2)
    DECLARE
    BEGIN
    user1.p_proc1(...,...,...)@db2_to_db1;
    END;
    (2)
    DECLARE
    BEGIN
    p_proc1(...,...,...)@db2_to_db1;
    END;
    .........but no one of those codes are right, I got an error like this:
    ORA-06550: line 12, column 3:
    PLS-00201: identifier 'SDI_CON_TRAFO_SID' must be declared
    Please I need some help....
    What can I do in order to execute a stored rpocedure of other database with a databse link??????
    I almost forget.... I already checked the "execute" privilegies over the stored procedure.... and is OK.

    What is the identifier 'SDI_CON_TRAFO_SID'? It sounds like you have a problem with dependencies rather than with how to call it.

  • In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String

    In JDBC Sender Adapter , the server is Microsoft SQL .I need to pass current date as the input column while Executing stored procedure, which will get me 10 Output Columns. Kindly suggest me the SQL Query String , for executing the Stored Procedure with Current date as the input .

    Hi Srinath,
    The below blog might be useful
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2013/03/06/executing-stored-procedure-from-sender-adapter-in-sap-pi-71
    PI/XI: Sender JDBC adapter for Oracle stored procedures in 5 days
    regards,
    Harish

  • Permissions needed for Applying SQL Tuning Sets/SQL Plans 11g?

    What permission are needed for a user to apply/activate sql tuning sets (sql plans) in 11g? The user can capture and move the the sql tuning sets from a 10g database to an 11g database but is getting "ORA-01031: insufficient privileges" when trying to activate/apply the sqlplans in 11g.
    The user has:
    ADMINISTER SQL MANAGEMENT OBJECT and ADMINISTER SQL TUNING SET and EXECUTE on SYS.DBMS_SPM
    The user is an administrator for our Data Warehouse team but they do not have sysdba priviliges.
    Do you also know of a good white paper that covers the step by step instructions and permissions needed for aquiring and applying/activating sqlplans?
    If more information is needed in order to respond please advise.
    Thank you

    What permission are needed for a user to apply/activate sql tuning sets (sql plans) in 11g? The user can capture and move the the sql tuning sets from a 10g database to an 11g database but is getting "ORA-01031: insufficient privileges" when trying to activate/apply the sqlplans in 11g.
    The user has:
    ADMINISTER SQL MANAGEMENT OBJECT and ADMINISTER SQL TUNING SET and EXECUTE on SYS.DBMS_SPM
    The user is an administrator for our Data Warehouse team but they do not have sysdba priviliges.
    Do you also know of a good white paper that covers the step by step instructions and permissions needed for aquiring and applying/activating sqlplans?
    If more information is needed in order to respond please advise.
    Thank you

  • I couldn't get my maps to work while out today which I needed for directions anyone know why ? It kept saying no server .

    I couldn't get my maps to work while out today which I needed for directions anyone know why ? It kept saying no server , is it to do with my settings, my network provider, 3G or what ? Anyone help please.
    Thanks

    Yes it is about 40 mg - I didn't know there was a size limit? How can I change that?

  • How do I merge data from table1 on server 1 to final table on server 2 with a stored procedure to execute every 4 hours.

    How do I merge data from table1 on server 1 to final table on server 2 with a stored procedure to execute every so many hours.

    Hello,
    If you had configure server2 as
    linked server on the server1, you can run the following statement inside stored proceduce to copy table data. And then create a job to the run stored proceduce every 4 hours.
    Insert Into Server2.Database2.dbo.Table2
    (Cols)
    Select Cols From Server1.Database1.dbo.Table1
    Or you can use the SQL Server Import and Export Wizard to export the data from server1 to server2, save the SSIS package created by the wizard on the SQL Server, create a job to run the SSIS package. 
    Reference:http://technet.microsoft.com/en-us/library/ms141209.aspx
    Regards,
    Fanny Liu
    Fanny Liu
    TechNet Community Support

  • How do I merge data from table1 on server 1 to final table on server 2 with a stored procedure to execute every so many hours.

    How do I merge data from table1 on server 1 to final table on server 2 with a stored procedure to execute every so
    many hours.

    How big is the table on server B? Is that possible to bring the all data into a server A and merge the data locally?
    Best Regards,Uri Dimant SQL Server MVP,
    http://sqlblog.com/blogs/uri_dimant/
    MS SQL optimization: MS SQL Development and Optimization
    MS SQL Consulting:
    Large scale of database and data cleansing
    Remote DBA Services:
    Improves MS SQL Database Performance
    SQL Server Integration Services:
    Business Intelligence

  • [Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'dbo.sp_SPNAMEHERE'.

    OK, something seemed to have changed with my system because this error is NEW. It might be related to my system upgrade from Vista to Win7, but just guessing here.
    I run a database on a corporate MS Sql Server (2005) and an ASP application that connects via ODBC. The real world application works fine, however when I attempt to access Stored Procedures from Dreamweaver (on my development machine)  I am getting the following error:
    [Microsoft][ODBC SQL Server Driver][SQL Server]Could not find stored procedure 'dbo.sp_SPNAMEHERE'.
    This only seems to happen on Stored procedures that RETURN a recordset.
    system:
    Win7
    Dreamweaver CS4
    Code: VBScript/Classic ASP
    SQL Server 2005
    Connecting via ODBC: MM_MY_STRING = "Driver={SQL Server};Server=wscxxxxxxxxx;Database=dbsystem;Uid=username;Pwd=XXXXXXXXXXXX"
    Stored procedures that do not return a recordset are not an issue.... this has put my development work at a standstill!!
    Thanks in advance!

    Well, I hate bumps, but I am really running out of solutions. I have now tried to use a system DSN on my development machine and that didnt solve the problem. I just un-installed DW and re-installed it and that didnt solve my problem either.
    This is very frustrating, because I cannot use any stored procs that return recordsets... I am stuck... can anybody think of a relatively easy work-around to working in DW w/ recordsets that come from SPs when you cant actually access them?
    The really weird thing is, when I build the command, and choose the stored proc, and give it valid input variables, and TEST it from the TEST button, everything works and data is returned as expected. Once I click "OK" and actually add it to the ASP page the recordset that should be visible isnt... and when I click the plus sign in the bindings window I get the error...
    Help!!

  • How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?

    Hi 
    I have a stored procedure. It can be executed like this
    exec test @p = 1;
    exec test @p = 2
    exec test @p = n;
    n can be hundred.
    I want the sp being executed in parallel, not sequence. It means the 3 examples above can be run at the same time.
    If I know the number in advance, say 3, I can create 3 different Execution SQL Tasks. They can be run in parallel.
    However, the n is not static. It is coming from a table. 
    How can I execute Stored Procedures in PARALLEL and DYNAMICALLY ?
    I think about using script task. In the script, I get the value of n, and the list of p, from the table, then running a loop with. In the loop, I create a threat and in the threat, I execute the sp like : exec test @p = p. So the exec test may
    be run parallel. But I am not sure if it works.
    Any idea is really appreciated.

    Hi nam_man,
    According to your description, you want to call stored procedures in parallel, right?
    In SSIS, we can create separate jobs with different stored procedures, then set the same schedule to kick the jobs off at the same time. In this way, we should be careful to monitor blocking and deadlocking depending on what the jobs are doing.
    We can also put all stored procedures in SSIS Sequence container, then they will be run in parallel.
    For more information about SSIS job and Sequence container, please refer to the following documents:
    http://www.mssqltips.com/sqlservertutorial/220/scheduling-ssis-packages-with-sql-server-agent/
    https://msdn.microsoft.com/en-us/library/ms139855(v=sql.110).aspx
    If you have any more questions, please feel free to ask.
    Thanks,
    Wendy Fu
    Wendy Fu
    TechNet Community Support

  • Using SQL Loader script in a Stored Procedure

    Can I use SQL Loader script in a stored procedure and then execute it from a front-end appl.? The reason for this seemingly convoluted solution is that the users don't want a batch load though the records volume is quite high (around 1 mil). Other loads using ODBC connection or OLE DB seem to be inferior to SQL Loader.

    I would suggest a couple of solutions:
    1. Have a cgi script that can upload the file to the server from a web ui, then have the cgi script call the sql*loader file, and it will insert into the database.
    2. You can try to use External tables. This is avaliable in 9i and onwards. You will be able to make any sql DML on the external table.
    I would normally use sql*loader, move the data to a staging table with nologging, and paralle loading. After it has been loaded into the staging table I would process it into my main tables. Have used this approach with up to 60 million records in one load.
    You can do calls to C procedures, Pro*C procedures through PLSQL, as well as java calls, or use Java stored procedures.
    My experience is that SQL*Loader is the fastest way to load data into the database.

  • Found a bug in "Execute Stored Procedure..." command

    Hi...I've found one interesting "feature": if I do click "Execute Stored Procedure"on SP, which contains an XML parameter (doesn't matter if it's input or output), Management Studio generates script without declaring datatype of that
    parameter. But if I click "Generate Script" everything works fine. This situation can be observed in SQL Server 2005-2012.

    Hello,
    Please submit a product feedback on Microsoft Connect:
    https://connect.microsoft.com/sqlServer/
    Thank you for sharing what you have discovered.
    Regards,
    Alberto Morillo
    SQLCoffee.com

  • Execute stored procedure as sysadmin

    Hi,
    I am running powershell script to execute stored procedure on SQL server. Powershell script is run with low privilege user account on SQL server, but SP is restoring databases and requires sysadmin permissions. How can I execute SP with sysadmin permissions?
    Could this be done proxy account? without additional users creation. Any links? Thanks

    You can create the sp using a sysadmin account (or in dbo schema) and use EXECUTE AS OWNER inside it
    Then give the powershell account execute access to the procedure and it will run under context of dbo user  (or owner account) which will have necessary permission to do the data base restore etc
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Could not execute stored procedure in oracle

    hello experts,
    Problem: I can not execute stored procedures stored in Oracle data base. Error Message: Portal request failed. Could not execute stored procedure.
    My steps:
    i connected my locally installed Oracle data base to the VC. I mapped the data base user to my VC user. I tested connection and it is fine. Further I see the db alias in Visual Composer and i can drop stored procedures to my story board. I can define parameters, but when I am executing procedures I get the error message.
    Further I installed MS SQL Server lokally and connected to the VC and it is working fine. I can do everything.
    Why it is not working for Oracle DB?
    DriverName: com.sap.portals.jdbc.oracle.OracleDriver
    Connect-URL: jdbc:sap:oracle://ip:port;sid=XE
    Any comment is highly appreciated.
    anton.

    Hi,
    Also you can follow this link which explains you the procedure to configure BI JDBC system for visual composer.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/6209b52e-0401-0010-6a9f-d40ec3a09424
    Regards
    Inder
    Do reward points if helpful.

  • OBIEE execute stored procedure to load tables before running report

    Hi..
    I want to execute a stored procedure to load database tables before running a report in OBIEE .
    I need to pass 2 parameters to the stored procedure which loads into tables.
    In the Connection Pool --> Connection Script Tab --> Execute before query, I wrote the below query using the repository variables VAR1 & VAR2 to execute the
    DECLARE VAR1 number; VAR2 number;
    BEGIN
    schema_name.package_name1.package_body('VALUE OF(VAR1)', 'VALUE OF(VAR2)'); COMMIT;
    schema_name.package_name2.package_body('VALUE OF(VAR1)', 'VALUE OF(VAR2)'); COMMIT;
    END;
    I am receiving the following error to declare the schema_name.package_name
    +++Administrator:2a0000:2a0004:----2010/06/21 14:29:00
    -------------------- Sending query to database named ACBS-OCC (id: <<49419>>):
    BEGIN schema_name.package_name1.package_body1('VALUE OF(VAR1', 'VALUE OF(VAR2'); COMMIT; schema_name.package_name2.package_body2('VALUE OF(VAR1)', 'VALUE OF(VAR2)'); COMMIT;END;
    +++Administrator:2a0000:2a0004:----2010/06/21 14:29:00
    -------------------- Query Status: Query Failed: [nQSError: 16001] ODBC error state: S1000 code: 6550 message: [Oracle][ODBC][Ora]ORA-06550: line 1, column 7:
    PLS-00201: identifier 'SCHEMA_NAME.PACKAGE_NAME1' must be declared
    ORA-06550: line 1, column 7:
    PL/SQL: Statement ignored
    ORA-06550: line 1, column 93:
    PLS-00201: identifier 'SCHEMA_NAME.PACKAGE_NAME2' must be declared
    ORA-06550: line 1, column 93:
    PL/SQL: Statement ignored.
    [nQSError: 16015] SQL statement execution failed.
    Please suggest how to declare and execute the stored procedure.
    Thanks in advance.

    Hi,
    I know that any Function / Procedure needs to be called using a EVALUATE function in OBIEE.
    Thanks,
    Vijay

Maybe you are looking for

  • "Delivery Completed" Indicator in Goods Receipt

    Hi, While doing GR, we want to check the "Delivery Completed" on the Goods Receipt Screen if we are expecting no future receipt against the Purchase Order. Currently we are not able to check the Delivery Completed Indicator as it is not in editable m

  • Creation of Materialized View is taking Long Time

    Hi All, In the execution of PLSQL script, I am executing the following sequence. First step I am creating the materialized view A, and Materialized view B using DB Links. In the same script as a part of second step I am creating one more materialized

  • PDF print Cocoon problem

    Hello! I use Apex + Tomcat + Cocoon + fop_post from Carl Backstrom's Blog [http://carlback.blogspot.com/2007/03/apex-cocoon-pdf-and-more.html]. Printing reports is possible, but printing big reports, with a lot of data in a cel,l doesn't work. Trying

  • Airport can't connect to my Airport Extreme Base Station

    Hi all, Just had this nagging problem for a couple of days. I can connect and see my aebs in airport utility but can't connect it to network in the airport menu. The network is fine and is working on my macbook, but the macbook pro can't see it. Both

  • Help! Items won't open

    I have a Macbook, probably 2009 model, and I'm having problems opening anything that's on the desktop. The item is recognized when clicked on, but it doesn't open. I have to go all the way to file, then open to access anything on the desktop. Possibl