RAC環境在ASM上建立表空間出錯ORA-569

yangtingkun發表於2009-02-21

在一個的測試資料庫上,建立表空間時出現了這個錯誤。

 

 

由於資料庫環境比較複雜,簡單描述一下。

這個測試環境安裝的是Oracle 1106 for Solaris 10 sparc 64bitRAC環境,搭建了ASM例項用於存放共享資料檔案。

RAC環境的其中一個節點上,又建立了一個單例項的資料庫,並把這個資料庫的資料檔案也放到了ASM例項上。

結果嘗試在這個例項上新增新的表空間時報錯:

SQL> select file_name from dba_data_files;

FILE_NAME
------------------------------------------------------------------------------
+DATA/test/datafile/system.533.668281219
+DATA/test/datafile/sysaux.534.668281227
+DATA/test/datafile/undotbs1.535.668281229
+DATA/test/datafile/users.537.668281241

SQL> create tablespace test datafile '+DATA/test/datafile/test01.dbf' size 4096m;
create tablespace test datafile '+DATA/test/datafile/test01.dbf' size 4096m
*
1 行出現錯誤:
ORA-01119:
建立資料庫檔案 '+DATA/test/datafile/test01.dbf' 時出錯
ORA-17502: ksfdcre: 4
未能建立檔案 +DATA/test/datafile/test01.dbf
ORA-00569: Failed to acquire global enqueue.
ORA-00569: Failed to acquire global enqueue.

這個錯誤似乎很少見,檢視了一下Oracle的官方錯誤文件描述:

ORA-00569: Failed to acquire global enqueue.
Cause: A prior error occurred on one of the instances in the cluster. Typically errors are caused by shared pool resource contention.
Action: Check for and resolve prior errors on all instances in the cluster. If there is shared pool resource contention, increase the SHARED_POOL_SIZE, DML_ LOCKS, PROCESSES, TRANSACTIONS, CLUSTER_DATABASE_INSTANCES and PARALLEL_MAX_SERVERS initialization parameters.

雖然對問題進行了描述,不過從錯誤看不出導致問題的真正原因。

查詢了一下METALINK,找到了一些錯誤說明,不過沒有和當前錯誤相似度很高的,大部分出現這個錯誤的同時,都會伴隨ORA-600錯誤和ORA-4031錯誤。

不過現在有一個簡單的方法來確定到底是資料庫產生的問題還是ASM例項導致的問題,現在只需要登陸RAC例項,執行類似的新增表空間的操作,檢查是否會出現相同的問題就可以了:

bash-3.00$ export ORACLE_SID=ractest1
bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on 星期三 2 18 17:12:42 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

已連線到空閒例程。

SQL> startup
ORACLE
例程已經啟動。

Total System Global Area 1603887104 bytes
Fixed Size                  2095208 bytes
Variable Size             741722008 bytes
Database Buffers          855638016 bytes
Redo Buffers                4431872 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL> CREATE TABLESPACE TEST DATAFILE '+DATA/ractest/datafile/test01.dbf' SIZE 4096M;
CREATE TABLESPACE TEST DATAFILE '+DATA/ractest/datafile/test01.dbf' SIZE 4096M
*
1 行出現錯誤:
ORA-01119:
建立資料庫檔案 '+DATA/ractest/datafile/test01.dbf' 時出錯
ORA-17502: ksfdcre: 4
未能建立檔案 +DATA/ractest/datafile/test01.dbf
ORA-00569: Failed to acquire global enqueue.
ORA-00569: Failed to acquire global enqueue.

可以看到,相同的錯誤產生了,看來問題可能和ASM例項的狀態有關係,登陸ASM例項,進行簡單的檢查:

bash-3.00$ export ORACLE_SID=+ASM1
bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on 星期三 2 18 17:33:12 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


連線到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> set pages 100 lines 120
SQL> select instance_name, status from v$instance;

INSTANCE_NAME                    STATUS
-------------------------------- ------------------------
+ASM1                            STARTED

由於ASM例項可以用來檢查的動態檢視太少,從現有的檢視也看不到特別的地方,看來只能重啟資料庫和ASM例項,再次檢查問題:

bash-3.00$ export ORACLE_SID=test
bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on 星期三 2 18 17:41:40 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


連線到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> shutdown immediate
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE
例程已經關閉。
SQL> exit
bash-3.00$ export ORACLE_SID=ractest1
bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on 星期三 2 18 17:43:21 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


連線到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> shutdown immediate
資料庫已經關閉。
已經解除安裝資料庫。
ORACLE
例程已經關閉。
SQL> exit
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
斷開
bash-3.00$ export ORACLE_SID=+ASM1  
bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on 星期三 2 18 17:44:05 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


連線到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> shutdown immediate
^CORA-01013: user requested cancel of current operation

SQL> CONN / AS SYSDBA
已連線。
SQL> shutdown abort
ASM
例項已關閉
SQL> startup
ASM
例項已啟動

Total System Global Area  284008448 bytes
Fixed Size                  2087944 bytes
Variable Size             256754680 bytes
ASM Cache                  25165824 bytes
ASM diskgroups mounted
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
bash-3.00$ export ORACLE_SID=test
bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on 星期三 2 18 17:47:22 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

已連線到空閒例程。

SQL> startup
ORACLE
例程已經啟動。

Total System Global Area  806133760 bytes
Fixed Size                  2099064 bytes
Variable Size             455669896 bytes
Database Buffers          343932928 bytes
Redo Buffers                4431872 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL> create tablespace test datafile '+DATA/test/datafile/test01.dbf' size 4096m;
create tablespace test datafile '+DATA/test/datafile/test01.dbf' size 4096m
*
1 行出現錯誤:
ORA-01119:
建立資料庫檔案 '+DATA/test/datafile/test01.dbf' 時出錯
ORA-17502: ksfdcre: 4
未能建立檔案 +DATA/test/datafile/test01.dbf
ORA-00569: Failed to acquire global enqueue.
ORA-00569: Failed to acquire global enqueue.

