C# Oracle PKG在其他架构中执行-不在ODP.net中连接字符串中指定的架构中

C# Oracle PKG在其他架构中执行-不在ODP.net中连接字符串中指定的架构中,c#,asp.net,oracle,odp.net,C#,Asp.net,Oracle,Odp.net,问题:Oracle PKG在其他架构中执行-不在ODP.net连接字符串中指定的架构中 环境 我们在一个数据库上有300多个模式 我们使用的是非托管ODP.net,它与oracle客户端安装一起安装 应用程序中不包含外部Oracle.DataAccess.dll。仅从GAC获取 主架构拥有访问子架构对象的所有授权 有些公共同义词用于从其他模式访问主模式中的某些表 在任何模式中都没有PKG PROC FUNC的同义词 每个模式都有相同的PKG PROC FUNC列表 我们使用下面提到的方法从过程中

问题:Oracle PKG在其他架构中执行-不在ODP.net连接字符串中指定的架构中

环境

我们在一个数据库上有300多个模式

  • 我们使用的是非托管ODP.net,它与oracle客户端安装一起安装
  • 应用程序中不包含外部Oracle.DataAccess.dll。仅从GAC获取
  • 主架构拥有访问子架构对象的所有授权
  • 有些公共同义词用于从其他模式访问主模式中的某些表
  • 在任何模式中都没有PKG PROC FUNC的同义词
  • 每个模式都有相同的PKG PROC FUNC列表
  • 我们使用下面提到的方法从过程中获取数据
  • 该过程和方法已运行了3年
  • 突然,当连接到主模式并使用驻留在主模式上的PKG获取数据时,它会自动连接到其他模式并尝试执行相同的命名过程

    在.net调试会话中,我们可以验证是否传递了下面提到的连接字符串,这是完全正确的

    但是程序执行是在不同的模式中进行的吗?去哪里看,怎么看

    连接字符串

    数据源=;用户Id=;密码=;最小池大小=10;连接寿命=120;连接超时=120;增量池大小=5;decrpool Size=2;最大池大小=150;验证连接=true

    执行方法

         public DataSet ExecuteQueryProcedure(string _ProcName, string[] _arrINPUTParamNames, string[] _arrINPUTParamValues, 
    string constr, ref string strMsg)
                {
        strMsg = "";
        try
        {
        if (_arrINPUTParamValues.Length < _arrINPUTParamNames.Length)
        {
        Array.Resize(ref _arrINPUTParamValues, _arrINPUTParamNames.Length);
        for (int _intParamCount = 0; _intParamCount < _arrINPUTParamValues.Length; _intParamCount++)
        {
        _arrINPUTParamValues[_intParamCount] = _arrINPUTParamValues[_intParamCount] == null ? "" : _arrINPUTParamValues[_intParamCount];
        }
        }
    
        OracleConnection con = new OracleConnection(constr);
        con.Open();
    
        // create the command object and set attributes
        OracleCommand cmd = new OracleCommand(_ProcName, con);
        cmd.CommandType = CommandType.StoredProcedure;
        cmd.FetchSize = cmd.FetchSize * 8;
    
        OracleCommandBuilder.DeriveParameters(cmd);
    
        int _intInputParamCount = 0;
        for (int _intParamCount = 0; _intParamCount < cmd.Parameters.Count; _intParamCount++)
        {
        if (cmd.Parameters[_intParamCount].Direction == ParameterDirection.Input)
        {
        _intInputParamCount++;
        cmd.Parameters[_intParamCount].Value = "";
        }
        }
        if (_intInputParamCount != _arrINPUTParamNames.Length)
        {
        strMsg = "Input Parameter count mismatch";
        return null;
        }
    
        for (int _intParamCount = 0; _intParamCount < cmd.Parameters.Count; _intParamCount++)
        {
        for (int _intSetParamCount = 0; _intSetParamCount < _arrINPUTParamNames.Length; _intSetParamCount++)
        {
        if (_arrINPUTParamNames[_intSetParamCount].ToUpper() == cmd.Parameters[_intParamCount].ParameterName.ToUpper())
        {
        cmd.Parameters[_intParamCount].Value = _arrINPUTParamValues[_intSetParamCount];
        break;
        }
        }
        }
    
        // create a data adapter to use with the data set
        OracleDataAdapter da = new OracleDataAdapter(cmd);
        // create the data set
        DataSet ds = new DataSet();
        // fill the data set
    
        DateTime dtBeforeTime = DateTime.Now;
    
        da.Fill(ds);
    
        DateTime dtAfterTime = DateTime.Now;
        TimeSpan ts = dtAfterTime - dtBeforeTime;
    
    
        // clean up our objects release resources
        ds.Dispose();
        da.Dispose();
    
        cmd.Dispose();
        con.Close();
        con.Dispose();
    
        return ds;
        }
        catch (OracleException Ex)
        {
        strMsg = Ex.Source + ": " + Ex.Message;
        return null;
        }
                }
    
    公共数据集ExecuteQuery过程(字符串_ProcName,字符串[]_ArrInputParamName,字符串[]_arrINPUTParamValues,
    字符串构造,参考字符串strMsg)
    {
    strMsg=“”;
    尝试
    {
    如果(_arriInputParamValues.Length<_arriInputParamNames.Length)
    {
    Resize(ref _arrINPUTParamValues,_arrINPUTParamNames.Length);
    对于(int intParamCount=0;intParamCount<\uArrInputParamValues.Length;intParamCount++)
    {
    _arrINPUTParamValues[\u intParamCount]=\u arrINPUTParamValues[\u intParamCount]==null?”:\u arrINPUTParamValues[\u intParamCount];
    }
    }
    OracleConnection con=新的OracleConnection(cont);
    con.Open();
    //创建命令对象并设置属性
    OracleCommand cmd=新的OracleCommand(_ProcName,con);
    cmd.CommandType=CommandType.storedProcess;
    cmd.FetchSize=cmd.FetchSize*8;
    OracleCommandBuilder.DeriveParameters(cmd);
    int _intInputParamCount=0;
    对于(int _intParamCount=0;_intParamCount
    我怀疑您调用的过程是用authid current\u user而不是默认的authid definer编译的。感谢@brian的反馈,您能告诉我如何检查吗。请从dba\u过程中选择*。AUTHID列显示“定义者”或“当前用户”