我的编程空间,编程开发者的网络收藏夹
学习永远不晚

基于scn的恢复是怎样的

短信预约 -IT技能 免费直播动态提醒
省份

北京

  • 北京
  • 上海
  • 天津
  • 重庆
  • 河北
  • 山东
  • 辽宁
  • 黑龙江
  • 吉林
  • 甘肃
  • 青海
  • 河南
  • 江苏
  • 湖北
  • 湖南
  • 江西
  • 浙江
  • 广东
  • 云南
  • 福建
  • 海南
  • 山西
  • 四川
  • 陕西
  • 贵州
  • 安徽
  • 广西
  • 内蒙
  • 西藏
  • 新疆
  • 宁夏
  • 兵团
手机号立即预约

请填写图片验证码后获取短信验证码

看不清楚,换张图片

免费获取短信验证码

基于scn的恢复是怎样的

今天就跟大家聊聊有关基于scn的恢复是怎样的,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。

--先背备份:(热备)

[oracle@wang ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 8 19:35:11 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DBDB (DBID=3282897732)

RMAN> backup database;

Starting backup at 08-DEC-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=44 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00004 name=/u01/app/oracle/oradata/DBdb/users01.dbf
input datafile file number=00006 name=/u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbf
input datafile file number=00001 name=/u01/app/oracle/oradata/DBdb/system01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/DBdb/undotbs01.dbf
channel ORA_DISK_1: starting piece 1 at 08-DEC-17
channel ORA_DISK_1: finished piece 1 at 08-DEC-17
piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T193949_f2nyj5gy_.bkp tag=TAG20171208T193949 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/DBdb/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/DBdb/example01.dbf
channel ORA_DISK_1: starting piece 1 at 08-DEC-17
 channel ORA_DISK_1: finished piece 1 at 08-DEC-17
piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T193949_f2nykwl2_.bkp tag=TAG20171208T193949 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
including current control file in backup set
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 08-DEC-17
channel ORA_DISK_1: finished piece 1 at 08-DEC-17
piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_ncsnf_TAG20171208T193949_f2nylpqk_.bkp tag=TAG20171208T193949 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 08-DEC-17

RMAN>     


二、模拟操作:
SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    3960846

SQL>  
SQL> create table scott.scn_a as select * from dba_objects;

Table created.

SQL> select count(*) from scott.scn_a;

  COUNT(*)
----------
     87053

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    3960968

SQL>
SQL> create table hr.scn_b as select * from dba_objects;

Table created.

SQL> select count(*) from hr.scn_b;

  COUNT(*)
----------
     87054

SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    3961042

SQL>        
SQL> alter system switch logfile;

System altered.

SQL>
SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    3961063

SQL>
SQL> alter system checkpoint;

System altered.

SQL>
SQL> select current_scn from v$database;

CURRENT_SCN
-----------
    3961088

--删除表scn_a/scn_b:
SQL> drop table scott.scn_a purge;

Table dropped.

SQL> drop table hr.scn_b purge;

Table dropped.


--进行恢复:
--关库,启动到mount状态:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount;
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size                  2257840 bytes
Variable Size             549456976 bytes
Database Buffers          281018368 bytes
Redo Buffers                2371584 bytes
Database mounted.
SQL>

启用rman进行恢复:
[oracle@wang ~]$ rman target /

Recovery Manager: Release 11.2.0.4.0 - Production on Fri Dec 8 19:49:38 2017

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DBDB (DBID=3282897732, not open)

RMAN>      

RMAN> run {  
    set until scn =3960968;  
    restore database;  
    recover database;  
    alter database open resetlogs; }

executing command: SET until clause

Starting restore at 08-DEC-17
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=20 device type=DISK

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to /u01/app/oracle/oradata/DBdb/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /u01/app/oracle/oradata/DBdb/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /u01/app/oracle/oradata/DBdb/users01.dbf
channel ORA_DISK_1: restoring datafile 00006 to /u01/app/oracle/fast_recovery_area/DBDB/newback/ts_xxf_01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T193949_f2nyj5gy_.bkp
  channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T193949_f2nyj5gy_.bkp tag=TAG20171208T193949
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:02:15
channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00002 to /u01/app/oracle/oradata/DBdb/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /u01/app/oracle/oradata/DBdb/example01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T193949_f2nykwl2_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/fast_recovery_area/DBDB/newback/DBDB/backupset/2017_12_08/o1_mf_nnndf_TAG20171208T193949_f2nykwl2_.bkp tag=TAG20171208T193949
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 08-DEC-17

Starting recover at 08-DEC-17
using channel ORA_DISK_1

starting media recovery
media recovery complete, elapsed time: 00:00:00

Finished recover at 08-DEC-17

database opened

RMAN>   

--验证:
SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> select count(*) from scott.scn_a;

  COUNT(*)
----------
     87053

SQL>
SQL> select count(*) from hr.scn_b;
select count(*) from hr.scn_b
                        *
ERROR at line 1:
ORA-00942: table or view does not exist

因为恢复时只是恢复到创建scn_a表后查询到的current_scn,此时表scn_b还没有创建。

看完上述内容,你们对基于scn的恢复是怎样的有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注亿速云行业资讯频道,感谢大家的支持。

免责声明:

① 本站未注明“稿件来源”的信息均来自网络整理。其文字、图片和音视频稿件的所属权归原作者所有。本站收集整理出于非商业性的教育和科研之目的,并不意味着本站赞同其观点或证实其内容的真实性。仅作为临时的测试数据,供内部测试之用。本站并未授权任何人以任何方式主动获取本站任何信息。

② 本站未注明“稿件来源”的临时测试数据将在测试完成后最终做删除处理。有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341

基于scn的恢复是怎样的

下载Word文档到电脑,方便收藏和打印~

下载Word文档

猜你喜欢

基于 MyFlash 的 MySQL 数据恢复

以前mysql回复误删数据用的比较多的是基于原始binlog或binlog2sql,昨天又遇到一例开发误删的问题,这次用用美团开源的工具 MyFlash试试。用下来效果还是不错的,基于库 or 表的过滤可以有效的筛选出来目标sql。 #### 项目地址 ht
2014-07-10

基于DF的Tokenizer分词是怎么样的

这篇文章给大家介绍基于DF的Tokenizer分词是怎么样的,内容非常详细,感兴趣的小伙伴们可以参考借鉴,希望对大家能有所帮助。Tokenizer分词进行文本分析前,对文本中句子进行分词我们处理的第一步。大家都是Spark的机器学习库分为基
2023-06-19

基于FUSE的Bittorrent文件系统是怎样的

今天就跟大家聊聊有关基于FUSE的Bittorrent文件系统是怎样的,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。Bittorrent 已经存在了很长时间,它可以从互联网上共享和下
2023-06-16

基于SQL2005的CLR存储过程是怎样的

基于SQL2005的CLR存储过程是怎样的,很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。在 SQL Server 2005 中,可以在SQL Server实例中
2023-06-17

编程热搜

目录