search
HomeDatabaseMysql Tutorial记一次Oracle 生产库还原归档日志经历

同事电话说急着要恢复生产库上的归档日志。系统环境是10.2.0.5,RAC,归档日志在node1上建立了nfs共享,而node2上没有建立nfs共享

中午刚去吃饭,就接到同事电话说急着要恢复生产库上的归档日志。系统环境是10.2.0.5,RAC,归档日志在node1上建立了nfs共享,而node2上没有建立nfs共享。另有一套查询库,通过DSG的同步软件将数据从生产库上同步到查询库上。软件原理是通过传说分析归档日志然后加以应用,总体感觉有点像DG。由于生产库上使用的是增量备份,每天都进行备份。且备份完后会自动删除归档日志。恢复生产库的归档日志的原因是,同步到查询库时失败(采用DSG的备份软件时,当遇到大量DML操作时经常遇到同步失败的情况),需要重新同步,但归档日志已经被删除,故需要还原归档日志。查询库昨日17:00后的数据同步失败,故需要还原从昨日至今的归档日志。系统环境交代到这,下面是具体的实施步骤。
在node1上进行操作

$ pwd
/arch_log/restore

$ df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/hd4          10.00      9.56    5%    12767     1% /
/dev/hd2          10.00      6.75   33%    62385     4% /usr
/dev/hd9var       10.00      9.23    8%    13956     1% /var
/dev/hd3          10.00      9.09   10%     3512     1% /tmp
/dev/hd1          10.00      8.99   11%     8013     1% /home
/dev/hd11admin      0.25      0.25    1%        5     1% /admin
/proc                 -         -    -         -     -  /proc
/dev/hd10opt      10.00      9.73    3%    10356     1% /opt
/dev/livedump      0.25      0.25    1%        8     1% /var/adm/ras/livedump
/dev/lv_oracle10g     30.00     11.84   61%   215252     7% /oracle10g
/dev/lv_zs_arch_01    997.00    989.75    1%       32     1% /arch_log
/dev/lv_zs_db2bk_01    998.00    432.63   57%      167     1% /rman_db2_bk
/dev/lv_zs_bck_01   2992.00   1836.57   39%      224     1% /rman_data
/dev/lv_cdump    200.00    199.97    1%       15     1% /oracle10g/app/oracle/admin/zgscdb/cdump
/dev/lv_dsg1      49.75     43.97   12%     8831     1% /dsg1
fjlt_zgsc_db02:/arch_log/zgsc_db02_arch    997.00    971.00    3%       34     1% /arch_log/zgsc_db02_arch

/arch_log挂载点下空余空间接近1T,,目标将归档日志还原到/arch_log/restore下

第一反应,通过v$archived_log找到17:00以后的归档日志序列号

select sequence#,completion_time from v$archived_log where completion_time > to_date('2012-02-15','hh24:mi:ss');

查询得出从sequence#为16147开始的归档日志为2012-02-17 17:00以后的归档日志

执行

$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Feb 16 13:07:12 2012
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: ZGSCDB (DBID=3629726729)

RMAN> run{
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> allocate channel c3 type disk;
5> allocate channel c4 type disk;
6> set archivelog destination to '/arch_log/restore';
7> restore archivelog  from logseq 16147;
8> release channel c1 ;ype disk
9> release channel c2;
10> release channel c3;
11> release channel c4;
12> }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: sid=4834 instance=zgscdb1 devtype=DISK

allocated channel: c2
channel c2: sid=5333 instance=zgscdb1 devtype=DISK

allocated channel: c3
channel c3: sid=4879 instance=zgscdb1 devtype=DISK

allocated channel: c4
channel c4: sid=5317 instance=zgscdb1 devtype=DISK

executing command: SET ARCHIVELOG DESTINATION

Starting restore at 16-FEB-12
released channel: c1
released channel: c2
released channel: c3
released channel: c4
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 02/16/2012 13:10:53
RMAN-20242: specification does not match any archive log in the recovery catalog

RMAN> list archivelog from logseq 16147;

