sqlnet.ora檔案引起的TNS-00583對dataguard的影響

skyin_1603發表於2017-03-13

探討sqlnet.ora檔案在dataguard中的影響:
事情是這樣的:由於自己很長的一段時間沒有開啟過自己虛擬機器裡的DG,自從16年10月搭建好之後。
中間也多多少少利用了主庫的節點作為其他的測試,比如EZCONNECT的測試,當中就建立了sqlnet.ora檔案。
這麼久的時間之後,當我再次開啟這個DG的時候,主備庫能正常開啟,但是不能切換,其中主備庫的狀態如下檢視所示:

----2.2:主庫

SQL>  select open_mode,protection_mode,switchover_status,database_role from v$database; 

OPEN_MODE            PROTECTION_MODE      SWITCHOVER_STATUS    DATABASE_ROLE

-------------------- -------------------- -------------------- ----------------

READ WRITE           MAXIMUM PERFORMANCE  FAILED DESTINATION   PRIMARY

----2.4:備庫

SQL>  select open_mode,protection_mode,switchover_status,database_role from v$database; 

OPEN_MODE            PROTECTION_MODE      SWITCHOVER_STATUS    DATABASE_ROLE

-------------------- -------------------- -------------------- ----------------

READ ONLY            MAXIMUM PERFORMANCE  NOT ALLOWED          PHYSICAL STANDBY


接著我去嘗試開啟主備庫的監聽的時候,發現:備庫的監聽啟動正常,而主庫的監聽就出現以下的報錯:

[oracle@host01 admin]$ lsnrctl start 

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-MAR-2017 14:42:07

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait... 

TNSLSNR for Linux: Version 11.2.0.4.0 - Production

System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/host01/listener/alert/log.xml

Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host01)(PORT=1521)))

TNS-12560: TNS:protocol adapter error

TNS-00583: Valid node checking: unable to parse configuration parameters

Listener failed to start. See the error message(s) above...

關於監聽的錯誤:

TNS-12560: TNS:protocol adapter error

TNS-00583: Valid node checking: unable to parse configuration parameters


然後進一步對比了主庫和備庫與監聽相關的檔案:主庫比備庫多了一個sqlnet.ora檔案:
開啟主庫的
sqlnet.ora檢視,裡面

[oracle@host01 admin]$ cat sqlnet.ora

# sqlnet.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/dbhome_1/network/admin/sqlnet.ora

# Generated by Oracle configuration tools.

NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)

 

~
第一的感覺以為是sqlnet.ora檔案裡面的引數的影響,接著就是把檔案裡面的所有引數註釋掉:如下

[oracle@host01 admin]$ vi sqlnet.ora

# sqlnet.ora Network Configuration File: /oracle/app/oracle/product/10.2.0/dbhome_1/network/admin/sqlnet.ora

# Generated by Oracle configuration tools.

 

#NAMES.DIRECTORY_PATH= (TNSNAMES,EZCONNECT)

 

~

"sqlnet.ora" 6L, 200C written         

後面再次嘗試去開啟主庫的監聽,結果還是出現同樣的報錯,依然不能正常啟動主庫的監聽。
sqlnet.ora檔案裡所有的內容註釋掉都不湊效,只能懷疑是sqlnet.ora檔案的存在了,因為剛才備庫
沒有這個檔案,它的監聽能夠正常地啟動。

  後面去把主庫的sqlnet.ora檔案刪除之後,去啟動主庫的監聽,最後可以了正常開啟了。
再次去檢視主庫的狀態時,變成了一下的狀態:

--主庫例項:

SQL> select open_mode,protection_mode,switchover_status,database_role from v$database;

OPEN_MODE            PROTECTION_MODE      SWITCHOVER_STATUS    DATABASE_ROLE

-------------------- -------------------- -------------------- ----------------

READ WRITE           MAXIMUM PERFORMANCE  TO STANDBY           PRIMARY
#這也就是說DG體系恢復正常狀態,可以正常切換。

 說了這麼多,為了進一步探討sqlnet.ora對DG的影響,直接影響就會監聽的影響,進行了一下的測試:
同時給備庫新增sqlnet.ora檔案,驗證備庫的監聽是否能再次正常的啟動。


