Linux Oracle 11g R2将实例恢复到其他主机的实例上

本文详细介绍了如何在Linux环境下将Oracle 11g R2数据库实例从一个主机恢复到另一个具有不同数据文件路径的主机上。主要步骤包括源数据库备份、目标数据库准备、备份文件传输、RMAN操作如设置DBID、恢复参数文件、修改数据文件路径等,最终成功完成数据库恢复。
摘要由CSDN通过智能技术生成

 

源数据库:

OS: CentOS Linux release 7.7.1908 (Core)

DB版本:oracle 11.2.0.1.0

目标数据库:

OS:Oracle Linux R6

DB版本:oracle 11.2.0.1.0

两个数据库的实例名和数据库名、Oracle_Sid,但是数据文件路径不一致

1、备份源数据库

backup  database plus archivelog delete  input;

备份完成后的备份集如下:

o1_mf_annnn_TAG20200603T213139_hfh9kwh7_.bkp、

o1_mf_annnn_TAG20200603T213409_hfh9pkty_.bkp

控制文件(含参数文件):o1_mf_ncsnf_TAG20200603T213207_hfh9ph8o_.bkp

o1_mf_nnndf_TAG20200603T213207_hfh9lsys_.bkp

通过list backupset

MAN> list backupset;
11      200.00M    DISK        00:00:16     03-JUN-20      
        BP Key: 11   Status: AVAILABLE  Compressed: NO  Tag: TAG20200603T213139
        Piece Name: /opt/oracle/flash_recovery_area/ORCL/backupset/2020_06_03/o1_mf_annnn_TAG20200603T213139_hfh9kwh7_.bkp

  List of Archived Logs in backup set 11
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    10      2398079    31-MAY-20 2430462    01-JUN-20
  1    11      2430462    01-JUN-20 2465163    01-JUN-20
  1    12      2465163    01-JUN-20 2498024    02-JUN-20
  1    13      2498024    02-JUN-20 2532104    02-JUN-20
  1    14      2532104    02-JUN-20 2566265    03-JUN-20
  1    15      2566265    03-JUN-20 2593288    03-JUN-20
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
12      Full    1.09G      DISK        00:01:50     03-JUN-20      
        BP Key: 12   Status: AVAILABLE  Compressed: NO  Tag: TAG20200603T213207
        Piece Name: /opt/oracle/flash_recovery_area/ORCL/backupset/2020_06_03/o1_mf_nnndf_TAG20200603T213207_hfh9lsys_.bkp
  List of Datafiles in backup set 12
  File LV Type Ckp SCN    Ckp Time  Name
  ---- -- ---- ---------- --------- ----
  1       Full 2593313    03-JUN-20 /opt/oracle/oradata/orcl/system01.dbf
  2       Full 2593313    03-JUN-20 /opt/oracle/oradata/orcl/sysaux01.dbf
  3       Full 2593313    03-JUN-20 /opt/oracle/oradata/orcl/undotbs01.dbf
  4       Full 2593313    03-JUN-20 /opt/oracle/oradata/orcl/users01.dbf
  5       Full 2593313    03-JUN-20 /opt/oracle/oradata/orcl/user_tbs.dbf
  6       Full 2593313    03-JUN-20 /opt/oracle/oradata/PROD/rcat_tb01.dbf
  7       Full 2593313    03-JUN-20 /opt/oracle/oradata/orcl/users_tbs.dbf
  8       Full 2593313    03-JUN-20 /opt/oracle/oradata/orcl/tmp.dbf
  9       Full 2593313    03-JUN-20 /opt/oracle/oradata/orcl/user02.dbf
  10      Full 2593313    03-JUN-20 /opt/oracle/oradata/orcl/undotbs02.dbf
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
13      Full    9.67M      DISK        00:00:04     03-JUN-20      
        BP Key: 13   Status: AVAILABLE  Compressed: NO  Tag: TAG20200603T213207
        Piece Name: /opt/oracle/flash_recovery_area/ORCL/backupset/2020_06_03/o1_mf_ncsnf_TAG20200603T213207_hfh9ph8o_.bkp
  SPFILE Included: Modification time: 31-MAY-20
  SPFILE db_unique_name: ORCL
  Control File Included: Ckp SCN: 2593418      Ckp time: 03-JUN-20
BS Key  Size       Device Type Elapsed Time Completion Time
------- ---------- ----------- ------------ ---------------
14      114.50K    DISK        00:00:01     03-JUN-20      
        BP Key: 14   Status: AVAILABLE  Compressed: NO  Tag: TAG20200603T213409
        Piece Name: /opt/oracle/flash_recovery_area/ORCL/backupset/2020_06_03/o1_mf_annnn_TAG20200603T213409_hfh9pkty_.bkp

  List of Archived Logs in backup set 14
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  1    16      2593288    03-JUN-20 2593424    03-JUN-20

 

查询得知

o1_mf_ncsnf_TAG20200603T213207_hfh9ph8o_.bkp 为控制文件,含参数文件以及备份的目录信息。

2 、同样备份目标数据库

backup  database plus archivelog delete  input;

3 、备份目标数据库的spfile和pfie

[oracle@localhost ~]$ cd /u01/app/oracle/product/11.2.0/db_home/dbs/
[oracle@localhost dbs]$ ls
hc_DBUA0.dat  hc_orcl.dat  init.ora  initorcl.ora  lkORCL  orapworcl  snapcf_orcl.f  spfileorcl.ora
[oracle@localhost dbs]$ mv spfileorcl.ora spfileorcl.ora.bk
[oracle@localhost dbs]$ mv initorcl.ora initorcl.ora.bk

 4、将备份文件拷贝到目标数据库中去

使用SFTP客户端 Win SCP下载远程服务器文件,并拷贝至目标服务中,数据文件有点大,大约1个G,有点慢,耐心点!

[oracle@localhost backup]$ ls -lh
总用量 1.3G
-rw-rw-r-- 1 oracle oracle 201M 6月   3 21:31 o1_mf_annnn_TAG20200603T213139_hfh9kwh7_.bkp
-rw-rw-r-- 1 oracle oracle 115K 6月   3 21:34 o1_mf_annnn_TAG20200603T213409_hfh9pkty_.bkp
-rw-rw-r-- 1 oracle oracle 9.7M 6月   3 21:34 o1_mf_ncsnf_TAG20200603T213207_hfh9ph8o_.bkp
-rw-rw-r-- 1 oracle oracle 1.1G 6月   3 21:33 o1_mf_nnndf_TAG20200603T213207_hfh9lsys_.bkp

5、RMAN打开源数据库

[oracle@bogon 2020_06_03]$ rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Jun 3 22:02:34 2020
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: ORCL (DBID=1567294299)

得知源数据库的DBID=1567294299,用于在目标数据库要切换到这个DBID。

6、RMAN打开目标数据库

开启到nomount

并设置DBI

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

终有一刻

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值