日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

dataguard从库数据库丢失恢复例子(模拟所有的控制文件)

發布時間:2023/12/2 数据库 30 豆豆
生活随笔 收集整理的這篇文章主要介紹了 dataguard从库数据库丢失恢复例子(模拟所有的控制文件) 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

1.退出日志應用模式
[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.停掉數據庫
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.嘗試啟動數據庫
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

發現報錯

5.啟動數據庫到nonout狀態,然后恢復控制文件
[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.啟動數據庫到mount狀態
RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1


7.做不完全恢復,指定sequence,數據量很大的情況下,該步驟會很消耗時間,可以寫個腳本采用nohup執行
從主庫看下當前的日志序號,看到主庫當前的日志序號為290,那么我們直接指定該序號,要是沒有權限查看,也可以使用系統視圖查看(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.打開數據庫
RMAN> alter database open;

database opened


9.應用主庫日志
alter database recover managed standby database using current logfile disconnect from session;

轉載于:https://www.cnblogs.com/hxlasky/p/10267509.html

總結

以上是生活随笔為你收集整理的dataguard从库数据库丢失恢复例子(模拟所有的控制文件)的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。