ORA-01000: 超出打开游标的最大数(解决及原因)

ORA-01000-超出打开游标的最大数(解决及原因) GPS平台、网站建设、软件开发、系统运维,找森大网络科技! https://cnsendnet.taobao.com 来自森大科技官方博客 http://www.cnsendblog.com/index.php/?p=1590 修改后就没报错了 还是 chongqingdaxue 缴费平台, 税票打印完毕, 上传到财务处时, 当税票数目较少时(10几张), 能正常上传; 当数目较大时(共408张), 就上传失败. 查看 tomcat 日志, 如下: 既然超出最大游标数, 为了第一间让程序恢复正常运行, 当 阅读详情
clip_image001[4]

既然超出最大游标数, 为了第一间让程序恢复正常运行, 当然"脚疼治脚", 先把最大游标数调大:

(1). 以 DBA 登录 PL/SQL

(2). 打开 Command Window(注意不是 SQL Window)

clip_image002[4]

(3). 输入以下命令, 修改 oracle 最大游标数为 1000
1    SQL> alter system set open_cursors=1000 scope=both;

(4). 查看最大游标数是否已修改成功
1    SQL> show parameter open_cursors;

(5). 重启 tomcat(一定要有这一步, 否则修改不生效)

 

经过以上操作, 票据顺利上传上去了, 可是这样治标不治本, 万一以后来个1000张以上的票据要上传, 那不就又得改游标数了; 在代码里肯定是每处理一张票就打开一个游标的, 这样是错误的. 网上找了这个错误代码的相关说明, 在这里发现以下这段话

    这样的错误很容易出现在Java代码中的主要原因是:Java代码在执行conn.createStatement()和 conn.prepareStatement()的时候,实际上都是相当与在数据库中打开了一个cursor。尤其是,如果你的 createStatement和prepareStatement是在一个循环里面的话,就会非常容易出现这个问题。因为游标一直在不停的打开,而且没有关闭。

在代码里看了一下, 果然是这样, 程序通过循环调用封装好的 executeSql 函数, 来对每张票进行 update, 而 executeSql 里每次都调用了 conn.prepareStatement(); 将其移出循环, 再改回原游标数, 再上传票据, 就不再报错了.
    public static void executeSql(Connection conn, String sql, Object[] parValue) throws Exception{
        PreparedStatement ps = null;
        try {
            LOGGER.info(sql);
            ps = conn.prepareStatement(sql);
            if (parValue != null){
                String params = "";
                for (int i = 0; i < parValue.length; i++){
                    if (i != 0){
                        params += ",";
                    }
                    ps.setObject(i+1, parValue[i]);
                    params += parValue[i];
                }
                LOGGER.info(params);
            }
            ps.execute();
        } catch (SQLException e) {
            e.printStackTrace();
            throw new Exception();
        } finally {
            if (ps != null){
                ps.close();
            }
        }
    }

注: 原代码有进行 ps.close(); 的, 但是仍然无效, 是因为 connection 的 autocommit 设为 false 的原因? 还是因为 connection 是从连接池取的原因呢?

有一个问题说明 connection 与 prepareStatement 进行 close 的关系, 但这里只是说明了直接 close connection, 而没有说明直接 close prepareStatement.
ORA-01000: 超出打开游标的最大数 处理方法 问题描述 在执行数据库操作时,产生如下错误信息: Nested exception is: java.sql.SQLException: ORA-01000: 超出打开游标的最大数 处理方法 通过报错信息很明显看出,是因为参数open_cursors设置值过小,所以应该适当调大open_cursors设置值。 操作步骤如下: $ sqlplus / as sysdba SQL*Plus: Release 12.1.0.2.0 Production on Mon Apr 26 08:05:20 2021 阅读详情

相关推荐

ORA-01000: 超出打开游标的最大数 问题的分析和解决

在java代码中,执行conn.createStatement()和conn.prepareStatement()的时候,实际上都是相当与在数据库中打开了一个cursor。尤其是,如果你的createStatement和prepareStatement是在一个循环里面的话,就会非常容易出现这个问题。因为游标一直在不停的打开,而且没有关闭。 一般来说,我们在写Java代码的时候,createStatement和prepareStatement都应该要放在循环外面,而且使用了这些Statment后,及

