dataguard从库数据库丢失恢复例子(模拟所有的控制文件)
1.退出日志應(yīng)用模式
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Mon Jan 14 16:09:16 2019
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> connect / as sysdba
Connected.
SQL> alter database recover managed standby database cancel;
Database altered.
2.停掉數(shù)據(jù)庫
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
3.模擬刪除掉所有的控制文件
[oracle@localhost slnngkdg]$ cd /u01/app/oracle/oradata/slnngkdg
[oracle@localhost slnngkdg]$ mv control01.ctl bak_control01.ctl
[oracle@localhost slnngkdg]$ cd /u01/app/oracle/fast_recovery_area/slnngkdg
[oracle@localhost slnngkdg]$ mv control02.ctl bak_control02.ctl
4.嘗試啟動(dòng)數(shù)據(jù)庫
SQL> connect / as sysdba
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 3724607488 bytes
Fixed Size 2258760 bytes
Variable Size 788531384 bytes
Database Buffers 2919235584 bytes
Redo Buffers 14581760 bytes
ORA-00205: error in identifying control file, check alert log for more info
發(fā)現(xiàn)報(bào)錯(cuò)
5.啟動(dòng)數(shù)據(jù)庫到nonout狀態(tài),然后恢復(fù)控制文件
[oracle@localhost ~]$ rman target /
RMAN> startup nomount;
database is already started
RMAN> restore controlfile from '/home/oracle/rman_bakckup/ctl_SLNNGK_36_1_20190114';
Starting restore at 14-JAN-19
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
output file name=/u01/app/oracle/oradata/slnngkdg/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/slnngkdg/control02.ctl
Finished restore at 14-JAN-19
6.啟動(dòng)數(shù)據(jù)庫到mount狀態(tài)
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
7.做不完全恢復(fù),指定sequence,數(shù)據(jù)量很大的情況下,該步驟會(huì)很消耗時(shí)間,可以寫個(gè)腳本采用nohup執(zhí)行
從主庫看下當(dāng)前的日志序號(hào),看到主庫當(dāng)前的日志序號(hào)為290,那么我們直接指定該序號(hào),要是沒有權(quán)限查看,也可以使用系統(tǒng)視圖查看(Select Max(t.SEQUENCE#) +1 From v$archived_log t)
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/oracle/archive_log
Oldest online log sequence 288
Next log sequence to archive 290
Current log sequence 290
run{
set until sequence 290;
restore database;
recover database;
}
8.打開數(shù)據(jù)庫
RMAN> alter database open;
database opened
9.應(yīng)用主庫日志
alter database recover managed standby database using current logfile disconnect from session;
轉(zhuǎn)載于:https://www.cnblogs.com/hxlasky/p/10267509.html
總結(jié)
以上是生活随笔為你收集整理的dataguard从库数据库丢失恢复例子(模拟所有的控制文件)的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 小猿搜题app怎么搜题
- 下一篇: 【博 客 文 章】