可以看到,重啟ASM例項,問題仍然出現。不過ASM例項也是在兩個節點上同時執行的,莫非是另一個節點的ASM例項出現了問題:

bash-3.00$ export ORACLE_SID=+ASM2
bash-3.00$ sqlplus "/ as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on 星期四 2 19 16:38:38 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


連線到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> set pages 100 lines 120
SQL> select instance_name, status from v$instance;

INSTANCE_NAME                    STATUS
-------------------------------- ------------------------
+ASM2                            STARTED

SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

檢查ASM例項未發現異常,嘗試重啟ASM例項:

bash-3.00$ srvctl stop instance -d ractest -i ractest2
bash-3.00$ srvctl stop asm -n ser2
bash-3.00$ srvctl start asm -n ser2

再次登陸test資料庫,執行CREATE TABLESPACE語句:

bash-3.00$ export ORACLE_SID=test
bash-3.00$ sqlplus "/as sysdba"

SQL*Plus: Release 11.1.0.6.0 - Production on 星期四 2 19 16:41:09 2009

Copyright (c) 1982, 2007, Oracle.  All rights reserved.


連線到:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> set pages 100 lines 120
SQL> create tablespace test datafile '+DATA/test/datafile/test01.dbf' size 4096m;

表空間已建立。

看來問題果然和ASM例項狀態不正常有關。

檢查asm例項2alert檔案,發現在執行CREATE TABLESPACE語句對應的時間點,出現了ORA-4031錯誤:

Wed Feb 18 15:50:04 2009
Errors in file /data/oracle/diag/asm/+asm/+ASM2/trace/+ASM2_lmd0_3099.trc  (incident=2412):
ORA-04031: unable to allocate 3512 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","ges enqueues")
Incident details in: /data/oracle/diag/asm/+asm/+ASM2/incident/incdir_2412/+ASM2_lmd0_3099_i2412.trc
Wed Feb 18 15:50:05 2009
Trace dumping is performing id=[cdmp_20090218155005]
WARNING: ran out of shared pool for GES enqueue object.
Errors in file /data/oracle/diag/asm/+asm/+ASM2/trace/+ASM2_lmd0_3099.trc  (incident=2413):
ORA-04031: unable to allocate 3512 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","ges enqueues")
Incident details in: /data/oracle/diag/asm/+asm/+ASM2/incident/incdir_2413/+ASM2_lmd0_3099_i2413.trc
Trace dumping is performing id=[cdmp_20090218155013]
Wed Feb 18 17:17:23 2009
Errors in file /data/oracle/diag/asm/+asm/+ASM2/trace/+ASM2_lmd0_3099.trc  (incident=2414):
ORA-04031: unable to allocate 3512 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","ges enqueues")
Incident details in: /data/oracle/diag/asm/+asm/+ASM2/incident/incdir_2414/+ASM2_lmd0_3099_i2414.trc
WARNING: ran out of shared pool for GES enqueue object.
Wed Feb 18 17:17:24 2009
Trace dumping is performing id=[cdmp_20090218171724]
Errors in file /data/oracle/diag/asm/+asm/+ASM2/trace/+ASM2_lmd0_3099.trc  (incident=2415):
ORA-04031: unable to allocate 3512 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","ges enqueues")
Incident details in: /data/oracle/diag/asm/+asm/+ASM2/incident/incdir_2415/+ASM2_lmd0_3099_i2415.trc
Trace dumping is performing id=[cdmp_20090218171732]
Wed Feb 18 17:18:02 2009
Errors in file /data/oracle/diag/asm/+asm/+ASM2/trace/+ASM2_lmd0_3099.trc  (incident=2416):
ORA-04031: unable to allocate 3512 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","ges enqueues")
Incident details in: /data/oracle/diag/asm/+asm/+ASM2/incident/incdir_2416/+ASM2_lmd0_3099_i2416.trc
WARNING: ran out of shared pool for GES enqueue object.
Wed Feb 18 17:18:03 2009
Trace dumping is performing id=[cdmp_20090218171803]
Errors in file /data/oracle/diag/asm/+asm/+ASM2/trace/+ASM2_lmd0_3099.trc  (incident=2417):
ORA-04031: unable to allocate 3512 bytes of shared memory ("shared pool","unknown object","sga heap(1,0)","ges enqueues")
Incident details in: /data/oracle/diag/asm/+asm/+ASM2/incident/incdir_2417/+ASM2_lmd0_3099_i2417.trc
Trace dumping is performing id=[cdmp_20090218171811]

這個ORA-4031錯誤已經和Oraclemetalink文章相符了,和Oracle錯誤文件上對這個錯誤的描述也是一致的。

而且這個ORA-4031錯誤資訊也很明顯,在分配全域性對了資源的時候出現的錯誤。

檢查ASM例項的sga,發現:

SQL> show sga

Total System Global Area  284008448 bytes
Fixed Size                  2087944 bytes
Variable Size             256754680 bytes
ASM Cache                  25165824 bytes

對於跑了多個RAC環境的ASM例項而言,200MSGA顯然太小了,和大部分Oracle預設引數一樣,預設的ASM例項引數也是偏小的。

以前也碰到過一次由於ASM例項PROCESS引數太小,導致ASM例項無法登陸的問題。因此,如果選擇ASM作為產品庫的儲存方式,那麼ASM例項要重新設定,預設的引數很可能無法滿足需要。

 

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

相關文章