hongtea1234的专栏 5676

ORA-01000: 超出打开游标的最大数

author:skatetime:2008/07/24 现象:执行存储过程的时候提示下面的错误 第 1 行出现错误:ORA-01000: 超出打开游标的最大数ORA-06512: 在 "HPO3.P_FINDFULLSQL", line 29ORA-06512: 在 line 1 分析与解决: Oracle 使用 init.ora 中的初始化参数 O

冰刀(skate) 5239

ORA-01000 超出打开游标的最大数的原因和解决方案

ORA-01000 超出打开游标的最大数的原因和解决方案

jgfyyfd的博客 1534

ORA-01000:超出最多允许打开的游标数

问题描述Oracle 使用 OPEN_CURSORS 参数指定一个会话一次最多可以打开的游标的数量。超过此数量时,Oracle 将报告 ORA-01000 错误。当此错误传播到 WebLogic Server 时,就会...

4320

数分实战(01):Global_Superstore数据集解析与商业洞察

本文以Global_Superstore零售数据集为例,手把手指导数据分析实战全流程。从数据清洗、探索性分析到深度商业洞察,详细解析了如何通过Python处理缺失值与异常值,进行销售利润分析、客户细分与地理分析,并探讨了折扣与利润的微妙关系。文章旨在帮助读者建立数据分析思维框架,从数据中挖掘可指导实际业务决策的核心洞察。

weixin_28487433的博客 342

Ambari 3.0.0 + BigTop 3.3.0 源码编译与集群部署指南(Kylin V10 / aarch64)

仅仅是针对“应用商店目录(Applications Catalog)”的一个外围附属子模块(它不是 YARN 监控大盘,不影响 YARN UI 网页的主体使用),我们可以采用。自带的 Node 二进制是 x86_64 版本,在 ARM64(aarch64)容器上无法执行(Exit value: 126)。:Ambari Server/Agent 使用 JDK 17,BigTop 大数据组件(Hadoop/HBase/Spark 等)使用 JDK 8。,源码中包含 x86 特定的原生二进制文件。

amumu1992的博客 481

ORACLE ORA-01000: 超出打开游标的最大数(解决及原因)

在for循环中调用数据库插表语句,容易造成ORA-01000: 超出打开游标的最大数的问题,主要原始是用CONNECTION 创建了 PREPAREDSTATEMENT ,用完了 PREPAREDSTATEMENT 后,没有关闭PREPAREDSTATEMENT,导致游标一直处于打开状态,因此在大数据访问量的情况下很容易出现数据库游标使用到最大,无法分配游标错误。 解决方式: 通过批量插入的方...

Eddie-Wang的博客 1万+

一种基于改进YOLOv8并与ORB-SLAM3融合的动态环境密集点云同步定位与建图(SLAM)方法

文章提出了一种基于改进 YOLOv8 与 ORB-SLAM3 融合的动态环境稠密点云 SLAM 方法,通过引入GSConv 卷积模块和VoVGSCSP 特征融合模块优化 YOLOv8 的轻量性,结合实时目标检测与语义分割技术去除动态特征点,显著提升了动态场景下的位姿估计精度。

2401_87345388的博客 1937

JDBC批量插入提示ORA-01000: 超出打开游标的最大数(解决及原因)

在用原生JDBC 循环插入数据 如果数据量超过数据库游标会提示 java.sql.SQLException: ORA-01000: 超出打开游标的最大数 在这种情况下游标不停的打开而没有关闭,当循环次数足够大时就会出现上面的错误。 解决方法: 1、增大游标的数量(不可取) 分析: 1.1、显然这种方法治标不治本,游标的数量往往设置一个 较小值即可,除非特殊情况;...

qq_39008613的博客 5137

【嵌入式原理系列-第七篇】ld脚本实战:从零构建MCU内存布局

