oracle flashback——oracle数据闪回实战,及恢复数据到指定的时间戳——timestamp

本文详细介绍了如何在Oracle数据库中使用SQL闪回命令进行数据库恢复,包括闪回时间点的选择、恢复步骤以及注意事项。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\ckz>sqlplus zzjd/zzjd@10.22.1.143/orcl as sysdba;

SQL*Plus: Release 11.2.0.1.0 Production on 星期三 5月 13 17:00:46 2015

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


连接到:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> SHUTDOWN IMMEDIATE;
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> startup MOUNT;
ORACLE 例程已经启动。

Total System Global Area 1071333376 bytes
Fixed Size                  1375792 bytes
Variable Size             713032144 bytes
Database Buffers          352321536 bytes
Redo Buffers                4603904 bytes
数据库装载完毕。
SQL> flashback database to scn 119272598;

闪回完成。

SQL> alter database open;
alter database open
*
第 1 行出现错误:
ORA-01589: 要打开数据库则必须使用 RESETLOGS 或 NORESETLOGS 选项


SQL> alter database open noresetlogs;
alter database open noresetlogs
*
第 1 行出现错误:
ORA-01610: 使用 BACKUP CONTROLFILE 选项的恢复必须已完成


SQL> alter database open resetlogs;

数据库已更改。

SQL>



查看可恢复的时间戳或SCN点,执行下列SQL语句:

select scn,to_char(time_dp,'yyyy-mm-dd hh24:mi:ss')from sys.smon_scn_time order by to_char(time_dp,'yyyy-mm-dd hh24:mi:ss') desc;

不推荐使用上述此方法恢复数据。


方法二:

在操作恢复数据表之前,先将要恢复的数据表清空,以免恢复时数据发生冲突

delete t_viradsl2 

insert into t_viradsl2 select * from t_viradsl2 as of timestamp to_Date('2011-01-19 15:28:00', 'yyyy-mm-dd hh24:mi:ss') 



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值