OracleϵÁУºÍ¼Æ¬µÄ´æ´¢
OracleϵÁУºÍ¼Æ¬µÄ´æ´¢
Ò»£ºÊ²Ã´ÊÇ´ó¶ÔÏ󣬴ó¶ÔÏó»ù±¾²Ù×÷£¿
²Î¼ûÎÒµÄBLOG£ºOracleϵÁУºLOB´ó¶ÔÏó´¦Àí
http://blog.csdn.net/qfs_v/archive/2008/05/21/2464599.aspx
¶þ£¬Í¼Æ¬µÄ´æ´¢»ò¶þ½øÖÆÎļþµÄ´æ´¢
1£¬ÏȲåÈëÆÕͨÊý¾Ý£¬Óöµ½´ó¶ÔÏóÁÐʹÓÃempty_blob()¹¹Ôì¿ÕµÄÖ¸Õë¡£
Àý×Ó£º
/*
conn scott/tiger;
Create TableSpace ts5_21;
*/
Create Table MyLob
(
no number(8) primary key,
fname varchar2(30),
myfile blob
)
Lob (myfile) Store As
(
Tablespace ts5_21
Chunk 15K
Disable Storage In Row
);
Insert Into MyLob Values(1,'IMG_0210.JPG',empty_blob());
2£¬´´½¨Â߼Ŀ¼MYDIR
Create Directory MYDIR As 'E:\Oracle';
3£¬ÉùÃ÷Ò»¸öBLOBÀàÐͱäÁ¿£¬Ê¹ÓÃselect into Óï¾äÈÃÆäÖ¸Ïòµ½empty_blob()¹¹Ôì¿ÕµÄÖ¸ÕëËùÖ¸ÏòµÄ´æ´¢¿Õ¼ä
Select myfile Into BLOBÀàÐͱäÁ¿ from myLob Where no = 1 FOR UPDATE;
4£¬ÉùÃ÷Ò»¸öBFileÀàÐͱäÁ¿£¬¹ØÁªÂ߼Ŀ¼ºÍÎïÀíĿ¼Îļþ£¬Ê¹Óà BFileName() ½«ÆäÖ¸Ïòµ½´ý´æ´¢µÄÎļþ¡£
BFileÀàÐͱäÁ¿ := BFileName('MYDIR','IMG_0210.JPG');
5£¬Ê¹ÓÃDBMS_LOB.open()·½·¨½«BFileÀàÐͱäÁ¿ËùÖ¸ÏòµÄÎļþ´ò¿ª
DBMS_LOB.Open(BFileÀàÐͱäÁ¿);
6£¬Ê¹ÓÃDBMS_LOB.loadfromfile()·½·¨½«BFileÀàÐͱäÁ¿ËùÖ¸ÏòµÄÎļþ¶ÁÈëµ½BLOBÀàÐͱäÁ¿ËùÖ¸ÏòµÄ´æ´¢¿Õ¼ä
DBMS_LOB.LoadfromFile(BLOBÀàÐͱäÁ¿,BFileÀàÐͱäÁ¿,DBMS_LOB.getlength(BFileÀàÐͱäÁ¿));
7£¬Ê¹ÓÃDBMS_LOB.close()·½·¨½«bfileµÄ±äÁ¿ËùÖ¸ÏòµÄÎļþ¹Ø±Õ
DBMS_LOB.Close(BFileÀàÐͱäÁ¿);
8£¬Ìá½»ÊÂÎñ
Commit;
Àý×Ó;
Declare
varB blob;
varF Bfile;
Begin
Ïà¹ØÎĵµ£º
Ò» ÔÚOracleÖÐÁ¬½ÓÊý¾Ý¿â
public class Test1 {
public static void main(String[] args) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection conn = DriverManager.getConnection(
&nbs ......
Oracle 10g statisticÊý¾Ýͳ¼Æ,Oracle»á¸ù¾ÝÕâЩͳ¼ÆÐÅÏ¢À´¾ö¶¨ÊÇ×ßRBO(Rule-BasedOptimization)£¬»¹ÊÇ×ßCBO(Cost-BasedOptimization)£¬»áȥѡÔñÄÄÖÖÖ´Ðмƻ®¸ü»®Ëã,Ó°ÏìÊÇ·ñ×ßÏà¹ØµÄË÷ÒýµÈ.Èç¹ûÊÇCBOµÄ»°£¬ËüÒÀ¿¿×¼È·µÄ£¨»òÕß˵±È½Ï׼ȷµÄ£©Í³¼ÆÐÅÏ¢À´²úÉúÓÅ»¯µÄÖ´Ðз¾¶,Èç¹ûûÓÐ×ö¹ýͳ¼Æ£¬CBOÒ²¾ÍûÓÐ×öcostÆÀ¹ÀµÄÒÀ¾Ý ......
1 ²Ù×÷ϵͳ±¸·Ý
²Ù×÷ϵͳ±¸·ÝºÍ»Ö¸´ÊµÊ©ÆðÀ´±È½Ï¼òµ¥£¬µ±È»Ò²±È½Ï·Ñʱ£¬ÒªÇóϵͳֹͣʹÓ㬴˹ý³Ì°üÀ¨¹Ø±ÕÊý¾Ý¿â²¢´ÓϵͳÉÏ×¢ÏúËùÓÐÓû§¡£ËùÓзÃÎʱ»½â³ýÖ®ºó£¬ÏµÍ³¹Ø±Õ²¢ÒÔµ¥Óû§·½Ê½ÖØÐÂÆô¶¯£¬¿ØÖÆȨ½»¸øϵͳ¹ÜÀíÔ±£¬ÕâÒ»²½È·±£Ã»ÓÐÓû§Ó¦ÓóÌÐòÈí¼þÔËÐУ¬±ÜÃâÐÞ¸ÄÓ²ÅÌÉϵÄÊý¾Ý¡£Èç¹ûÕâ¸ö±¸·ÝÓÃÓÚ»Ö¸´Êý¾Ý¿âϵͳ£¬ÄÇôϵ ......
ÔÚORACLEÖиø±í¡¢ÁÐÔö¼Ó×¢ÊÍÒÔ¼°¶ÁȡעÊÍ
1¡¢¸ø±íÌî¼Ó×¢ÊÍ£ºSQL>comment on table ±íÃû is '±í×¢ÊÍ";
2¡¢¸øÁмÓ×¢ÊÍ£ºSQL>comment on column ±í.ÁÐ is 'ÁÐ×¢ÊÍ';
3¡¢¶ÁÈ¡±í×¢ÊÍ£ºSQL>select * from user_tab_comments where comments is not null;
4¡¢¶ÁÈ¡ÁÐ×¢ÊÍ£ºSQL>select * from user_col_commnents wh ......
Ò»¡¢Ð½¨databack.shÎļþ£¬´æ·ÅĿ¼/opt/databack/
#Êý¾Ý¿âÓû§×ÊÁÏ
USERNAME=Êý¾Ý¿âÓû§Ãû(ÐÅÏ¢Òþ²Ø)
PASSWORD=Êý¾Ý¿âÃÜÂë(ÐÅÏ¢Òþ²Ø)
#FTP·þÎñÆ÷ÐÅÏ¢
FTP_SERV=FTP·þÎñÆ÷(ÐÅÏ¢Òþ²Ø)
FTP_USER=FTPÓû§Ãû(ÐÅÏ¢Òþ²Ø)
FTP_PASS=FTPÃÜÂë(ÐÅÏ¢Òþ²Ø)
FTP_DIR=FTPĿ¼(ÐÅÏ¢Òþ²Ø)
#±¸·ÝĿ¼
BACKUP_DIR=/opt/databack
#¸ ......