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;
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章