iis服务器助手广告广告
返回顶部
首页 > 资讯 > 数据库 >怎么恢复在全备后添加了数据文件的数据库
  • 458
分享到

怎么恢复在全备后添加了数据文件的数据库

2024-04-02 19:04:59 458人浏览 八月长安
摘要

这篇文章主要介绍了怎么恢复在全备后添加了数据文件的数据库,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。 参考H

这篇文章主要介绍了怎么恢复在全备后添加了数据文件的数据库,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。

参考
How to Recover a Database Having Added a Datafile Since Last Backup (文档 ID 29430.1)

HOW TO RECOVER A DATABASE HAVING ADDED A DATAFILE SINCE THE LAST BACKUP
-----------------------------------------------------------------------

This bulletin outlines the steps required in perfORMing database recovery
having added a datafile to the database since the last backup was taken. 
Section A is applicable to oracle release 7.x. Section B applies only to
Oracle releases 7.3.x and above.

PLEASE READ THROUGH ALL STEPS AND WARNINGS BEFORE ATTEMPTING TO USE THIS
BULLETIN.


A. Current controlfile, backup of datafile exists (Oracle release 7.x)
   ===================================================================

 A valid (either hot or cold) backup of the datafiles exists, except for the
 datafile created since the backup was taken. The current controlfile exists. 
 The database is in arcHivelog mode (see note (c) at bottom of page).

 1. Restore ONLY the datafiles (those that have been lost or damaged) from the 
    last hot or cold backup. The current online redo logs and control file(s) 
    must be intact.

 2. Mount the database

 3. Create a new datafile using the 'ALTER DATABASE CREATE DATAFILE' command.

    a. The datafile can be created with the same name as the original
       file. For example,

       sqlDBA> alter database create datafile
            2> '/dev1/oracle/dbs/testtbs.dbf';
       Statement processed.
 
    b. The datafile can be created with a different filename to the original. 
       This option might be chosen if the original file was lost due to disk 
       failure and the failed disk was still unavailable; the new file would 
       then be created on a different device. For example,

       SQLDBA> alter database create datafile
            2> '/dev1/oracle/dbs/testtbs.dbf'
            3> as
            4> '/dev2/oracle/dbs/testtbs.dbf';
       Statement processed.

       The above command creates a new datafile on the dev2 device. The file
       is created using information, stored in the control file, from the 
       original file. The command implicitly renames the filename in the 
       control file.
   
       NOTE: IT IS VERY IMPORTANT TO SPECIFY THE CORRECT FILENAME WHEN
             RECREATING THE LOST DATAFILE. IF YOU SPECIFY AN EXISTING
             ORACLE DATAFILE, THAT DATAFILE WILL BE INITIALISED AND WILL
             ITSELF REQUIRE RECOVERY.

 4. Recover the database.

    SQLDBA> recover database
    ORA-00279: Change 6677 generated at 06/03/97 15:20:24 needed for thread 1
    ORA-00289: Suggestion : /dev1/oracle/dbs/arch/arch000074.arc
    ORA-00280: Change 6677 for thread 1 is in sequence #74
    Specify log: {=suggested | filename | AUTO | CANCEL}
    
    At this point the recovery procedure will wait for the user to supply the
    information requested regarding the name and location of the archived log
    files. For example, entering AUTO directs Oracle to apply the suggested 
    redo log and any others that it requires to recover the datafiles.

    Applying suggested logfile...
    Log applied.
              :
              :
    
              :
              :
    Media recovery complete.

 5. Open the database

    SQLDBA> alter database open;
    Statement processed.



