自己编写了一个导入脚本,很简单,记录一下:
[App_server@14:14:48 ~/dmpscript]$cat impdp.sh
#!/usr/bin/bash
echo "Please enter your username"
read n
sleep 1
echo "Please enter the dumpfile name"
read m
sleep 1
:> /home/oracle/dmpscript/create_user.sql
echo "create user $n identified by $n default tablespace users temporary tablespace tmp quota unlimited on users;" >> /home/oracle/dmpscript/create_user.sql
echo "exit" >> /home/oracle/dmpscript/create_user.sql
:> /home/oracle/dmpscript/grant_privs.sql
echo "grant dba to $n ;" >> /home/oracle/dmpscript/grant_privs.sql
echo "exit" >> /home/oracle/dmpscript/grant_privs.sql
sqlplus sys/sys as sysdba @/home/oracle/dmpscript/create_user.sql
sleep 3
sqlplus sys/sys as sysdba @/home/oracle/dmpscript/grant_privs.sql
sleep 3
impdp $n/$n directory=dpdata dumpfile=$m schemas=test remap_schema=bdtom:$n
sleep 1
rm /db/app/oracle/oradata/dmp.tmp/$m
echo "dumpfile has been removed"
[App_server@14:14:52 ~/dmpscript]$
效果如下:
执行脚本后,提示输入用户名和dump文件名。完成后,就会自动将schema为test的dump文件导入到输入的schema里面。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/25915379/viewspace-720912/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/25915379/viewspace-720912/