码迷,mamicode.com
首页 > 其他好文 > 详细

Proc恢复数据文件

时间:2018-05-04 11:48:58      阅读:176      评论:0      收藏:0      [点我收藏+]

标签:ora   abort   sqlplus   install   glob   查看进程   direct   cot   director   

1.模拟数据文件删除

[oracle@Ora ~]$ sqlplus / as sysdba

SYS@ykyk > 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

SYS@ykyk > !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进程号

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


[root@Ora ~]# cd /proc/9127/fd

[root@Ora fd]# ll

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

3.恢复

[root@Ora 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恢复数据文件

标签:ora   abort   sqlplus   install   glob   查看进程   direct   cot   director   

原文地址:https://www.cnblogs.com/ykyk1229/p/8989314.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!