亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Linux ORCLE數(shù)據(jù)庫(kù)增量備份腳本

 更新時(shí)間:2009年11月20日 17:57:19   作者:  
Linux下ORCLE數(shù)據(jù)庫(kù)增量備份腳本 (基礎(chǔ)篇) ,需要的朋友可以參考下。
ORCLE數(shù)據(jù)庫(kù)備份策略
1.通過(guò)使用exp和imp命令實(shí)現(xiàn)數(shù)據(jù)庫(kù)導(dǎo)出和導(dǎo)入。
有三種模式:
a. 用戶模式: 導(dǎo)出(導(dǎo)入)用戶所有對(duì)象以及對(duì)象中的數(shù)據(jù);
b. 表模式: 導(dǎo)出(導(dǎo)入)用戶所有表或者指定的表;
c. 整個(gè)數(shù)據(jù)庫(kù): 導(dǎo)出(導(dǎo)入)數(shù)據(jù)庫(kù)中所有對(duì)象。
如:
普通導(dǎo)出
a.導(dǎo)出一個(gè)完整數(shù)據(jù)庫(kù)
exp system/manager file=f.dmp full=y
b.導(dǎo)出數(shù)據(jù)庫(kù)定義而不導(dǎo)出數(shù)據(jù)
exp system/manager file=f.dmp full=y rows=n
普通導(dǎo)入:
a.完全導(dǎo)入
imp system/manager file=f.dmp full=y
b.數(shù)據(jù)庫(kù)結(jié)構(gòu)存在時(shí),只導(dǎo)入數(shù)據(jù)
imp system/manager file=f.dmp full=y ignore=y
2.每周進(jìn)行數(shù)據(jù)庫(kù)備份,以防數(shù)據(jù)庫(kù)被意外破壞后恢復(fù)數(shù)據(jù)
安排如下:
周一: 完全備份(f1) exp xxx/xxx inctype=complete file=f1.dmp
周二: 增量備份(f2) exp xxx/xxx inctype=incremental file=f2.dmp
周三: 增量備份(f3) exp xxx/xxx inctype=incremental file=f3.dmp
周四: 增量備份(f4) exp xxx/xxx inctype=incremental file=f4.dmp
周五: 累積備份(f5) exp xxx/xxx inctype=cumulative file=f5.dmp
周六: 增量備份(f6) exp xxx/xxx inctype=incremental file=f6.dmp
周日: 增量備份(f7) exp xxx/xxx inctype=incremental file=f7.dmp
比如數(shù)據(jù)庫(kù)在周日被破壞,則可用以下方式恢復(fù):
1.創(chuàng)建空的數(shù)據(jù)庫(kù),同之前的結(jié)構(gòu)。
2.imp xxx/xxx inctype=RESTORE FULL=y FILE=f1.dmp
3.imp xxx/xxx inctype=RESTORE FULL=y FILE=f5.dmp
4.imp xxx/xxx inctype=RESTORE FULL=y FILE=f6.dmp
說(shuō)明:
完全導(dǎo)出:對(duì)整個(gè)數(shù)據(jù)庫(kù)的備份
增量導(dǎo)出:是備份上一次完全導(dǎo)出后改變的數(shù)據(jù)。
累積導(dǎo)出:是備份自上次完全導(dǎo)出后改變的數(shù)據(jù)。
EXAMPLE:LINUX下備份數(shù)據(jù)庫(kù)
BACKUP_DIR=/home/oracle/backups
if [ ! -d $BACKUP_DIR ]; then
mkdir -p $BACKUP_DIR
fi
DAYS=(Sun Mon Tue Wed Thu Fri Sat) #創(chuàng)建數(shù)組
TYPES=(incremental complete incremental incremental incremental cumulative incremental)
day=`date +%w` #取得本周天數(shù),0代表周日,1代表周一
DAY_NAME=${DAYS[$day]} #取得數(shù)組的值
TYPE=${TYPES[$day]}
DATE_NAME=`date +%F`
FILE_NAME=${DATE_NAME}-${DAY_NAME}-${TYPE}.dmp #2008-12-8-Mon-complete.dmp
exp xxx/xxx inctype=$TYPE file=${BACKUP_DIR}/${FILE_NAME} > /dev/null
gzip ${BACKUP_DIR}/${FILE_NAME}
find $BACKUP_DIR -mtime +7 -delete #刪除七天前更改過(guò)的文件

相關(guān)文章

最新評(píng)論