1、目标库创建相应目录
mkdir -p /u01/app/oracle/oradata/orcl
mkdir -p /u01/app/oracle/fast_recovery_area/ORCL
mkdir -p /u01/app/oracle/admin/orcl/{a,dp}dump

2、目标库创建密码文件
orapwd file=orapworcl password=oracle

3、原库备份
RMAN> backup as compressed backupset database plus archivelog;

4、将原库备份传输到目标库
在目标库创建目录存放原库传输过来的原库备份
mkdir –p /home/oracle/bak
mkdir –p /home/oracle/autobak
利用scp工具传输,具体不详细介绍。

5、修改dbid

[oracle@orcl ~]$ rman target /
Recovery Manager: Release 11.2.0.3.0 - Production on Mon Nov 5 11:19:38 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: (not started)
RMAN> set dbid 238796283
executing command: SET DBID

6、恢复参数文件
RMAN> startup nomount

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora'

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area 159019008 bytes

Fixed Size 1343612 bytes
Variable Size 75501444 bytes
Database Buffers 79691776 bytes
Redo Buffers 2482176 bytes

RMAN> restore spfile to pfile '/u01/app/oracle/product/11.2.0/db_1/dbs/initorcl.ora' from '/home/oracle/autobak/o1_mf_s_991416863_fy03o039_.bkp';

Starting restore at 05-NOV-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK

channel ORA_DISK_1: restoring spfile from AUTOBACKUP /home/oracle/autobak/o1_mf_s_991416863_fy03o039_.bkp
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 05-NOV-18

RMAN> exit

Recovery Manager complete.

7、创建spfile

[oracle@fz-orcl autobak]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Nov 5 18:28:15 2018

Copyright (c) 1982, 2011, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SYS@orcl>select status from v$instance;

STATUS
------------
STARTED

SYS@orcl>create spfile from pfile;

File created.

SYS@orcl>shutdown immediate
ORA-01507: database not mounted

ORACLE instance shut down.
SYS@orcl>startup nomount
ORACLE instance started.

Total System Global Area 472887296 bytes
Fixed Size 1345716 bytes
Variable Size 289408844 bytes
Database Buffers 176160768 bytes
Redo Buffers 5971968 bytes
SYS@orcl>show parameter spfile

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0
/db_1/dbs/spfileorcl.ora
SYS@orcl>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

8、恢复控制文件,并将数据库开启到mount状态

[oracle@fz-orcl autobak]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Nov 5 18:29:57 2018

Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.

connected to target database: ORCL (not mounted)

RMAN> restore controlfile from '/home/oracle/autobak/o1_mf_s_991416863_fy03o039_.bkp';

Starting restore at 05-NOV-18
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/orcl/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/orcl/control02.ctl
Finished restore at 05-NOV-18

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

9、注册备份文件

RMAN> catalog start with '/home/oracle/bak';

Starting implicit crosscheck backup at 05-NOV-18
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=20 device type=DISK
Crosschecked 6 objects
Finished implicit crosscheck backup at 05-NOV-18

Starting implicit crosscheck copy at 05-NOV-18
using channel ORA_DISK_1
using channel ORA_DISK_2
Crosschecked 2 objects
Finished implicit crosscheck copy at 05-NOV-18

searching for all files in the recovery area
cataloging files...
no files cataloged

searching for all files that match the pattern /home/oracle/bak

List of Files Unknown to the Database
=====================================
File Name: /home/oracle/bak/o1_mf_annnn_TAG20181105T173422_fy03nylc_.bkp
File Name: /home/oracle/bak/o1_mf_annnn_TAG20181105T173202_fy03jlmo_.bkp
File Name: /home/oracle/bak/o1_mf_nnndf_TAG20181105T173205_fy03jolp_.bkp
File Name: /home/oracle/bak/o1_mf_annnn_TAG20181105T173202_fy03jllk_.bkp
File Name: /home/oracle/bak/o1_mf_nnndf_TAG20181105T173205_fy03joyn_.bkp
File Name: /home/oracle/bak/o1_mf_s_991416863_fy03o039_.bkp
File Name: /home/oracle/bak/o1_mf_annnn_TAG20181105T173202_fy03jms6_.bkp