本文是一篇针对嵌入式开发者的实战指南,详细讲解了如何从零开始为MCU编写ld链接器脚本以构建自定义内存布局。文章以STM32F103C8T6为例,深入剖析了MEMORY和SECTIONS指令的用法,并提供了OTA分区、非易失数据存储等高级定制案例,帮助开发者解决实际工程中的Flash与RAM管理难题,实现对程序运行的深度掌控。

weixin_29271263的博客 246

AUTOSAR&UDS 理论要点及isolar实战-DEM模块

从这节开始,将讲解UDS诊断中非常重要的知识点:故障事件触发、故障信息上报、故障信息处理、故障信息存储和故障系统降级,后续会陆续更新。

cqaa11的博客 552

ORA-01000: maximum open cursors exceeded 超出打开游标的最大数的原因和解决方案

错误类型:ORA-01000: maximum open cursors exceeded  超出打开游标的最大数、 原因分析:Java代码的时候,createStatement和prepareStatement都应该要放在循环外面,而且使用了这些Statment后,及时关闭。最好是在执行了一次executeQuery、executeUpdate等之后,如果不需要使用结果集(ResultS

Grey_Guo的专栏 1万+

9.23华为OD机试真题 新系统 - 世界杯徽章换购 (Java/Py/C/C++/Js/Go)

9.23华为OD机试真题 新系统 - 世界杯徽章换购 (Java/Py/C/C++/Js/Go)

算法大师! 1558

【原因及解决办法】C# 报错 ORA-00604: 递归 SQL 级别 1 出现错误,ORA-01000: 超出打开游标的最大数

记录一下今天遇到的一个Oracle 错误 :ORA-00604: 递归 SQL 级别 1 出现错误,ORA-01000: 超出打开游标的最大数 医院运行的接口,最近频繁出现这个错误,一开始以为是游标最大数不够大经过以下SQL查询结果为 300,第一想到的就是修改最游标最大数 方式一 从数据库游标最大数修改入手,不过这个方法治标不治本。 --结果 300 select value from v$parameter where name = 'open_cursors' --加大游标数 alter

Aries·Zhao 2027

图解B+树的插入过程

B+ 树在现代数据库中很常见,如果我们了解它,在工作中可能对性能优化会有更好的帮助! 最近我一直在思考 B+ 树的高度是由什么决定的。知道我了解了 B+ 树的插入过程,才有一种恍然大悟的感觉! 网上的一些资料杂乱无章,不同的数据库可能还有对 B+ 树有不同的实现。但是万变不离其宗,B+ 树的定义,大致如下所示: 总结一下,B+ 树有下面 5 个重要的特点。 B+ 树包含 2 种类型的结点: 内部结点(也称索引结点)和叶子结点。 根结点本身即可以是内部结点,也可以是叶子结点。 根结点的关键字个数最

愿君出走半生,归来时仍是少年 2133

【libnice】meson + vs2022,生成win32工程

libnice

突围 947

ORA-01000:超出打开游标的最大数的原因和解决方案

原文发表于: http://www.laozizhu.com/view.jsp?articleId=34先看有问题的代码import java.sql.Connection;import java.sql.DriverManager;import java.sql.SQLException;import java.sql.Statement;public class Test {  publi

老紫竹的专栏 1万+

VC中sqlite的使用

在VC中对sqlite的使用,实现数据库大批数据的快速插入,读取数据库中的数据在ListCtrl中显示

ORA-01000: maximum open cursors exceeded 超出打开游标的最大数的原因和解决方案

错误类型:ORA-01000: maximum open cursors exceeded  超出打开游标的最大数、   原因分析:Java代码的时候,createStatement和prepareStatement都应该要放在循环外面,而且使用了这些Statment后,及时关闭。最好是在执行了一次executeQuery、executeUpdate等之后,如果不需要使用结果集(ResultS

1441

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

锂电池充电器电路设计 里面有电路

锂电池充电器电路设计 里面有电路 3.7V升压到5V电路设计。

上一篇: oracle全文检索的创建及使用
下一篇: 2009-03-17 13:32 HP小机常见故障及解决办法
OilAlways
博客等级 码龄17年 57粉丝 27原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值