B. Old controlfile, no backup of datafile (Oracle release 7.3.x and above)
   =======================================================================

 A valid (either hot or cold) backup of the datafiles exists, except for the
 datafile created since the backup was taken. The controlfile is a backup from
 before the creation of the new datafile. The database is in archivelog mode 
 (see note (c) at bottom of page).

 NOTE : 'svrmgrl' has been replaced by SQL*Plus starting from Oracle8i
        So the 'SVRMGR>' prompt is than replaced by 'SQL>'

 1. Restore the datafiles (those that have been lost or damaged) from the 
    last hot or cold backup. Also restore the old copy of the controlfile.
    The current online redo logs must be intact.

 2. Mount the database

 3. Start media recovery, specifying backup controlfile

    SVRMGR> recover database using backup controlfile
    ORA-00279: Change 6677 generated at 06/03/97 15:20:24 needed for thread 1
    ORA-00289: Suggestion : /dev1/oracle/dbs/arch/arch000074.arc
    ORA-00280: Change 6677 for thread 1 is in sequence #74
    Specify log: {=suggested | filename | AUTO | CANCEL}

    At this point, apply the archived logs as requested. Eventually Oracle
    will encounter redo to be applied to the non-existent datafile. The 
    recovery session will exit with the following message, and will return
    the user to the Server Manager prompt:

    ORA-00283: Recovery session canceled due to errors
    ORA-01244: unnamed datafile(s) added to controlfile by media recovery
    ORA-01110: data file 5: '/dev1/oracle/dbs/testtbs.dbf'
 
 4. Recreate the missing datafile. To do this, select the relevant filename 
    from v$datafile:

    SVRMGR> select name from v$datafile where file#=5;
    NAME
    -------------------------------------------------------
    UNNAMED0005

    Now recreate the file:

    SVRMGR> alter database create datafile
         2> 'UNNAMED0005'
         3> as
         4> '/dev1/oracle/dbs/testtbs.dbf';



 5. Restart recovery

    SVRMGR> recover database using backup controlfile
    ORA-00279: Change 6747 generated at 09/24/97 16:57:18 needed for thread 1
    ORA-00289: Suggestion : /dev1/oracle/dbs/arch/arch000079.arc
    ORA-00280: Change 6747 for thread 1 is in sequence #79
    Specify log: {=suggested | filename | AUTO | CANCEL}

    Apply archived logs as requested. Prior to Oracle8, recovery must apply
    the complete log which was current at the time of the datafile creation
    (in the above example, this would be log sequence 79). A recovery to a
    point in time before the end of this log would result in errors:

    ORA-01196: file 1 is inconsistent due to a failed media recovery session
    ORA-01110: data file 1: '/dev1/oracle/dbs/systbs.dbf'

    If this happens, re-recover the database and ensure that the complete log
    is applied (plus any further redo if required). This limitation does
    not exist from Oracle 8.0+.

    Eventually, Oracle will request the archived log corresponding to the 
    current online log. It does this because the (backup) controlfile has no 
    knowledge of the current log sequence. If an attempt is made to apply the 
    suggested log, the recovery session will exit with the following message:

    ORA-00308: cannot open archived log '/dev1/oracle/dbs/arch/arch000084.arc'
    ORA-07360: sfifi: stat error, unable to obtain information about file.
    SVR4 Error: 2: No such file or directory

    At this stage, simply restart the recovery session and apply the current
    online log. The best way to do this is to try applying the online redo 
    logs one by one until Oracle completes media recovery:

    SVRMGR> recover database using backup controlfile
    ORA-00279: Change 6763 generated at 09/24/97 16:57:59 needed for thread 1
    ORA-00289: Suggestion : /dev1/oracle/dbs/arch/arch000084.arc
    ORA-00280: Change 6763 for thread 1 is in sequence #84
    Specify log: {=suggested | filename | AUTO | CANCEL}
    /dev1/oracle/dbs/log2.dbf
    Log applied.
    Media recovery complete.

 6. Open the database

    SVRMGR> alter database open resetlogs;

    The resetlogs option must be chosen to resynchronize the controlfile. 

    
NOTES:
======

a) These techniques can be used whether the database was closed either 
   cleanly or uncleanly (aborted).

b) If the database is recovered using an incomplete recovery technique (either
   time-based, cancel-based, or change-based), and is recovered to a point in
   time before the datafile was originally created, any references to that
   datafile will be removed from the database when the database is opened.

   Oracle handles this situation as follows:

   - The 'alter database create datafile....' command creates a reference in 
     the controlfile for the datafile.
   - Incomplete recovery terminates before applying redo that would create a
     corresponding row for the datafile in the file$ dictionary table.
   - When the database is opened, Oracle detects an inconsistency between file$
     and the controlfile and resolves in favour of file$, deleting the entry
     from the controlfile. 

c) It may be possible to recover the datafile using this technique even if the
   database is not in archivelog mode. However, this relies on the required 
   redo being available in the online redo logs.

感谢你能够认真阅读完这篇文章,希望小编分享的“怎么恢复在全备后添加了数据文件的数据库”这篇文章对大家有帮助,同时也希望大家多多支持编程网,关注编程网数据库频道,更多相关知识等着你来学习!

您可能感兴趣的文档:

--结束END--

本文标题: 怎么恢复在全备后添加了数据文件的数据库

本文链接: https://www.lsjlt.com/news/63697.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

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

