数据库热备份后的新库恢复。

简介:
SQL> select checkpoint_change# from v$database;
CHECKPOINT_CHANGE#
------------------
            579501
SQL> select checkpoint_change# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
            579501
            579501
            579501
            579501
            579501
SQL> select checkpoint_change#,last_change#,online_change#,offline_change#,checkpoint_time from v$datafile;
CHECKPOINT_CHANGE# LAST_CHANGE# ONLINE_CHANGE# OFFLINE_CHANGE# CHECKPOIN
------------------ ------------ -------------- --------------- ---------
            579501                      579500          579499 10-NOV-09
            579501                      579500          579499 10-NOV-09
            579501                      579500          579499 10-NOV-09
            579501                      579500          579499 10-NOV-09
            579501                      579500          579499 10-NOV-09

SQL> select * from v$log;    --查询日志文件中,组3中的FIRST_CHANGE# 号是579500
    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
         1          1          0   52428800          1 YES UNUSED
            0
         3          1          1   52428800          1 NO  CURRENT
       579500 10-NOV-09
         2          1          0   52428800          1 YES UNUSED
            0
--开始恢复,用DIGOAL的REDO日志文件。
SQL> recover database using backup controlfile;
ORA-00279: change 579501 generated at 11/10/2009 04:30:43 needed for thread 1
ORA-00289: suggestion : /u01/archive/digoal/1_1_702534642.dbf
ORA-00280: change 579501 for thread 1 is in sequence #1

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/oradata/digoal/redo01.log
ORA-00339: archived log does not contain any redo
ORA-00334: archived log: '/u01/oradata/digoal/redo01.log'

SQL> recover database using backup controlfile;
ORA-00279: change 579501 generated at 11/10/2009 04:30:43 needed for thread 1
ORA-00289: suggestion : /u01/archive/digoal/1_1_702534642.dbf
ORA-00280: change 579501 for thread 1 is in sequence #1

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/oradata/digoal/redo02.log
ORA-00339: archived log does not contain any redo
ORA-00334: archived log: '/u01/oradata/digoal/redo02.log'

SQL> recover database using backup controlfile;
ORA-00279: change 579501 generated at 11/10/2009 04:30:43 needed for thread 1
ORA-00289: suggestion : /u01/archive/digoal/1_1_702534642.dbf
ORA-00280: change 579501 for thread 1 is in sequence #1

Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
/u01/oradata/digoal/redo03.log
Log applied.
Media recovery complete.                    ---应用到REDO03.LOG的时候,提示恢复完成
SQL> alter database open resetlogs;         --但OPEN 的时候,还是提示错误了。
alter database open resetlogs
*
ERROR at line 1:
ORA-01092: ORACLE instance terminated. Disconnection forced

