Execute Permission Denied on Stored Procedure for SSRS Report

I have a report in SSRS 2008R2.  The report is running against a 2005 instance.  This report, encapsulated as a stored procedure, runs fine in BIDS.  When I deploy it to the Report Manager I suddenly get"
The EXECUTE permission was denied on the object 'ticketStatus',database 'SomeDatabase', schema 'dbo'.
I have granted the execute permission to the sql login, I'll call it 'bob', being used in the datasource.  I can run the stored procedure in SSMS as that sql login.  That SQL login is also assigned the db_datareader and db_denydatawriter database
level roles in the database for the query.  The query makes use of a linked server to another database.  I have tested that I can run the query via the linked server using the SQL login.  I created a separate SSRS report and simply used the
SELECT part of my stored proc.  I upload that to the Report Manager and it works fine.  I can't figure out why this report will not work when it is set up to use the Stored Proc.  Any help sorting this out would be appreciated.

I have granted the execute permission to the sql login, I'll call it 'bob', being used in the datasource.  I can run the stored procedure in SSMS as that sql login.  That SQL login is also assigned the db_datareader and db_denydatawriter database
level roles in the database for the query.  The query makes use of a linked server to another database.  ...
You are saying you are using a linked server for a database that sits on the same server as the database where the Procedure resides? Is there any reason to do that instead of just using a 3-part name, possibly in combination with a synonym?
Linked servers have a different security concept also
Trustworthy should not be used then either as it can lead to privilege escalation/elevation attacks from inside that database
Cross Database Ownership chaining is yet another and different problem
The best woul be to have that Login as a user in both databases and have the necessary permissions like Execute on Schema/Database there. Deny should only be necvessary under the circumstances that the user is member of different groups/roles
Andreas Wolter
Microsoft Certified Master SQL Server 2008
Microsoft Certified Solutions Master SQL Data Platform, SQL Server 2012
Blog: www.insidesql.org/blogs/andreaswolter
Web: www.andreas-wolter.com |
www.SarpedonQualityLab.com

