阿里云-云小站(无限量代金券发放中)
【腾讯云】云服务器、云数据库、COS、CDN、短信等热卖云产品特惠抢购

使用RMAN来PDB执行完全恢复

202次阅读
没有评论

共计 4820 个字符,预计需要花费 13 分钟才能阅读完成。

可以对一个或多个 PDB 执行完全恢复而不影响其它为 open 状态的 PDB 的操作。RMAN 有两种方法来恢复 PDB:
. 连接到 CDB 的 root 容器,然后使用 restore pluggable database 与 recover pluggable database 命令。这种方法能让你使用单个命令来恢复多个 PDB。

. 连接到 PDB 并使用 restore database 与 recover database 语句,这种方法只能恢复单个 PDB 并且能让你使用相同的命令来恢复 non-CDB 数据库

使用 RMAN 恢复一个或多个 PDB
1. 启动 RMAN 并使用有 sysdba 或 sysbackup 权限的公共用户连接到 root 容器

[Oracle@jytest1 ~]$ rman target/ catalog rco/xxxxx@jypdb_173

Recovery Manager: Release 12.2.0.1.0 – Production on Mon Dec 11 16:56:58 2017

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

connected to target database: JY (DBID=979425723)
connected to recovery catalog database
2. 关闭你要执行恢复操作的 PDB

SQL> alter pluggable database jypdb,testpdb close immediate;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                            OPEN_MODE
——————————————————————————————————————————– ———-
PDB$SEED                                                                                                                        READ ONLY
JYPDB                                                                                                                            MOUNTED
TESTPDB                                                                                                                          MOUNTED

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

4. 执行 restore pluggable database 与 recover pluggable database 命令,下面的语句恢复 jypdb,testpdb

RMAN> restore pluggable database  jypdb,testpdb;

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=2279 instance=jy1 device type=DISK

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_20171211_0osls830_1_1
channel ORA_DISK_1: piece handle=+TEST/rman_backup/jy_979425723_20171211_0osls830_1_1 tag=TAG20171211T164446
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:35
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 00016 to +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/system.260.962469409
channel ORA_DISK_1: restoring datafile 00017 to +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/sysaux.259.962469409
channel ORA_DISK_1: restoring datafile 00018 to +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undotbs1.265.962469409
channel ORA_DISK_1: restoring datafile 00019 to +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/undo_2.266.962469409
channel ORA_DISK_1: restoring datafile 00020 to +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/users.267.962469409
channel ORA_DISK_1: restoring datafile 00021 to +DATA/JY/600D6F56DEB669CCE053AB828A0AAB7E/DATAFILE/test.269.962469409
channel ORA_DISK_1: reading from backup piece +TEST/rman_backup/jy_979425723_20171211_0psls843_1_1
channel ORA_DISK_1: piece handle=+TEST/rman_backup/jy_979425723_20171211_0psls843_1_1 tag=TAG20171211T164446
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:36
Finished restore at 11-DEC-17

RMAN> recover pluggable database jypdb,testpdb;

Starting recover at 11-DEC-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=2279 instance=jy1 device type=DISK

starting media recovery
media recovery complete, elapsed time: 00:00:02

Finished recover at 11-DEC-17
5.open PDB(jypdb,testpdb)

SQL> alter pluggable database jypdb,testpdb open;

Pluggable database altered.

SQL> select name,open_mode from v$pdbs;

NAME                                                                                                                            OPEN_MODE
——————————————————————————————————————————– ———-
PDB$SEED                                                                                                                        READ ONLY
JYPDB                                                                                                                            READ WRITE
TESTPDB         

更多 Oracle 相关信息见 Oracle 专题页面 http://www.linuxidc.com/topicnews.aspx?tid=12

本文永久更新链接地址 :http://www.linuxidc.com/Linux/2017-12/149389.htm

正文完
星哥玩云-微信公众号
post-qrcode
 0
星锅
版权声明:本站原创文章,由 星锅 于2022-01-22发表,共计4820字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。
【腾讯云】推广者专属福利,新客户无门槛领取总价值高达2860元代金券,每种代金券限量500张,先到先得。
阿里云-最新活动爆款每日限量供应
评论(没有评论)
验证码
【腾讯云】云服务器、云数据库、COS、CDN、短信等云产品特惠热卖中