对于 ORACLE_SID(服务?),有一个使用 RMAN 配置和计划的备份。SID 上有多个 DB,但其中只有一个需要备份数据。对于定义和设置的其余备份就足够了。这样的 RMAN 配置是否可行?
我正在开发一个 Oracle11gR2 数据库。数据库处于 DataGuard 模式,即使 dataguard 设置为 DEFER。
我想删除已至少备份 2 次到磁带的所有归档日志。
rman> list archivelog all backed up 2 times to device type sbt_tape;
显示符合条件的归档日志列表
但是,当我稍后尝试运行时
rman> delete force noprompt archivelog all backed up 2 times to device type sbt_tape;
没有文件被删除。
除了设置为 370 天窗口的保留策略外,所有参数均设置为默认值
查看我生成的跟踪,除其他外,显示list
命令报告的每个文件的此消息
DBGMISC: Matching archived log has 0 backups
我不知道如何解释。
任何有关如何进一步调查该问题的想法将不胜感激
rman配置如下
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORACLE are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 370 DAYS;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE SBT_TAPE TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DEVICE TYPE SBT_TAPE PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE SBT_TAPE TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE 'SBT_TAPE' PARMS 'SBT_LIBRARY=/opt/tivoli/tsm/client/oracle/bin64/libobk.so';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '+ASMARCHIVES/oracle/snap_orcld.f';
我是 RMAN 新手,我正在尝试使用recover pluggable database <pdbname>
在发出recover pluggable database
命令之前,我执行以下步骤:
- 增量备份+自动备份备份可插拔数据库
- 关闭数据库
- 从 CDB 中删除控制文件和我要恢复的 PDB 中的所有文件(因为我想在控制文件丢失时模拟恢复 PDB)
- RMAN 目标和问题
STARTUP NOMOUNT
- 从自动备份恢复控制文件(当我在 PDB 上进行增量备份时生成)
- 挂载数据库并发出
restore pluggable database <pdbname>
- 恢复 CDB 中 PDB 和控制文件的所有文件后,我运行
recover pluggable database <pdbname>
.
但是当我运行最后一个命令时,会发生此错误
RMAN> recover pluggable database pdb;
Starting recover at 23-JAN-22
using channel ORA_DISK_1
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 01/23/2022 23:59:47
RMAN-06067: RECOVER DATABASE required with a backup or created control file
是什么导致了这个错误以及如何解决它?我已经从备份中恢复了控制文件,但仍然出现此错误。当控制文件丢失时,是否需要同时备份 CDB 和 PDB 才能恢复 PDB?
提前致谢!
我们有 Oracle 18c 和 RMAN:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '+FRA';
我们也有增量备份。备份脚本中没有“备份当前控制文件”,但每次我们进行备份时都会备份控制文件。有人可以告诉为什么“DELETE OBSOLETE”在仍然需要数据库恢复时会删除自动备份控制文件的所有副本(除了最新的)吗?比如,WTF?例如,如果控制文件是多余的,为什么 RMAN 不会删除相关的备份集。无法得到它。是的 - 我们有大量没有控制文件的所谓“备份”。
TSPITR 失败并显示:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of recover command at 10/29/2020 17:39:13
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the control file found to restore
数据库新手。对 Oracle Data Guard 感兴趣。新使用 RMAN。
所有这些仅用于测试,不涉及任何类型的生产环境。
使用 ORACLE 文档:
- 使用 RMAN DUPLICATE...FROM ACTIVE DATABASE 创建物理备用的分步指南(文档 ID 1075908.1)
. .=================================================== ==========================。.
主数据库:
[oracle@ol12c pridb]$ env | grep ORA
ORACLE_UNQNAME=cdb1
ORACLE_SID=pridb
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ol12c.localdomain
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
SQL> startup pfile=/u01/app/oracle/product/12.1.0.2/db_1/dbs/initpridb.ora;
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/oracle/fast_recovery_
area
db_recovery_file_dest_size big integer 2G
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 12
Next log sequence to archive 13
Current log sequence 13
. .=================================================== ==========================。.
2. 待机:
[oracle@ol12c stbdb]$ env | grep ORA
ORACLE_UNQNAME=cdb1
ORACLE_SID=stbdb
ORACLE_BASE=/u01/app/oracle
ORACLE_HOSTNAME=ol12c.localdomain
ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/db_1
SQL> startup nomount pfile='/u01/app/oracle/product/12.1.0.2/db_1/dbs/initstbdb.ora'
SQL> show parameter db_recovery_file_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_recovery_file_dest string /u01/app/oracle/fast_recovery_
area/stbdb
db_recovery_file_dest_size big integer 2G
. .=================================================== ==========================。.
3. RMAN(在主数据库上):
[oracle@ol12c pridb]$ rman
RMAN> connect target sys/oracle@pridb
connected to target database: PRIDB (DBID=1212094364)
RMAN> connect auxiliary sys/oracle@stbdb
connected to auxiliary database: PRIDB (not mounted)
. .=================================================== ==========================。.
4.错误:
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "db_unique_name": expecting one of: "archivelog, autobackup, auxiliary, auxname, backup, catalog, command, compression, controlfile, database, dbid, decryption, default, echo, encryption, high, incarnation, incremental, long, maxcorrupt, maxseq, newname, nocfau, numwidth, restore, snapshot, to restore point, until restore point, until, "
RMAN-01007: at line 1 column 1 file: standard input
和
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00558: error encountered while parsing input commands
RMAN-01009: syntax error: found "identifier": expecting one of: "archivelog, autobackup, auxiliary, auxname, backup, catalog, command, compression, controlfile, database, dbid, decryption, default, echo, encryption, high, incarnation, incremental, long, maxcorrupt, maxseq, newname, nocfau, numwidth, restore, snapshot, to restore point, until restore point, until, "
RMAN-01008: the bad identifier was: log_archive_dest_2
RMAN-01007: at line 1 column 7 file: standard input
对于从 log_file_name_convert 开始的命令中指定的所有参数,我收到RMAN-01008错误。
. .=================================================== ==========================。.
5. 我的意见:
run
{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate auxiliary channel aux type disk;
duplicate target database for standby from active database
parameter_value_convert'pridb','stbdb'
set db_unique_name='stbdb'
set db_file_name_convert='pridb','stbdb'
set log_file_name_convert='pridb','stbdb'
set control_files='/u01/app/oracle/oradata/stbdb/stbdb_control1.ctl'
set standby_file_management='AUTO'
set log_archive_max_processes='10'
set fal_client='stbdb'
set fal_server='pridb'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(pridb,stbdb)'
set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=stbdb'
set log_archive_dest_2='service=testdb ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=stbdb'
;
}
首先我得到:
RMAN-05557:目标实例未使用服务器参数文件启动
因为我在尝试:duplicate target database for standby from active database spfile
而且我不是从 spfile 开始,而是直接从 pfile 开始。
根据我的研究,我应该能够不指定 SPfile:
因此,我从我检查的链接中duplicate target database for standby from active database spfile
提到duplicate target database for standby from active database
的应该工作的地方改变了。
--> 但是我现在要更新哪些参数?在我看来,这似乎不合逻辑。 .
上面的代码在分配通道时成功运行了一次,但随后停止并开始抛出错误。
目前我正在运行脚本rman checksyntax
只是为了确保我不会破坏任何东西.. :)
. .=================================================== ==========================。.
你能帮我吗:
我试图更好地理解 RMAN。
找出我在上述情况下做错了什么。(+ 为什么!)
我对了解正在发生的事情等比快速完成这项工作更感兴趣。
(即使它工作起来会很棒!:)此时的目的是学习)
预先感谢您的帮助!
. .=================================================== ==========================。.
解决方案
需要一个 SPFILE
在主数据库上:
SQL> create spfile from pfile='/u01/app/oracle/product/12.1.0.2/db_1/dbs/initpridb.ora';
File created.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup;
ORACLE instance started.
Total System Global Area 1073741824 bytes
Fixed Size 2932632 bytes
Variable Size 671088744 bytes
Database Buffers 394264576 bytes
Redo Buffers 5455872 bytes
Database mounted.
Database opened.
然后启动 RMAN 并运行脚本,正如我们所说的那样运行!:) -耶!
以下错误:
RMAN-05537:当使用 spfile 启动辅助实例时,没有 TARGET 连接的 DUPLICATE 不能使用 SPFILE 子句
通过更新脚本值和重新连接数据库来解决。
使用的最终脚本:
RMAN> run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
allocate auxiliary channel aux type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert'pridb','stbdb'
set db_unique_name='stbdb'
set db_file_name_convert='/u01/app/oracle/oradata/pridb/PRIDB/datafile/','/u01/app/oracle/oradata/stbdb/STBDB/datafile/'
set log_file_name_convert='/u01/app/oracle/oradata/pridb/PRIDB/onlinelog/','/u01/app/oracle/oradata/stbdb/STBDB/onlinelog/'
set control_files='/u01/app/oracle/oradata/stbdb/stbdb_control1.ctl'
set standby_file_management='AUTO'
set log_archive_max_processes='10'
set fal_client='stbdb'
set fal_server='pridb'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(pridb,stbdb)'
set log_archive_dest_1='location=USE_DB_RECOVERY_FILE_DEST valid_for=(all_logfiles,all_roles) db_unique_name=stbdb'
set log_archive_dest_2='service=testdb ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=stbdb'
;
}
我在 ODA(Oracle 数据库机,运行 linux)上使用 Oracle 版本 12.2.0.1.0 标准版。我的实例“xyz”正在归档日志模式下运行。RMAN 执行备份,不必要的数据文件会自动从备份集中删除。
[oracle@oda ~]$ rman TARGET /
Recovery Manager: Release 12.2.0.1.0 - Production on Fr Aug 31 16:50:05 2018
Copyright (c) 1982, 2017, Oracle and/or its affiliates. All rights reserved.
Mit Zieldatenbank verbunden: XYZ (DBID=4079461799)
RMAN> show all;
Kontrolldatei der Zieldatenbank wird anstelle des Recovery-Katalogs verwendet
RMAN-Konfigurationsparameter für Datenbank mit db_unique_name XYZ sind:
CONFIGURE RETENTION POLICY TO REDUNDANCY 3;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/mnt/backup/rman/xyz/%F';
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/mnt/backup/rman/xyz/%U';
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u03/app/oracle/fast_recovery_area/XYZ/controlfile/snapcf_xyz.f';
当我检查目录时,一切看起来都很好——除了不断堆积的控制文件
[oracle@oda1 xyz]$ pwd
/mnt/backup/rman/xyz
[oracle@oda1 xyz]$ l
total 4144832
drwxr-xr-x 2 oracle oinstall 4096 Aug 31 11:00 .
drwxr-xr-x 7 oracle oinstall 4096 Jul 4 14:38 ..
-rw-r----- 1 oracle asmadmin 1072447488 Aug 29 01:02 6ntbnscr_1_1
-rw-r----- 1 oracle asmadmin 943104 Aug 29 01:02 6otbnshm_1_1
-rw-r----- 1 oracle asmadmin 18115072 Aug 29 11:00 6qtbovhi_1_1
-rw-r----- 1 oracle asmadmin 62260224 Aug 30 01:00 6stbqgoj_1_1
-rw-r----- 1 oracle asmadmin 1072734208 Aug 30 01:05 6ttbqgq1_1_1
-rw-r----- 1 oracle asmadmin 1159680 Aug 30 01:05 6utbqh2k_1_1
-rw-r----- 1 oracle asmadmin 10599424 Aug 30 11:00 70tbrjtj_1_1
-rw-r----- 1 oracle asmadmin 42828288 Aug 31 01:00 72tbt54i_1_1
-rw-r----- 1 oracle asmadmin 1073242112 Aug 31 01:02 73tbt54q_1_1
-rw-r----- 1 oracle asmadmin 2316288 Aug 31 01:02 74tbt59l_1_1
-rw-r----- 1 oracle asmadmin 17406976 Aug 31 11:00 76tbu89j_1_1
-rw-r----- 1 oracle asmadmin 10698752 Jun 20 11:11 c-4079461799-20180620-00
-rw-r----- 1 oracle asmadmin 10698752 Jun 20 11:25 c-4079461799-20180620-01
-rw-r----- 1 oracle asmadmin 10698752 Jun 20 13:03 c-4079461799-20180620-02
-rw-r----- 1 oracle asmadmin 10698752 Jun 20 13:48 c-4079461799-20180620-03
-rw-r----- 1 oracle asmadmin 10698752 Jun 20 14:03 c-4079461799-20180620-04
-rw-r----- 1 oracle asmadmin 10698752 Jul 16 10:22 c-4079461799-20180716-00
-rw-r----- 1 oracle asmadmin 10698752 Jul 26 17:32 c-4079461799-20180726-00
-rw-r----- 1 oracle asmadmin 10698752 Jul 27 01:02 c-4079461799-20180727-00
-rw-r----- 1 oracle asmadmin 10698752 Jul 27 11:00 c-4079461799-20180727-01
..
以“c”开头的文件是控制文件。
问题:我该怎么做才能自动删除这些文件?
感谢您的见解!
在不完全恢复并打开 9i 数据库后,resetlogs
我们运行了一个成功完成的完整备份。备份包含一个命令,用于在完成后删除过时的备份:
delete noprompt obsolete device type sbt;
RMAN 配置为使用 REDUNDANCY 2:
RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 2;
然而,旧版本的所有备份都立即标记为过时并删除,而不考虑冗余。
- 如果我们有一个
RECOVERY WINDOW
配置而不是,这种行为会有所不同REDUNDANCY 2
吗? - 这种行为在更高版本的 Oracle 中是否相同?
编辑:添加的输出LIST INCARNATION
:
RMAN> list incarnation;
List of Database Incarnations
DB Key Inc Key DB Name DB ID CUR Reset SCN Reset Time
------- ------- -------- ---------------- --- -------------- ----------
1 1 LIVE 3494832994 NO 1 19-JAN-04
2 2 LIVE 3494832994 NO 11966702870498 01-JAN-14
3 3 LIVE 3494832994 YES 12041003378277 04-JUL-18