oracle查看onlinelog文件,误删online redolog

某台服务器的文件夹使用率超过阈值触发自动报警邮件,登陆上去查看。

该文件夹存放有大量的归档日志,按照惯例将其备份至磁带后删除即可,可是没有找到相应的rman脚本,此时发现有名为log的文件夹上有几个日志文件,以为是什么操作生成的日志文件,于是直接rm *。

过了一会才反应过来,这是redolog。

当时汗就下来了,检查数据库发现居然没挂,原来此数据库使用了logfile group,每组两个日志文件, 还好刚刚只删除了其中的一半

Alter database drop logfile member 误删除的log名字

Alter database add logfile member误删除的log名字 to group n;

即可恢复,且不会产生数据丢失

在linux/unix上,如果通过rm命令误删除数据文件,大致可以通过以下方式恢复

1

Ps –ef | grep dbw找出数据库的dbwr进程信息pid

2

如果是linux,则进入到/proc/pid/fd目录,然后ls –l会显示出类似如下信息

total 0

lr-x------ 1 oracle dba 64 Dec 19 21:50 0 -> /dev/null

lr-x------ 1 oracle dba 64 Dec 19 21:50 1 -> /dev/null

lr-x------ 1 oracle dba 64 Dec 19 21:50 10 -> /dev/zero

lr-x------ 1 oracle dba 64 Dec 19 21:50 11 -> /dev/zero

lr-x------ 1 oracle dba 64 Dec 19 21:50 12 -> /app/oracle/product/10.2.0/db_1/rdbms/mesg/oraus.msb

lrwx------ 1 oracle dba 64 Dec 19 21:50 13 -> /app/oracle/product/10.2.0/db_1/dbs/hc_orcl.dat

lrwx------ 1 oracle dba 64 Dec 19 21:50 14 -> /app/oracle/product/10.2.0/db_1/dbs/lkORCL

lrwx------ 1 oracle dba 64 Dec 19 21:50 15 -> /app/oracle/oradata/ORCL/controlfile/o1_mf_555wq3ng_.ctl

lrwx------ 1 oracle dba 64 Dec 19 21:50 16 -> /app/oracle/oradata/ORCL/datafile/o1_mf_system_555wqbnk_.dbf

lrwx------ 1 oracle dba 64 Dec 19 21:50 17 -> /app/oracle/oradata/ORCL/datafile/o1_mf_undotbs1_555wqxgl_.dbf

lrwx------ 1 oracle dba 64 Dec 19 21:50 18 -> /app/oracle/oradata/ORCL/datafile/o1_mf_sysaux_555wr5p6_.dbf

lrwx------ 1 oracle dba 64 Dec 19 21:50 19 -> /app/oracle/oradata/ORCL/datafile/o1_mf_users_555wrj4o_.dbf (deleted)

黄色部分即被误删除的数据文件信息,直接cp 19 /app/oracle/oradata/ORCL/datafile/o1_mf_users_555wrj4o_.dbf即可restore,然后进行recover即可

表示该文件已经被删除,如果是Solaris操作系统,ls命令不会有如此清晰的显示,为了在Solaris系统中确认哪个句 柄对应哪个文件,则需要使用lsof程序。

lsof -a -p pid -d ^txt | egrep "COMMAND|dbf"

具体可参照如下链接

Multiple Copies of Online Redo Log Files

Oracle Database can automatically maintain two or more identical copies of the online redo log in separate locations. An online redo log group consists of an online redo log file and its redundant copies. Each identical copy is a member of the online redo log group. Each group is defined by a number, such as group 1, group 2, and so on.

Maintaining multiple members of an online redo log group protects against the loss of the redo log. Ideally, the locations of the members should be on separate disks so that the failure of one disk does not cause the loss of the entire online redo log.

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值