省略部分输出


 List of Archived Logs in backup set 5193
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  2    16148   12670010177819 15-FEB-12 12670011207570 15-FEB-12
  2    16149   12670011207570 15-FEB-12 12670012283915 15-FEB-12
  2    16150   12670012283915 15-FEB-12 12670012754302 15-FEB-12
  2    16151   12670012754302 15-FEB-12 12670012969887 15-FEB-12
  2    16152   12670012969887 15-FEB-12 12670013212670 15-FEB-12
  2    16153   12670013212670 15-FEB-12 12670013780868 15-FEB-12
  2    16154   12670013780868 15-FEB-12 12670013976009 15-FEB-12
  2    16155   12670013976009 15-FEB-12 12670015183858 15-FEB-12
  2    16156   12670015183858 15-FEB-12 12670015441965 15-FEB-12
  2    16157   12670015441965 15-FEB-12 12670015599451 15-FEB-12
  2    16158   12670015599451 15-FEB-12 12670015722094 15-FEB-12
  2    16159   12670015722094 15-FEB-12 12670015785593 15-FEB-12
  2    16160   12670015785593 15-FEB-12 12670015847887 15-FEB-12
  2    16161   12670015847887 15-FEB-12 12670016000750 15-FEB-12

  Backup Set Copy #1 of backup set 5193
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:03:55     16-FEB-12       NO         TAG20120216T010430

    List of Backup Pieces for backup set 5193 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    12560   1   AVAILABLE   /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p1_C1
    12561   2   AVAILABLE   /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p2_C1
    12562   3   AVAILABLE   /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_39n3e111_s5225_p3_C1


  List of Archived Logs in backup set 5198
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  2    16134   12668052207072 15-FEB-12 12668052339209 15-FEB-12
  2    16135   12668052339209 15-FEB-12 12668052456743 15-FEB-12
  2    16136   12668052456743 15-FEB-12 12668052579080 15-FEB-12
  2    16137   12668052579080 15-FEB-12 12668052695760 15-FEB-12
  2    16138   12668052695760 15-FEB-12 12668056672468 15-FEB-12
  2    16139   12668056672468 15-FEB-12 12668060445745 15-FEB-12
  2    16140   12668060445745 15-FEB-12 12668062444755 15-FEB-12
  2    16141   12668062444755 15-FEB-12 12668660576479 15-FEB-12
  2    16142   12668660576479 15-FEB-12 12668660718987 15-FEB-12
  2    16143   12668660718987 15-FEB-12 12668660871830 15-FEB-12
  2    16144   12668660871830 15-FEB-12 12668661303733 15-FEB-12
  2    16145   12668661303733 15-FEB-12 12668661585953 15-FEB-12
  2    16146   12668661585953 15-FEB-12 12668662079217 15-FEB-12
  2    16147   12668662079217 15-FEB-12 12670010177819 15-FEB-12

  Backup Set Copy #1 of backup set 5198
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:01:07     16-FEB-12       NO         TAG20120216T010430

    List of Backup Pieces for backup set 5198 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    12573   1   AVAILABLE   /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_3an3e18j_s5226_p1_C1
    12574   2   AVAILABLE   /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_3an3e18j_s5226_p2_C1
    12575   3   AVAILABLE   /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_3an3e18j_s5226_p3_C1

  List of Archived Logs in backup set 5195
  Thrd Seq     Low SCN    Low Time  Next SCN   Next Time
  ---- ------- ---------- --------- ---------- ---------
  2    16162   12670016000750 15-FEB-12 12670016088204 15-FEB-12
  2    16163   12670016088204 15-FEB-12 12670016308969 15-FEB-12
  2    16164   12670016308969 15-FEB-12 12670016653192 15-FEB-12
  2    16165   12670016653192 15-FEB-12 12670017027396 15-FEB-12
  2    16166   12670017027396 15-FEB-12 12670017225549 15-FEB-12
  2    16167   12670017225549 15-FEB-12 12670017317060 15-FEB-12
  2    16168   12670017317060 15-FEB-12 12670017393441 15-FEB-12
  2    16169   12670017393441 15-FEB-12 12670017462567 15-FEB-12
  2    16170   12670017462567 15-FEB-12 12670017541021 15-FEB-12
  2    16171   12670017541021 15-FEB-12 12670017654244 15-FEB-12
  2    16172   12670017654244 15-FEB-12 12670017735163 15-FEB-12
  2    16173   12670017735163 15-FEB-12 12670017811611 15-FEB-12
  2    16174   12670017811611 15-FEB-12 12670017888323 15-FEB-12
  2    16175   12670017888323 15-FEB-12 12670019198216 15-FEB-12

  Backup Set Copy #1 of backup set 5195
  Device Type Elapsed Time Completion Time Compressed Tag
  ----------- ------------ --------------- ---------- ---
  DISK        00:03:56     16-FEB-12       NO         TAG20120216T010430

    List of Backup Pieces for backup set 5195 Copy #1
    BP Key  Pc# Status      Piece Name
    ------- --- ----------- ----------
    12566   1   AVAILABLE   /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_38n3e111_s5224_p1_C1
    12567   2   AVAILABLE   /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_38n3e111_s5224_p2_C1
    12568   3   AVAILABLE   /rman_data/zgscdb_rman/ZGSCDB_arch_20120216_38n3e111_s5224_p3_C1

可以看到从日志序列号为16147到16181的归档日志备份全部存。那为什么执行list backup of archivelog from logseq 16147;时没有输出呢?

