Proc恢复数据文件

Posted ykyk

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Proc恢复数据文件相关的知识,希望对你有一定的参考价值。

1.模拟数据文件删除

[[email protected] ~]$ sqlplus / as sysdba

[email protected] > select name from v$datafile;

NAME
-----------------------------------------------------------------
/test/app/oracle/oradata/ykyk/system01.dbf
/test/app/oracle/oradata/ykyk/sysaux01.dbf
/test/app/oracle/oradata/ykyk/undotbs01.dbf
/test/app/oracle/oradata/ykyk/users01.dbf
/test/app/oracle/oradata/ykyk/tbs02.dbf

[email protected] > !rm -rf /test/app/oracle/oradata/ykyk/tbs02.dbf

删除一个不太重要的数据文件

不要删重要的文件

create table t tablespace tbs02 as select * from tab;


SQL> insert into t values(‘ykyk‘,‘TABLE‘);
	insert into t values(‘ykyk‘,‘TABLE‘)
				*
	ERROR at line 1:
	ORA-00947: not enough values


	SQL> show user
	USER is "SCOTT"
	SQL> insert into t values(‘ykyk‘,‘TABLE‘,null);
	insert into t values(‘ykyk‘,‘TABLE‘,null)
				*
	ERROR at line 1:
	ORA-01116: error in opening database file 5
	ORA-01110: data file 5: ‘/test/app/oracle/oradata/ykyk/tbs02.dbf‘
	ORA-27041: unable to open file
	Linux-x86_64 Error: 2: No such file or directory
	Additional information: 3

2.查看进程

dbwn进程号

[[email protected] backup]$ ps -ef |grep dbw
	oracle     9127      1  0 Apr13 ?        00:00:00 ora_dbw0_ykyk


[[email protected] ~]# cd /proc/9127/fd

[[email protected] fd]# ll

	lrwx------ 1 oracle oinstall 64 Apr 14 01:56 262 -> /test/app/oracle/oradata/ykyk/tbs02.dbf (deleted)

3.恢复

[[email protected] fd]# cp 262 /test/app/oracle/oradata/ykyk/tbs02.dbf


chown oracle.oinstall /test/app/oracle/oradata/ykyk/tbs02.dbf

4.验证

 SQL> conn scott/tiger

	Connected.

 SQL> insert into t values(‘ykyk‘,‘TABLE‘,null);

	1 row created.
	SQL> commit;

	Commit complete.

SQL> shu abort;
	ORACLE instance shut down.
	SQL> startup ;
	ORACLE instance started.

	Total System Global Area  521936896 bytes
	Fixed Size		    2229944 bytes
	Variable Size		  419432776 bytes
	Database Buffers	   96468992 bytes
	Redo Buffers		    3805184 bytes
	Database mounted.
	Database opened.

 SQL> select name from v$datafile;

	NAME
	--------------------------------------------------------------------------------
	/test/app/oracle/oradata/ykyk/system01.dbf
	/test/app/oracle/oradata/ykyk/sysaux01.dbf
	/test/app/oracle/oradata/ykyk/undotbs01.dbf
	/test/app/oracle/oradata/ykyk/users01.dbf
	/test/app/oracle/oradata/ykyk/tbs02.dbf

以上是关于Proc恢复数据文件的主要内容,如果未能解决你的问题,请参考以下文章

/proc目录的作用,及利用/proc恢复删除的文件

恢复删除的文件

从 .sql 备份恢复 MySQL 数据库失败:mysql.proc 表不存在

EMC Isilon(OneFS)存储误删除数据恢复方法数据恢复实例

恢复片段后android地图停止响应

为啥片段恢复后再次调用onLoadFinished?