oracle 恢复某张误删的表

今天在oracle 10g 环境下测试误删某张表后怎样恢复,恢复的方法很多,我用了其中比较简单的两种:

实验:

 

1.模拟误删表

 SQL> conn scott
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                Enter password: *****
Connected.
SQL> create table test1(id number);

Table created.

SQL> insert into test1 values(1);

1 row created.

SQL> select * from test1;

        ID
----------
         1

SQL> drop table test1;

Table dropped.

SQL> select * from test1;
select * from test1
              *
ERROR at line 1:
ORA-00942: table or view does not exist

2.使用闪回恢复表

 SQL> flashback table test1 to before drop;

Flashback complete.

SQL> select * from test1;

        ID
----------
         1

SQL>

 

3.假如数据库用的是逻辑备份,使用备份进行恢复表test1

[oracle@peter bak]$ imp scott/tiger file=expdat_scott20110312.dmp log=implog_scott20110312.log fromuser=scott table=test1
LRM-00101: unknown parameter name 'table'

IMP-00022: failed to process parameters, type 'IMP HELP=Y' for help
IMP-00000: Import terminated unsuccessfully
[oracle@peter bak]$ imp scott/tiger file=expdat_scott20110312.dmp log=implog_scott20110312.log fromuser=scott tables=test1

Import: Release 10.2.0.1.0 - Production on Wed May 18 17:54:41 2011

Copyright (c) 1982, 2005, Oracle.  All rights reserved.


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options

Export file created by EXPORT:V10.02.01 via conventional path
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
. importing SCOTT's objects into SCOTT
. importing SCOTT's objects into SCOTT
. . importing table                        "TEST1"          1 rows imported
Import terminated successfully without warnings.

 


SQL> select * from test1;

        ID
----------
         1

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值