1.建立文本文件 createuser.sql
conn sys/orcl as sysdba;
--创建表空间smart
create tablespace smart
datafile 'd:\smartdb\smart.dbf'
size 32M
autoExtend on next 32M
EXTENT MANAGEMENT LOCAL;
--创建临时表空间temp_smart
CREATE TEMPORARY TABLESPACE temp_smart
TEMPFILE 'd:\smartdb\temp_smart.dbf'
SIZE 32M
AUTOEXTEND ON
NEXT 32M
EXTENT MANAGEMENT LOCAL;
--创建用户smart/smart
create user smart
identified by smart
default tablespace smart
temporary tablespace temp_smart;
--给用户授予权限
grant create session,resource,dba to smart;
ALTER USER smart Quota 0 ON system;
alter user smart quota unlimited on system;
exit;
2.创建.bat格式文件
@echo off
echo ****************开始创建表空间、用户、授权***********************
sqlplus /nolog @createuser.sql
echo ****************************************结束*********************
pause
echo ****************************************数据导入开始*************
imp [email protected] file=smart.dmp fromuser=smart touser=smart ignore = y tablespaces=smart
echo ****************************************数据导入结束*************
pause