Home >Database >Mysql Tutorial >联机日志损坏时的恢复(非正常关闭数据库)

联机日志损坏时的恢复(非正常关闭数据库)

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-07 17:16:39891browse

联机日志损坏时的恢复(非正常关闭数据库),做过不完全恢复后需要立即执行一次完整备份,不能连续执行两次不完全恢复.

1、创建表T2
SQL> create table t2(
           a1 number(10),
           a2 char(10)) tablespace users;

2.插入两行数据
SQL> insert into t2 values (33,'cc');
SQL> commit;
SQL> alter system switch logfile;
SQL> insert into t2 values(44,'dd');
SQL> commit;
 
3.非正常关闭数据库,没有执行检查点
SQL> shutdown abort
Oracle instance shut down.
 
4.模拟联机日志损坏
SQL> host rm -rf /database/ykg/ykg*.log
 
5.查看当前正在使用的归档日志
SQL> archive log list
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     4
Next log sequence to archive   5
Current log sequence           5
 
6.数据库不完全恢复
RMAN> run {
2> restore database;
3> recover database until sequence 5 thread 1;
4> alter database open resetlogs;}
 
备注:做过不完全恢复后需要立即执行一次完整备份,不能连续执行两次不完全恢复.

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