重慶思莊oracle技術(shù)分享-ORA-01105 & ORA-01677 模擬1
1、說(shuō)明
在日常rac搭建dg或者rac修改轉(zhuǎn)換路徑,有時(shí)候可能會(huì)對(duì)參數(shù)進(jìn)行修改,修改之后又沒(méi)有同時(shí)停止和啟動(dòng)兩個(gè)節(jié)點(diǎn)實(shí)例,造成后續(xù)維護(hù)人員在關(guān)閉重啟某個(gè)節(jié)點(diǎn)時(shí)遇到ORA-01105、ORA-01677錯(cuò)誤;
2、分析錯(cuò)誤
1)scope=spfile;為靜態(tài)參數(shù),執(zhí)行后兩臺(tái)rac的環(huán)境均未生效
2)假設(shè)重啟了節(jié)點(diǎn)2,先srvctl stop instance -d xx -n xx,然后再srvctl start instance -d xx -n xx錯(cuò)誤就出現(xiàn)了;
3)通過(guò)現(xiàn)象可用知道,節(jié)點(diǎn)1還沒(méi)有重啟過(guò),也就是說(shuō)該參數(shù)還是沒(méi)生效的,現(xiàn)在節(jié)點(diǎn)2重新啟動(dòng)讀取spfile就會(huì)使該參數(shù)生效,此時(shí)兩邊參數(shù)不一致oracle就會(huì)拋出ORA-01105、ORA-01677錯(cuò)誤;
3、模擬錯(cuò)誤
節(jié)點(diǎn)1 oracle rdbms下修改
sqlplus / as sysdba
alter system set db_file_name_convert='+data/healdg/datafile/','+data/heal/datafile/' scope=spfile;
alter system set log_file_name_convert='+data/healdg/tempfile/','+data/heal/tempfile/' scope=spfile;
節(jié)點(diǎn)1 模擬關(guān)閉和啟動(dòng)
startup force
--
ORA-01105: mount is incompatible with mounts by other instances
ORA-01677: standby file name conversion parameters differ from other instance
節(jié)點(diǎn)1創(chuàng)建pfile
SQL> create pfile='/tmp/1.txt' from spfile;
節(jié)點(diǎn)1刪除該參數(shù),重新拉起數(shù)據(jù)庫(kù)
vi /tmp/1.txt
刪除*.db_file_name_convert='+data/healdg/datafile/','+data/heal/datafile/'
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup mount pfile='/tmp/1.txt'; 《《兩個(gè)節(jié)點(diǎn)參數(shù)一致
SQL> show parameter spfile; --沒(méi)有使用spfile
節(jié)點(diǎn)1查看spfile位置
[oracle@rac1 ~]$ srvctl config database -d orcl
Spfile: +DATA/orcl/spfileorcl.ora
--節(jié)點(diǎn)1備份現(xiàn)有spfile
ASMCMD [+DATA/ORCL] > cp spfileorcl.ora /tmp/spfileorcl.ora
copying +DATA/ORCL/spfileorcl.ora -> /tmp/spfileorcl.ora
--節(jié)點(diǎn)1創(chuàng)建新spfile(沒(méi)有修改的db_file_name_convert)
SQL> create spfile='+DATA/orcl/spfileorcl.ora' from pfile='/tmp/1.txt';
File created.
--備份修改后的spfile
ASMCMD [+DATA/ORCL] > cp spfileorcl.ora /tmp/spfileorcl_new.ora
--對(duì)比
[root@rac1 tmp]# strings spfileorcl.ora |grep db_file_name
*.db_file_name_convert='+data/healdg/datafile/','+data/heal/datafile/'
[root@rac1 tmp]# strings spfileorcl_new.ora |grep db_file_name
--還原之前的修改,最后可以找停機(jī)時(shí)間,同時(shí)重啟兩節(jié)點(diǎn)
alter system set db_file_name_convert='+data/healdg/datafile/','+data/heal/datafile/' scope=spfile;
--經(jīng)過(guò)測(cè)試,發(fā)現(xiàn)按照節(jié)點(diǎn)的方式修改參數(shù),也會(huì)報(bào)這個(gè)問(wèn)題;
alter system set db_file_name_convert='+data/healdg/datafile/','+data/heal/datafile/' scope=spfile sid='orcl1';
alter system set db_file_name_convert='+data/healdg/datafile/','+data/heal/datafile/' scope=spfile sid='orcl2';
SQL> startup force
ORACLE instance started.
Total System Global Area 2415918568 bytes
Fixed Size? ? ? ? ? ? ? ?? ???9137640 bytes
Variable Size? ? ? ? ? ? ? ???1426063360 bytes
Database Buffers? ? ? ?? ?973078528 bytes
Redo Buffers? ? ? ? ? ? ? ?? ???7639040 bytes
ORA-01105: mount is incompatible with mounts by other instances
ORA-01677: standby file name conversion parameters differ from other instance
總結(jié):1)在不能啟動(dòng)的節(jié)點(diǎn)創(chuàng)建pfile,然后刪除節(jié)點(diǎn)2未生效的參數(shù),nomount讀取pfile啟動(dòng)測(cè)試;
? ?? ?2)查看現(xiàn)有spfile位置,然后備份到文件系統(tǒng)
? ? ? ?? ? 3)不能啟動(dòng)的節(jié)點(diǎn)創(chuàng)建spfile從pfile
? ? ? ?? ? 4)關(guān)閉不能啟動(dòng)的節(jié)點(diǎn),然后通過(guò)spfile啟動(dòng)即可;
總體思路:想辦法把spfile中的參數(shù)刪除了,然后用相同的spfile啟動(dòng)就行了;因?yàn)閟pfile只是nomount時(shí)候使用,其它時(shí)候都是空閑的;