错误:ORA-01652:无法在表空间TEMP中将临时段扩展128

时间:2015-07-08 14:44:02

标签: c# asp.net oracle

下午好,我正在运行一个程序并返回一个游标,因此出现了ORA-01652错误:无法在表空间TEMP中将临时段扩展128个

C#,ASP.NET

OracleCommand cmd = connection.CreateCommand();             OracleDataReader dr;

        DataTable dt = new DataTable();

        try
        {
            OpenConn();

            cmd.CommandText = "UNITIZA_RELATORIOS.getComparaZila";
            cmd.CommandType = CommandType.StoredProcedure;

            OracleParameter par1 = new OracleParameter("vElemServico", OracleType.VarChar);
            par1.Value = elemServico;
            par1.Direction = ParameterDirection.Input;

            OracleParameter par2 = new OracleParameter("vdataInicio", OracleType.VarChar);
            par2.Value = dataInicio;
            par2.Direction = ParameterDirection.Input;

            OracleParameter par3 = new OracleParameter("vdataFim", OracleType.VarChar);
            par3.Value = dataFim;
            par3.Direction = ParameterDirection.Input;

            OracleParameter par4 = new OracleParameter("vOrdem", OracleType.VarChar);
            par4.Value = ordem;
            par4.Direction = ParameterDirection.Input;

            OracleParameter par5 = new OracleParameter("vCodAneel", OracleType.VarChar);
            par5.Value = codigoAneel;
            par5.Direction = ParameterDirection.Input;

            OracleParameter par6 = new OracleParameter("nCodigoError", OracleType.Number);
            par6.Size = 1;
            par6.Direction = ParameterDirection.Output;

            OracleParameter par7 = new OracleParameter("return_value", OracleType.Cursor);
            par7.Direction = ParameterDirection.ReturnValue;

            cmd.Parameters.Add(par1);
            cmd.Parameters.Add(par2);
            cmd.Parameters.Add(par3);
            cmd.Parameters.Add(par4);
            cmd.Parameters.Add(par5);
            cmd.Parameters.Add(par6);
            cmd.Parameters.Add(par7);

            dr = cmd.ExecuteReader();              

            dt.Load(dr);

            return dt;

注意:只有在超过1800行的咨询时才会出现错误

1 个答案:

答案 0 :(得分:0)

这表明您的进程正在咀嚼所有临时表空间......可能是低效的连接或查询语法。看一下解释计划,看看为什么它需要所有空间。与其他解决方案相比,优化查询可能更容易:

来自here 通过运行以下命令创建新数据文件:

alter tablespace TABLE_SPACE_NAME添加数据文件'D:\ oracle \ Oradata \ TEMP04.dbf'size 2000M autoextend on;