阅读量:3
在Linux上迁移Oracle数据库数据可以通过多种方法实现,主要包括使用Data Pump (expdp/impdp)、RMAN (Recovery Manager) 以及Oracle GoldenGate等工具。以下是使用Data Pump和RMAN进行数据迁移的详细步骤:
使用Data Pump (expdp/impdp)进行数据迁移
前提条件:
- 确保源数据库和目标数据库均已安装并配置在Linux服务器上。
- 源数据库和目标数据库的用户名和密码已知。
迁移步骤:
源服务器操作:
-
创建目录对象:
[root@linux100] # su - oracle [oracle@linux100] # sqlplus / as sysdba SQL create or replace directory tmpDir as '/tempFile'; -
使用expdp导出数据表:
[oracle@linux100] # expdp username/password@Ip:port/database schemas dbTest directory tmpDir dumpfile export.dmp logfile export.log; -
复制dmp文件到目标服务器:
[oracle@linux100] # scp -P 2222 /tempFile/export.dmp name@xxx.xxx.xxx.xxx:/home/tempFile;
目标服务器操作:
-
创建目录对象:
[root@linux101] # su - oracle [oracle@linux101] # sqlplus / as sysdba SQL create or replace directory tmpDir as '/tempFile'; -
使用impdp导入数据表:
[oracle@linux101] # impdp username/password@Ip:port/database schemas dbTest directory tmpDir dumpfile export.dmp job_namemyjob;
使用RMAN进行数据迁移
前提条件:
- 确保源数据库和目标数据库均已安装并配置在Linux服务器上。
- 源数据库和目标数据库的用户名和密码已知。
迁移步骤:
源服务器操作:
-
连接到RMAN:
[oracle@linux100] # rman target / -
备份数据库:
RMAN backup database plus archivelog; -
迁移数据文件:
RMAN run { allocate channel c1 type disk; allocate channel c2 type disk; restore database from tag 'backup_tag'; switch datafile all; release channel c1; release channel c2; } -
更新初始化参数文件:
[oracle@linux100] # sqlplus / as sysdba SQL ALTER SYSTEM SET DB_FILE_NAME_CONVERT '/old/path,/new/path' SCOPESPFILE; SQL ALTER SYSTEM SET LOG_FILE_NAME_CONVERT '/old/path,/new/path' SCOPESPFILE; -
关闭数据库并启动到NOMOUNT状态:
SQL shutdown immediate; SQL startup nomount;
目标服务器操作:
-
创建目录对象:
[root@linux101] # su - oracle [oracle@linux101] # sqlplus / as sysdba SQL create or replace directory tmpDir as '/tempFile'; -
使用RMAN恢复数据库:
RMAN startup nomount; RMAN @/target-directory/crdb.sql;
以上就是关于“Oracle在Linux上如何迁移数据”的相关介绍,筋斗云是国内较早的云主机应用的服务商,拥有10余年行业经验,提供丰富的云服务器、租用服务器等相关产品服务。云服务器资源弹性伸缩,主机vCPU、内存性能强悍、超高I/O速度、故障秒级恢复;电子化备案,提交快速,专业团队7×24小时服务支持!
简单好用、高性价比云服务器租用链接:https://www.jindouyun.cn/product/cvm