linux平台下误删oracle数据文件
来源:互联网 发布:logo制作软件中文版 编辑:程序博客网 时间:2024/06/05 09:10
来自大神 David http://blog.csdn.net/tianlesoftware/article/details/44082283
1 问题描述
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
2 创建测试数据
SQL> create tablespace test1 datafile '/oradata/ogg02/test1.dbf' size 100m;
Tablespace created.
Tablespace created.
User created.
Grant succeeded.
Table created.
Table created.
SQL> create table t3 as select * from all_users;
Table created.
3 归档模式处理
3.1 模拟故障
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /oradata/arch
Oldest online log sequence 6
Next log sequence to archive 8
Current log sequence 8
[oracle@dg1 u01]$ rm -rf /oradata/ogg02/test1.dbf
*
ERROR at line 1:
ORA-01116: error in opening database file 7
ORA-01110: data file 7: '/oradata/ogg02/test1.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
至少从目前看,一切都是正常。 这里正常也是因为我们的操作系统是Linux,当数据文件从操作系统级别被rm掉,但之前打开该文件的进程仍然持有相应的文件句柄,所以指向的文件仍然可以读写,并且该文件的文件描述符可以从/proc目录中获得,也可以利用这个句柄恢复文件。如果在这个时候,重启了数据库或者操作系统,那么句柄就会消失,也就只能通过扫描磁盘进行文件恢复。
3.2 恢复
检查dbwr的进程PID:
[oracle@dg1 trace]$ ps -ef|grep dbw0
oracle 21884 1 0 19:05 ? 00:00:00 ora_dbw0_ogg02
[oracle@dg1 trace]$ cd /proc/21884/fd
这里的 265 就是我们删掉的数据文件。
//直接cp该句柄文件名回原位置:
[oracle@dg1 fd]$ cp 265 /oradata/ogg02/test1.dbf
因为数据库一直是open的,那么SCN也会不断的变化,我们cp出来的数据文件和数据库当前的信息不一致,所以我们需要进行recover:
SQL> alter database datafile'/oradata/ogg02/test1.dbf' offline;
Database altered.
SQL> recover datafile'/oradata/ogg02/test1.dbf'
ORA-01110: data file 7: '/oradata/ogg02/test1.dbf'
ORA-01157: cannot identify/lock data file 7 - see DBWR trace file
ORA-01110: data file 7: '/oradata/ogg02/test1.dbf'
1.查看这个数据文件有没有权限
Media recovery complete.
Database altered.
恢复正常。
//重启数据库:
ORACLE instance shut down.
- linux平台下误删oracle数据文件
- ORACLE Linux 平台下 误删 oracle 数据文件的恢复方法
- Linux 平台下 误删 oracle 数据文件的恢复方法
- Linux 平台下 误删 oracle 数据文件的恢复方法
- linux下误删数据文件恢复
- linux下oracle数据文件管理操作命令
- 使用Linux文件句柄恢复Oracle数据文件
- Linux下更改Oracle数据文件位置
- linux 误删除Oracle数据文件恢复
- Oracle数据文件
- Oracle数据文件
- oracle下误删数据文件问题的解决
- Linux下ORACLE误删除数据文件恢复操作
- 【转载】linux中误删除oracle数据文件的恢复操作
- 使用linux文件句柄恢复误删除的Oracle数据文件
- Linux中模拟oracle数据文件的误删除与恢复
- Oracle自学笔记---在linux环境下转移数据文件
- 使用linux文件句柄恢复误删除的Oracle数据文件
- ssign,copy,retain,readonly,writeonly,strong,weak
- HDU 5293 Tree chain problem(树形DP+树链剖分+LCA)
- xcode合并模拟器和真机静态库的编译
- MQTT使用笔记
- Oracle 中文数据导入乱码问题解决
- linux平台下误删oracle数据文件
- 类似QQ点赞的动画效果
- 欧拉函数小结
- linux下tar 报错gzip: stdin: not in gzip format
- web.xml里的标签是起什么作用的
- 高性能JavaScript(2)之加载和执行优化
- c++ 友元函数
- OOXX Game
- thinkphp 隐藏index.php