问题10:临时表空间中的临时文件损坏、丢失的情况下如何恢复?

目的:在临时表空间的数据文件损坏的前提下,进行临时文件的恢复,更确切的说是修复

临时数据文件的损坏或丢失会造成需要使用临时表空间的命令执行失败,但不会造成实例崩溃。由于临时表空间存放的是临时数据,RMAN不会对其进行备份,一旦损坏采用的恢复方法是重建或替换
如果在数据库运行过程中,发现临时数据文件损坏或丢失,可以采用 替换的方法恢复,不需要重启数据库:
如出现下列的错误:
SQL> select * from v$tempfile;
select * from v$tempfile
*
ERROR at line 1:
ORA-00600: internal error code, arguments: [krhcvt_filhdr_v10_01], [], [], [], [], [], [], []
恢复步骤如下:

1.向临时表空间中添加新的临时数据文件
SQL> alter tablespace temp add tempfile '/u01/oradata/radius/temp02.dbf' size 100M;

Tablespace altered.
2.删除掉损坏的临时文件
SQL> alter tablespace temp drop tempfile '/u01/oradata/radius/temp01.dbf';

Tablespace altered.
3.重新进行一样的查询,来确认是否临时表空间内的数据文件修复成功,从而可以让查询使用临时表空间
SQL> select file#, name from v$tempfile;

FILE# NAME
---------- ---------------------------------------------
2 /u01/oradata/radius/temp02.dbf
4.修复成功

另外,如果在启动实例的情况下,发现临时文件丢失了数据库会自动重建这个临时文件,用户不会有任何的错误信息提示,但是在alert日志中,有相关提示:
如:
启动实例,没有任何的错误提示:
SQL> startup
ORACLE instance started.

Total System Global Area 599785472 bytes
Fixed Size 2085776 bytes
Variable Size 163581040 bytes
Database Buffers 427819008 bytes
Redo Buffers 6299648 bytes
Database mounted.
Database opened.
监控警告日志alert_radius.log,如下:
Wed Sep 3 18:50:01 2014
Re-creating tempfile /u01/oradata/radius/temp02.dbf
Database Characterset is US7ASCII
Opening with internal Resource Manager plan
where NUMA PG = 1, CPUs = 1
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
QMNC started with pid=22, OS id=4637
Wed Sep 3 18:50:06 2014
db_recovery_file_dest_size of 2048 MB is 0.69% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Wed Sep 3 18:50:06 2014
Completed: ALTER DATABASE OPEN
【说明】
Re-creating tempfile /u01/oradata/radius/temp02.dbf 代表了重新创建临时文件

如果,在启动实例时,监测到临时文件损坏,而不是丢失,因为这个文件的存在,不能重新创建同名的文件,启动时没有任何的错误提示,但是在警告日志中,会有下列的提示:
Cannot re-create tempfile /u01/oradata/radius/temp02.dbf, the same name file exists
Wed Sep 3 18:56:26 2014
Errors in file /u01/app/oracle/admin/radius/bdump/radius_dbw0_4679.trc:
ORA-01157: cannot identify/lock data file 202 - see DBWR trace file
ORA-01110: data file 202: '/u01/oradata/radius/temp02.dbf'
ORA-27046: file size is not a multiple of logical block size
Additional information: 1
Database Characterset is US7ASCII
ARC5 started with pid=21, OS id=4711
Wed Sep 3 18:56:26 2014
Opening with internal Resource Manager plan
where NUMA PG = 1, CPUs = 1
replication_dependency_tracking turned off (no async multimaster replication found)
Starting background process QMNC
QMNC started with pid=22, OS id=4713
Wed Sep 3 18:56:26 2014
db_recovery_file_dest_size of 2048 MB is 0.69% used. This is a
user-specified limit on the amount of space that will be used by this
database for recovery-related files, and does not reflect the amount of
space available in the underlying filesystem or ASM diskgroup.
Wed Sep 3 18:56:26 2014
Completed: ALTER DATABASE OPEN
【说明】
临时文件重建失败,为了不在数据库的整个运行过程中,出现问题,需要关闭实例,删除损坏的临时文件,重新启动实例,就会重新创建出一个同名的临时文件,避免在数据库正常运行的过程中,出现问题。

--END--




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值