我的编程空间,编程开发者的网络收藏夹
学习永远不晚

使用RMAN对CDB的root执行完全恢复

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

使用RMAN对CDB的root执行完全恢复

如果数据损坏或用户错误只影响CDB的root容器,那么可能只会考虑恢复root容器。然而,Oracle强烈建议你在恢复root容器后恢复所有的PDB来阻止root与PDB中的元数据不一致的情况。在这种情况下,更好的方法是对整个CDB执行恢复操作。

使用RMAN对root执行完全恢复的操作如下:
1.启动RMAN并以有sysdba或sysbackup权限的公共用户连接到root容器。

[oracle@jytest1 ~]$ rman target/ catalog rco/xxxxxx@jypdb 

Recovery Manager: Release 12.2.0.1.0 - Production on Mon Dec 11 15:55:18 2017

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

connected to target database: JY (DBID=979425723, not open)
connected to recovery catalog database

2.将整个CDB启动到mount状态

SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.

Total System Global Area 6442450944 bytes
Fixed Size                  8807168 bytes
Variable Size            1895828736 bytes
Database Buffers         4529848320 bytes
Redo Buffers                7966720 bytes
Database mounted.

SQL> select name from v$pdbs;

NAME
--------------------------------------------------------------------------------
PDB$SEED
JYPDB

3.可选操作,使用configure命令来配置缺省的设备类型与自动通道。

4.执行以下命令来还原与恢复root容器

RMAN> restore database root;

Starting restore at 11-DEC-17
starting full resync of recovery catalog
full resync complete
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1521 instance=jy1 device type=DISK

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 +DATA/JY/DATAFILE/system.317.962209603
channel ORA_DISK_1: restoring datafile 00003 to +DATA/JY/DATAFILE/sysaux.298.962209605
channel ORA_DISK_1: restoring datafile 00004 to +DATA/JY/DATAFILE/undotbs1.277.962209605
channel ORA_DISK_1: restoring datafile 00007 to +DATA/JY/DATAFILE/users.301.962209605
channel ORA_DISK_1: restoring datafile 00009 to +DATA/JY/DATAFILE/undotbs2.312.962209605
channel ORA_DISK_1: reading from backup piece +TEST/rman_backup/jy_979425723_20171208_0fslkbg2_1_1
channel ORA_DISK_1: piece handle=+TEST/rman_backup/jy_979425723_20171208_0fslkbg2_1_1 tag=TAG20171208T165528
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 11-DEC-17

RMAN> recover database root;

Starting recover at 11-DEC-17
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 14 is already on disk as file +TEST/arch/1_14_961976319.dbf
archived log for thread 1 with sequence 15 is already on disk as file +TEST/arch/1_15_961976319.dbf
archived log for thread 1 with sequence 16 is already on disk as file +TEST/arch/1_16_961976319.dbf
archived log for thread 1 with sequence 17 is already on disk as file +TEST/arch/1_17_961976319.dbf
archived log for thread 1 with sequence 18 is already on disk as file +TEST/arch/1_18_961976319.dbf
archived log for thread 1 with sequence 19 is already on disk as file +TEST/arch/1_19_961976319.dbf
archived log for thread 1 with sequence 20 is already on disk as file +TEST/arch/1_20_961976319.dbf
archived log for thread 1 with sequence 21 is already on disk as file +TEST/arch/1_21_961976319.dbf
archived log for thread 1 with sequence 22 is already on disk as file +TEST/arch/1_22_961976319.dbf
archived log for thread 1 with sequence 23 is already on disk as file +TEST/arch/1_23_961976319.dbf
archived log for thread 1 with sequence 24 is already on disk as file +TEST/arch/1_24_961976319.dbf
archived log for thread 1 with sequence 25 is already on disk as file +TEST/arch/1_25_961976319.dbf
archived log for thread 1 with sequence 26 is already on disk as file +TEST/arch/1_26_961976319.dbf
archived log for thread 1 with sequence 27 is already on disk as file +TEST/arch/1_27_961976319.dbf
archived log for thread 2 with sequence 12 is already on disk as file +TEST/arch/2_12_961976319.dbf
archived log for thread 2 with sequence 13 is already on disk as file +TEST/arch/2_13_961976319.dbf
archived log for thread 2 with sequence 14 is already on disk as file +TEST/arch/2_14_961976319.dbf
archived log for thread 2 with sequence 15 is already on disk as file +TEST/arch/2_15_961976319.dbf
archived log for thread 2 with sequence 16 is already on disk as file +TEST/arch/2_16_961976319.dbf
archived log for thread 2 with sequence 17 is already on disk as file +TEST/arch/2_17_961976319.dbf
archived log for thread 2 with sequence 18 is already on disk as file +TEST/arch/2_18_961976319.dbf
archived log for thread 2 with sequence 19 is already on disk as file +TEST/arch/2_19_961976319.dbf
archived log for thread 2 with sequence 20 is already on disk as file +TEST/arch/2_20_961976319.dbf
archived log file name=+TEST/arch/1_14_961976319.dbf thread=1 sequence=14
archived log file name=+TEST/arch/2_12_961976319.dbf thread=2 sequence=12
archived log file name=+TEST/arch/1_15_961976319.dbf thread=1 sequence=15
archived log file name=+TEST/arch/2_13_961976319.dbf thread=2 sequence=13
archived log file name=+TEST/arch/1_16_961976319.dbf thread=1 sequence=16
archived log file name=+TEST/arch/1_17_961976319.dbf thread=1 sequence=17
archived log file name=+TEST/arch/2_14_961976319.dbf thread=2 sequence=14
archived log file name=+TEST/arch/1_18_961976319.dbf thread=1 sequence=18
archived log file name=+TEST/arch/1_19_961976319.dbf thread=1 sequence=19
archived log file name=+TEST/arch/1_20_961976319.dbf thread=1 sequence=20
archived log file name=+TEST/arch/2_15_961976319.dbf thread=2 sequence=15
archived log file name=+TEST/arch/1_21_961976319.dbf thread=1 sequence=21
archived log file name=+TEST/arch/1_22_961976319.dbf thread=1 sequence=22
archived log file name=+TEST/arch/2_16_961976319.dbf thread=2 sequence=16
archived log file name=+TEST/arch/1_23_961976319.dbf thread=1 sequence=23
archived log file name=+TEST/arch/1_24_961976319.dbf thread=1 sequence=24
archived log file name=+TEST/arch/2_17_961976319.dbf thread=2 sequence=17
archived log file name=+TEST/arch/1_25_961976319.dbf thread=1 sequence=25
archived log file name=+TEST/arch/2_18_961976319.dbf thread=2 sequence=18
archived log file name=+TEST/arch/1_26_961976319.dbf thread=1 sequence=26
media recovery complete, elapsed time: 00:06:07
Finished recover at 11-DEC-17
starting full resync of recovery catalog
full resync complete

