Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1765309
  • 博文数量: 293
  • 博客积分: 10574
  • 博客等级: 上将
  • 技术积分: 5085
  • 用 户 组: 普通用户
  • 注册时间: 2006-12-22 17:00
文章分类

全部博文(293)

文章存档

2011年(27)

2010年(84)

2009年(62)

2008年(120)

我的朋友

分类:

2011-05-12 20:26:58

将主机A的lcfa的表导入到主机B的lcfb中。

#!/bin/sh

DATE=`/bin/date +%Y-%m-%d-%H-%M`

BACK_PATH=/opt/backup/oracle_bak

ORACLE_BASE=/app2/oracle

ORACLE_HOME=/opt/oracle/product/10.2.0/db_1

ORACLE_SID=lcfb

NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"

EXP=$ORACLE_HOME/bin/exp

IMP=$ORACLE_HOME/bin/imp

export ORACLE_BASE ORACLE_HOME ORACLE_SID BACK_PATH NLS_LANG EXP IMP


# ftp
HOST=`hostname`
auto_ftp() {
        cd $1
        /usr/bin/ftp -v -i -n 10.199.77.20 << EOF
        user umap user
        bin
        mkdir ftp_back/$HOST/$2
        cd ftp_back/$HOST/$2
        prompt off
        put $3
        put $4
        bye
EOF
}

$EXP file=$BACK_PATH/lcfa-$DATE.dmp log=$BACK_PATH/lcfa-$DATE.log tables="(AUTHEN_MODE,AUTHEN_POLICY,AUTHEN_RULE,AUTH_CHAIN_MOD,AUTH_LOCK_PL,CMD_SET,DIC_POLICY,EVENT_TOKEN,LICENSE,MENU_CLASS,PAGRP_PRACCT_R,PAROLE_PAUTH_R,PASSWORD_AUDIT,PASSWORD_PLAN,PASSWORD_POLICY,PLATFORM_AUTH,POST,POST_RESROLE_R,PRACCT_APPR_REC,PRACCT_AUTHPL_R,PRACCT_GRP,PRACCT_LOCK_REC,PRACCT_LOGIN,PRACCT_ONLINE,PRACCT_POST_R,PRACCT_PWD_REC,PRACCT_RESROLE_R,PRACCT_SLACCT_R,PRIMARY_ACCOUNT,PROT_ACCR,RES_ACCR_R,RES_ATTR_PR,RES_AUTH_PL_R,RES_AUTH_PROP,RES_ID_PROP,RES_ROLE,RES_ROLE_REL,RES_SSO_PROP,SLACCT_APPR_REC,SLACCT_ATTR_PR,SLACCT_ATTR_VAL,SLACCT_LOCK_REC,SLACCT_NAME_RULE,SLACCT_POLICY,SLACCT_POLICY_GLOSSARY,SLAVE_ACCOUNT,SYNC_PLAN,SYNC_PLAN_EX_DAY,SYNC_PLAN_REC,TEST2,TEST3,TIME_TOKEN,UKEY,ACCESS_POLICY,ACCR_TYPE,ADDRESS,ADDRESS_POOL,AGENT_SERV_LOC,APP_RESOURCE,APP_ROLE,APP_TAB_PROP,AUTHEN_CHAIN)"

if [ `grep exported $BACK_PATH/lcfa-$DATE.log | wc -l` -eq 62 ] ; then
 $ORACLE_HOME/bin/sqlplus @$BACK_PATH/oracle_drop-lcfb-23.sql > $BACK_PATH/oracle_drop-lcfa-23-$DATE.log
else
 echo $DATE >> $BACK_PATH/oracle_exp-drop-imp-log.log
 echo -e "warning!! exp lcfa error\n\n" >> $BACK_PATH/oracle_exp-drop-imp-log.log
 exit -1
fi

if [ `grep dropped. $BACK_PATH/oracle_drop-lcfa-23-$DATE.log | wc -l` -eq 62 ] ; then
 $IMP file=$BACK_PATH/lcfa-$DATE.dmp log=$BACK_PATH/oracle_imp-lcfa-23-$DATE.log fromuser=user touser=user
else
 echo $DATE >> $BACK_PATH/oracle_exp-drop-imp-log.log
 echo -e "warning!! drop lcfb error\n\n" >> $BACK_PATH/oracle_exp-drop-imp-log.log
 exit -1
fi

if [ `grep imported $BACK_PATH/oracle_imp-lcfa-23-$DATE.log | wc -l ` -eq 62 ] ; then
 :
else
 echo $DATE >> $BACK_PATH/oracle_exp-drop-imp-log.log
 echo -e "warning!! imp lcfb error\n\n" >> $BACK_PATH/oracle_exp-drop-imp-log.log
 exit -1
fi

echo  "$DATE" >> $BACK_PATH/oracle_exp-drop-imp-log.log
echo -e "ok!! exp drop imp lcfb\n\n" >> $BACK_PATH/oracle_exp-drop-imp-log.log

auto_ftp $BACK_PATH oracle_backup lcfa-$DATE.dmp lcfa-$DATE.log |tee $BACK_PATH/oracle_bak_to_ftp.log

exit 0

阅读(613) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~