SQL> exit    --退出重新登录
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[oracle@myoracle ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Tue Nov 10 05:33:40 2009
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup mount;
ORACLE instance started.
Total System Global Area  167772160 bytes
Fixed Size                  1218316 bytes
Variable Size              62916852 bytes
Database Buffers          100663296 bytes
Redo Buffers                2973696 bytes
Database mounted.
SQL> select * from v$log;     --查看SCN号已经变化。
    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS
---------- ---------- ---------- ---------- ---------- --- ----------------
FIRST_CHANGE# FIRST_TIM
------------- ---------
         1          1          0   52428800          1 YES UNUSED
            0
         3          1          1   52428800          1 NO  CURRENT
       579504 10-NOV-09
         2          1          0   52428800          1 YES UNUSED
            0
---查看以下3个文件的SCN号已经变化成579505。

SQL> select checkpoint_change#,last_change#,online_change#,offline_change#,checkpoint_time from v$datafile;
CHECKPOINT_CHANGE# LAST_CHANGE# ONLINE_CHANGE# OFFLINE_CHANGE# CHECKPOIN
------------------ ------------ -------------- --------------- ---------
            579505                      579504          579503 10-NOV-09
            579505                      579504          579503 10-NOV-09
            579505                      579504          579503 10-NOV-09
            579505                      579504          579503 10-NOV-09
            579505                      579504          579503 10-NOV-09
SQL> select checkpoint_change# from v$database;
CHECKPOINT_CHANGE#
------------------
            579505
SQL> select checkpoint_change# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
            579505
            579505
            579505
            579505
            579505
SQL> alter database open;     --打开数据库的时候,提示错误。要恢复datafile 1.
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u01/oradata/digoal/system01.dbf'
 
SQL> recover datafile 1;   --按照提示恢复datafile 1
Media recovery complete.
SQL> alter database open;  --打开数据库的时候,提示错误。要恢复datafile 2.
alter database open
*
ERROR at line 1:        
ORA-01113: file 2 needs media recovery
ORA-01110: data file 2: '/u01/oradata/digoal/undotbs01.dbf'

SQL> select checkpoint_change# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
            579507     --SYSTEM表空间的SCN号已经改变,其它的也都需要恢复
            579505
            579505
            579505
            579505
SQL> select checkpoint_change# from v$datafile;
CHECKPOINT_CHANGE#
------------------
            579507
            579505
            579505
            579505
            579505
SQL> select checkpoint_change# from v$database;
CHECKPOINT_CHANGE#
------------------
            579505
SQL> recover datafile 2;    --按照提示恢复datafile 2
Media recovery complete.
SQL> select checkpoint_change# from v$datafile;
CHECKPOINT_CHANGE#
------------------
            579507
            579507
            579505
            579505
            579505
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 3 needs media recovery
ORA-01110: data file 3: '/u01/oradata/digoal/sysaux01.dbf'

SQL> recover datafile 3;   --按照提示恢复datafile 3;
Media recovery complete.
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 4 needs media recovery
ORA-01110: data file 4: '/u01/oradata/digoal/users01.dbf'

SQL> recover datafile 4;  --按照提示恢复datafile 4
Media recovery complete.  --按照提示恢复datafile 5
SQL> recover datafile 5;  --按照提示恢复datafile 6
Media recovery complete.
--恢复表文件后的。SCN 变成了579507, 但v$database 中的SCN 没有变化
SQL> select checkpoint_change# from v$datafile;   --
CHECKPOINT_CHANGE#
------------------
            579507
            579507
            579507
            579507
            579507
SQL> select checkpoint_change# from v$database;
CHECKPOINT_CHANGE#
------------------
            579505
SQL> select checkpoint_change# from v$datafile_header;
CHECKPOINT_CHANGE#
------------------
            579507
            579507
            579507
            579507
            579507
SQL> alter database open resetlogs;    --尝试打开数据库
alter database open resetlogs
*
ERROR at line 1:
ORA-01139: RESETLOGS option only valid after an incomplete database recovery

SQL> alter database open unresetlogs;  --- -尝试打开数据库
alter database open unresetlogs
                    *
ERROR at line 1:
ORA-02288: invalid OPEN mode 

SQL> alter database open;    ---尝试打开数据库,哈哈居然可以了,都感觉像做梦的!!!
Database altered.
SQL>


本文转自 gjm008 51CTO博客,原文链接:http://blog.51cto.com/gaoshan/224556,如需转载请自行联系原作者
相关文章
|
4月前
|
存储 关系型数据库 MySQL
mysql数据库备份与恢复
MySQL数据库的备份与恢复是确保数据安全性和业务连续性的关键操作。
156 4
|
5月前
|
SQL 关系型数据库 MySQL
如何快速在表级别做同构或者异构数据库之间的数据迁移/备份
【8月更文挑战第17天】本文介绍在同构与异构数据库间快速迁移/备份表级数据的方法。同构迁移可利用数据库自带工具(如MySQL的`mysqldump`)或管理软件(如phpMyAdmin);异构迁移则推荐使用ETL工具(如Pentaho Data Integration)或数据库复制工具(如SymmetricDS),亦可通过编程方式实现。实施前需测试以确保数据完整准确,并注意处理兼容性问题。
213 4
|
2月前
|
关系型数据库 MySQL Linux
Linux环境下MySQL数据库自动定时备份实践
数据库备份是确保数据安全的重要措施。在Linux环境下,实现MySQL数据库的自动定时备份可以通过多种方式完成。本文将介绍如何使用`cron`定时任务和`mysqldump`工具来实现MySQL数据库的每日自动备份。
146 3
|
2月前
|
监控 关系型数据库 MySQL
Linux环境下MySQL数据库自动定时备份策略
在Linux环境下,MySQL数据库的自动定时备份是确保数据安全和可靠性的重要措施。通过设置定时任务,我们可以每天自动执行数据库备份,从而减少人为错误和提高数据恢复的效率。本文将详细介绍如何在Linux下实现MySQL数据库的自动定时备份。
66 3
|
3月前
|
存储 定位技术 数据库
介绍一下数据库的备份和恢复策略
【10月更文挑战第21】介绍一下数据库的备份和恢复策略
|
3月前
|
存储 关系型数据库 MySQL
PACS系统 中 dicom 文件在mysql 8.0 数据库中的 存储和读取(pydicom 库使用)
PACS系统 中 dicom 文件在mysql 8.0 数据库中的 存储和读取(pydicom 库使用)
50 2
|
2月前
|
数据库
【赵渝强老师】数据库的备份方式
备份数据库是指将数据库中的数据及相关信息保存起来,以便在系统故障时恢复。备份对象不仅限于数据本身,还包括数据库对象、用户权限等。根据备份策略、类型和模式的不同,可分为整体/部分备份、完全/增量备份、一致/非一致备份。文中还附有相关视频讲解。
|
4月前
|
关系型数据库 MySQL 数据库
Navicat备份数据库
涵盖`Navicat`数据库备份、数据安全及备份策略等主题。文库采用精美主题,提升阅读体验。
52 1
Navicat备份数据库
|
4月前
|
SQL 数据库 数据安全/隐私保护
如何手动备份数据库?
如何手动备份数据库?
158 1
|
5月前
|
SQL 数据库
Microsoft SQL Server 2014如何来备份数据库
Microsoft SQL Server 2014如何来备份数据库
509 3

热门文章

最新文章