Oracle从Windows 11.2.0.1升级并迁移到Linux 19c

来源:这里教程网 时间:2026-03-03 17:32:33 作者:

环境介绍

项目

源端

目标端

操作系统

Windows Server 2008R2 64bit

Oracle Linux 7.8 64bit

数据库版本

Oracle 11.2.0.1

Oracle 19c

存储系统

文件系统

ASM

字节序

little

little

  

准备测试数据

create tablespace mytbs1 datafile 'C:\oradata\mytbs1.dbf' size 500M autoextend on maxsize 30G;create tablespace mytbs2 datafile 'C:\oradata\mytbs2.dbf' size 500M autoextend on maxsize 30G; create user testuser identified by "testuser" default tablespace mytbs1 temporary tablespace temp;grant unlimited tablespace to testuser;grant resource, connect to testuser; create table testuser.tb1(id number, name varchar2(100)) tablespace mytbs1;alter table testuser.tb1 add constraint pk_tb1 primary key(id) using index TABLESPACE  mytbs2; insert into testuser.tb1 select object_id, object_name from all_objects;

预检查

检查字符集: SELECT *   FROM NLS_DATABASE_PARAMETERS T WHERE T.PARAMETER LIKE '%CHARACTERSET'; 检查DBTIMEZONE SELECT version FROM v$timezone_file;  在这次测试中,windows主机的version为11,linux主机为32

因为这次测试的时候,目标端是19c,所以这个没有关系。Timezone不同的问题可能导致导入时出现ORA-39322错误,在11.2.0.4版本中已经解决

检查表空间是否自包含

EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('mytbs1', TRUE);EXECUTE DBMS_TTS.TRANSPORT_SET_CHECK('mytbs2', TRUE); SELECT * FROM TRANSPORT_SET_VIOLATIONS;这个例子当中,我们需要处理两个表空间。

源端导出表空间元数据

将源端表空间设置为只读:alter tablespace mytbs1 read only;alter tablespace mytbs2 read only; 创建目录对象create directory mydump_dir as 'C:\dumpfile'; 导出元数据 expdp \"/ as sysdba\" dumpfile=tts_test.dmp directory=mydump_dir transport_tablespaces=mytbs1,mytbs2 transport_full_check=y logfile=tts_test.dmp.log 将数据文件从源端拷贝至目标端 

目标端处理

 

创建用户

create user testuser identified by "testuser" default tablespace users temporary tablespace temp;grant unlimited tablespace to testuser;grant resource, connect to testuser; 不预先创建好用户的话,会出错

拷贝数据文件至ASM

在ASMCMD下执行: cp /tmp/MYTBS1.DBF +data/orcl/datafile/MYTBS1.DBFcp /tmp/MYTBS2.DBF +data/orcl/datafile/MYTBS2.DBF  

导入

impdp \' sys/sys as sysdba\' directory=mydump_dir dumpfile=TEST_TTS.DMP transport_datafiles=+data/orcl/datafile/MYTBS1.DBF,+data/orcl/datafile/MYTBS2.DBF logfile=impdp_tts.log 注意,windows下使用expdp导出时,文件名是大写, linux下面大小写是敏感的 导入完成:

修改表空间

alter tablespace mytbs1 read write;alter tablespace mytbs2 read write;

修改用户默认表空间

alter user testuser default tablespace mytbs1;

相关推荐