OracleÖÐBLOB/CLOB×ֶοÉÄÜÓöµ½µÄÎÊÌâ
Blob ²ÉÓõ¥×Ö½Ú´æ´¢£¬Êʺϱ£´æ¶þ½øÖÆÊý¾Ý£¬ÈçͼƬ¡¢ÊÓÆµµÈ¡£
Clob ²ÉÓöà×Ö½Ú´æ´¢£¬Êʺϱ£´æ´óÐÍÎı¾Êý¾Ý¡£
1. ÔÚOracle JDBCÖвÉÓÃÁ÷»úÖÆ¶Ô BLOB/CLOB ½øÐжÁд²Ù×÷£¬ËùÒÔҪעÒâ²»ÄÜÔÚÅú´¦ÀíÖжÁд BLOB/CLOB×ֶΣ¬·ñÔò½«³öÏÖ
Stream type cannot be used in batching Òì³£¡£
2. Oracle BLOB/CLOB ×ֶα¾ÉíÓµÓÐÒ»¸öÓα꣨cursor£©£¬JDBCͨ¹ýÓαê¶ÔBlob/Clob×ֶνøÐвÙ×÷£¬ÔÚBlob/Clob×ֶδ´½¨Ö®Ç°£¬ÎÞ·¨»ñÈ¡ÆäÓαê¾ä±ú£¬»á³öÏÖ
Connection reset by peer: socket write error Òì³£¡£
ÕýÈ·µÄ×ö·¨ÊÇ£ºÊ×ÏÈ´´½¨Ò»¸ö¿Õ Blob/Clob ×ֶΣ¬ÔÙ´ÓÕâ¸ö¿Õ Blob/Clob×ֶλñÈ¡Óα꣬ÀýÈçÏÂÃæµÄ´úÂ룺
PreparedStatement ps = conn.prepareStatement( " insert into PICTURE(image,resume) values(?,?) " );
// ͨ¹ýoralce.sql.BLOB/CLOB.empty_lob()¹¹Ôì¿ÕBlob/Clob¶ÔÏó
ps.setBlob( 1 ,oracle.sql.BLOB.empty_lob());
ps.setClob( 2 ,oracle.sql.CLOB.empty_lob());
ps.excuteUpdate();
ps.close();
// ÔٴζԶÁ³öBlob/Clob¾ä±ú
ps = conn.prepareStatement( " select image,resume from PICTURE where id=? for update " );
ps.setInt( 1 , 100 );
ResultSet rs = ps.executeQuery();
rs.next();
oracle.sql.BLOB imgBlob = (oracle.sql.BLOB)rs.getBlob( 1 );
oracle.sql.CLOB resClob = (oracle.sql.CLOB)rs.getClob( 2 );
// ½«¶þ½øÖÆÊý¾ÝдÈëBlob
FileInputStream inStream = new FileInputStream( " c://image.jpg " );
OutputStream outStream = imgBlob.getBinaryOutputStream();
byte [] buf = new byte [ 10240 ];
int len;
while (len = inStream.read(buf) > 0 ) {
outStream.write(buf, 0 ,len);
}
inStream.close();
outStream.cloese();
// ½«×Ö·û´®Ð´ÈëClob
resClob.putString( 1 , " this is a clob " );
// ÔÙ½«Blob/Clob×ֶθüе½Êý¾Ý¿â
ps = conn.prepareStatement( " update PICTURE set image=? and resume=? where id=? " );
ps.setBlob( 1 ,imgBlob);
ps.setClob( 2 ,resClob);
ps.setInt( 3 , 100 );
ps.executeUpdate();
ps.close();
²Î¿¼×ÊÁÏ£º¿ª·¢ÕßÔÚÏßhttp://www.builder.com.cn/files/list-0-0-50259-1-1.
Ïà¹ØÎĵµ£º
extent--×îС¿Õ¼ä·ÖÅ䵥λ --tablespace management
block --×îСi/oµ¥Î» --segment management
create tablespace james
datafile '/export/home/oracle/oradata/james.dbf'
size 100M ¡¡¡¡¡¡¡¡¡¡¡¡--³õʼµÄÎļþ´óС¡¡
autoextend On¡¡¡¡¡¡¡¡ --×Ô¶¯Ôö³¤
next 10M¡ ......
Oracle 10.2.0.1µÄPatchµµÖð½¥ÐγÉÁ˼Ò×åÌåϵÁË,ÏÖÔÚÈôó¼ÒÀ´ÈÏʶһÏÂÕâ¸öÌåϵ°É!µ½Ä¿Ç°Ëù·¢²¼µÄÖ÷ÒªµÄPatchÓÐ10.2.0.2,10.2.0.3,10.2.0.4,10.2.0.4.1,10.2.0.4.2,10.2.0.4.3,10.2.0.5.
֮ǰÔÚ32λºÍ64λLinuxϰ²×°Á˽ÏΪÎȶ¨µÄOracle 10G for Linux x86º ......
Ò»¡¢Oracle PackageµÄ×÷ÓÃ
1¡¢¶¨ÒåÓë˵Ã÷
a. Ïà¹Ø¶ÔÏó£¨×Ô¶¨ÒåÀàÐÍ¡¢º¯Êý¡¢´æ´¢¹ý³ÌµÈ£©µÄ·â×°
b. ³ÌÐò°üµÄ¸÷²¿·Ö
- ³ÌÐò°ü¹æ¸ñ˵Ã÷
ÉùÃ÷×Ó³ÌÐò
- ³ÌÐò°üÖ÷Ìå
&n ......
Òì»ú»Ö¸´¹ý³Ì£º
ÔÚrman>run
{
allocate channel ch00 type 'sbt_tape' parms="ENV=(NB_ORA_CLIENT=zjddms1)";
set newname for datafile 1 to '/oradata/zjdms/1.dbf';
......
set newname for datafile 23 to '/oradata/test/23.dbf';
set newname for datafile 24 to '/oradata/test/24.dbf';
restore databas ......
Just a few days ago a got to two Oracle DBAs discussing why the have so much “PX Deq Credit : send blkd” on a system. And if that is causing their performance problems.
The are some blog on the internet claiming it has to do with qc distribution and what ever.
But in many cases, especi ......