檢查數(shù)據(jù)庫(kù)服務(wù)器,發(fā)現(xiàn)磁盤(pán)已滿,因?yàn)榍捌谝?guī)劃問(wèn)題,磁盤(pán)空間不足,還好該庫(kù)不影響。
創(chuàng)新互聯(lián)建站是一家專業(yè)提供義安企業(yè)網(wǎng)站建設(shè),專注與成都做網(wǎng)站、網(wǎng)站制作、成都h5網(wǎng)站建設(shè)、小程序制作等業(yè)務(wù)。10年已為義安眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)網(wǎng)絡(luò)公司優(yōu)惠進(jìn)行中。
刪除歸檔時(shí),發(fā)現(xiàn)刪除過(guò)多,導(dǎo)致備庫(kù)歸檔沒(méi)有成功應(yīng)用,就被刪除了。
這個(gè)操作確實(shí)粗心大意,檢查備庫(kù)歸檔時(shí),發(fā)現(xiàn)無(wú)法應(yīng)用,查看日志有如下報(bào)錯(cuò):
Fetching gap sequence in thread 1, gap sequence 42102-42102 FAL[client]: All defined FAL servers have been attempted. ------------------------------------------------------------ Check that the CONTROL_FILE_RECORD_KEEP_TIME initialization parameter is defined to a value that's sufficiently large enough to maintain adequate log switch information to resolve archivelog gaps. ------------------------------------------------------------
處理方法,在主庫(kù)查看該歸檔的SCN發(fā)生的序列:
SQL> col first_change# for 999999999999999 SQL> select first_change# from v$archived_log where sequence#='42102' 2 ; FIRST_CHANGE# ---------------- 11769444390910 主庫(kù) SQL> alter system set log_archive_dest_state_2=defer; 備庫(kù) SQL> alter database managed standby database recovery cancel;
對(duì)主庫(kù)進(jìn)行增量和控制文件備份:
RMAN> backup incremental from scn 11769444390910 database format '/u01/temp/archivedlog_%U'; RMAN> backup current controlfile for standby format '/u01/temp/controlfile.bak';
將文件拷貝到備庫(kù)后,進(jìn)行還原
RMAN> shutdown immediate RMAN> startup nomount RMAN> restore standby controlfile from '/u01/temp/controlfile.bak'; RMAN> alter database mount; RMAN> recover database noredo;
另外如果未采用的standby log模式,則需要清空備庫(kù)redo log,有幾組清理幾組。
SQL> alter database clear logfile group 1;
切換主庫(kù)日志文件觀察主備庫(kù)日志序列是否一致!
主庫(kù): SQL> alter system switch logfile; SQL> select max(sequence#) from v$log_history; MAX(SEQUENCE#) -------------- 42141 備庫(kù): SQL> select max(sequence#) from v$log_history; MAX(SEQUENCE#) -------------- 42141
恢復(fù)歸檔應(yīng)用
主庫(kù) SQL> alter system set log_archive_dest_state_2=enable; 備庫(kù) SQL> alter database managed standby database recovery disconnect from session;
關(guān)注以下幾個(gè)視圖:
v$managed_standby SQL> select process,status,sequence# from v$managed_standby; v$archive_dest_status SQL> col dest_name for a25 SQL> select dest_name,status,recovery_mode from v$archive_dest_status;
啟動(dòng)時(shí)觀察alert日志發(fā)現(xiàn)如下內(nèi)容
Wed Sep 30 14:27:09 2015
Managed Standby Recovery not using Real Time Apply
表示歸檔沒(méi)有實(shí)時(shí)同步,檢查發(fā)現(xiàn)備庫(kù)監(jiān)聽(tīng)未開(kāi)啟
$ tnsping sss_dg TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 30-SEP-2015 14:27:42 Copyright (c) 1997, 2011, Oracle. All rights reserved. Used parameter files: Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.x)(PORT=1521))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=sss))) TNS-12541: TNS:no listene
參考:
http://www.xifenfei.com/2011/07/data-guard%e5%87%ba%e7%8e%b0gap-sequence%e4%bf%ae%e5%a4%8d.html