OracleÖдò¿ªÓα곬³ö×î´óÖµ
ÏòOracleÊý¾Ý¿â±íÖвåÈëÊ®¼¸ÍòÌõÊý¾Ý£¬¿ÉÊǵ±²åÈë3Íò¶àÌõºó£¬³ÌÐò¾ÍÅ×
Java´úÂë
ORA-01000 maximum open cursors exceeded
ORA-01000 maximum open cursors exceeded
Òì³£ÐÅÏ¢¡£GoogleÁËÒì³£ÐÅÏ¢£¬µÃÖªÕâÑùµÄ´íÎóºÜÈÝÒ׳öÏÖÔÚJava´úÂëÖеÄÖ÷ÒªÔÒòÊÇ£ºJava´úÂëÔÚÖ´ÐÐconn.createStatement()ºÍconn.prepareStatement()µÄʱºò£¬Êµ¼ÊÉ϶¼ÊÇÏ൱ÓÚÔÚÊý¾Ý¿âÖдò¿ªÁËÒ»¸öcursor¡£ÓÈÆäÊÇ£¬Èç¹ûÄãµÄcreateStatementºÍprepareStatementÊÇÔÚÒ»¸öÑ»·ÀïÃæµÄ»°£¬¾Í»á·Ç³£ÈÝÒ׳öÏÖÕâ¸öÎÊÌâ¡£ÒòΪÓαêÒ»Ö±ÔÚ²»Í£µÄ´ò¿ª£¬¶øÇÒûÓйرա£
Ò»°ãÀ´Ëµ£¬ÎÒÃÇÔÚдJava´úÂëµÄʱºò£¬createStatementºÍprepareStatement¶¼Ó¦¸ÃÒª·ÅÔÚÑ»·ÍâÃ棬¶øÇÒʹÓÃÁËÕâЩStatmentºó£¬¼°Ê±¹Ø±Õ¡£×îºÃÊÇÔÚÖ´ÐÐÁËÒ»´ÎexecuteQuery¡¢executeUpdateµÈÖ®ºó£¬Èç¹û²»ÐèҪʹÓýá¹û¼¯£¨ResultSet£©µÄÊý¾Ý£¬¾ÍÂíÉϽ«Statment¹Ø±Õ£¨statementName.close()£©¡£
ÏÂÃ潫´úÂ븽ÉÏ
Å×Òì³£´úÂ룺
Java´úÂë
Connection conn = DBUtils.getConnection();//»ñÈ¡Êý¾Ý¿âÁ¬½Ó
PreparedStatement pstmt = conn.prepareStatement("select statement...");
ResultSet rset = pstmt.executeQuery();
while (rset.next()) {
PreparedStatement pst=conn.prepareStatement("insert statement...");//¿ªÆôÒ»¸öÓαê
//pst.setXXX()...;
pst.executeUpdate();
pst=conn.prepareStatement("another insert statement");//ÔÙ¿ªÆôÒ»¸öÓαê
//pst.setXXX()...;
pst.executeUpdate();
pst=conn.prepareStatement("third insert statement");//¿ªÆôÒ»¸öÓαê
//pst.setXXX()...;
&
Ïà¹ØÎĵµ£º
oracle±í¿Õ¼ä²Ù×÷Ïê½â
1
2
3×÷Õߣº À´Ô´£º ¸üÐÂÈÕÆÚ£º2006-01-04
5
6
7½¨Á¢±í¿Õ¼ä
8
9CREATE TABLESPACE data01
10DATAFILE '/ora ......
×¢£ºÏÂÃæÖ»ÊÇÎÒ´ÖÁӵļǼһÏ£¬×Ô¼ºÔÚ¿ª·¢ÖÐËùѧµÄÒ»²¿·Ö×ÊÁÏ£¡
1£® µÚÒ»¡¢ÊÇÏÂÔØÒ»¸ö“Oracle9i¿Í»§¶Ë¾«¼ò°æ.exe”¿Í»§¶Ë£¬È»ºó°ÑËü°²×°µ½CÅÌÏÂÃæ¡£
È»ºó°ÑÎÒÃÇ×Ô¼ºÅäÖúõĔ tnsnames.ora”Îļþ£¬¸´¸ÇC:\oracle\ora90\network\adminÏÂÃæµÄtnsnames.oraÎļþ¡£
2£® ÔÚVS2005¿ª·¢¹¤¾ßÖ ......
SQL> show user
USER is "SYS"
SQL> create user t1 identified by t1;
create user t1 identified by t1
*
ERROR at line 1:
ORA-01920: user name 'T1' conflicts with another user or role name
SQL> drop user t1 cascade;
User dropped.
SQL> create user t1 identified by t1;
Us ......
µ¼³öOracleÊý¾Ý¿â½á¹¹
1.·½·¨Ò»£ºÖ±½ÓдsqlÓï¾ä
//»ñÈ¡Ò»¸öSCHEMAϵÄËùÓн¨±íºÍ½¨Ë÷ÒýµÄÓï·¨£¬ÒÔscottΪÀý£º
spool portal_schema.sql
SELECT DBMS_METADATA.GET_DDL('TABLE',u.table_name)
from USER_TABLES u;
SELECT DBMS_METADATA.GET_DDL('INDEX',u.index_name)
from USER_INDEXES u;
spool off;
2. ......
OracleÊý¾Ý×ֵ䳣Óòéѯ
--²é¿´µ±Ç°Óû§ËùÓÐ±í¼°ÃèÊö
select o.object_name,c.comments
from user_objects o
left outer join user_tab_comments c
on o.object_name=c.table_name
where object_type='TABLE'
and c.comments like '%ÏîÄ¿%'
--²é¿´µ±Ç°Óû§ËùÓÐ×Ö¶ÎÐÅÏ¢¼°ÃèÊö
select c.table ......