5.检查输出结果查看是否介质恢复成功。如果介质恢复成功继续下面的操作

6.强烈建议的操作,恢复所有PDB,包括CDB seed

RMAN> restore pluggable database 'PDB$SEED',jypdb;

Starting restore at 11-DEC-17
using channel ORA_DISK_1

skipping datafile 5; already restored to file +DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/system.256.962209675
skipping datafile 6; already restored to file +DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/sysaux.270.962209675
skipping datafile 8; already restored to file +DATA/JY/5F9AA264B21F3ED9E053AB828A0A6088/DATAFILE/undotbs1.296.962209675
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 00010 to +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/system.271.962209649
channel ORA_DISK_1: restoring datafile 00011 to +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/sysaux.316.962209649
channel ORA_DISK_1: restoring datafile 00012 to +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undotbs1.264.962209649
channel ORA_DISK_1: restoring datafile 00013 to +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/undo_2.268.962209649
channel ORA_DISK_1: restoring datafile 00014 to +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/users.278.962209649
channel ORA_DISK_1: restoring datafile 00015 to +DATA/JY/5F9AC6865E87549FE053AB828A0ADE94/DATAFILE/test.275.962210609
channel ORA_DISK_1: reading from backup piece +TEST/rman_backup/jy_979425723_20171208_0gslkbie_1_1
channel ORA_DISK_1: piece handle=+TEST/rman_backup/jy_979425723_20171208_0gslkbie_1_1 tag=TAG20171208T165528
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 11-DEC-17

RMAN> recover pluggable database 'PDB$SEED',jypdb;