Do you really want to catalog the above files (enter YES or NO)? yes
cataloging files...
cataloging done

List of Cataloged Files
=======================
File Name: /home/oracle/bak/o1_mf_annnn_TAG20181105T173422_fy03nylc_.bkp
File Name: /home/oracle/bak/o1_mf_annnn_TAG20181105T173202_fy03jlmo_.bkp
File Name: /home/oracle/bak/o1_mf_nnndf_TAG20181105T173205_fy03jolp_.bkp
File Name: /home/oracle/bak/o1_mf_annnn_TAG20181105T173202_fy03jllk_.bkp
File Name: /home/oracle/bak/o1_mf_nnndf_TAG20181105T173205_fy03joyn_.bkp
File Name: /home/oracle/bak/o1_mf_s_991416863_fy03o039_.bkp
File Name: /home/oracle/bak/o1_mf_annnn_TAG20181105T173202_fy03jms6_.bkp

10、恢复数据库

RMAN> restore database;

Starting restore at 05-NOV-18
using channel ORA_DISK_1
using channel ORA_DISK_2

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/orcl/system01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/orcl/users01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/oradata/orcl/rc_data.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/bak/o1_mf_nnndf_TAG20181105T173205_fy03joyn_.bkp
channel ORA_DISK_2: starting datafile backup set restore
channel ORA_DISK_2: specifying datafile(s) to restore from backup set
channel ORA_DISK_2: restoring datafile 00002 to /u01/app/oracle/oradata/orcl/sysaux01.dbf
channel ORA_DISK_2: restoring datafile 00003 to /u01/app/oracle/oradata/orcl/undotbs01.dbf
channel ORA_DISK_2: restoring datafile 00005 to /u01/app/oracle/oradata/orcl/example01.dbf
channel ORA_DISK_2: reading from backup piece /home/oracle/bak/o1_mf_nnndf_TAG20181105T173205_fy03jolp_.bkp
channel ORA_DISK_2: piece handle=/home/oracle/bak/o1_mf_nnndf_TAG20181105T173205_fy03jolp_.bkp tag=TAG20181105T173205
channel ORA_DISK_2: restored backup piece 1
channel ORA_DISK_2: restore complete, elapsed time: 00:01:57
channel ORA_DISK_1: piece handle=/home/oracle/bak/o1_mf_nnndf_TAG20181105T173205_fy03joyn_.bkp tag=TAG20181105T173205
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:27
Finished restore at 05-NOV-18

11、开启数据库

RMAN> alter database open resetlogs;

database opened

RMAN> exit

SYS@orcl>select dbid,name,LOG_MODE,OPEN_MODE from v$database;

DBID NAME LOG_MODE OPEN_MODE
---------- --------- ------------ --------------------
3831555442 ORCL ARCHIVELOG READ WRITE

