泰拉瑞亚pe群:Oracle通过nbu恢复误删数据

来源:百度文库 编辑:偶看新闻 时间:2024/05/07 07:01:04

档案数据库oracle9i数据63日下午4点左右被误删一部分,在64日上午10时对数据进行恢复。

此次恢复为本机恢复。

第一步:备份当前数据库。

1, 备份数据库pfile或者spfile

通过show parameter pfile;查看pfile位置。Copy到同目录下改名为initora9i.ora.200906041000oracle sidora9i

2, 备份当前数据库。

可以使用nbu手动执行一次数据库备份。但现在又更为简便的方法。

关闭数据库。Shutdown immdiate

将数据库所在的文件夹d:\oracle\oradata\ora9i改名为ora9i200906041000。并新建一个文件夹ora9i用作数据库恢复目录。

第二步:启动恢复。

1,启动数据库到nomount状态

 

SQL> startup nomount

ORACLE 例程已经启动。

Total System Global Area 135338868 bytes

Fixed Size                   453492 bytes

Variable Size             109051904 bytes

Database Buffers           25165824 bytes

Redo Buffers                 667648 bytes

SQL> exit

2,恢复controlfile

nbu servercatalog里找到最后一次完全备份的控制文件名。

C:\>rman target /

RMAN> run {

 

2> allocate channel t1 type 'sbt_tape';

3> send 'NB_ORA_CLIENT=server';

4> send 'NB_ORA_SERV=veritas_server';

5> restore controlfile from '/ctrl_u14jtkssd_s36_p1_t668627853';#catalog中控制文件名

6> release channel t1;

7> }

3,启动数据库到mount状态。

C:\>sqlplus "/as sysdba"

SQL> alter database mount

 

数据库已更改。

4, 恢复归档日志。

C:\>rman target /

 

RMAN> list backup of archivelog all;

 

选择恢复最近3天的归档日志恢复。

RMAN> run {

2> allocate channel t1 type 'sbt_tape';

3> send 'NB_ORA_CLIENT=server';

4> send 'NB_ORA_SERV=veritas_server';

5> set archivelog destination to 'e:\oracle_archivelog';

6> restore archivelog sequence 77 thread 1;

7> restore archivelog sequence 78 thread 1;

8> restore archivelog sequence 79 thread 1;

9> release channel t1;

10> }

5, 恢复数据库。

RMAN> run {

2> allocate channel t1 type 'sbt_tape';

3> send 'NB_ORA_CLIENT=server';

4> send 'NB_ORA_SERV=veritas_server';

5>Sql ‘alter session set nls_date_format=”yyyy-mm-dd hh24:mi:ss”';#设置时间格式

5> set until time ='2009-06-03 16:00:00';

6> restore database;

7> recover database;

8> release channel t1;

9> }

6,重置log打开数据库。

C:\>sqlplus "/as sysdba"

SQL*Plus: Release 9.2.0.1.0 - Production on 星期四 6 4 11:07:24 2009

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

连接到:

Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.1.0 - Production

SQL> alter database open resetlogs;

数据库已更改。

SQL>

7,创建临时表空间。

SQL> alter tablespace temp add tempfile 'd:\oracle\oradata\ora9i\temp01.dbf' size

200M;

表空间已更改。

第三步:启动数据库,找回丢失数据。

备注:如果想恢复数据库到当前状态(20090604 1000)。

1, 关闭数据库。

2, 修改d:\oracle\oradata\ora9id:\oracle\oradata\ora9iback,将d:\oracle\oradata\ora9i200906041010恢复为d:\oracle\oradata\ora9i

3, 启动数据库。

4, 导入误删数据。