Similar Messages

  • Stored Procedure for Crystal Reports

    Hi All,
    I developed this test stored procedure to see wheather we could a stored procedure for crystal reports. It compiled without any problem, but when I run it, it gives me error message. Here is the stored Procedure..
    CREATE OR REPLACE PROCEDURE WOLD1SIM.TEST_PROCEDURE(
    TEST_CURSOR IN OUT TEST_PACKAGE.TEST_TYPE,
    TEST_PARAMETER IN TEST_TABLE.ID%TYPE)
    AS
    BEGIN
    OPEN TEST_CURSOR FOR
    SELECT *
    FROM TEST_TABLE
    WHERE TEST_TABLE.ID = TEST_PARAMETER;
    END TEST_PROCEDURE;
    And
    This is the error message..
    ERROR at line 2:
    ORA-06550: line 2, column 1:
    PLS-00201: identifier 'TEST_PROC' must be declared
    ORA-06550: line 2, column 1:
    PL/SQL: Statement ignored
    I have created the package sucessfully.
    I was wondering If any one of you can advice me where I am making the mistake.
    Thank you

    CREATE OR REPLACE PROCEDURE WOLD1SIM.TEST_PROCEDURE(TEST_CURSOR IN OUT TEST_PACKAGE.TEST_TYPE,
                                                         TEST_PARAMETER IN TEST_TABLE.ID%TYPE)
    ...you have 2 parameters in your procedure WOLD1SIM.TEST_PROCEDURE(). you should also use two parameters when you execute the procedure.

  • Give execute access on SP_WHO2 stored procedure for a developer without giving VIEW SERVER STATE access.

    Hi,
    Is there anyway, we can give just execute access on sp_who2 SP for a developer without giving VIEW SERVER STATE access?
    Please let me know ASAP? Any help is greatly appreciated.
    Thanks,
    Vel
    Vel Thavasi

    Thanks Erland,
    I tried on master as well. Seems like no luck. I think, I am messing up with certificate or access level!! Would you mind in modify my script and help me out on this issue?
    CREATE
    CERTIFICATE uSPWHO2Cert
    ENCRYPTION BY PASSWORD
    = 'testpwd'
    WITH SUBJECT =
    'Certificate to run usp_who2',
    START_DATE = '20140901',
    EXPIRY_DATE =
    '20300101'
    go
    --drop certificate uSPWHO2Cert
    -- Create the certificate user and give it rights to access the test table.
    CREATE
    Login uViewServerStateUser
    FROM CERTIFICATE
    uSPWHO2Cert
    go
    create
    proc [usp_who2]
    as
    exec
    sp_who2;
    GO
    GRANT
    Execute ON
    usp_who2 TO uViewServerStateUser
    go
    -- Sign the procedure.
    ADD
    SIGNATURE TO
    usp_who2 BY CERTIFICATE
    uSPWHO2Cert
    WITH PASSWORD =
    'testpwd'
    go
    --drop proc usp_who2
    Grant
    View server
    State to uViewServerStateUser;
    Grant
    Execute on
    usp_who2 to testuser;
    -- Run as the test user, to actually see that this works.
    EXECUTE
    AS LOGIN
    = 'testuser'
    go
    -- First run the unsigned procedure. This gives a permission error.
    EXEC
    usp_who2
    go
    revert
    Thanks again!!!
    Thanks,
    Vel
    Vel Thavasi

  • EXECUTE permission denied

    hi 
    Im getting  the following error when querying  a database :   
    <b>
    Error when executing statement for table/stored proc. 'procedure name' (structure 'Select'): java.sql.SQLException: [Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]EXECUTE permission denied on object 'procedure name ', database '<database name>', owner 'owner name'</b>
    Is it  because the user use to access in the comunication channel  does not have rights on the  given databse / table  or something else as well ??
    please suggest
    sd

    Hi,
    yes right.
    the user which you use in the JDBC Adapter isn't allowed to execute the stored procedure.
    Regards,
    Robin

  • Procedure for statspack report creation.

    Is it possible to create a stored procedure for creating a statspack report for two snap ids?

    Prajeesh wrote:
    Can I create a stored procedure for creating a statspack report for two snap ids?probably... how should we know?
    what is a statspack report and what are snap ids?
    I'm currently building a stored procedure for TPS reports - that will probably do what you want with some slight modifications.....

  • Stored Procedure For Web Service in Visual Composer 7.1

    Hello,
    I want to use stored procedure for Webservice in Visual Composer 7.1
    I can find this Web service but not supported. ( ex) prcreleased_test - Not supported )
    Log.
    Message: Error in connection - Can' t execute Web service.
    Date: 2008-07-01
    Time: 16:41:43:906
    Category: com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent
    Location: com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.processExecution: 
    Application: sap.com/test~kmshim_wf_impl
    Thread: HTTP Worker [1]
    Data Source: j2ee\cluster\server0\log\defaultTrace_00.trc
    Correlator ID: 240496500000034715
    Argument Objects: 
    Arguments: 
    DSR Component: n.a.
    DSR Transaction: cb4b3560473711dd9fb4001e4f3b8fcb
    Log2
    Message: Stopped further execution since the interpreter is unusable
    Date: 2008-07-01
    Time: 16:41:43:906
    Category: com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent
    Location: com.sap.tc.webdynpro.progmodel.generation.DelegatingComponent.XGLInterpreter
    Application: sap.com/test~kmshim_wf_impl
    Thread: HTTP Worker [1]
    Data Source: j2ee\cluster\server0\log\defaultTrace_00.trc
    Correlator ID: 240496500000034715
    Argument Objects: 
    Arguments: 
    DSR Component: n.a.
    DSR Transaction: cb4b3560473711dd9fb4001e4f3b8fcb '
    Help me^^ plz..

    Hi Tanna.
    Thanks for your reply^^
    I create webservice that access my stored procedure.
    But not supported.
    http://dmp.humaxdigital.com/HumaxCmdwService/Service1.asmx?wsdl
    There are two service. (Hello World - Test, prcrelease_test - Stored Procedure )
    'Hello World' is supported but prcrelease_test is not supported. I can't drag to storyboard.
    Our company's DB is MSSQL2005.
    please help me^^

  • Calling a Stored Procedure using SSRS Custom Data Processing Extension

    I need SSRS Custom Data Processing Extension to call a stored procedure for my ssrs report. I refered many links regarding this, but i cannot find it. Instead of that there are examples for Data processing extensions that uses XML files and also multiple
    data sources.
    I want Data Processing Extension to call a stored procedure.
    Please Help. Thanks in advance

    Sorry why do you need a Data Processing Extension for that? Cant you directly call the procedure
    from SSRS dataset? Whats the RDBMS which holds this procedure?
    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

  • EXECUTE permission denied on object 'xp_sqlagent_notify', database 'mssqlsystemresource', schema 'sys'.

    I'm trying to create a new subscriptions on an existing report and get the following error.
    An internal error occurred on the report server. See the error log for more details. (rsInternalError) Get Online Help
    Get Online Help
    EXECUTE permission denied on object 'xp_sqlagent_notify', database 'mssqlsystemresource', schema 'sys'.
    I ran the following that was suggested in http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=17774&SiteID=1. But still I get the same error. Do I need a reboot or restart of the services?
    The only log file information I can find contains the following.
    System.Web.Services.Protocols.SoapException: System.Web.Services.Protocols.SoapException: An internal error occurred on the report server. See the error log for more details. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.Data.SqlClient.SqlException: EXECUTE permission denied on object 'xp_sqlagent_notify', database 'mssqlsystemresource', schema 'sys'.
       --- End of inner exception stack trace ---
       at Microsoft.ReportingServices.WebServer.ReportingService2005.ListSchedules(Schedule[]& Schedules)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.ReadResponse(SoapClientMessage message, WebResponse response, Stream responseStream, Boolean asyncCall)
       at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
       at Microsoft.SqlServer.ReportingServices2005.ReportingService2005.ListSchedules()
       at Microsoft.SqlServer.ReportingServices2005.RSConnection.ListSchedules()
       at Microsoft.ReportingServices.UI.SharedScheduleDropDown.EnsureSchedulesAreLoaded()
       at Microsoft.ReportingServices.UI.SharedScheduleDropDown.SharedScheduleDropDown_Load(Object sender, EventArgs e)
       at System.Web.UI.Control.OnLoad(EventArgs e)
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Control.LoadRecursive()
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
    aspnet_wp!ui!1!17/10/2006-08:44:26:: e ERROR: Exception in ShowErrorPage: System.Threading.ThreadAbortException: Thread was being aborted.
       at System.Threading.Thread.AbortInternal()
       at System.Threading.Thread.Abort(Object stateInfo)
       at System.Web.HttpResponse.End()
       at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
       at Microsoft.ReportingServices.UI.ReportingPage.ShowErrorPage(String errMsg) at    at System.Threading.Thread.AbortInternal()
       at System.Threading.Thread.Abort(Object stateInfo)
       at System.Web.HttpResponse.End()
       at System.Web.HttpServerUtility.Transfer(String path, Boolean preserveForm)
       at Microsoft.ReportingServices.UI.ReportingPage.ShowErrorPage(String errMsg)
    aspnet_wp!extensionfactory!e!17/10/2006-09:35:13:: w WARN: The extension Report Server Email does not have a LocalizedNameAttribute.
    aspnet_wp!extensionfactory!e!17/10/2006-09:35:13:: w WARN: The extension Report Server FileShare does not have a LocalizedNameAttribute.
    aspnet_wp!ui!e!17/10/2006-09:35:13:: e ERROR: System.Web.Services.Protocols.SoapException: An internal error occurred on the report server. See the error log for more details. ---> Microsoft.ReportingServices.Diagnostics.Utilities.InternalCatalogException: An internal error occurred on the report server. See the error log for more details. ---> System.Data.SqlClient.SqlException: EXECUTE permission denied on object 'xp_sqlagent_notify', database 'mssqlsystemresource', schema 'sys'.
       --- End of inner exception stack trace ---
       at Microsoft.ReportingServices.WebServer.ReportingService2005.ListSchedules(Schedule[]& Schedules)
    aspnet_wp!ui!e!17/10/2006-09:35:13:: e ERROR: HTTP status code --> 200
    I cannot find any other error log.
    Can anybody help?
    Tuesday, October 17, 2006 8:49 AM
    Reply
    |
    Quote
    All replies
    0
    Sign in to vote
    Sorry for the late reply. Try this: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=662319&SiteID=1
    Thursday, November 16, 2006 2:51 AM
    Reply
    |
    Quote
    Answerer
    0
    Sign in to vote
    GRANT EXECUTE ON master.dbo.xp_sqlagent_notify TO RSExecRole
    GO
    solved my problem.
    Proposed as answer by
    Christopher D. Stover
    Monday, September 16, 2013 6:52 PM
    Monday, September 16, 2013 6:51 PM
    Reply
    |
    Quote
    0
    Sign in to vote
    Tried that but no joy. Found this post on SQLServerCentral, solved our issue which mimic's the posters issue.  Just adding here as this is the first result in our search.
    Look for Topic452669-150-1
    There are a number of places I found with the information in the following
    link:
    http://phew-meme.blogspot.com/2007/10/reporting-service-on-report.html
    In
    my specific case, the RsExecRole role in both the "master" and "msdb" databases
    had had both the "NT Authority\Network Service" and "NTAuthority\System" logins
    removed from its members (the RSExecRole had had all its members removed by
    someone doing some maintenance). I compared another Reporting Services
    installation on another server after reading information in the above
    link.
    Steps:
    1. In Mangement Studio connect to the SQL Server instance
    on which Reporting Services runs.
    2. Databases > system Databases
    3.
    master > Security > Roles > RSExecRole (then add whatever logins are
    required... check in the ReportServer or ReportServerTempDB databases if you're
    not sure)
    4. msdb > Security > Roles > RSExecRole (add the same
    logins you did to the master DB)
    In the end you need the same logins in
    RSExecRole role for the master, msdb, ReportServer, and ReportServerTempDB
    databases. ("ReportServer" is the default Reporting Services database name, in
    case that's not clear ;)
    Monday, March 31, 2014 1:24 PM
    Reply
    |
    Quote
    if (!$.Microsoft) $.Microsoft = {};
    if (!$.Microsoft.Mtps) $.Microsoft.Mtps = {};
    if (!$.Microsoft.Mtps.NetReflectorInit)
    $.Microsoft.Mtps.NetReflectorInit = {
    surveyUrl: 'http://support.microsoft.com/common/survey.aspx?scid=sw%3ben%3b3763&altstyle=narrow&renderoption=overridedefault&theme=tech&url=http://social.technet.microsoft.com/Forums/en-US/3fcc7b54-ce84-48c2-9004-baaac07f2515/execute-permission-denied-on-object-xpsqlagentnotify-database-mssqlsystemresource-schema?forum=sqlreportingservices&P0=055ccfc1-78f5-46ff-8171-33f8ff760a7c',
    throttleRate: "5.00",
    privacyStatementText: "Privacy statement",
    trackerWindowText: "Please do not close this window.Thank you! The survey will appear here when you've completed your visit, so please do not close this window.",
    logoUrl: 'https://www.microsoft.com/library/svy/sto/technet_logo.gif',
    closeButtonUrl: 'https://www.microsoft.com/library/svy/sto/technet-close.gif',
    topBarUrl: 'https://www.microsoft.com/library/svy/sto/top-stripe.gif',
    bottomBarUrl: 'https://www.microsoft.com/library/svy/sto/bottom-stripe.gif',
    blankPage: 'https://social.technet.microsoft.com/forums/blank.htm',
    showSurveyToComscoreUser: 'no'
    setTimeout("Forums.loadScript('https://i1.social.s-msft.com/Forums/resources/NetReflector/NetReflector.js?cver=0%0d%0a')", 1000);
    Microsoft is conducting an online survey to understand your opinion of the Technet Web site. If you choose to participate, the online survey will be presented to you when you leave the Technet Web site.
    Would you like to participate?
    Privacy statement
    © 2015 Microsoft. All rights reserved.
    Newsletter|Contact Us|Privacy Statement|Terms of Use|Trademarks|Site Feedback
    TechNet
    Products
    IT Resources
    Downloads
    Training
    Support
    Products
    Windows
    Windows Server
    System Center
    Internet Explorer
    Office
    Office 365
    Exchange Server
    SQL Server
    SharePoint Products
    Lync
    See all products »
    Resources
    Curah! curation service
    Evaluation Center
    Learning Resources
    Microsoft Tech Companion App
    Microsoft Technical Communities
    Microsoft Virtual Academy
    Script Center
    Server and Tools Blogs
    TechNet Blogs
    TechNet Flash Newsletter
    TechNet Gallery
    TechNet Library
    TechNet Magazine
    TechNet Subscriptions
    TechNet Video
    TechNet Wiki
    Windows Sysinternals
    Virtual Labs
    Solutions
    Networking
    Cloud and Datacenter
    Security
    Virtualization
    Updates
    Service Packs
    Security Bulletins
    Microsoft Update
    Trials
    Windows Server 2012 R2
    System Center 2012 R2
    Microsoft SQL Server 2012 SP1
    Windows 8.1 Enterprise
    See all trials »
    Related Sites
    Microsoft Download Center
    TechNet Evaluation Center
    Drivers
    Windows Sysinternals
    TechNet Gallery
    Training
    Training Catalog
    Class Locator
    Microsoft Virtual Academy
    Free Windows Server 2012 courses
    Free Windows 8 courses
    SQL Server training
    e-Learning overview
    Certifications
    Certification overview
    MCSA: Windows 8
    Windows Server Certification (MCSE)
    Private Cloud Certification (MCSE)
    SQL Server Certification (MCSE)
    Other resources
    TechNet Events
    Second shot for certification
    Born To Learn blog
    Find technical communities in your area
    Support options
    For small and midsize businesses
    For enterprises
    For developers
    For IT professionals
    From partners
    For technical support
    Support offerings
    For home users
    More support
    Microsoft Premier Online
    Microsoft Fix It Center
    TechNet Forums
    MSDN Forums
    Security Bulletins & Advisories
    International support solutions
    Log a support ticket
    Not an IT pro?
    Microsoft Customer Support
    Microsoft Community Forums
    var railItems = ["/Forums/en-US/rightrailannouncement/Technet/1794d07f-9d4e-4dc0-8c1c-8bfe9d5e0bce"];
    var pageData = {"validUser":false,"autoSubscribe":false};
    var userEmailConfigured = false;
    $(document).ready(function () {
    Forums.ThreadPage.wirePageElements('Search forum questions');

    Tried that but no joy. Found this post on SQLServerCentral, solved our issue which mimic's the posters issue.  Just adding here as this is the first result in our search.
    Look for Topic452669-150-1
    There are a number of places I found with the information in the following
    link:
    http://phew-meme.blogspot.com/2007/10/reporting-service-on-report.html
    In
    my specific case, the RsExecRole role in both the "master" and "msdb" databases
    had had both the "NT Authority\Network Service" and "NTAuthority\System" logins
    removed from its members (the RSExecRole had had all its members removed by
    someone doing some maintenance). I compared another Reporting Services
    installation on another server after reading information in the above
    link.
    Steps:
    1. In Mangement Studio connect to the SQL Server instance
    on which Reporting Services runs.
    2. Databases > system Databases
    3.
    master > Security > Roles > RSExecRole (then add whatever logins are
    required... check in the ReportServer or ReportServerTempDB databases if you're
    not sure)
    4. msdb > Security > Roles > RSExecRole (add the same
    logins you did to the master DB)
    In the end you need the same logins in
    RSExecRole role for the master, msdb, ReportServer, and ReportServerTempDB
    databases. ("ReportServer" is the default Reporting Services database name, in
    case that's not clear ;)

  • Stored procedure for arhive

    I created a stored procedure for send data from a source bd to the bd destination with a link between BD
    But it will not work
    CREATE OR REPLACE PROCEDURE archivage ( source IN VARCHAR2, destination IN VARCHAR2)
    BEGIN
    / * - Prepare a cursor to select from the bd_source: * /
    source_cursor: = dbms_sql.open_cursor;
    DBMS_SQL.PARSE (source_cursor,
    'SELECT table_name FROM dba_tables' | | source,DBMS_SQL.NATIVE);
    LOOP i in source_cursor
    /* Or i use this !!!!
    SELECT object_name FROM dba_objects WHERE owner = 'SCOTT' AND object_type = 'TABLE'*/
    DBMS_SQL.DEFINE_COLUMN (source_cursor, i);
    end loop
    ignorer: DBMS_SQL.EXECUTE = (source_cursor);
    / * - Prepare a cursor to insert into the destination db: * /
    destination_cursor: = DBMS_SQL.OPEN_CURSOR;
    DBMS_SQL.PARSE (destination_cursor,
    'INSERT INTO' | | destination | | DBMS_SQL.NATIVE);
    / * - Fetch a row from the source table and insert it into the destination table: * /
    loop
    if DBMS_SQL.FETCH_ROWS (source_cursor)> 0 ALORS
    - Obtenir des valeurs de colonne de la ligne
    DBMS_SQL.COLUMN_VALUE (source_cursor,i);
    DBMS_SQL.BIND_VARIABLE (destination_cursor,i);
    ignorer: DBMS_SQL.EXECUTE = (destination_cursor);
    ELSE
    EXIT;
    End If;
    END LOOP;
    /*-Close cursor */
    COMMIT;
    DBMS_SQL.CLOSE_CURSOR (source_cursor);
    DBMS_SQL.CLOSE_CURSOR (destination_cursor);
    EXCEPTION
    WHEN OTHERS, THEN
    if
    DBMS_SQL.IS_OPEN (source_cursor)then
    DBMS_SQL.CLOSE_CURSOR (source_cursor);
    End If;
    if DBMS_SQL.IS_OPEN (destination_cursor) then
    DBMS_SQL.CLOSE_CURSOR (destination_cursor);
    End If;
    RAISE;
    END;

    find 10 differences ... :(
    CREATE OR REPLACE PROCEDURE archivage (source        IN VARCHAR2,
                                           destination   IN VARCHAR2)
    IS
       source_cursor        INTEGER;
       destination_cursor   INTEGER;
       ignorer              INTEGER;
    BEGIN
       /* - Prepare a cursor to select from the bd_source: */
       source_cursor := DBMS_SQL.open_cursor;
       DBMS_SQL.
        PARSE (source_cursor,
               'SELECT table_name FROM dba_tables' || source,
               DBMS_SQL.NATIVE);
       FOR i IN source_cursor
       LOOP
          /* Or i use this !!!!
          SELECT object_name FROM dba_objects WHERE owner = 'SCOTT' AND object_type = 'TABLE'*/
          DBMS_SQL.DEFINE_COLUMN (source_cursor, i);
       END LOOP;
       ignorer := DBMS_SQL.EXECUTE (source_cursor);
       /* - Prepare a cursor to insert into the destination db: */
       destination_cursor := DBMS_SQL.OPEN_CURSOR;
       DBMS_SQL.
        PARSE (destination_cursor,
               'INSERT INTO ' || destination,
               DBMS_SQL.NATIVE);
       /* - Fetch a row from the source table and insert it into the destination table: */
       LOOP
          IF DBMS_SQL.FETCH_ROWS (source_cursor) > 0
          THEN
             --ALORS
             -- Obtenir des valeurs de colonne de la ligne
             DBMS_SQL.COLUMN_VALUE (source_cursor, i);
             DBMS_SQL.BIND_VARIABLE (destination_cursor, i);
             ignorer := DBMS_SQL.EXECUTE (destination_cursor);
          ELSE
             EXIT;
          END IF;
       END LOOP;
       /*-Close cursor */
       COMMIT;
       DBMS_SQL.CLOSE_CURSOR (source_cursor);
       DBMS_SQL.CLOSE_CURSOR (destination_cursor);
    EXCEPTION
       WHEN OTHERS
       THEN
          IF DBMS_SQL.IS_OPEN (source_cursor)
          THEN
             DBMS_SQL.CLOSE_CURSOR (source_cursor);
          END IF;
          IF DBMS_SQL.IS_OPEN (destination_cursor)
          THEN
             DBMS_SQL.CLOSE_CURSOR (destination_cursor);
          END IF;
          RAISE;
    END;
    /

  • Stored procedure for disabling all foreign key constraints ?

    hi all,
    I need a stored procedure for disabling / enable all constraints in that database schema.
    Create or replace procedure enable_disable_proc(status varchar2(3),schema_name varchar2(20))
    ---> where 'status' parameter condition should be ( YES for enable) (NO for disable)
    ---> 'schema_name' is a parameter where ,only this schema should be affected with this procedure..
    Thanks in Advance..

    Hi,
    Try this code
    /* Formatted on 2009/07/16 08:15 (Formatter Plus v4.8.8) */
    CREATE PROCEDURE enab_disab_proc (
       enforce          IN   VARCHAR2,
       current_schema   IN   VARCHAR2
    IS
       v_alter_table_sql   VARCHAR2 (2000);
    BEGIN
       FOR rec_con IN (SELECT table_name, constraint_name
                         FROM user_constraints
                        WHERE owner = current_schema)
       LOOP
          IF (enforce = 'NO')
          THEN
             v_alter_table_sql :=
                   ' alter table '
                || current_schema
                || '.'
                || rec_con.table_name
                || ' disable constraint '
                || rec_con.constraint_name;
          ELSE
             v_alter_table_sql :=
                   ' alter table '
                || current_schema
                || '.'
                || rec_con.table_name
                || ' enable constraint '
                || rec_con.constraint_name;
          END IF;
          EXECUTE IMMEDIATE v_alter_table_sql;
       END LOOP;
    END;Edited by: Salim Chelabi on 2009-07-16 05:15

  • EXECUTE permission denied on object 'xp_sqlagent_enum_jobs'

    Hello.  I am running SQL 2005 SP2 (9.0.3282) on a Windows 2003 SP2 Enterprise server.  I have three users that I have assigned the three SQL Server Agent roles within the msdb system database so that they may manage jobs that they own.  Recently they started seeing this error:
    The EXECUTE permission was denied on the object 'xp_sqlagent_enum_jobs', dartabase 'mssqlsystemresource', schema 'sys'. (Microsoft SQL Server, Error: 229)
    I have other servers that have SQL server configured the same where we are not seeing the errors.
    Any assistance would be greatly appreciated.
    Thanks.
    Kris

     
    After you move the msdb database, you may receive the following error message:
    Error 229: EXECUTE permission denied on object 'ObjectName', database 'master', owner 'dbo'.
    This problem occurs because the ownership chain has been broken. The database owners for the msdb database and for the master database are not the same. In this case, the ownership of the msdb database had been changed. To work around this problem, run the following Transact-SQL statements. You can do this by using the Osql.exe command-line utility (SQL Server 7.0 and SQL Server 2000) or the Sqlcmd.exe command-line utility (SQL Server 2005):
    USE MSDB Go EXEC sp_changedbowner 'sa' Go
    http://support.microsoft.com/kb/224071
    INF: Object Ownership Chain Checking Across Databases Depends on the Login That Is Mapped to the Object Owners| Sankar Reddy | http://sankarreddy.spaces.live.com/ |

  • Grant read only permission on my stored procedure.

    I have a requirement like give reaonly access on my stored procedure to another user , not even execute permission on that steored procedure.
    Could you please let us know the command ?

    Marwim wrote:
    You can read the source of any PL/SQL code in dba_sourceBut that requires a priv such as select any dictionary to be granted. Why would you want to give a schema access to reading any and all source code in the database?
    This is why I think it is important that the OP provides the reasons behind the question of granting read-only source code access.
    Security is a critical component of software engineering. The basic security principle is to grant the absolute minimum privileges required to s/w and users to get the job done. Granting access to a schema read access to a dictionary view like DBA_SOURCE violates it.
    If userB wants to see userA's source code - then why not have userA simply mail it to userB, or check the code into a common source code repository?

  • Running following command gives,0403-006 Execute permission denied

    Dear
    According to metalink doc id: 422419.1 for enabling & collect debugging files for HTTP, OC4J and OPMN. But when i run this command using applmgr (apps owner) in AIX gives '0403-006 Execute permission denied'. Though applmgr have full permissions on this mount point where instance is hosted, giving this error.What is going wrong does not know?
    Any help, highly appreciated.

    The command is
    zip -r /tmp/`uname -n`_`date +%m%d%y.%H%M`_iAS_CONFIG.zip \
    $ORA_CONFIG_HOME/10.1.3/Apache/Apache/conf \
    $ORA_CONFIG_HOME/10.1.3/config \
    $INST_TOP/pids/10.1.3/Apache \
    $ORA_CONFIG_HOME/10.1.3/j2ee/ \
    $ORA_CONFIG_HOME/10.1.3/javacache/admin \
    $ORA_CONFIG_HOME/10.1.3/network/admin \
    $ORA_CONFIG_HOME/10.1.3/opmn
    When i copy & paste in telnet it was adding some spaces. Removing spaces resloved the issue. Thanking you.

  • Issue with Executing OS commands from Stored Procedure

    I am trying to execute the scripts provided at :
    http://github.com/xtender/XT_SHELL
    provided by xtender user.
    As required, I have asked my DBAs to grant privileges by executing the following scripts:
    Begin
      --change to needed permissions and execute
      dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/factiva/ODS/bin/CVIM_Rpt_ExportCSVFile’, 'read,write,execute' );
    end;
    /where CVIM_Rpt_ExportCSVFile is my script residing in the Unix server where my Oracle is installed.
    The error I am facing when I try to execute the following command is:
    select * from table(xt_shell.shell_exec('/var/scripts/CVIM_Rpt_ExportCSVFile',100))
    Exception:the Permission (java.io.FilePermission /var/scripts/CVIM_Rpt_ExportCSVFile execute) has not been granted to ODS. The PL/SQL to grant this is dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/scripts/CVIM_Rpt_ExportCSVFile', 'execute' )I have asked my DBA to also execute the following scripts: - But I still see the same error as above. I am not able to figure out whats going on. Can anyone pls help me out??
    EXEC Dbms_Java.Grant_Permission('ODS', 'SYS:java.lang.RuntimePermission', 'writeFileDescriptor', '');
    EXEC Dbms_Java.Grant_Permission(ODS', 'SYS:java.lang.RuntimePermission', 'readFileDescriptor', '');
    dbms_java.grant_permission( 'ODS', 'SYS:java.io.FilePermission', '/var/scripts/CVIM_Rpt_ExportCSVFile', 'execute' )

    DUPLICATE
    ===============================================================
    Issue with Executing OS commands from Stored Procedure
    ==============================================================

  • Stored Procedure for Accounts Receivable

    Hi. First off, apologies in advance if I have put this question into the wrong topic. Secondly, I first saw SAP 3 weeks ago when I stared my new job and have had no training so please bear with me if some of what I ask doesn't make much sense.
    OK, the issue is this.  In SAP B1, there is a built in Report called "Customer Receivables Aging" which allows you to see Customer Receivable Accounts by age (e.g 0-30, 31-60, 61-90, 90+) and so on.  The problem with the built in report is that it doesn't show all the fields I want - it only shows the Customer Name, balance, and then the aging balances.  I want to be able to see things like the customer's contact details, etc. I know this makes no sense because the whole point of the report is to be able to drill down into the different rows, but this report needs to be issued in printed form, hence the need for the extra fields.
    Since I can't seen any way from within SAP to change the fields returned by this report, I thought I'd have a stab at writing my own SQL to select out the same data along with the extra fields I wanted.  That's when the problems began...try as I might, I cannot get my figures to tally with the SAP Report.
    They are almost correct, but not quite. I am sure that I am missing a selection or some other element of the logic that B1 uses to create the built in report.
    If you want, I can post the SQL I'm using....I'm not an SQL guru by any means, but I do know my way around it; the biggest problem I have is that I cannot find any documentation as to the 4 letter tables that SAP uses and their relationships except on the most basic level (e.g ORIN is Open Return Invoice [maybe])
    Then I thought maybe it might be possible to edit that report section in B1 using the SDK.  That would be a better solution as I would not have to 'reinvent the wheel', I can just SELECT an extra field or three to include in the report.
    So my question is
    ->Does anyone have a stored procedure for SQL Server that can replicate correctly the SAP B1 "Customer Receivable Aging", even just the process SAP uses to gather this data would be good.
    OR
    is it possible to edit this report in SAP to put in the extra fields I want.
    Or, am I totally barking up the wrong tree? Thanks in advance, I know this is a long post.

    Hi Stephen,
    There should be a print layout attached to the on-screen report. This can be altered to show the additional fields you want without resorting to SDK or SQL development.
    When you have the Customer Receivables Ageing report open on screen, choose Tools-Print Layout Designer or click on the Print Layout Designer icon on the toolbar. When prompted, choose the layout you wish to edit and you'll be taken to the layout design. In the layout, you can add additional fields and should be able to add most business partner fields. As the report is set to portrait by default, I recommend changing it to landscape so you have lots more space to add the extra fields you want. This report writer is fairly intuitive, if a little basic.
    You will need to save this new report design, set it to be the default layout and then when you select to print the Customer Receivables Ageing report (ie Print Preview or Print) you will see the new report.
    Hope this helps,
    Owen

Maybe you are looking for