欢迎光临
我们一直在努力

Oracle恢复实验一:使用添加数据文件之前的控制文件-数据库专栏,ORACLE

建站超值云服务器,限时71元/月

———————————————

实验平台:windows + oracle 10.1.0.2.0

author:ningoo  2005-03-26

——————————————–

 

在备份控制文件之后,在数据库中又添加了数据文件,然后当前控制文件损坏,需要使用之前的备份控制文件来做恢复。

 

1.备份控制文件

 

sql> alter database backup controlfile to e:\control.ctl;

 

数据库已更改。

 

2.使用create tablespace或者alter tablespace add datafile给数据库添加数据文件

 

sql> create tablespace test

  2  datafile e:\oracle\oradata\ning\test01.dbf size 10m,

  3  e:\oracle\oradata\ning\test02.dbf size 10m;

 

表空间已创建。

 

3.shutdown后将现在的控制文件删除

 

4.startup数据库

 

报错:ora-00205: error in identifying controlfile, check alert log for more info

 

5.将备份的控制文件restore

 

6.使用备份控制文件做恢复

 

sql> recover database using backup controlfile;

 

ora-00283: 恢复会话因错误而取消

ora-01244: 未命名的数据文件由介质恢复添加至控制文件

ora-01110: 数据文件 5: e:\oracle\oradata\ning\test01.dbf

ora-01110: 数据文件 6: e:\oracle\oradata\ning\test02.dbf

 

此时,查看v$datafile可以看到有两个unname文件

sql> select name from v$datafile;

 

name

——————————————-

 

e:\oracle\oradata\ning ystem01.dbf

e:\oracle\oradata\ning\undotbs01.dbf

e:\oracle\oradata\ning ysaux01.dbf

e:\oracle\oradata\ning\users01.dbf

c:\windows ystem32\unnamed00005

c:\windows ystem32\unnamed00006

 

查看alert_sid.log,可以看到如下内容

 

file #5 added to control file as unnamed00005. originally created as:

e:\oracle\oradata\ning\test01.dbf

file #6 added to control file as unnamed00006. originally created as:

e:\oracle\oradata\ning\test02.dbf

 

可知unnamed00005对应e:\oracle\oradata\ning\test01.dbf

unnamed00006对应e:\oracle\oradata\ning\test02.dbf

 

7.重命名数据文件

 

sql> alter database rename file c:\windows ystem32\unnamed00005 to

  2  e:\oracle\oradata\ning\test01.dbf;

 

数据库已更改。

 

sql> alter database rename file c:\windows ystem32\unnamed00006 to

  2  e:\oracle\oradata\ning\test02.dbf;

 

数据库已更改。

 

8.再使用备份控制文件恢复

 

sql> recover database using backup controlfile;

 

完成介质恢复。

 

9.使用resetlogs选项打开数据库

 

sql> alter database open;

alter database open

*

第 1 行出现错误:

ora-01589: 要打开数据库则必须使用 resetlogs 或 noresetlogs 选项

 

sql> alter database open noresetlogs;

alter database open noresetlogs

*

第 1 行出现错误:

ora-01588: 要打开数据库则必须使用 resetlogs 选项

 

sql> alter database open resetlogs;

 

数据库已更改。

 

10.添加temp文件

 

此时查看alert_sid.log,可以看到以下警告

***************************************************************

warning: the following temporary tablespaces contain no files.

         this condition can occur when a backup controlfile has

         been restored.  it may be necessary to add files to these

         tablespaces.  that can be done using the sql statement:

 

         alter tablespace <tablespace_name> add tempfile

 

         alternatively, if these temporary tablespaces are no longer

         needed, then they can be dropped.

           empty temporary tablespace: temp

***************************************************************

 

使用备份控制文件恢复后,temp表空间被置空

sql> select name from v$tempfile;

 

未选定行

 

sql>alter tablespace temp add tempfile

2 e:\oracle\oradata\ning\temp01.dbf;

 

表空间已更改。

 

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » Oracle恢复实验一:使用添加数据文件之前的控制文件-数据库专栏,ORACLE
分享到: 更多 (0)

相关推荐

  • 暂无文章