Oracle复制仓库基本操作

这里以仓库34复制到仓库36为例

1.分配权限

在linux界面oracle账号下执行

sqlplus / as sysdba;

oracle数据库中执行:

create or replace directory DUMP_DIR as  '/backup/zqw/dump';
grant read,write on directory DUMP_DIR to wmwhse34,wmwhse36;

2.导出(/仓库34)

一级目录

linux界面oracle账户下执行

expdp wmwhse34/WMwhSql34  DIRECTORY=DUMP_DIR  DUMPFILE=wmwhse34.DMP schemas=wmwhse34  logfile=exp_wmwhse34.log;

3.备份(/仓库36)

一级目录

linux界面oracle账户下执行

expdp wmwhse36/WMwhSql36 DIRECTORY=DUMP_DIR  DUMPFILE=wmwhse36.DMP schemas=wmwhse36 logfile=exp_wmwhse36.log;

4.停WMS应用

5.删除原有仓库用户

删除原有仓库用户(/仓库36) --删除整个仓库数据,用户所有的数据(包括在表空间中的数据),谨慎操作!!
进入sqlplus / as sysdba里面操作,需要等待,不要动任何操作!

drop user wmwhse36 cascade;

6.创建用户

进入sqlplus / as sysdba里面操作

create user wmwhse36 PROFILE SCEUSER identified by WMwhSql36 DEFAULT TABLESPACE wmwhse36_DATA TEMPORARY TABLESPACE wmwhse36_TEMPDATA;

授权

grant create any table to  wmwhse36;
grant dba to wmwhse36;
grant execute on DBMS_LOCK to wmwhse36;
grant select on DBA_OBJECTS to wmwhse36;
grant create any sequence to wmwhse36;
grant read,write on directory DUMP_DIR to wmwhse36;

7.导入仓库数据

注意:在oracle账号界面执行!

impdp wmwhse36/WMwhSql36 DIRECTORY=DUMP_DIR DUMPFILE=wmwhse34.DMP REMAP_SCHEMA=wmwhse34:wmwhse36 remap_tablespace=wmwhse34_DATA:wmwhse36_DATA  TRANSFORM=segment_attributes:n,OID:n EXCLUDE=STATISTICS logfile=imp_wmwhse36.log;

8.回收权限

数据库中执行

--revoke exp_full_database from wmwhse36;

如果没有表空间,创建表空间如下

1.1.创建表空间
create tablespace WMWHSE36_DATA datafile '+DATADG' size 3424m autoextend on next 512m maxsize unlimited extent management local segment space management auto;
1.2.创建临时表空间
create temporary tablespace WMWHSE36_TEMPDATA tempfile '+DATADG' size 512m reuse autoextend on next 256m maxsize unlimited extent management local uniform size 1m;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章