下载Word文档
猜你喜欢
  • 怎么恢复在全备后添加了数据文件的数据库
    这篇文章主要介绍了怎么恢复在全备后添加了数据文件的数据库,具有一定借鉴价值,感兴趣的朋友可以参考下,希望大家阅读完这篇文章之后大有收获,下面让小编带着大家一起了解一下。 参考H...
    99+
    2024-04-02
  • 怎么在MySQL中使用全库备份数据恢复单表数据
    怎么在MySQL中使用全库备份数据恢复单表数据?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。提取建表语句sed -e '...
    99+
    2024-04-02
  • 云服务器数据库备份文件怎么恢复
    备份数据通常包含以下信息: 时间戳。这些数据是历史数据的标识符,用于跟踪数据的访问时间。 备份设备。这些数据指的是我们将数据从本地硬盘或云存储备份中复制到的设备上的名称或IP地址。 数据。这些数据是原始数据的副本,其中包括数据的基本要素...
    99+
    2023-10-27
    备份文件 服务器 数据库
  • 数据库中怎么自动添加数据文件add_datafiles.sh
    这篇文章主要讲解了“数据库中怎么自动添加数据文件add_datafiles.sh”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“数据库中怎么自动添加数据文件a...
    99+
    2024-04-02
  • oracle数据库数据删除了怎么恢复
    在 oracle 数据库中恢复已删除的数据有四种方法:1) 撤消最近的提交或回滚;2) 从备份还原;3) 使用闪回查询;4) 使用日志文件分析。恢复数据之前建议备份数据库,具体方法取决于...
    99+
    2024-04-18
    oracle 数据丢失
  • gitlab删库后怎么恢复数据
    随着互联网的高速发展,开源项目的代码托管平台也越来越多,GitLab作为其中的佼佼者吸引了众多用户。然而,随着代码提交量的增多,GitLab也不时出现一些问题。尤其是删库事件,一旦发生,对于团队的影响不可估量。本文将重点介绍GitLab删库...
    99+
    2023-10-22
  • 数据库备份与恢复策略:守护数据安全的坚实后盾
    随着数字化时代的到来,企业对数据的依赖日益加深,数据库作为存储企业重要数据的核心枢纽,其安全与稳定性尤为关键。一旦发生数据丢失或损坏,企业将面临巨大的损失,甚至可能危及生存。因此,建立一套完善的数据库备份与恢复策略是守护数据安全的坚实后...
    99+
    2024-02-10
    数据库备份 恢复策略 数据安全 数据保护
  • mysql怎么恢复备份数据库
    要恢复MySQL备份数据库,可以按照以下步骤进行操作: 将备份文件复制到MySQL数据库服务器上的合适位置。确保备份文件的权限设...
    99+
    2024-04-02
  • 数据库备份与恢复的哲学思考:数据安全背后的奥义
    备份:预防性思维 备份代表了预防性思维的至高境界。它承认错误、故障和不可预测事件的可能性,并采取主动措施来减轻其后果。通过定期创建数据的副本,备份为我们提供了一个安全网,即使原始数据丢失或损坏,也能恢复数据。备份是对不可预知未来的明智投资...
    99+
    2024-04-02
  • 数据库中怎么添加控制文件
    这篇文章主要讲解了“数据库中怎么添加控制文件”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“数据库中怎么添加控制文件”吧!1.  &nbs...
    99+
    2024-04-02
  • 数据的守护神:数据库备份与恢复全攻略
    完整备份:备份整个数据库的所有数据和对象。 差异备份:仅备份自上次完整备份以来更改的数据。 事务日志备份:记录自上次备份以来所有数据库事务的详细信息。 备份策略 频率:根据数据的更改频率确定备份频率。 保留时间:确定应保留备份的时长...
    99+
    2024-04-02
  • Oracle数据库使用DMP文件恢复数据
    要使用DMP文件恢复Oracle数据库中的数据,可以按照以下步骤进行操作:1. 在Oracle数据库服务器上找到DMP文件,并确保数...
    99+
    2023-09-17
    Oracle数据库
  • mysql数据库怎么添加数据
    要向MySQL数据库添加数据,可以使用INSERT INTO语句。以下是向数据库中添加数据的基本语法: INSERT INTO ta...
    99+
    2024-04-09
    mysql
  • 掌握数据库备份与恢复,数据安全无忧
    备份 备份是指创建数据库及其数据的副本。备份可以是完全的,即包含整个数据库,也可以是增量的,即只包含自上次备份以来更改的数据。备份的类型和频率应根据组织的数据重要性和恢复时间目标 (RTO) 而定。 恢复 恢复是指将备份的数据还原到数据库...
    99+
    2024-04-02
  • php怎么在文件结尾添加数据
    本篇内容主要讲解“php怎么在文件结尾添加数据”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“php怎么在文件结尾添加数据”吧!直接开始正题!我们有一个名为“test.txt”的文本文件,里面的内...
    99+
    2023-06-20
  • 怎么备份与恢复MongoDB数据库
    这期内容当中小编将会给大家带来有关怎么备份与恢复MongoDB数据库,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。Mongodump工具在MongoDB中,mongodump工具通常用来做备份使用。它有如...
    99+
    2023-06-14
  • 怎么备份和恢复MySQL数据库
    这篇文章主要介绍“怎么备份和恢复MySQL数据库”,在日常操作中,相信很多人在怎么备份和恢复MySQL数据库问题上存在疑惑,小编查阅了各式资料,整理出简单好用的操作方法,希望对大家解答”怎么备份和恢复MyS...
    99+
    2024-04-02
  • Oracle数据库怎么备份与恢复
    本篇内容主要讲解“Oracle数据库怎么备份与恢复”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“Oracle数据库怎么备份与恢复”吧!在Oracle数据库的使用过程中,备份与恢复是经常遇到的操作...
    99+
    2023-06-21
  • 怎么在mysql数据库中添加备注信息
    这期内容当中小编将会给大家带来有关怎么在mysql数据库中添加备注信息,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。创建表的时候,添加表名备注和字段备注CREATE TABLE `he...
    99+
    2023-06-06
  • 怎么备份和恢复Couchbase数据库
    备份Couchbase数据库可以通过两种方式进行:使用cbbackup命令行工具或通过Couchbase Web管理界面。 使用c...
    99+
    2024-03-08
    Couchbase
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作