linux

Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Explain the InnoDB Buffer Pool and its importance for performance.Explain the InnoDB Buffer Pool and its importance for performance.Apr 19, 2025 am 12:24 AM

InnoDBBufferPool reduces disk I/O by caching data and indexing pages, improving database performance. Its working principle includes: 1. Data reading: Read data from BufferPool; 2. Data writing: After modifying the data, write to BufferPool and refresh it to disk regularly; 3. Cache management: Use the LRU algorithm to manage cache pages; 4. Reading mechanism: Load adjacent data pages in advance. By sizing the BufferPool and using multiple instances, database performance can be optimized.

MySQL vs. Other Programming Languages: A ComparisonMySQL vs. Other Programming Languages: A ComparisonApr 19, 2025 am 12:22 AM

Compared with other programming languages, MySQL is mainly used to store and manage data, while other languages ​​such as Python, Java, and C are used for logical processing and application development. MySQL is known for its high performance, scalability and cross-platform support, suitable for data management needs, while other languages ​​have advantages in their respective fields such as data analytics, enterprise applications, and system programming.

Learning MySQL: A Step-by-Step Guide for New UsersLearning MySQL: A Step-by-Step Guide for New UsersApr 19, 2025 am 12:19 AM

MySQL is worth learning because it is a powerful open source database management system suitable for data storage, management and analysis. 1) MySQL is a relational database that uses SQL to operate data and is suitable for structured data management. 2) The SQL language is the key to interacting with MySQL and supports CRUD operations. 3) The working principle of MySQL includes client/server architecture, storage engine and query optimizer. 4) Basic usage includes creating databases and tables, and advanced usage involves joining tables using JOIN. 5) Common errors include syntax errors and permission issues, and debugging skills include checking syntax and using EXPLAIN commands. 6) Performance optimization involves the use of indexes, optimization of SQL statements and regular maintenance of databases.

MySQL: Essential Skills for Beginners to MasterMySQL: Essential Skills for Beginners to MasterApr 18, 2025 am 12:24 AM

MySQL is suitable for beginners to learn database skills. 1. Install MySQL server and client tools. 2. Understand basic SQL queries, such as SELECT. 3. Master data operations: create tables, insert, update, and delete data. 4. Learn advanced skills: subquery and window functions. 5. Debugging and optimization: Check syntax, use indexes, avoid SELECT*, and use LIMIT.

MySQL: Structured Data and Relational DatabasesMySQL: Structured Data and Relational DatabasesApr 18, 2025 am 12:22 AM

MySQL efficiently manages structured data through table structure and SQL query, and implements inter-table relationships through foreign keys. 1. Define the data format and type when creating a table. 2. Use foreign keys to establish relationships between tables. 3. Improve performance through indexing and query optimization. 4. Regularly backup and monitor databases to ensure data security and performance optimization.

MySQL: Key Features and Capabilities ExplainedMySQL: Key Features and Capabilities ExplainedApr 18, 2025 am 12:17 AM

MySQL is an open source relational database management system that is widely used in Web development. Its key features include: 1. Supports multiple storage engines, such as InnoDB and MyISAM, suitable for different scenarios; 2. Provides master-slave replication functions to facilitate load balancing and data backup; 3. Improve query efficiency through query optimization and index use.

The Purpose of SQL: Interacting with MySQL DatabasesThe Purpose of SQL: Interacting with MySQL DatabasesApr 18, 2025 am 12:12 AM

SQL is used to interact with MySQL database to realize data addition, deletion, modification, inspection and database design. 1) SQL performs data operations through SELECT, INSERT, UPDATE, DELETE statements; 2) Use CREATE, ALTER, DROP statements for database design and management; 3) Complex queries and data analysis are implemented through SQL to improve business decision-making efficiency.

MySQL for Beginners: Getting Started with Database ManagementMySQL for Beginners: Getting Started with Database ManagementApr 18, 2025 am 12:10 AM

The basic operations of MySQL include creating databases, tables, and using SQL to perform CRUD operations on data. 1. Create a database: CREATEDATABASEmy_first_db; 2. Create a table: CREATETABLEbooks(idINTAUTO_INCREMENTPRIMARYKEY, titleVARCHAR(100)NOTNULL, authorVARCHAR(100)NOTNULL, published_yearINT); 3. Insert data: INSERTINTObooks(title, author, published_year)VA

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Tools

Dreamweaver Mac version

Dreamweaver Mac version

Visual web development tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Safe Exam Browser

Safe Exam Browser

Safe Exam Browser is a secure browser environment for taking online exams securely. This software turns any computer into a secure workstation. It controls access to any utility and prevents students from using unauthorized resources.

SAP NetWeaver Server Adapter for Eclipse

SAP NetWeaver Server Adapter for Eclipse

Integrate Eclipse with SAP NetWeaver application server.