rac環境中鏈接pdb報ORA-01033

鏈接pdb數據庫報:
ORA-01033: ORACLE initialization or shutdown in progress

檢查數據庫狀態,其中3節點的portal庫處於mount狀態:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

   INST_ID     CON_ID NAME                                                    OPEN_MODE
---------- ---------- ------------------------------------------------------- --------------------
         1          2 PDB$SEED                                                READ ONLY
         1          3 PORTALMESSAGE                                           READ WRITE
         1          4 PORTAL                                                  READ WRITE
         1          5 PORTALDEV                                               READ WRITE
         1          6 PORTALMOBILE                                            READ WRITE
         1          7 PORTALTEST                                              READ WRITE
         1          9 ECOLOGY                                                 READ WRITE
         2          2 PDB$SEED                                                READ ONLY
         2          3 PORTALMESSAGE                                           READ WRITE
         2          4 PORTAL                                                  READ WRITE
         2          5 PORTALDEV                                               READ WRITE
         2          6 PORTALMOBILE                                            READ WRITE
         2          7 PORTALTEST                                              READ WRITE
         2          9 ECOLOGY                                                 READ WRITE
         3          2 PDB$SEED                                                READ ONLY
         3          3 PORTALMESSAGE                                           READ WRITE
         3          4 PORTAL                                                  MOUNTED <<<<<
         3          5 PORTALDEV                                               READ WRITE
         3          6 PORTALMOBILE                                            READ WRITE
         3          7 PORTALTEST                                              READ WRITE
         3          9 ECOLOGY                                                 READ WRITE

文檔Connecting To A 12c RAC Pluggable Database Intermittently Fails With ORA-1033 (文檔 ID 1998112.1)中指出,緣由有兩個:
1.pdb所使用的服務名與pdb數據庫名相同
2.PDB沒有在全部RAC實例上打開,在RAC環境中,使用pdb數據庫名做爲服務名不是一個最佳方案,由於當實例使用SCAN註冊pdb名時且節點監聽到pdb被mounted。這可能形成非sysdba權限鏈接被髮送到被mounted的pdb實例上,致使ora-0133錯誤。

建立服務名:
[oracle@rac1 ~]$ $ORACLE_HOME/bin/srvctl add service -database orcl -pdb ECOLOGY -s ecology_srv  -preferred "orcl11,orcl12,orcl13" -available "orcl11,orcl12,orcl13"  -e select -m basic -P BASIC -failoverdelay 2  -failoverretry 2
此處配置如爲-preferred "orcl11" -available "orcl12,orcl13",則在手動中止orcl11上的pdb後沒法進行故障轉移。

[oracle@rac1 ~]$ $ORACLE_HOME/bin/srvctl start service -database orcl -s ecology_srv
[oracle@rac1 ~]$ srvctl status service -db orcl -s ecology_srv
服務 ecology_srv 正在實例 orcl11 上運行
[oracle@rac1 ~]$ srvctl config service -d orcl -s ecology_srv服務名: ecology_srv
服務器池:
基數: 3
服務角色: PRIMARY
管理策略: AUTOMATIC
DTP 事務處理: 假
AQ HA 通知: 假
全局: 假
提交結果: 假
故障轉移類型: SELECT
故障轉移方法: BASIC
TAF 故障轉移重試次數: 2
TAF 故障轉移延遲: 2
故障轉移還原: NONE
鏈接負載平衡目標: LONG
運行時負載平衡目標: NONE
TAF 策略規範: BASIC
版本:
插接式數據庫名: ECOLOGY
最長滯後時間: ANY
SQL 轉換概要文件:
保留期: 86400 秒
重放啓動時間: 300 秒
消耗超時:
中止選項:
會話狀態一致性: DYNAMIC
GSM 標記: 0
服務已啓用
首選實例: orcl11,orcl12,orcl13
可用實例:

CSS 關鍵型: no
css

$ lsnrctl statussql

LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 13-MAY-2021 17:31:10Copyright (c) 1991, 2016, Oracle.  All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))STATUS of the LISTENER------------------------Alias                     LISTENERVersion                   TNSLSNR for Linux: Version 12.2.0.1.0 - ProductionStart Date                11-MAY-2021 09:17:00Uptime                    2 days 8 hr. 14 min. 9 secTrace Level               offSecurity                  ON: Local OS AuthenticationSNMP                      OFFListener Parameter File   /u01/app/12.2.0/grid/network/admin/listener.oraListener Log File         /u01/app/grid/diag/tnslsnr/rac1/listener/alert/log.xmlListening Endpoints Summary...  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.102.91)(PORT=1521)))  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.102.96)(PORT=1521)))Services Summary...Service "+ASM" has 1 instance(s).  Instance "+ASM1", status READY, has 1 handler(s) for this service...Service "+ASM_DATA" has 1 instance(s).  Instance "+ASM1", status READY, has 1 handler(s) for this service...Service "+ASM_FRA" has 1 instance(s).  Instance "+ASM1", status READY, has 1 handler(s) for this service...Service "+ASM_OCR_VOTE" has 1 instance(s).  Instance "+ASM1", status READY, has 1 handler(s) for this service...Service "99f774786184674be0535b66a8c016e8" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "99f92203449e800fe0535b66a8c029cd" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "99f9220344a0800fe0535b66a8c029cd" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "99f9220344a1800fe0535b66a8c029cd" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "9aee50bc89125960e0535b66a8c0e34e" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "a365d71938bb20f7e0535b66a8c08094" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "a37448aa67e01097e0535b66a8c0686d" has 2 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...  Instance "orcl11", status READY, has 2 handler(s) for this service...Service "ecology" has 2 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...  Instance "orcl11", status READY, has 2 handler(s) for this service...Service "ecology_srv" has 2 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...  Instance "orcl11", status READY, has 2 handler(s) for this service...Service "ecologytest20200321" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "orcl" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "orcl1XDB" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "portal" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "portaldev" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "portalmessage" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "portalmobile" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...Service "portaltest" has 1 instance(s).  Instance "orcl11", status READY, has 1 handler(s) for this service...The command completed successfully配置tns:ecol =  (DESCRIPTION =    (ADDRESS = (PROTOCOL = TCP)(HOST = racscan)(PORT = 1521))    (CONNECT_DATA =      (SERVER = DEDICATED)      (SERVICE_NAME = ecology_srv)    )  )檢查服務$crsctl status res -tora.orcl.ecology_srv.svc      1        ONLINE  ONLINE       rac1                     STABLE      2        ONLINE  ONLINE       rac2                     STABLE      3        ONLINE  ONLINE       rac3                     STABLE登陸測試停掉rac2對應的pdb,鏈接中斷後能自動恢復:SP2-0306: Invalid option.Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]where <logon> ::= <username>[/<password>][@<connect_identifier>]      <proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]SP2-0306: Invalid option.Usage: CONN[ECT] [{logon|/|proxy} [AS {SYSDBA|SYSOPER|SYSASM|SYSBACKUP|SYSDG|SYSKM|SYSRAC}] [edition=value]]where <logon> ::= <username>[/<password>][@<connect_identifier>]      <proxy> ::= <proxyuser>[<username>][/<password>][@<connect_identifier>]SP2-0157: unable to CONNECT to ORACLE after 3 attempts, exiting SQL*PlusINSTANCE_NAME                                 HOST_NAME--------------------------------------------- -------------------------orcl13                                        rac3.ccic.comINSTANCE_NAME                                 HOST_NAME--------------------------------------------- -------------------------orcl13                                        rac3.ccic.com----$ srvctl add service -help -verbose將服務配置添加到 Oracle Clusterware。用法: srvctl add service -db <db_unique_name> -service <service_name>       {-preferred "<preferred_list>" [-available "<available_list>"] [-tafpolicy {BASIC | NONE | PRECONNECT}] | -serverpool <pool_name> [-cardinality {UNIFORM | SINGLETON}] }       [-netnum <network_number>] [-role "[PRIMARY][,PHYSICAL_STANDBY][,LOGICAL_STANDBY][,SNAPSHOT_STANDBY]"] [-policy {AUTOMATIC | MANUAL}]       [-notification {TRUE | FALSE}] [-dtp {TRUE | FALSE}] [-clbgoal {SHORT | LONG}] [-rlbgoal {NONE | SERVICE_TIME | THROUGHPUT}]       [-failovertype {NONE | SESSION | SELECT | TRANSACTION}] [-failovermethod {NONE | BASIC}] [-failoverretry <failover_retries>] [-failoverdelay <failover_delay>] [-failover_restore {NONE | LEVEL1}]       [-edition <edition>] [-pdb <pluggable_database>] [-global {TRUE | FALSE}] [-maxlag <max_lag_time>] [-sql_translation_profile <sql_translation_profile>]       [-commit_outcome {TRUE | FALSE}] [-retention <retention>] [-replay_init_time <replay_initiation_time>] [-session_state {STATIC | DYNAMIC}]       [-pqservice <pq_service>] [-pqpool "<pq_pool_list>"] [-gsmflags <gsm_flags>] [-drain_timeout <timeout>] [-stopoption <stop_option>] [-css_critical {YES | NO}] [-rfpool <pool_name>]       [-force] [-eval] [-verbose]    -db <db_unique_name>           數據庫的惟一名稱    -service <service>             服務名    -preferred "<preferred_list>"  逗號分隔的首選實例列表    -available "<available_list>"  逗號分隔的可用實例列表    -serverpool <pool_name>        服務器池名稱    -cardinality                   (UNIFORM | SINGLETON) 服務在託管此服務的服務器池中的每個活動服務器上運行 (UNIFORM) 或僅在一個服務器上運行 (SINGLETON)    -netnum  <network_number>      網絡編號 (默認編號爲 1)    -tafpolicy                     (NONE | BASIC | PRECONNECT)        TAF 策略規範    -role <role>                   服務的角色 (primary, physical_standby, logical_standby, snapshot_standby)    -policy <policy>               服務的管理策略 (AUTOMATIC 或 MANUAL)    -failovertype                  (NONE | SESSION | SELECT | TRANSACTION)      故障轉移類型    -failovermethod                (NONE | BASIC)     故障轉移方法    -failoverdelay <failover_delay> 故障轉移延遲 (秒)    -failoverretry <failover_retries> 重試鏈接的嘗試次數    -failover_restore <failover_restore>  Option to restore initial environment for Application Continuity and TAF (NONE or LEVEL1)    -edition <edition>             版本 ("" 表示空版本值)    -pdb <pluggable_database>      插接式數據庫名    -maxlag <maximum replication lag> 最長複製滯後時間, 以秒爲單位 (非負整數, 默認值爲 'ANY')    -clbgoal                       (SHORT | LONG)                   鏈接負載平衡目標。默認值爲 LONG。    -rlbgoal                       (SERVICE_TIME | THROUGHPUT | NONE)     運行時負載平衡目標    -dtp                           (TRUE | FALSE)  分佈式事務處理    -notification                  (TRUE | FALSE)  啓用用於 OCI 鏈接的快速應用程序通知 (FAN)    -global <global>               全局屬性 (TRUE 或 FALSE)    -preferred <new_pref_inst>     新首選實例的名稱    -available <new_avail_inst>    新可用實例的名稱    -sql_translation_profile <sql_translation_profile> 爲 SQL 轉換概要文件指定數據庫對象    -commit_outcome                (TRUE | FALSE)          提交結果    -retention <retention>         指定保留提交結果的秒數    -replay_init_time <replay_init_time> 以後不啓動重放的秒數    -session_state <session_state> 會話狀態一致性 (STATIC 或 DYNAMIC)    -pqservice <pq_service>        並行查詢服務名    -pqpool <pq_pool>              並行查詢服務器池名    -gsmflags <gsm_flags>          設置行政區和區域故障轉移值    -drain_timeout <drain_timeout> 服務消耗超時, 以秒爲單位指定    -stopoption <stop_options>     用於中止服務的選項 (例如 TRANSACTIONAL 或 IMMEDIATE)    -css_critical {YES | NO}          定義數據庫或服務是否爲 CSS 關鍵型    -rfpool <pool_name>            讀進程場服務器池名稱    -eval                          評估事件的效果, 不對系統進行任何更改用法: srvctl add service -db <db_unique_name> -service <service_name> -update {-preferred "<new_pref_inst>" | -available "<new_avail_inst>"} [-force] [-verbose]    -db <db_unique_name>           數據庫的惟一名稱    -service <service>             服務名    -update                        爲服務配置添加一個新實例    -preferred <new_pref_inst>     新首選實例的名稱    -available <new_avail_inst>    新可用實例的名稱    -force                         強制執行添加操做, 即便沒有爲網絡配置監聽程序    -verbose                       詳細輸出    -help                          輸出用法
相關文章
相關標籤/搜索