Aix 5.3ÏÂ×Ô¶¯±¸·ÝOracle¶à¸öʵÀý£¬²¢ÉÏ´«ÖÁFTP·þÎñÆ÷
Ò»¡¢Ð½¨databack.shÎļþ£¬´æ·ÅĿ¼/opt/databack/
#Êý¾Ý¿âÓû§×ÊÁÏ
USERNAME=Êý¾Ý¿âÓû§Ãû(ÐÅÏ¢Òþ²Ø)
PASSWORD=Êý¾Ý¿âÃÜÂë(ÐÅÏ¢Òþ²Ø)
#FTP·þÎñÆ÷ÐÅÏ¢
FTP_SERV=FTP·þÎñÆ÷(ÐÅÏ¢Òþ²Ø)
FTP_USER=FTPÓû§Ãû(ÐÅÏ¢Òþ²Ø)
FTP_PASS=FTPÃÜÂë(ÐÅÏ¢Òþ²Ø)
FTP_DIR=FTPĿ¼(ÐÅÏ¢Òþ²Ø)
#±¸·ÝĿ¼
BACKUP_DIR=/opt/databack
#¸ñʽ»¯ÈÕÆÚ
DATE=`date +%Y%m%d`
#¶¨ÒåÈý¸öʵÀý
EXP1=µÚÒ»¸öORACLEʵÀýÃû³Æ(ÐÅÏ¢Òþ²Ø)
EXP2=µÚ¶þ¸öORACLEʵÀýÃû³Æ(ÐÅÏ¢Òþ²Ø)
EXP3=µÚÈý¸öORACLEʵÀýÃû³Æ(ÐÅÏ¢Òþ²Ø)
#¿ªÊ¼±¸·ÝµÚÒ»¸öʵÀý
export ORACLE_SID=${EXP1}
if [ -f ${BACKUP_DIR}/${EXP1}/${EXP1}_${DATE}.dmp ]; then
echo exp ${EXP1} `date +%Y-%m-%d` backup file already exists.
else
exp ${USERNAME}/${PASSWORD} file=${BACKUP_DIR}/${EXP1}/${EXP1}_${DATE}.dmp
fi
#×¢ÊÍ£ºÈç¹û±¸·ÝĿ¼Ï´æÔÚµ±Èյı¸·ÝÎļþ£¬ÔòÊä³ö“ÎļþÒÑ´æÔÚ”µÄÌáʾÐÅÏ¢£¬Èç¹ûûÓУ¬Ôò±¸·ÝÎļþ¡£
#¿ªÊ¼±¸·ÝµÚ¶þ¸öʵÀý
export ORACLE_SID=${EXP2}
if [ -f ${BACKUP_DIR}/${EXP2}/${EXP2}_${DATE}.dmp ]; then
echo exp ${EXP2} `date +%Y-%m-%d` backup file already exists.
else
exp ${USERNAME}/${PASSWORD} file=${BACKUP_DIR}/${EXP2}/${EXP2}_${DATE}.dmp
fi
#¿ªÊ¼±¸·ÝµÚÈý¸öʵÀý
export ORACLE_SID=${EXP3}
if [ -f ${BACKUP_DIR}/${EXP3}/${EXP3}_${DATE}.dmp ]; then
echo exp ${EXP3} `date +%Y-%m-%d` backup file already exists.
else
exp ${USERNAME}/${PASSWORD} file=${BACKUP_DIR}/${EXP3}/${EXP3}_${DATE}.dmp
fi
#¿ªÊ¼ÉÏ´«±¸·ÝÎļþ
ftp -n $FTP_SERV <<AUTO_FTP
user $FTP_USER $FTP_PASS
passive
binary
cd $FTP_DIR
cd ${EXP1}
put ${BACKUP_DIR}/${EXP1}/${EXP1}_${DATE}.dmp ${EXP1}_${DATE}.dmp
cd ../${EXP2}
put ${BACKUP_DIR}/${EXP2}/${EXP2}_${DATE}.dmp ${EXP2}_${DATE}.dmp
cd ../${EXP3}
put ${BACKUP_DIR}/${EXP3}/${EXP3}_${DATE}.dmp ${EXP3}_${DATE}.dmp
AUTO_FTP
¶þ¡¢½«databack.sh¼ÓÈëµ½¼Æ»®ÈÎÎñÖÐ
$crontab -e [»Ø³µ]
* 18 * * * /opt/databack/databack.sh
#×¢ÊÍ£ºÃ¿ÌìÍí18µãÔËÐд˱¸·Ý³ÌÐò¡£
PS£º´Ë×Ô¶¯±¸·Ý½Å±¾ÔÚAIX 5.3ºÍCentOS
Ïà¹ØÎĵµ£º
Êýѧº¯Êý
ÔÚoracle ÖÐdistinct¹Ø¼ü×Ö¿ÉÒÔÏÔʾÏàͬ¼Ç¼ֻÏÔʾһÌõ
¡¡¡¡1.¾ø¶ÔÖµ
¡¡¡¡S:select abs(-1) value
¡¡¡¡O:select abs(-1) value from dual
¡¡¡¡2.È¡Õû(´ó)
¡¡¡¡S:select ceiling(-1.001) value
¡¡¡¡O:select ceil(-1.001) value from dual
¡¡¡¡3.È¡Õû£¨Ð¡£©
¡¡¡¡S:select floor(-1.001) value
......
Ö»ÊÇsqlserver ÌṩµÄÔ¶³ÌÊý¾Ý·ÃÎʺ¯Êý; ÔÚ±¾µØsqlserver ÖÐÈ¡ÍⲿÊý¾ÝÔ´Êý¾Ýʱºò¿ÉÓÃ;
¶ÔÁ¬½Ó±¾µØ oracle ²Ù×÷Ô¶³Ì oracle ²»ÄÜʹÓÃ; ²âÊÔ: pl/sql ÖÐʹÓÃ:
select * from openrowset(................); ÎÞЧ!!!!!!!!!!!!!!
ÔÚoracle ÖÐÐèÒª·ÃÎÊÔ¶³ÌÊý¾Ý,ÐèÒª½¨Á¢Ò»Á¬½ÓÔ¶³Ìoracle µÄ dblink ;
ÔÙÓÃÈçÏ·½ ......
oracle²»Í¬°æ±¾¼äÊý¾ÝµÄµ¼Èëµ¼³ö
OracleµÄimp/exp×é¼þÊÇÎÒÃdz£ÓõŤ¾ß£¬ËüµÄÒ»¸ö²Ù×÷ÔÔò¾ÍÊÇÏòϼæÈÝ¡£ÏÂÃæÊǾݴË×ܽáµÄ¼¸¸öʹÓùæÔòºÍÏà¹Ø²âÊÔ£º
¹æÔò1£ºµÍ°æ±¾µÄexp/imp¿ÉÒÔÁ¬½Óµ½¸ß°æ±¾£¨»òͬ°æ±¾£©µÄÊý¾Ý¿â·þÎñÆ÷£¬µ«¸ß°æ±¾µÄexp/imp²»ÄÜÁ¬½Óµ½µÍ°æ±¾µÄÊý¾Ý¿â·þÎñÆ÷
1.1 ʹÓÃ9i¿Í»§¶Ëͨ¹ýimpÁ¬ ......
CASE±í´ïʽ¿ÉÒÔÔÚSQLÖÐʵÏÖif-then-elseÐ͵ÄÂß¼£¬¶ø²»±ØʹÓÃPL/SQL¡£CASEµÄ¹¤×÷·½Ê½ÓëDECODE()ÀàËÆ£¬µ«Ó¦¸ÃʹÓÃCASE,ÒòΪËüÓëANSI¼æÈÝ¡£
CASEÓÐÁ½ÖÖ±í´ïʽ:
1. ¼òµ¥CASE±í´ïʽ,ʹÓñí´ïʽȷ¶¨·µ»ØÖµ.
Óï·¨:
CASE search_expression
WHEN expression1 THEN result1
WHEN expression2 THEN ......
Oracle ´¥·¢Æ÷ÓÐÓï¾ä¼¶´¥·¢Æ÷ºÍÐм¶´¥·¢Æ÷
Óï¾ä¼¶´¥·¢Æ÷ µ±É¾³ý²¿ÃűíÖеIJ¿ÃźÅʱ£¬Í¬Ê±É¾³ýµôÔ±¹¤±íÖв¿ÃźÅΪ£ºold.deptnoµÄ¼Ç¼
create or replace trigger del_dept_id
after delete on dept
for each row
begin
delete from emp where deptno=:old.deptno;
end;
µ±Íù²¿Ãűí²åÈëʱ£¬Í¬Ê±ÔÚÔ±¹¤±íÖ ......