今天碰到了一个怪问题,明明archivelog 备份成功,可是crosscheck的时候去显示 对归档日志的验证失败,到网上搜了一下,发现是NLS_LANG的问题,set NLS_LANG=AMERICAN_AMERICA.ZHS16GBK 即可。
tahiti关于crosscheck 的说明
Purpose
To verify the status of backups and copies recorded in the RMAN repository against media such as disk or tape. The CROSSCHECK command only processes files created on the same device type as the channels running the crosscheck.
Status of RMAN Backups
The CROSSCHECK command checks only objects marked AVAILABLE or EXPIRED by examining the files on disk for DISK channels or by querying the media manager for sbt channels. Table 2-2 describes the meaning of each status.
Table 2-2 Meaning of Crosscheck Status
Status | Description |
---|---|
EXPIRED | Object is not found either in file system (for DISK) or in the media manager (for sbt). Note that for a backup set to be EXPIRED, all backup pieces in the set must be EXPIRED. Note: EXPIRED does not mean the same as OBSOLETE. 个人注释:obsolete:当备份或者副本根据保存策略而被丢弃的时候,就会被标记为该状态。 |
AVAILABLE | Object is available for use by RMAN. For a backup set to be AVAILABLE, all backup pieces in the set must have the status AVAILABLE. |
UNAVAILABLE | Object is not available for use by RMAN. For a backup set to be UNAVAILABLE, all backup pieces in the set must have the status UNAVAILABLE. |
The CROSSCHECK command does not delete any files that it is unable to find, but updates their repository records to EXPIRED. Then, you can run DELETE EXPIRED to remove the repository records for all expired files as well as any existing physical files whose records show the status EXPIRED.
If some backup pieces or copies were erroneously marked as EXPIRED, for example, because the media manager was misconfigured, then after ensuring that the files really do exist in the media manager, run the CROSSCHECK BACKUP command again to restore those files to AVAILABLE status.
网上关于这个问题的原文如下
环境:9201 on windows2k
情况:更改了log_archive_dest_1后,crosscheck archivelog all;就会报告失败,可实际上是成功的,只不过是显示错误.
真弄不明白为什么?下面是全过程.
1 归档路径是默认位置:
SQL> show parameter log_archive_dest_1
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_1 string LOCATION=D:oracleoradatates
tarchive
log_archive_dest_10 string
2 此时有一个归档日志:
SQL> select count(1) from v$archived_log;
COUNT(1)
----------
1
3 更改归档路径:
SQL> alter system set log_archive_dest_1='LOCATION=D:oracleoradatatestarchiv
e1' scope=both;
系统已更改。
4 插入数据使数据库归档:
SQL> insert into test select * from test;
已创建24660行。
SQL> commit;
提交完成。
SQL> select count(1) from v$archived_log;
COUNT(1)
----------
1
SQL> insert into test select * from test;
已创建49320行。
SQL> select count(1) from v$archived_log;
COUNT(1)
----------
2
SQL> commit;
提交完成。
5 在rman中用crosscheck检查归档日志,2个归档日志都是失败的:
RMAN> crosscheck archivelog all;
释放的通道: ORA_DISK_1
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=14 devtype=DISK
对归档日志的验证失败
存档日志文件名 =D:ORACLEORADATATESTARCHIVE1_47.DBF 记录 ID=1 时间戳 =572866
683
对归档日志的验证失败
存档日志文件名 =D:ORACLEORADATATESTARCHIVE11_48.DBF 记录 ID=2 时间戳 =57286
6931
已交叉检验的 2 对象
6 试着同步一下,看行不行,结果不行,crosscheck还是失败:
RMAN> resync catalog;
正在启动全部恢复目录的 resync
完成全部 resync
RMAN> crosscheck archivelog all;
释放的通道: ORA_DISK_1
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=14 devtype=DISK
对归档日志的验证失败
存档日志文件名 =D:ORACLEORADATATESTARCHIVE1_47.DBF 记录 ID=1 时间戳 =572866
683
对归档日志的验证失败
存档日志文件名 =D:ORACLEORADATATESTARCHIVE11_48.DBF 记录 ID=2 时间戳 =57286
6931
已交叉检验的 2 对象
7 用list expired看看是否有失效的archive log,证明没有失效的archive log:
RMAN> list expired archivelog all;
说明与恢复目录中的任何存档日志均不匹配
8 更改语言环境试试,结果再次crosscheck,2个archive log 都成功了:
RMAN> exit
恢复管理器完成。
C:>set nls_lang=american_america.zhs16gbk
C:>rman catalog rman/rman@safe target /
Recovery Manager: Release 9.2.0.1.0 - Production
Copyright (c) 1995, 2002, Oracle Corporation. All rights reserved.
connected to target database: TEST (DBID=1870953724)
connected to recovery catalog database
RMAN> crosscheck archivelog all;
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=9 devtype=DISK
validation succeeded for archived log
archive log filename=D:ORACLEORADATATESTARCHIVE1_47.DBF recid=1 stamp=57286
6683
validation succeeded for archived log
archive log filename=D:ORACLEORADATATESTARCHIVE11_48.DBF recid=2 stamp=5728
66931
Crosschecked 2 objects
9 不解,难道是bug?
10 进一步验证是语言显示的错误:
还是中文的环境,看备份archvielog是否成功:
RMAN> crosscheck archivelog all;
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: sid=16 devtype=DISK
对归档日志的验证失败
存档日志文件名 =D:ORACLEORADATATESTARCHIVE1_47.DBF 记录
683
对归档日志的验证失败
存档日志文件名 =D:ORACLEORADATATESTARCHIVE11_48.DBF 记
6931
已交叉检验的 2 对象
RMAN> backup archivelog all format 'd:archive_bak%T.bak';
启动 backup 于 28-10月-05
当前日志已存档
使用通道 ORA_DISK_1
通道 ORA_DISK_1: 正在启动存档日志备份集
通道 ORA_DISK_1: 正在指定备份集中的存档日志
输入存档日志线程 =1 序列 =47 记录 ID=1 时间戳=572866683
输入存档日志线程 =1 序列 =48 记录 ID=2 时间戳=572866931
输入存档日志线程 =1 序列 =49 记录 ID=3 时间戳=572868387
通道 ORA_DISK_1: 正在启动段 1 于 28-10月-05
通道 ORA_DISK_1: 已完成段 1 于 28-10月-05
段 handle=D:ARCHIVE_BAK20051028.BAK comment=NONE
通道 ORA_DISK_1: 备份集已完成, 经过时间:00:00:02
完成 backup 于 28-10月-05
RMAN> list backup;
备份集列表
===================
BS 关键字 大小 设备类型占用时间 完成时间
------- ---------- ----------- ------------ ----------
616 12M DISK 00:00:02 28-10月-05
BP 关键字: 617 状态: AVAILABLE 标记:TAG20051028T100627
段名:D:ARCHIVE_BAK20051028.BAK
备份集 616 中的已存档日志列表
Thrd Seq 低 SCN 短时间 下一个 SCN 下一次
---- ------- ---------- ---------- ---------- ---------
1 47 48051 27-10月-05 68045 28-10月-05
1 48 68045 28-10月-05 68167 28-10月-05
1 49 68167 28-10月-05 68664 28-10月-05
结果是成功的.
11 删除归档路径中的归档,然后从备份中恢复.
RMAN> crosscheck archivelog all;
released channel: ORA_DISK_1
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=9 devtype=DISK
validation failed for archived log
archive log filename=D:ORACLEORADATATESTARCHIVE1_47.DBF recid=1 stamp=57286
6683
validation failed for archived log
archive log filename=D:ORACLEORADATATESTARCHIVE11_48.DBF recid=2 stamp=5728
66931
validation failed for archived log
archive log filename=D:ORACLEORADATATESTARCHIVE11_49.DBF recid=3 stamp=5728
68387
Crosschecked 3 objects
RMAN> list expired archivelog all;
List of Archived Log Copies
Key Thrd Seq S Low Time Name
------- ---- ------- - --------- ----
602 1 47 X 27-OCT-05 D:ORACLEORADATATESTARCHIVE1_47.DBF
606 1 48 X 28-OCT-05 D:ORACLEORADATATESTARCHIVE11_48.DBF
614 1 49 X 28-OCT-05 D:ORACLEORADATATESTARCHIVE11_49.DBF
RMAN> restore archivelog all;
Starting restore at 28-OCT-05
using channel ORA_DISK_1
channel ORA_DISK_1: starting archive log restore to default destination
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=47
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=48
channel ORA_DISK_1: restoring archive log
archive log thread=1 sequence=49
channel ORA_DISK_1: restored backup piece 1
piece handle=D:ARCHIVE_BAK20051028.BAK tag=TAG20051028T100627 params=NULL
channel ORA_DISK_1: restore complete
Finished restore at 28-OCT-05
恢复成功了.说明了那个"失败"就是rman的语言显示问题.
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/1698901/viewspace-103236/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/1698901/viewspace-103236/