1.首先,创建新用户
create user username identified by password;
username:新用户的用户名
password:新用户的密码
县区用户创建:
create user credit_tja identified by credit;
2.创建表空间
create tablespace tablespacename datafile 'D:APPADMINISTRATORORADATACREDITCREDITTJA.DBF' size xxm;
tablespacename:表空间的名字
D:APPADMINISTRATORORADATACREDITCREDITTJA.DBF:表空间的存储位置
xx:表空间的大小,m单位为m
县区用户创建
create tablespace credittja datafile 'D:APPADMINISTRATORORADATACREDITCREDITTJA.DBF' size 5120m;
3.将空间分配给用户
alter user username default tablespace tablespacename;
将名字为tablespacename的表空间分配给username
县区用户创建
alter user credit_tja default tablespace credittja;
4.将创建的用户授权
grant dba to credit_tja;
或者
grant read,write to credit_tja;
5.导出前检查用户下的数据量大小
查看该用户下数据量大小:
SELECT SUM(s.BYTES)/1024/1024 "sizes(MB)" from dba_segments s where s.owner= 'CREDITWZ';
6.检查该用户下有多少张表
select count(*) from dba_tables t where t.owner='CREDITWZ';
7.导出和导入语句
导出
expdp creditwz/credit directory=dir dumpfile=wz.dmp logfile=wz.log
导入
impdp credit_tja/credit directory=dir dumpfile=wz.dmp REMAP_SCHEMA=creditwz:credit_tja EXCLUDE=USER