Starting recover at 11-DEC-17
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 14 is already on disk as file +TEST/arch/1_14_961976319.dbf
archived log for thread 1 with sequence 15 is already on disk as file +TEST/arch/1_15_961976319.dbf
archived log for thread 1 with sequence 16 is already on disk as file +TEST/arch/1_16_961976319.dbf
archived log for thread 1 with sequence 17 is already on disk as file +TEST/arch/1_17_961976319.dbf
archived log for thread 1 with sequence 18 is already on disk as file +TEST/arch/1_18_961976319.dbf
archived log for thread 1 with sequence 19 is already on disk as file +TEST/arch/1_19_961976319.dbf
archived log for thread 1 with sequence 20 is already on disk as file +TEST/arch/1_20_961976319.dbf
archived log for thread 1 with sequence 21 is already on disk as file +TEST/arch/1_21_961976319.dbf
archived log for thread 1 with sequence 22 is already on disk as file +TEST/arch/1_22_961976319.dbf
archived log for thread 1 with sequence 23 is already on disk as file +TEST/arch/1_23_961976319.dbf
archived log for thread 1 with sequence 24 is already on disk as file +TEST/arch/1_24_961976319.dbf
archived log for thread 1 with sequence 25 is already on disk as file +TEST/arch/1_25_961976319.dbf
archived log for thread 1 with sequence 26 is already on disk as file +TEST/arch/1_26_961976319.dbf
archived log for thread 1 with sequence 27 is already on disk as file +TEST/arch/1_27_961976319.dbf
archived log for thread 2 with sequence 12 is already on disk as file +TEST/arch/2_12_961976319.dbf
archived log for thread 2 with sequence 13 is already on disk as file +TEST/arch/2_13_961976319.dbf
archived log for thread 2 with sequence 14 is already on disk as file +TEST/arch/2_14_961976319.dbf
archived log for thread 2 with sequence 15 is already on disk as file +TEST/arch/2_15_961976319.dbf
archived log for thread 2 with sequence 16 is already on disk as file +TEST/arch/2_16_961976319.dbf
archived log for thread 2 with sequence 17 is already on disk as file +TEST/arch/2_17_961976319.dbf
archived log for thread 2 with sequence 18 is already on disk as file +TEST/arch/2_18_961976319.dbf
archived log for thread 2 with sequence 19 is already on disk as file +TEST/arch/2_19_961976319.dbf
archived log for thread 2 with sequence 20 is already on disk as file +TEST/arch/2_20_961976319.dbf
archived log file name=+TEST/arch/1_14_961976319.dbf thread=1 sequence=14
archived log file name=+TEST/arch/2_12_961976319.dbf thread=2 sequence=12
archived log file name=+TEST/arch/1_15_961976319.dbf thread=1 sequence=15
archived log file name=+TEST/arch/2_13_961976319.dbf thread=2 sequence=13
archived log file name=+TEST/arch/1_16_961976319.dbf thread=1 sequence=16
archived log file name=+TEST/arch/1_17_961976319.dbf thread=1 sequence=17
archived log file name=+TEST/arch/2_14_961976319.dbf thread=2 sequence=14
archived log file name=+TEST/arch/1_18_961976319.dbf thread=1 sequence=18
archived log file name=+TEST/arch/1_19_961976319.dbf thread=1 sequence=19
archived log file name=+TEST/arch/1_20_961976319.dbf thread=1 sequence=20
archived log file name=+TEST/arch/2_15_961976319.dbf thread=2 sequence=15
archived log file name=+TEST/arch/1_21_961976319.dbf thread=1 sequence=21
archived log file name=+TEST/arch/1_22_961976319.dbf thread=1 sequence=22
archived log file name=+TEST/arch/2_16_961976319.dbf thread=2 sequence=16
archived log file name=+TEST/arch/1_23_961976319.dbf thread=1 sequence=23
archived log file name=+TEST/arch/1_24_961976319.dbf thread=1 sequence=24
archived log file name=+TEST/arch/2_17_961976319.dbf thread=2 sequence=17
archived log file name=+TEST/arch/1_25_961976319.dbf thread=1 sequence=25
archived log file name=+TEST/arch/2_18_961976319.dbf thread=2 sequence=18
archived log file name=+TEST/arch/1_26_961976319.dbf thread=1 sequence=26
media recovery complete, elapsed time: 00:02:52
Finished recover at 11-DEC-17
starting full resync of recovery catalog
full resync complete

检查输出结果查看是否介质恢复成功。如果介质恢复成功继续下面的操作

7.open CDB与所有的PDB

RMAN> alter database open;

Statement processed

RMAN> alter pluggable database all open;

Statement processed
starting full resync of recovery catalog
full resync complete


免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

使用RMAN对CDB的root执行完全恢复

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

如何恢复MySQL root用户的完全权限?

我们可以借助UPDATE命令恢复MySQL root用户的完全权限。首先,您需要停止 mysqld 并使用 --skip-grant-tables 选项重新启动它。之后,仅使用 mysql 连接到 mysqld 服务器(即没有 -p 选项
2023-10-22

Oracle使用RMAN进行数据库恢复的实现步骤

目录1. 准备工作2. 启动 RMAN3. 恢复整个数据库1. 关闭数据库2. 启动到装载模式3. 恢复控制文件(如果需要)4. 恢复数据文件5. 应用归档日志和联机重做日志6. 打开数据库4. 恢复特定数据文件5. 恢复表空间6. 恢复时
Oracle使用RMAN进行数据库恢复的实现步骤
2024-09-08

SQLServer 错误 2516 修复操作已经使数据库 NAME 的差异位图无效。 差异备份链断开。 必须首先执行完全数据库备份,才能执行差异备份。 故障 处理 修复 支持远程

详细信息 Attribute 值 产品名称 SQL Server 事件 ID 2516 事件源 MSSQLSERVER 组件 SQLEngine 符号名称 DBCC_REPAIR_DIFF_MAP_INVALIDATED ...
SQLServer 错误 2516 修复操作已经使数据库 NAME 的差异位图无效。 差异备份链断开。 必须首先执行完全数据库备份,才能执行差异备份。 故障 处理 修复 支持远程
2023-11-05

编程热搜

目录