Oracle数据库创建表空间+用户+授权

--导入测试数据库
--connect sys/password as sysdba
---删除表空间
drop tablespace pt6 INCLUDING CONTENTS;
drop tablespace br INCLUDING CONTENTS;
drop tablespace cbb INCLUDING CONTENTS;

create tablespace pt6 datafile '&1\pt6.dbf' size 100m autoextend on next 10m;
create tablespace br datafile '&1\br.dbf' size 100m autoextend on next 10m;
create tablespace cbb datafile '&1\cbb.dbf' size 100m autoextend on next 10m;


--删除用户
drop user pt6 CASCADE;
drop user br CASCADE;
drop user cbb CASCADE;

--创建用户
create user pt6 identified by cape default tablespace pt6;
create user br identified by cape default tablespace br;
create user cbb identified by cape default tablespace cbb;


--赋权限
grant dba to pt6;
grant dba to br;
grant dba to cbb;


grant all on dual to pt6 with grant option;
grant all on dual to br with grant option;
grant all on dual to cbb with grant option;

-- with grant option     表示收回权限时级联取消

-- with admin option     表示收回权限时不级联


-- drop directory dir_dp;
create directory dir_dp as 'E:\oracle\dir_dp';
Grant read,write on directory dir_dp to pt6;

--磁盘建立dir_dp文件夹目录


--在服务器端数据泵导库:

--进入dos命令窗口:
expdp pt6/cape@localhost/IMBR(数据源实例名) schemas=pt6,br,cbb directory=dir_dp dumpfile=IMBR_2015040101.dmp logfile=IMBR_2015040101.log;
impdp pt6/cape@localhost/IMBR_test(入库实例名) schemas=pt6,br,cbb directory=dir_dp dumpfile=IMBR_2015040101.dmp nologfile=yes;


--远程数据泵导库:

--远程导库

--进入dos命令窗口
exp pt6/[email protected]/IMBRV6R3  file=d:\cap20101230.dmp owner=(pt6,br,cbb)
imp pt6/cape@localhost/IMBR file=d:\cap20101230.dmp fromuser=pt6 touser=pt6 fromuser=br touser=br fromuser=cbb touser=cbb




猜你喜欢

转载自blog.csdn.net/weixin_42306823/article/details/120367005