【数据库】oracle创建表空间、用户及导入导出

–导入数据库
–connect sys/password as sysdba

—删除表空间(执行语句后,到相应路径手动删除实际表空间文件)
drop tablespace ecoarchives INCLUDING CONTENTS;

–当首次导入时创建表空间 (运行脚本时会提示输入 &1 输入数据文件希望存放的物理地址 例如D:\app\Administrator\oradata\ECOARCHIVES)
//自定义服务名创建表空间
create tablespace ecoarchives datafile ‘&1\ecoarchives.dbf’ size 100m autoextend on next 10m;
//默认服务名创建表空间
create tablespace ORCL datafile ‘&1\ecoarchives.dbf’ size 100m autoextend on next 10m;

–如已经存在用户,删除用户
drop user ecoarchives CASCADE;

–创建用户
create user ecoarchives identified by password default tablespace ecoarchives;

–赋权限
grant dba to ecoarchives;
grant all on dual to ecoarchives with grant option;
grant create any view to ecoarchives;
grant create any table to ecoarchives;

–11g 导出
expdp ecoarchives/[email protected]/ECOARCHIVES dumpfile=ECO_ARCHIVES_20160311.EXPDB schemas=(ecoarchives)

–11g 导入
把要导入的EXPDB文件放在 E:\app\Administrator\admin\orcl\dpdump
impdp ecoarchives/[email protected]/ECOARCHIVES dumpfile=ECO_ARCHIVES_20160311.EXPDB schemas=(ecoarchives)

猜你喜欢

转载自blog.csdn.net/long5693525/article/details/52663496