Oracle 11g 数据库跨平台迁移

Oracle 11g 数据库跨平台迁移


实验环境

源端系统版本:Red Hat Enterprise Linux 6.5

源端数据库版本:Oracle 11.2.0.4


目标端系统版本:Windows 7 Service Pack1
目标端数据库版本:Oracle 11.2.0.4

源端数据库准备

1.创建测试用户并赋予权限

create user test identified by oracle;
grant dba to test;
grant resource,connect to test;
grant select any table to test;




2.源端测试用户下创建测试表

(1)创建测试表
create table test as select * from sys.test;
(sys用户下存在测试表test,数据量约为25万条)
(2)确认表已创建成功
select table_name from user_tables;
(3)统计表的数据量
select count(*) from test;




3.查询源端数据库现有用户下的表和数据量

(1)select table_name from user_tables;
(2)select count(*) from emp2;




源端测试环境准备完毕!


目标端数据库准备

1.创建测试用户并赋予权限

create user test identified by oracle;
grant dba to test;
grant resource,connect to test;
grant select any table to test;

数据库迁移

1.源端数据库数据导出(全库导出)

(1)创建数据导出目录Directory: 
create or replace directory DUMP_1 as '/home/oracle/backup';
(2)给创建的数据导出目录赋权:
grant read, write on directory DUMP_1 to system;
(3)进行源端数据库数据导出
expdp system/oracle directory=DUMP_1 dumpfile=exp2.dmp logfile=exp2.log full=y;

2.目标端数据库数据全库导入

(1)建立导入数据存放目录:
位置:D:\backup
(2)创建数据导入目录Directory:
create or replace directory DUMP_1 as 'D:\backup';
(3)给创建的数据导出目录赋权:
grant read, write on directory DUMP_1 to system;
(4)数据文件拷贝:
将源端导出的数据文件拷贝到目标端建立的数据存放目录D:\backup
(5)将源端数据导入数据库:
impdp system/oracle@ORCL directory=DUMP_1 dumpfile=exp2.dmp full=y

注意:
1.在Windows环境dos命令窗口下,导入命令最后full=y后面不加分号,加了会报LRM-00105错


数据校验

1.scott用户




scott用户下7张表全部导入
emp2表数据量14条,和源端数据一致


2.test用户





test用户下TEST表已经导入
test表数据量为259071和源端数据量一致

总结

至此,整个Oracle数据库跨平台迁移完成!






猜你喜欢

转载自blog.csdn.net/dbdeep/article/details/78501920