#!/usr/bin/ksh # impdpa.sh aix系统下自动删除用户,创建用户然后导入指定dmp数据库备份文件的脚本, # dmp文件为expdp命令导出,exp导出文件不能导入。脚本适合单sid环境 #========================需要修改的参数========================================= #dmp文件名称 dmp_filename=gxpm1121.dmp #表空间 tbname=BIZTS #日志名称 dmp_log=gxmcpm_b_02.log #导入的oracle用户 username=gxmcpm_b_02; #导入的oracle用户密码 password=gxmcpm_b_02; #导出dmp备份文件的oracle用户 outuser=gxmc2 #========================需要修改的参数========================================= #删除用户 sqlplus "/as sysdba"<<EOF drop user ${username} cascade; EOF #目录 directory_dir=`pwd`; #directory名称 directory_name=gxdp; #创建用户,directory,授权 sqlplus "/as sysdba"<<EOF create user ${username} identified by ${password} default tablespace ${tbname} temporary tablespace TEMP profile DEFAULT; grant connect to ${username}; grant dba to ${username}; grant resource to ${username}; create or replace directory ${directory_name} as '${directory_dir}'; grant read, write on directory ${directory_name} to ${username}; exit EOF #导入dmp包 impdp ${username}/${password} directory=${directory_name} dumpfile=${dmp_filename} logfile=${dmp_log} remap_schema=${outuser}:${username}; #删除directory sqlplus "/as sysdba"<<EOF drop directory ${directory_name}; exit EOF