caidan250 2019-04-24 17:15 采纳率: 0%
浏览 279

rman 全备份 恢复无效

最近再学习rman。
完全备份后 修改数据 再恢复,发现恢复无效。

环境:vm虚拟机 centos6.7 oracle12c
操作数据:

1.**启用archivelog模式: **

[root@localhost ~]# su - oracle 
-bash-4.1$ sqlplus / as sysdba
SQL*Plus: Release 12.2.0.1.0 Production on Wed Apr 24 01:53:58 2019
Copyright (c) 1982, 2016, Oracle.  All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> archive log list;
Database log mode          Archive Mode
Automatic archival         Enabled
Archive destination        /home/oracle/product/12.2.0/db_1/dbs/arch
Oldest online log sequence     1
Next log sequence to archive   1
Current log sequence           1
SQL> 

2.进入rman

Last login: Wed Apr 24 01:53:04 2019 from 192.168.30.1
[root@localhost ~]# su - oracle
-bash-4.1$ rman target / nocatalog
Recovery Manager: Release 12.2.0.1.0 - Production on Wed Apr 24 01:57:30 2019
Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.
connected to target database: LESP (DBID=1750011068)
using target database control file instead of recovery catalog
RMAN> 

3.全备份

RMAN> backup database;

Starting backup at 24-APR-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=55 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=00001 name=/home/oracle/oradata/lesp/system01.dbf
input datafile file number=00003 name=/home/oracle/oradata/lesp/sysaux01.dbf
input datafile file number=00004 name=/home/oracle/oradata/lesp/undotbs01.dbf
input datafile file number=00005 name=/home/oracle/oradata/lesp/ts_data_lesp_etl_001.dbf
input datafile file number=00007 name=/home/oracle/oradata/lesp/users01.dbf
channel ORA_DISK_1: starting piece 1 at 24-APR-19
channel ORA_DISK_1: finished piece 1 at 24-APR-19
piece handle=/home/oracle/product/12.2.0/db_1/dbs/34tvomv8_1_1 tag=TAG20190424T015904 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:45
Finished backup at 24-APR-19

Starting Control File and SPFILE Autobackup at 24-APR-19
piece handle=/home/oracle/product/12.2.0/db_1/dbs/c-1750011068-20190424-0a comment=NONE
Finished Control File and SPFILE Autobackup at 24-APR-19

4.查看备份信息

RMAN> list backupset ;

List of Backup Sets
===================
BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
106     Full    1.07G      DISK        00:00:43     24-APR-19      
        BP Key: 106   Status: AVAILABLE  Compressed: NO  Tag: TAG20190424T015904
        Piece Name: /home/oracle/product/12.2.0/db_1/dbs/34tvomv8_1_1
  List of Datafiles in backup set 106
  File LV Type Ckp SCN    Ckp Time  Abs Fuz SCN Sparse Name
  ---- -- ---- ---------- --------- ----------- ------ ----
  1       Full 2016498    24-APR-19              NO    /home/oracle/oradata/lesp/system01.dbf
  3       Full 2016498    24-APR-19              NO    /home/oracle/oradata/lesp/sysaux01.dbf
  4       Full 2016498    24-APR-19              NO    /home/oracle/oradata/lesp/undotbs01.dbf
  5       Full 2016498    24-APR-19              NO    /home/oracle/oradata/lesp/ts_data_lesp_etl_001.dbf
  7       Full 2016498    24-APR-19              NO    /home/oracle/oradata/lesp/users01.dbf

BS Key  Type LV Size       Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
107     Full    10.66M     DISK        00:00:00     24-APR-19      
        BP Key: 107   Status: AVAILABLE  Compressed: NO  Tag: TAG20190424T015950
        Piece Name: /home/oracle/product/12.2.0/db_1/dbs/c-1750011068-20190424-0a
  SPFILE Included: Modification time: 24-APR-19
  SPFILE db_unique_name: LESP
  Control File Included: Ckp SCN: 2016523      Ckp time: 24-APR-19

6.修改数据库数据:
之前:

SQL> select count(1) from tabs;

  COUNT(1)
----------
     0

创建一个表:

SQL> select count(1) from tabs;

  COUNT(1)
----------
     1

7.恢复:
1.nomount

RMAN> shutdown abort;

Oracle instance shut down

RMAN> startup nomount;

connected to target database (not started)
Oracle instance started

Total System Global Area     784334848 bytes

Fixed Size                     8625608 bytes
Variable Size                658506296 bytes
Database Buffers             113246208 bytes
Redo Buffers                   3956736 bytes

7.2.restore controlfile

RMAN> restore controlfile from '/home/oracle/product/12.2.0/db_1/dbs/c-1750011068-20190424-0a'
2> ;
Starting restore at 24-APR-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=37 device type=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/home/oracle/oradata/lesp/control01.ctl
output file name=/home/oracle/oradata/lesp/control02.ctl
Finished restore at 24-APR-19

7.3 mount /restore/ recover

RMAN> alter database mount;

Statement processed
released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 24-APR-19
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=37 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 /home/oracle/oradata/lesp/system01.dbf
channel ORA_DISK_1: restoring datafile 00003 to /home/oracle/oradata/lesp/sysaux01.dbf
channel ORA_DISK_1: restoring datafile 00004 to /home/oracle/oradata/lesp/undotbs01.dbf
channel ORA_DISK_1: restoring datafile 00005 to /home/oracle/oradata/lesp/ts_data_lesp_etl_001.dbf
channel ORA_DISK_1: restoring datafile 00007 to /home/oracle/oradata/lesp/users01.dbf
channel ORA_DISK_1: reading from backup piece /home/oracle/product/12.2.0/db_1/dbs/34tvomv8_1_1
channel ORA_DISK_1: piece handle=/home/oracle/product/12.2.0/db_1/dbs/34tvomv8_1_1 tag=TAG20190424T015904
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:36
Finished restore at 24-APR-19

RMAN> recover database;

Starting recover at 24-APR-19
using channel ORA_DISK_1

starting media recovery

archived log for thread 1 with sequence 1 is already on disk as file /home/oracle/oradata/lesp/redo01.log
archived log file name=/home/oracle/oradata/lesp/redo01.log thread=1 sequence=1
media recovery complete, elapsed time: 00:00:01
Finished recover at 24-APR-19

RMAN> alter database open resetlogs;
Statement processed
RMAN> 

8.查看效果;

SQL> select count(1) from tabs;

  COUNT(1)
----------
     1 

没有恢复 还是备份之后的数据

  • 写回答

1条回答

  • CSDN-Ada助手 CSDN-AI 官方账号 2022-10-27 21:59
    关注
    不知道你这个问题是否已经解决, 如果还没有解决的话:

    如果你已经解决了该问题, 非常希望你能够分享一下解决方案, 写成博客, 将相关链接放在评论区, 以帮助更多的人 ^-^
    评论

报告相同问题?

悬赏问题

  • ¥20 有人能用聚类分析帮我分析一下文本内容嘛
  • ¥15 请问Lammps做复合材料拉伸模拟,应力应变曲线问题
  • ¥30 python代码,帮调试
  • ¥15 #MATLAB仿真#车辆换道路径规划
  • ¥15 java 操作 elasticsearch 8.1 实现 索引的重建
  • ¥15 数据可视化Python
  • ¥15 要给毕业设计添加扫码登录的功能!!有偿
  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥100 Jenkins自动化部署—悬赏100元