---主庫主機上:

[oracle@host01 admin]$ ls

listener.ora  samples  shrept.lst  sqlnet.ora  sqlnet.ora.bak20170312  sqlnet.ora.bak201703122  tnsnames.ora

[oracle@host01 admin]$

 

[oracle@host01 admin]$ lsnrctl start

 

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-MAR-2017 14:42:07

 

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

 

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

 

TNSLSNR for Linux: Version 11.2.0.4.0 - Production

System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/host01/listener/alert/log.xml

Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host01)(PORT=1521)))

TNS-12560: TNS:protocol adapter error

 TNS-00583: Valid node checking: unable to parse configuration parameters

 

Listener failed to start. See the error message(s) above...

[oracle@host01 admin]$

 

---備庫主機上:

[oracle@oracle admin]$ ls

listener.ora  listener.ora.bak  listener.ora.ok  samples  shrept.lst  sqlnet.ora  sqlnet.ora.bak201703122  tnsnames.ora

[oracle@oracle admin]$ lsnrctl start

 

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-MAR-2017 14:45:19

 

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

 

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

 

TNSLSNR for Linux: Version 11.2.0.4.0 - Production

System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml

Error listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle)(PORT=1521)))

TNS-12560: TNS:protocol adapter error

 TNS-00583: Valid node checking: unable to parse configuration parameters

 

Listener failed to start. See the error message(s) above...

 

[oracle@oracle admin]$

 

----分別在主備庫中刪除sqlnet.ora檔案,在重啟主備庫主機的監聽:

--主庫上:

[oracle@host01 admin]$ rm sqlnet.ora

[oracle@host01 admin]$ ls

listener.ora  samples  shrept.lst  sqlnet.ora.bak20170312  sqlnet.ora.bak201703122  tnsnames.ora

[oracle@host01 admin]$

[oracle@host01 admin]$ lsnrctl start

 

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-MAR-2017 14:49:35

 

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

 

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

 

TNSLSNR for Linux: Version 11.2.0.4.0 - Production

System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/host01/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host01)(PORT=1521)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=host01)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date                12-MAR-2017 14:49:35

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/host01/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=host01)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary...

Service "ORA11GR2" has 1 instance(s).

  Instance "ORA11GR2", status UNKNOWN, has 1 handler(s) for this service...

Service "SBDB" has 1 instance(s).

  Instance "SBDB", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

 

--備庫上:

[oracle@oracle admin]$ rm sqlnet.ora

[oracle@oracle admin]$ ls

listener.ora  listener.ora.bak  listener.ora.ok  samples  shrept.lst  sqlnet.ora.bak201703122  tnsnames.ora

[oracle@oracle admin]$

[oracle@oracle admin]$ lsnrctl start

 

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 12-MAR-2017 14:48:36

 

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

 

Starting /u01/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

 

TNSLSNR for Linux: Version 11.2.0.4.0 - Production

System parameter file is /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Log messages written to /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

 

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle)(PORT=1521)))

STATUS of the LISTENER

------------------------

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production

Start Date                12-MAR-2017 14:48:36

Uptime                    0 days 0 hr. 0 min. 0 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

Listener Log File         /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml

Listening Endpoints Summary...

  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))

  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

Services Summary...

Service "ENMO.oracle.com" has 1 instance(s).

  Instance "ENMO", status UNKNOWN, has 1 handler(s) for this service...

Service "ORA11GR2" has 1 instance(s).

  Instance "ORA11GR2", status UNKNOWN, has 1 handler(s) for this service...

The command completed successfully

[oracle@oracle admin]$ 

--以上可以看到,sqlnet.ora無論在主庫還是備庫,都直接影響對應主機監聽的正常啟動。DG主備庫的監聽不相通,就直接影響
DG的正常狀態,阻礙主備庫之間的日誌傳輸,阻礙DG主備庫的角色的切換。當然sqlnet.ora只是對DG上的監聽引起TNS-00583,單例項
的庫的監聽啟動並不受sqlnet.ora影響。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31392094/viewspace-2135280/,如需轉載,請註明出處,否則將追究法律責任。

相關文章