recover table失败
恢复表时提示类似下面的信息:
.......
Creating automatic instance, with SID='<oracle_sid>' initialization parameters used for automatic instance: db_name=<db_name> db_unique_name=<db_unique_name> compatible=19.0.0 db_block_size=8192 db_files=200 diagnostic_dest=<path> _system_trig_enabled=FALSE sga_target=2560M processes=200 db_create_file_dest=<path> log_archive_dest_1='location=<path>' #No auxiliary parameter file used
RMAN-00571: =========================================================== RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS =============== RMAN-00571: =========================================================== RMAN-03002: failure of recover command at 04/12/2020 08:16:32 RMAN-04025: unable to generate a temporary file
问题分析
初步怀疑是文件系统空间或权限的问题,造成auxiliary数据库的写出现了问题。
到处查找,有提示说window平台下的一个补丁没有打完会出现这种情况,但我们是linux平台,按说不会出现这种问题,但这个说法提醒了我,检查一下opatch的补丁情况:
$ ./opatch lspatches 31281355;Database Release Update : 19.8.0.0.200714 (31281355) 31219897;OJVM RELEASE UPDATE: 19.8.0.0.200714 (31219897) 29585399;OCW RELEASE UPDATE 19.3.0.0.0 (29585399) OPatch succeeded.
再检查一下数据库的补丁情况
SQL> set linesize 200 SQL> select patch_id,action,status,SOURCE_VERSION,TARGET_VERSION from dba_registry_sqlpatch; PATCH_ID ACTION STATUS SOURCE_VERSION TARGET_VERSION ---------- --------------- ------------------------- --------------- --------------- 29517242 APPLY SUCCESS 19.1.0.0.0 19.3.0.0.0
在数据库里面并没有找到opatch的补丁!
解决和回顾
现在的问题是oracle执行文件的补丁和数据库的补丁不一致,显然上次打补丁的时候DBA没有执行datapatch修改数据库的sql文件。执行下面的命令进行补充执行datapatch:
[oracle@dell OPatch]$ ./datapatch -verbose SQL Patching tool version 19.8.0.0.0 Production on Fri Sep 18 16:53:54 2020 Copyright (c) 2012, 2020, Oracle. All rights reserved. Log file for this invocation: /opt/oracle/cfgtoollogs/sqlpatch/sqlpatch_1376_2020_09_18_16_53_54/sqlpatch_invocation.log Connecting to database...OK Gathering database info...done ....... SQL Patching tool complete on Fri Sep 18 16:54:53 2020 [oracle@dell OPatch]$
执行完成后,发现数据库的补丁已经apply成功了!
SQL> select patch_id,action,status,SOURCE_VERSION,TARGET_VERSION from dba_registry_sqlpatch; PATCH_ID ACTION STATUS SOURCE_VERSION TARGET_VERSION ---------- --------------- ------------------------- --------------- --------------- 31219897 APPLY SUCCESS 19.1.0.0.0 19.1.0.0.0 31281355 APPLY SUCCESS 19.1.0.0.0 19.8.0.0.0 SQL>
再次执行recover table,成功!
有的DBA抱怨,Oracle为什么不把Datapatch 和 OPatch合并到一起执行,实际上把Datapatch和OPatch 合并是不可能的。因为 OPatch 在数据库关闭时执行,而 datapatch 要求数据库是打开以完成其活动。