Tag Archives: example

Bash Example: Backup Multiple Oracle User Schema

Example  #!/bin/sh backup_dir=/backup/dbdb_sid=orcl declare -A usrsusrs[scott]=tigerusrs[hr]=hr curr_ts=`date +"%m-%d-%y_%H-%M-%S"`curr_backup_dir=${backup_dir}/${curr_ts}mkdir -p ${curr_backup_dir} FOR k IN "${!usrs[@]}"do echo "Backing up ${k}…" expcmd="exp ${k}/${usrs[$k]}@${db_sid} owner=${k} grants=y rows=y compress=y file=${curr_backup_dir}/${k}.exp log=${curr_backup_dir}/${k}.log &" echo "export command is: ${expcmd}" echo "done." echo ""done echo "All done."   References * Bash Associative Arrays   

Posted in oracle, shell | Tagged , , , , | Leave a comment