RMAN迁移数据库(不改变文件目录)的更多相关文章

  1. 使用rman迁移数据库到异机

    迁移数据库的方法有多种,较为常用的则是使用RMAN来迁移.使用RMAN迁移数据库属于数据库的物理备份与恢复范畴,整个过程中数据库的相关信息是完整地镜像.因此,基于此种方式还原恢复的数据库用于测试会使得 ...

  2. Rman实现数据库迁移

    Rman实现数据库迁移(从库A迁移到库B)环境:服务器A:Oracle10g+AS3服务器B:Oracle10g+AS4准备工作: 1 在数据库B上建立与库A相同的目录结构(若由于磁盘空间等原因可以用 ...

  3. 使用RMAN迁移文件系统数据库到ASM

    --================================== -- 使用RMAN迁移文件系统数据库到ASM --================================== 在实际 ...

  4. linux 6.4平台利用rman迁移oracle 11g r2数据库

    测试环境分别在虚拟机安装A,B主机 系统:linux 6.4, 数据库:oracle 11g r2 A主机:安装oracle 11g r2数据库 B主机:只安装oracle 11g r2软件 第一步, ...

  5. Capistrano:自动完成多台服务器上新版本的同步更新,包括数据库的改变

    https://baike.baidu.com/item/Capistrano/6844928?fr=aladdin   Capistrano是一种在多台服务器上运行脚本的开源工具,它主要用于部署we ...

  6. 使用数据泵(expdp、impdp)迁移数据库流程

    转载原文地址为:http://blog.itpub.net/26736162/viewspace-2652256/ 使用数据泵迁移数据库流程 How To Move Or Copy A Databas ...

  7. 全自动迁移数据库的实现 (Fluent NHibernate, Entity Framework Core)

    在开发涉及到数据库的程序时,常会遇到一开始设计的结构不能满足需求需要再添加新字段或新表的情况,这时就需要进行数据库迁移. 实现数据库迁移有很多种办法,从手动管理各个版本的ddl脚本,到实现自己的mig ...

  8. [python][django学习篇][4]django完成数据库代码翻译:迁移数据库(migration)

    上一篇我们已经完成数据库的设计,但是仅仅是python语言,并没有真正创建了数据库表.翻译成数据库语言,真正创建数据库表由django manage.py来实现,这一过程专业术语:迁移数据库 切换到m ...

  9. Entity Framework Code First 迁移数据库

    新版EF,系统实现过程中如果对Model进行更改,队形修改数据库并不能正常运行项目,需要借助Code First 手动迁移数据库 首先启用迁移,允许迁移Context Tools->Librar ...

随机推荐

  1. 使用create-react-app 搭建react + ts + antd框架

    一.创建项目 使用npx create-react-app (项目名) --template typescript 创建项目 ①如果App.tsx文件有如下报错: (没有报错的请忽略) 需要将tsco ...

  2. Mysql获取webshell方式总结

    select ... into outfile general_log cnblogs-MySQL获取webshell的几种方式 csdn-PhpMyadmin后台拿webshell方法总结

  3. 精尽 MyBatis 源码分析 - MyBatis 初始化(三)之 SQL 初始化(上)

    该系列文档是本人在学习 Mybatis 的源码过程中总结下来的,可能对读者不太友好,请结合我的源码注释(Mybatis源码分析 GitHub 地址.Mybatis-Spring 源码分析 GitHub ...

  4. 【C++】归并排序

    性能分析: 时间复杂度:O(n*log(n)) 空间复杂度:O(n) 归并排序算法来自于分而治之思想,"归"是"递归"的意思,"并"是&qu ...

  5. FL Studio杂项设置页讲解(下)

    上篇文章中我们重点讲解了FL Studio中"截断/被截"如何有效的避免个采样在播放时相互干扰的知识以及电平设置栏的知识,今天我们将讲完该页面中剩下的栏目知识,一起来看看吧! 1. ...

  6. IDM下载器的队列功能有什么用?

    使用IDM下载器中的队列功能,可以帮助大家快速分类下载任务,这样,就可以统一管理有同样下载需求的内容. 一.队列的添加及设置 打开IDM下载器,单击菜单中的"队列",可以看到在左侧 ...

  7. 攻克弹唱第九课(如何运用好G大调和弦)

    在本期文章中,笔者将使用guitar pro7软件与大家分享如何运用好G大调音阶的经验. 众所周知,在我们学习吉他的过程中,先从C大调开始,再以G大调为深入,然后才走过入门的阶段.很多朋友都觉得自己对 ...

  8. 思维导图MindManager流程图有哪些功能

    流程图是思维导图中的一种图表,应用相当广泛.MindManager 2020作为专业的思维导图软件,更加强了流程图的功能,让用户能使用更加简便的MindManager技巧绘制流程图.接下来,就让我们一 ...

  9. Boom 3D带你聆听《我们的乐队》音乐盛宴

    说到前段时间大热的音乐类综艺节目,<我们的乐队>肯定值得一提.<我们的乐队>是由谢霆锋.萧敬腾.王俊凯担任导师,以团队的形式组成各种风格的乐队,并通过同场比拼,最终选出获胜的乐 ...

  10. Docker-maven-plugin + Dockerfile + Arthas实现应用诊断

    一.前言 我们的微服务响应生产环境出现一个功能响应时间过慢,对Prometheus监控 Http Request进行分析发下该功能调用的后端接口响应时间平均在30秒以上,分析源码接口有mysql查询. ...