切换oracle用户
su - oracle
进入oracle数据库
sqlplus /nolog
conn /as sysdba
如果提示:????,查看oracle变量
env |grep oracle
增加NLS_LANG变量
vi .bash_profile NLS_LANG=”SIMPLIFIED CHINESE_CHINA.ZHS16GBK” source .bash_profile
查询相关目录
select *from dba_directories;
导出数据
expdp test1/test1@localhost/spptdb schemas=test1 directory=DATA_PUMP_DIR dumpfile=BDP20191218.DMP logFile=bdp.log
导入数据
如果已经创建了表空间
drop user test1cascade;
如果没有创建表空间
create tablespace test1 datafile ‘/appdata/u01/oradata/orcl/test1.dbf’ size 2G;
创建用户
create user test1 identified by test1 default tablespace test1;
授权
grant connect,resource to test1;
grant create any view to test1;
grant read,write on directory DATA_PUMP_DIR to test1;
grant imp_full_database to test1;
导入数据
impdp test/test schemas=test(原用户) directory=DATA_PUMP_DIR dumpfile=BDP20191218.DMP logFile=test1.log remap_schema=test:test1(原用户:新用户) remap_tablespace=test:test1(原表空间:新表空间)