今天有幸做了几个RMAN的全库恢复实验,这里是一个brief版,方便忘了时可以瞬速找到 一 完全恢复1.数据库全库【完全恢复】$ rman
今天有幸做了几个RMAN的全库恢复实验,这里是一个brief版,方便忘了时可以瞬速找到
一 完全恢复
1.数据库全库【完全恢复】
$ rman target / 登录rman工具,如果使用了catalog,则登陆方法rman targetsys/Oracle@lscatalogcata/cata@leo
RMAN> startup mount 必须为mount状态,才能restore 和 recover 数据库
RMAN> restore database; 复制旧数据文件覆盖损坏的数据文件
RMAN> recover database; 数据文件头SCN号同步当前日志中最后一个SCN号【完全恢复】
RMAN> alter database open; 打开数据文件
二 不完全恢复
1.基于时间点【不完全恢复】
在restore recover命令中直接使用until time 、until scn 、 until sequence参数
这种方法避免使用run代码块,建议使用这种方法 【必须启动到mount状态,才能restore 和 recover 数据库】
startup mount;
restore database until time "to_date('2012-04-04 19:13:50','yyyy-mm-dd hh24:mi:ss')";
recover database until time "to_date('2012-04-04 19:13:50','yyyy-mm-dd hh24:mi:ss')";
alter database open resetlogs; 【resetlogs只在“不完全恢复”之后才有效,不完全恢复必须加resetlogs/noresetlogs选项打开数据,重置归档日志序列号从1开始】
注:该命令可将数据库恢复到指定时间点状态,但必须具备此时间点之前最后的有效备份,和所有相关归档日志。
2.基于scn号的【不完全恢复】
startup mount;
restore database until scn 10000;
recover database until scn 10000;
alter database open resetlogs; 【resetlogs只在“不完全恢复”之后才有效,,不完全恢复必须加resetlogs/noresetlogs选项打开数据,重置归档日志序列号从1开始】
注:该命令可将数据库恢复到指定的scn号的状态,但不包括此scn号。
3.基于归档日志序列号【不完全恢复】
startup mount;
restore database until sequence 123 thread 1;
recover database until sequence 123 thread 1;
alter database open resetlogs; 【resetlogs只在“不完全恢复”之后才有效,不完全恢复必须加resetlogs/noresetlogs选项打开数据,重置归档日志序列号从1开始】
注:该命令可将数据库恢复到指定归档日志序列号的状态,如果归档日志列表存在断点使用这中方法恢复比较方便,断点意味着我们只能恢复到断点的开始点
如果在open下直接restore database ,会报如下错误
channel ORA_DISK_1: reading from backup piece /home/oracle/backup/DB_0fn7d50b 备份块,此备份块就是最后一次的备份来恢复,在catalog库中自动找【前提必须连接到catalog】
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 04/04/2012 12:03:18
ORA-19870: error reading backup piece /home/oracle/backup/DB_0fn7d50b 错误读取备份块
ORA-19573: cannot obtain exclusive enqueue for datafile 4 不能包括独占数据文件4队列
小结:一般“实例恢复”采用完全恢复的多,“介质恢复”采用不完全恢复的多。
推荐阅读:
Oracle基础教程之通过RMAN复制数据库
RMAN备份策略制定参考内容
RMAN备份学习笔记
Oracle数据库备份加密 RMAN加密

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

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]

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

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

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.

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

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.

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


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Zend Studio 13.0.1
Powerful PHP integrated development environment

SublimeText3 English version
Recommended: Win version, supports code prompts!

Dreamweaver Mac version
Visual web development tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools