当前所在位置:珠峰网资料 >> 计算机 >> Oracle认证 >> 正文
自动导出oracle用户到指定目录下的shell
发布时间:2011/9/20 11:04:57 来源:城市学习网 编辑:ziteng

  平时对一些小的数据导出的时候,都得写一条长长的exp命令,此脚本目的就是为了简化日常的重复输入,提高效率,实现起来很简单,具体如下:daochu.sh #!/bin/sh if [ $# -ne 1 ]; then echo "Usage: $0 Username" exit 101 fi username=$1 echo "please input your password" stty -echo read password stty echo #echo "Your password is: $password" filepath=`date +%y%m%d_%H%M%S`_$username mkdir $filepath exp $username/$password file=$filepath/$username.dmp log=$filepath/"$username"_exp.log cd $filepath md5sum $username.dmp>$username.dmp.md5语法为daochu.sh username密码不显示,文件名以日期+导出用户名命名,并计算md5值。

  上述密码输入在使用时也可以借鉴网上的一个转*的shell,将输入的密码以*号展现,转*的shell如下:##automatically convert the input characters to *## getchar() { stty cbreak -echo dd if=/dev/tty bs=1 count=1 2> /dev/null stty -cbreak echo }

  printf "Please input your password: "

  while : ; do ret=`getchar` if [ x$ret = x ]; then echo break fi password="$password$ret" printf "*" done ######################################################

  功能很简单,应该比较实用。

广告合作:400-664-0084 全国热线:400-664-0084
Copyright 2010 - 2017 www.my8848.com 珠峰网 粤ICP备15066211号
珠峰网 版权所有 All Rights Reserved