目录
- 1、创建目录(UAT环境,QAS环境)
- 2、源端172.18.1.217信息:
- 3、目标端10.40.0.203 当前信息:
- 4、源端UAT导出命令(从UAT导出)
- 5、目标端备份(导出,从QAS导出,给目标端做个备份)
- 6、删除目标端原用户、表空间
- 7、目标端创建表空间、用户、用户授权、对象授权
- 8、导入(导入到QAS测试机中,导入和原表空间、用户相同,则需要重新创建表空间以及用户即可)
- 二、SHYCBZ新MES正式机 10.40.0.222 导入到UAT1(172.18.1.217)中 2019-12-11执行
- 三、SHYBZ包装MES UAT2 10.40.0.203(12.1.0.1.0)导入到PRD (10.40.0.222)(12.2.0.1.0)中 2019-12-11--
- 四、SHYCBZshanhj--PRD MES 10.40.0.2(12.2.0.1.0)导入UAT2 (10.40.0.203)(12.1.0.1.0)
- 1、创建目录(UAT环境)
- 2、源端10.40.0.2信息(PRD):
- 3、目标端10.40.0.203 信息:
- 4、源端PRD导出命令(从PRD导出)
- 5、目标端UAT导出命令(UAT)备份
- 6、删除目标端172.18.1.217 原用户、表空间(因目标端的表空间和源一致,所以保持即可)
- 7、目标端创建表空间(本次保持)、用户、用户授权、对象授权
- 8、导入(导入到QAS测试机中,导入和原表空间、用户相同,则需要重新创建表空间以及用户即可)
- (1)导入原用户:
- 1、多个用户MESSHYCBZ、A01_1001
- 2、创建目录(UAT环境)
- 3、源端10.40.0.222信息(PRD):
- 4、目标端10.40.0.203 信息[docker]:
- 5、源端PRD导出命令(从PRD导出)
- 6、目标端UAT导出命令(UAT)备份
- 7、目标端UAT
- 8、目标端创建表空间(本次保持)、用户、用户授权、对象授权
- 9、导入(导入QAS测试机中,导入和原表空间、用户相同,则需要重新创建表空间以及用户即可)
一、SYBZ新MES---2019-12-06执行
1、创建目录(UAT环境,QAS环境)
create directory backup_mes as '/data/backup'; GRANT READ,WRITE ON DIRECTORY backup_mes to MESSHYCBZ; GRANT READ,WRITE ON DIRECTORY backup_mes to system;
2、源端172.18.1.217信息:
ORACLE 版本号:12.2.0.1.0 表空间:MESPRD_TBSP 用户:MESSHYCBZ 密码:**** 管理用户:system 密码:**** orcl:shycorcl
3、目标端10.40.0.203 当前信息:
ORACLE 版本号:12.1.0.1.0 表空间:MESQAS_SHYCBZ 用户:messhycbz 密码:**** 管理用户:system 密码:**** orcl:shycbzorclqas 需要更改为: 表空间:MESPRD_TBSP 用户:messhycbz 密码:**** 管理用户:system 密码:**** orcl:shycbzorclqas
4、源端UAT导出命令(从UAT导出)
UAT导出: expdp system/**** DIRECTORY=backup_mes DUMPFILE=SHYCBZMES20191013_full_UAT.dmpdp logfile=SHYCBZMES20191013_full_UAT.log full=y version =12.1.0.1.0
5、目标端备份(导出,从QAS导出,给目标端做个备份)
expdp system/**** DIRECTORY=backup_mes DUMPFILE=SHYCBZMES20191013_full_QAS.dmpdp logfile=SHYCBZMES20191013_full_QAS.log full=y
6、删除目标端原用户、表空间
drop user messhycbz cascade; drop tablespace MESQAS_SHYCBZ including contents and datafiles;
7、目标端创建表空间、用户、用户授权、对象授权
CREATE tablespace MESPRD_TBSP logging DATAFILE'/data/u01/app/oracle/oradata/SHYCBZORCLQAS/datafile/MESPRD_01.dbf' size 5120m autoextend on next 1000m; create user messhycbz identified by "Mes#shycbz" default tablespace MESPRD_TBSP temporary tablespace TEMP profile DEFAULT; grant connect,dba,resource to messhycbz; grant unlimited tablespace to messhycbz with admin option;
8、导入(导入到QAS测试机中,导入和原表空间、用户相同,则需要重新创建表空间以及用户即可)
impdp messhycbz/**** dumpfile=SHYCBZMES20191013_full_UAT.dmpdp logfile=SHYCMES20191013_full_impdp.log DIRECTORY=backup_mes schemas=messhycbz expdp MESPRD/****@127.0.0.1/kssyorclprd DIRECTORY=backup_mes DUMPFILE=KSSYMES20200104_MESPRD_NO_FND_COMP.dmpdp logfile=KSSYMES20200104_MESPRD_NO_FND_COMP.log exclude=table:\"in\(\'FND_CUSTOMER\'\)\" compression=all
二、SHYCBZ新MES正式机 10.40.0.222 导入到UAT1(172.18.1.217)中 2019-12-11执行
1、创建目录(正式环境)
create directory backup_mes as '/data/backup'; GRANT READ,WRITE ON DIRECTORY backup_mes to mesprd; GRANT READ,WRITE ON DIRECTORY backup_mes to system; GRANT READ,WRITE ON DIRECTORY backup_mes to sys;
2、源端10.40.0.222信息:
ORACLE 版本号:12.2.0.1.0 表空间:MESPRD_TBSP 用户: MESPRD 密码: Mes1qaz#EDC 管理用户:system 密码:**** orcl:shycorcl
3、目标端172.18.1.217()
ORACLE 版本号:12.2.0.1.0 表空间:MESPRD_TBSP 用户:MESSHYCBZ 密码:**** 管理用户:system 密码:**** orcl:shycorcl
4、源端PRD导出命令(从PRD导出)
PRD导出: expdp system/**** DIRECTORY=backup_mes DUMPFILE=SHYCBZMES20191206_full_PRD-2.dmpdp logfile=SHYCBZMES20191206_full_PRD-2.log full=y compression=all
5、删除目标端原用户、表空间(和源一致,保持即可)
drop user messhycbz cascade; drop tablespace MESQAS_SHYCBZ including contents and datafiles;
6、目标端创建表空间(本次保持)、用户、用户授权、对象授权
CREATE tablespace MESPRD_TBSP logging DATAFILE'/data/u01/app/oracle/oradata/SHYCBZORCLQAS/datafile/MESPRD_01.dbf' size 5120m autoextend on next 1000m; create user messhycbz identified by "Mes#shycbz" default tablespace MESPRD_TBSP temporary tablespace TEMP profile DEFAULT; grant connect,dba,resource to messhycbz; grant unlimited tablespace to messhycbz with admin option;
7、导入(导入到QAS测试机中,导入和原表空间、用户相同,则需要重新创建表空间以及用户即可)
impdp messhycbz/**** dumpfile=SHYCBZMES20191206_full_PRD.dmpdp logfile=SHYCBZMES20191206_full_PRD_impdp.log DIRECTORY=backup_mes schemas=messhycbz
三、SHYBZ包装MES UAT2 10.40.0.203(12.1.0.1.0)导入到PRD (10.40.0.222)(12.2.0.1.0)中 2019-12-11--
多个用户MESSHYCBZ、A01_1001
1、创建目录(正式环境)
select * from dba_directories; create directory backup_mes as '/data/backup'; GRANT READ,WRITE ON DIRECTORY backup_mes to mesprd; GRANT READ,WRITE ON DIRECTORY backup_mes to system; GRANT READ,WRITE ON DIRECTORY backup_mes to sys;
2、源端10.40.0.203 信息:
ORACLE 版本号:12.1.0.1.0 表空间:MESPRD_TBSP #Select Tablespace_Name,Sum(bytes)/1024/1024 From Dba_Segments Group By Tablespace_Name 普通用户: MESSHYCBZ,A01_1001 #select * from dba_users;select username from dba_users; 密码: **** 管理用户:sys 密码:**** SID:shycbzorclqas
3、目标端10.40.0.222信息(PRD):
ORACLE 版本号:12.2.0.1.0 表空间:MESPRD_TBSP 普通用户: MESPRD 密码: **** 管理用户:sys 密码: **** orcl: shycorcl
4、源端PRD导出命令(从PRD导出)
PRD导出: expdp system/*** DIRECTORY=backup_mes DUMPFILE=SHYCBZMES20191210_full_0_203qas.dmpdp logfile=SHYCBZMES20191210_full_0_203qas.log full=y compression=all
5、删除目标端10.40.0.222 原用户、表空间(因目标端的表空间和源一致,所以保持即可)
drop user messhycbz cascade; --drop tablespace MESQAS_SHYCBZ including contents and datafiles;
6、目标端创建表空间(本次保持)、用户、用户授权、对象授权
--CREATE tablespace MESPRD_TBSP logging DATAFILE'/data/u01/app/oracle/oradata/SHYCBZORCLQAS/datafile/MESPRD_01.dbf' size 5120m autoextend on next 1000m; SQL> create user MESPRD identified by "Mes1qaz#EDC" default tablespace MESPRD_TBSP temporary tablespace TEMP profile DEFAULT; SQL> grant connect,dba,resource to MESPRD; SQL> grant unlimited tablespace to MESPRD with admin option;
7、导入(导入到QAS测试机中,导入和原表空间、用户相同,则需要重新创建表空间以及用户即可)
impdp messhycbz/**** dumpfile=SHYCBZMES20191206_full_PRD.dmpdp logfile=SHYCBZMES20191206_full_PRD_impdp.log DIRECTORY=backup_mes schemas=messhycbz
四、SHYCBZshanhj--PRD MES 10.40.0.2(12.2.0.1.0)导入UAT2 (10.40.0.203)(12.1.0.1.0)
多个用户MESSHYCBZ、A01_1001
1、创建目录(UAT环境)
select * from dba_directories; create directory backup_mes as '/data/backup'; GRANT READ,WRITE ON DIRECTORY backup_mes to mesprd; GRANT READ,WRITE ON DIRECTORY backup_mes to system; GRANT READ,WRITE ON DIRECTORY backup_mes to sys;
2、源端10.40.0.2信息(PRD):
ORACLE 版本号:12.2.0.1.0 表空间:MESPRD_TBSP 普通用户: MESPRD 密码: **** 管理用户:sys 密码: **** orcl: shycorcl
3、目标端10.40.0.203 信息:
ORACLE 版本号:12.1.0.1.0 表空间:MESPRD_TBSP 普通用户: MESPRD 密码: **** 管理用户:sys 密码: **** orcl: shycorclqas
4、源端PRD导出命令(从PRD导出)
PRD导出(只按照12.1.0.1.0版本导出):
expdp system/**** DIRECTORY=backup_mes DUMPFILE=SHYCBZMES_`date +%Y%m%d%\H%M%S`_FULL_expdp_v121010.dmpdp logfile=SHYCBZMES_`date+%Y%m%d\%H%M%S`_FULL_expdp_v121010.log full=y version=12.1.0.1.0 compression=all
5、目标端UAT导出命令(UAT)备份
expdp system/****DIRECTORY=BACKUP_MES DUMPFILE=SHYCBZMESQAS-20200407.dmpdp logfile=SHYCBZMESQAS-20200407.log full=y compression=all;
6、删除目标端172.18.1.217 原用户、表空间(因目标端的表空间和源一致,所以保持即可)
drop user MESPRD cascade; drop user MESSHYCBZ cascade; drop tablespace MESPRD_TBSP including contents and datafiles;
7、目标端创建表空间(本次保持)、用户、用户授权、对象授权
(1)创建表空间
CREATE tablespace MESPRD_TBSP logging DATAFILE'/u01/app/oracle/oradata/SHYCORCL/datafile/MESPRD_01.dbf' size 5120m autoextend on next 1000m; alter tablespace MESPRD_TBSP add DATAFILE'/u01/app/oracle/oradata/SHYCORCL/datafile/MESPRD_02.dbf' size 5120m autoextend on next 1000m;
(2)创建用户:
create user MESSHYCBZ identified by "Mes1qaz#EDC" default tablespace MESPRD_TBSP temporary tablespace TEMP profile DEFAULT; create user MESPRD identified by "Mes1qaz#EDC" default tablespace MESPRD_TBSP temporary tablespace TEMP profile DEFAULT; create user A01_1001 identified by "Mes1qaz#EDC" default tablespace MESPRD_TBSP temporary tablespace TEMP profile DEFAULT;
(3)授予用户权限
grant connect,dba,resource to MESSHYCBZ; grant unlimited tablespace to MESSHYCBZ with admin option; GRANT READ,WRITE ON DIRECTORY backup_mes to MESSHYCBZ; grant connect,dba,resource to MESPRD; grant unlimited tablespace to MESPRD with admin option; GRANT READ,WRITE ON DIRECTORY backup_mes to MESPRD; grant connect,dba,resource to A01_1001; grant unlimited tablespace to A01_1001 with admin option; GRANT READ,WRITE ON DIRECTORY backup_mes to A01_1001;
8、导入(导入到QAS测试机中,导入和原表空间、用户相同,则需要重新创建表空间以及用户即可)
(1)导入原用户:
impdp system/**** dumpfile=SHYCBZMESQAS-20200407.dmpdp logfile=SHYCBZMESQAS-20200407_imp.log DIRECTORY=backup_mes schemas=MESSHYCBZ impdp system/**** dumpfile=SHYCBZMES_20200407020001_FULL_expdp_v121010.dmpdp logfile=SHYCBZMES20191206_full_PRD_impdp_A011001.log DIRECTORY=backup_mes schemas=A01_1001;
注:如果按照(1)中使用用户schemas=MESSHYCBZ,则只会导入这个用户且不报错
(2)更换用户导入,
如果使用remap_schema=MESSHYCBZ:MESPRD,容易报错,此命令会导入所有用户及数据结构(可能是因为expdp时,用system导出的full数据库),包括非mesprd用户;
如果使用remap_schema,只导入想要的用户,后面再加上schemas=messhycbz即可,使用remap_schema,schemas即可如图
impdp mesprd/**** dumpfile=SHYCBZMESQAS-20200407.dmpdp logfile=SHYCBZMESQAS-20200407_imp.log DIRECTORY=backup_mes REMAP_SCHEMA=A01_1001:MESPRD schemas=A01_1001;
(3)其他用户导入一个道理,也是可以直接导入,加入schemas源用户即可
impdp mesprd/**** dumpfile=SHYCBZMESQAS-20200407.dmpdp logfile=SHYCBZMESQAS-0200407_imp.log IRECTORY=backup_mes REMAP_SCHEMA=MESSHYCBZ:MESPRD schemas=MESSHYCBZ;
注:在导入数据时,一定要观察是否开启归档日志,如果开启归档日志,导数据时,特别容易把归档日志的容量(show parameter DB_RECOVERY_FILE_DEST)撑爆,所以需要时刻注意日志容量的大小(select * from V$FLASH_RECOVERY_AREA_USAGE;)
五、PRD (10.40.0.222)(12.2.0.1.0)导入SHYCBZ MES UAT2 10.40.0.203(12.1.0.1.0)-2020-0516
1、多个用户MESSHYCBZ、A01_1001
2、创建目录(UAT环境)
select * from dba_directories;
create directory backup_mes as '/data/backup';
GRANT READ,WRITE ON DIRECTORY backup_mes to mesprd;
GRANT READ,WRITE ON DIRECTORY backup_mes to A01_1001;
GRANT READ,WRITE ON DIRECTORY backup_mes to system;
GRANT READ,WRITE ON DIRECTORY backup_mes to sys;
3、源端10.40.0.222信息(PRD):
ORACLE 版本号:12.2.0.1.0 表空间:MESPRD_TBSP 普通用户: **** 密码: ************ 管理用户:sys 密码: **** orcl: shycorcl
4、目标端10.40.0.203 信息[docker]:
ORACLE 版本号:12.2.0.1.0
表空间:MESPRD_TBSP
普通用户: MESPRD,A01_1001 #
密码: ****#****
管理用户:sys
密码:****#****
SID:orcl
5、源端PRD导出命令(从PRD导出)
PRD导出():
expdp system/**** DIRECTORY=backup_mes DUMPFILE=SHYCBZMES_`date +%Y%m%d%\H%M%S`_FULL_expdp.dmpdp logfile=SHYCBZMES_`date+%Y%m%d\%H%M%S`_FULL_expdp.log full=y compression=all
6、目标端UAT导出命令(UAT)备份
expdp system/**** DIRECTORY=BACKUP_MES DUMPFILE=SHYCBZMESQAS-20200407.dmpdp logfile=SHYCBZMESQAS-20200407.log full=y compression=all;
7、目标端UAT
删除目标端10.40.0.203 原用户、表空间(因目标端的表空间和源一致,所以保持即可) drop user messhycbz cascade; drop user MESPRD cascade; drop tablespace MESQAS_SHYCBZ including contents and datafiles;
8、目标端创建表空间(本次保持)、用户、用户授权、对象授权
(1)创建表空间
CREATE tablespace MESPRD_TBSP logging DATAFILE'/data/u01/app/oracle/oradata/orcl/MESPRD_01.dbf' size 5120m autoextend on next 1000m;
(2)给表空间增加数据文件
alter tablespace MESPRD_TBSP add DATAFILE'/data/u01/app/oracle/oradata/orcl/MESPRD_02.dbf' size 5120m autoextend on next 1000m;
(3)创建用户
create user MESPRD identified by "Mes#shycbz" default tablespace MESPRD_TBSP temporary tablespace TEMP profile DEFAULT;
create user A01_1001 identified by "Mes#shycbz" default tablespace MESPRD_TBSP temporary tablespace TEMP profile DEFAULT;
(4)授予用户MESPRD权限
grant connect,dba,resource to MESPRD; grant unlimited tablespace to MESPRD with admin option; GRANT READ,WRITE ON DIRECTORY backup_mes to MESPRD;
(5)授予用户A_1001权限
grant connect,dba,resource to A01_1001; grant unlimited tablespace to A01_1001 with admin option; GRANT READ,WRITE ON DIRECTORY backup_mes to A01_1001;
9、导入(导入QAS测试机中,导入和原表空间、用户相同,则需要重新创建表空间以及用户即可)
impdp system/**** dumpfile=SHYCBZMES_20200516010001_FULL_expdp.dmpdp logfile=SHYCBZMES_20200516010001_FULL_impdp.log DIRECTORY=backup_mes schemas=mesprd impdp system/**** dumpfile=SHYCBZMES_20200516010001_FULL_expdp.dmpdp logfile=SHYCBZMES_20200516010001_FULL_impdp.log DIRECTORY=backup_mes schemas=A01_1001
文章评论