search
HomeDatabaseMysql TutorialOracle 11g dataguard undo恢复

注意,在操作dataguard环境里,在操作undo表空间和数据时, 要特别注意,这里就是一个例子。发现没有变化undo_tablespace,于是想

Oracle 11g dataguard undo恢复

环境:
os:CentOS5.5
db:oracle11g datauard
version:11.2.0.2.0

在primary收缩数据文件大小
ALTER DATABASE
  DATAFILE '/oracle/oradata/skatedb/undotbs03.dbf'
 RESIZE 1024M;

稍后就收到报警短信,登录standby库,发现在alert.logl里有如下错误

......
Media Recovery Waiting for thread 1 sequence 17248 (in transit)
Recovery of Online Redo Log: Thread 1 Group 8 Seq 17248 Reading mem 0
  Mem# 0: /oracle/oradata/skatedb/sdbyredo08.log
Thu Oct 11 13:59:06 2012
Archived Log entry 10938 added for thread 1 sequence 17247 ID 0xa47b04d0 dest 1:
Thu Oct 11 14:06:26 2012
Errors in file /oracle/app/diag/rdbms/skate04/skatedb/trace/skatedb_pr0d_25721.trc  (incident=40497):
ora-00600: internal error code, arguments: [3020], [3], [160], [12583072], [], [], [], [], [], [], [], []
ora-10567: Redo is inconsistent with data block (file# 3, block# 160, file offset is 1310720 bytes)
ora-10564: tablespace UNDOTBS1
ora-01110: data file 3: '/oracle/oradata/skatedb/undotbs01.dbf'
ora-10560: block type 'KTU SMU HEADER BLOCK'
Incident details in: /oracle/app/diag/rdbms/skate04/skatedb/incident/incdir_40497/skatedb_pr0d_25721_i40497.trc
Thu Oct 11 14:06:52 2012

......


standby库无法apply

重启standby,数据库可以
alter database mount standby database;

但是open read only的时候,总报如上的错误

在standby上,执行如下也不可以

sql> recover standby database;

为了解决这个问题,我们决定不恢复了undotbs01.dbf , 直接从primary把这个文件复制过来(主库的比较新),
然后在恢复standby库,操作如下:

为了数据文件的一致性,冻结表空间undo
1.primary:
sql> ALTER TABLESPACE UNDOTBS1 BEGIN BACKUP;

2.standby:
shutdown immediate

3.primary:
把primary上的undotbs01.dbf文件copy到standby上,待copy完之后,一定要解冻(如不解冻,在standby库apply时会hang住)
sql> ALTER TABLESPACE UNDOTBS1 END BACKUP;

4.standby:
sql> startup nomount;
sql> alter database mount standby database;
sql> alter database open read only;
sql> alter database recover managed standby database disconnect using current logfile;

注意,在操作dataguard环境里,在操作undo表空间和数据时, 要特别注意,这里就是一个例子。

还有一个例子,为了节省空间,决定收缩undo的大小,步骤如下:
1.在primary上新建undotbs2表空间,查看并验证了在primary和standby上都有的表空间和相应的数据文件
2.在primary上更换在线undo表空间,如下命令

SQL>  alter system set undo_tablespace = undotbs2 scope=both;
System altered
SQL> 

在primary上查看
SQL> show parameter undo
 NAME                                TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                      integer    900
undo_tablespace                      string      UNDOTBS2
 
但在standby上查看
SQL> show parameter undo
NAME                                TYPE        VALUE
------------------------------------ ----------- ------------------------------
undo_management                      string      AUTO
undo_retention                      integer    900
undo_tablespace                      string      UNDOTBS1
 
发现没有变化undo_tablespace,,于是想通过更改到spfile文件里,然后重启库,结果错误出现(用如山方法恢复),理论不应该报错的。以后找环境继续测试的。 

------end------

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
How do you alter a table in MySQL using the ALTER TABLE statement?How do you alter a table in MySQL using the ALTER TABLE statement?Mar 19, 2025 pm 03:51 PM

The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

How do I configure SSL/TLS encryption for MySQL connections?How do I configure SSL/TLS encryption for MySQL connections?Mar 18, 2025 pm 12:01 PM

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?What are some popular MySQL GUI tools (e.g., MySQL Workbench, phpMyAdmin)?Mar 21, 2025 pm 06:28 PM

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

How do you handle large datasets in MySQL?How do you handle large datasets in MySQL?Mar 21, 2025 pm 12:15 PM

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

How do you drop a table in MySQL using the DROP TABLE statement?How do you drop a table in MySQL using the DROP TABLE statement?Mar 19, 2025 pm 03:52 PM

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

How do you create indexes on JSON columns?How do you create indexes on JSON columns?Mar 21, 2025 pm 12:13 PM

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?How do I secure MySQL against common vulnerabilities (SQL injection, brute-force attacks)?Mar 18, 2025 pm 12:00 PM

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)

How do you represent relationships using foreign keys?How do you represent relationships using foreign keys?Mar 19, 2025 pm 03:48 PM

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

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 Article

Hot Tools

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

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.