举例:在从库上备份,到主库上恢复

简介: 在备库上备份,在主库上恢复control file和recovery catalog的同步

在备库上备份,在主库上恢复control file和recovery catalog的同步

rman target / catalog rco/dingjia@192.168.17.201/test1
run{
allocate channel c1 type 'sbt_tape' parms='
SBT_LIBRARY=/opt/scutech/dbackup3/lib/libobk.so,
ENV=(URL=http://192.168.87.155:50306/d2/data/0d36020eecec11ea8000b49691622ac4/c7873e9aed0811ea8000b49691622ac4,
EXTRA=X-Access-Key:ea5350ac00fa61d08533a729da808de0)' trace=0;
backup tablespace ex1;
}
LIST DB_UNIQUE_NAME OF DATABASE;
list backup summary  for db_unique_name 'orcl1by';
changebackup tag='standby_backup_1' for db_unique_name orcl reset db_unique_name;


RMAN> host 'rm /u01/app/oracle/oradata/orcl/ex1.dbf';
host command complete
RMAN> validate datafile 13;
Starting validate at Sep 09 2020 11:51:13  
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=378 device type=DISK
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03009: failure of validate command on ORA_DISK_1 channel at 09/09/2020 11:51:14
ORA-01122: database file 13 failed verification check
ORA-01110: data file 13: '/u01/app/oracle/oradata/orcl/ex1.dbf'
ORA-01565: error in identifying file '/u01/app/oracle/oradata/orcl/ex1.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
RMAN> list failure;
Database Role: PRIMARY
List of Database Failures
=========================
Failure ID Priority Status    Time Detected        Summary
---------- -------- --------- -------------------- -------
1642       HIGH     OPEN      Sep 09 2020 11:46:03 One or more non-system datafiles are missing
RMAN> advise failure;
Database Role: PRIMARY
List of Database Failures
=========================
Failure ID Priority Status    Time Detected        Summary
---------- -------- --------- -------------------- -------
1642       HIGH     OPEN      Sep 09 2020 11:46:03 One or more non-system datafiles are missing
analyzing automatic repair options; this may take some time
using channel ORA_DISK_1
analyzing automatic repair options complete
Mandatory Manual Actions
========================
1. If file /u01/app/oracle/oradata/orcl/ex1.dbf was unintentionally renamed or moved, restore it
2. If you have an export of tablespace EX1, then drop and re-create the tablespace and import the data.
3. Contact Oracle Support Services if the preceding recommendations cannot be used, or if they do not fix the failures selected for repair
Optional Manual Actions
=======================
1. Shut down, mount the database and try flush redo using ALTER SYSTEM FLUSH REDO TO 'standby name' command.  Then perform a Data Guard role change (failover).  Available standbys: orcl1by.
Automated Repair Options
========================
no automatic repair options available
RMAN> RMAN> 
RMAN> ALTER TABLESPACE ex1 offline immediate;
Statement processed
RMAN> run{
allocate channel c1 type 'sbt_tape' parms='
SBT_LIBRARY=/opt/scutech/dbackup3/lib/libobk.so,
ENV=(URL=http://192.168.87.155:50306/d2/data/0d36020eecec11ea8000b49691622ac4/c7873e9aed0811ea8000b49691622ac4,
EXTRA=X-Access-Key:ea5350ac00fa61d08533a729da808de0)' trace=0;
restore tablespace ex1;
}
2> 3> 4> 5> 6> 7> 
released channel: ORA_DISK_1
allocated channel: c1
channel c1: SID=378 device type=SBT_TAPE
channel c1: DBackup3 Oracle MMS Library
Starting restore at Sep 09 2020 11:51:45
channel c1: starting datafile backup set restore
channel c1: specifying datafile(s) to restore from backup set
channel c1: restoring datafile 00013 to /u01/app/oracle/oradata/orcl/ex1.dbf
channel c1: reading from backup piece 66v9vp9q_1_1
channel c1: piece handle=66v9vp9q_1_1 tag=TAG20200909T114458
channel c1: restored backup piece 1
channel c1: restore complete, elapsed time: 00:00:01
Finished restore at Sep 09 2020 11:51:48
released channel: c1
RMAN>  recover tablespace ex1;
Starting recover at Sep 09 2020 11:53:12
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=378 device type=DISK
starting media recovery
archived log for thread 1 with sequence 279 is already on disk as file /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_09_08/o1_mf_1_279_hogz5ylq_.arc
archived log for thread 1 with sequence 280 is already on disk as file /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_09_08/o1_mf_1_280_hoh3qxk1_.arc
archived log for thread 1 with sequence 281 is already on disk as file /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_09_08/o1_mf_1_281_hoh7bow0_.arc
archived log for thread 1 with sequence 282 is already on disk as file /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_09_09/o1_mf_1_282_hohw8y8y_.arc
archived log for thread 1 with sequence 283 is already on disk as file /u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_09_09/o1_mf_1_283_hoj818t1_.arc
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_09_08/o1_mf_1_279_hogz5ylq_.arc thread=1 sequence=279
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_09_08/o1_mf_1_280_hoh3qxk1_.arc thread=1 sequence=280
archived log file name=/u01/app/oracle/fast_recovery_area/ORCL/archivelog/2020_09_08/o1_mf_1_281_hoh7bow0_.arc thread=1 sequence=281
media recovery complete, elapsed time: 00:00:01
Finished recover at Sep 09 2020 11:53:14
RMAN> ALTER TABLESPACE ex1 online;
Statement processed
RMAN> validate tablespace ex1;
Starting validate at Sep 09 2020 11:53:35
using channel ORA_DISK_1
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00013 name=/u01/app/oracle/oradata/orcl/ex1.dbf
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
13   OK     0              1            129             2488395   
  File Name: /u01/app/oracle/oradata/orcl/ex1.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              0               
  Index      0              0               
  Other      0              127             
Finished validate at Sep 09 2020 11:53:37
RMAN>


相关文章
|
2月前
|
SQL 存储 关系型数据库
Mysql主从同步 清理二进制日志的技巧
Mysql主从同步 清理二进制日志的技巧
23 1
|
12月前
|
SQL 关系型数据库 MySQL
Mysql使用binlog增量备份与恢复
Mysql使用binlog增量备份与恢复
224 0
|
数据库
主库和备库数据库文件名不同时,resync不成功
《Dataguard Concepts and Administration》文档中12.9.3 Standby Database File Names Are Different From Primary Database 有描述对文件名不同时的处理情况
|
SQL 存储 数据库
在DG环境中,主库丢失归档,对主库进行基于SCN的增量备份来恢复物理DG环境
在DG环境中,主库丢失归档,对主库进行基于SCN的增量备份来恢复物理DG环境
387 0
|
运维
简单记录一次ADG备库同步故障
这是一套11g的老库,主库3节点,备库1节点。项目上于昨天晚上做某测试扩容了表空间,在其他位置新建了9个数据文件,在备库无法创建这个非标准位置的datafile,从而导致同步中断。
355 0
|
SQL Oracle 关系型数据库
PostgreSQL pg_rewind,时间线修复,脑裂修复,flashback - 从库开启读写后,回退为只读从库。异步主从发生角色切换后,主库rewind为新主库的从库
PostgreSQL pg_rewind,时间线修复,脑裂修复,flashback - 从库开启读写后,回退为只读从库。异步主从发生角色切换后,主库rewind为新主库的从库
1975 1