在ASM下创建spfile 出现DB_UNKOWN

文章来源于metalink。

出现DB_UNKNOWN的真实原因就在于在diskgroup上创建spfile的时候,没有打开rdbms(在此区别asm)数据库。其实,spfile文件出现在db_unkown里还是出现在/里,都不会影响数据库的启动和运行。因此不会引起问题,所以不调整spfile让他呆在db_unknown里也没关系。

如下描述:

Applies to:


Oracle Server - Enterprise Edition - Version: 10.1.0.2 to 11.1.0.7
This problem can occur on any platform.



Symptoms


On 10.2.0.1 in Production:

-- Suppose that the database instance name is "osmdr"

-- In the database instance

When trying to create a new spfile from a pfile under sqlplus

SQL> create SPFILE='+DATA/osmdr/spfileosmdr.ora' from pfile='/home/oracle/osmdr.init';
File created.


SQL>create SPFILE='+DATA/osmdr/spfileosmdr.ora' from PFILE='/home/oracle/osmdr.init'; File created


Under ASM , the spileosmdr.ora is link to the wrong location under ASM


ASMCMD> ls -alr
Type Redund Striped Time Sys Name
N spfileosmdr.ora =>
+DATA/DB_UNKNOWN/PARAMETERFILE/SPFILE.272.613162051

ASMCMD>

Q. Why it will create +DATA/DB_UNKNOW instead of +DATA/osmdr ?

The same question can be like that

Q. Why does the spfile get created in the directory DB_UNKNOWN?


IT'S EXPECTED BEHAVIOR



Cause


-- Considering the TESTCASE hereunder

The string "DB_UNKNOWN/PARAMETERFILE/SPFILE" is a generic system tag for the proxied spfile creation. This will be used in case the database instance has no open client session to the ASM instance at the time of the 'create spfile' command. That is, the ASM instance is not aware of the db name and therefore uses "DB_UNKNOWN".

Please see the TESTCASE section above that demonstrates two scenarios; [

【A】where the DB_UNKNOWN
directory structure gets created

【B】where the PARAMETERFILE
directory structure gets created


Solution


TESTCASE
[A] No open database connection to the ASM instance

-- In the ASM instance


SQL> select * from v$asm_client;

no rows selected

-- In the database instance


SQL> show parameter db_name

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_name string V1020

SQL> select * from v$asm_client;

no rows selected

SQL> create spfile='+DG1' from pfile;

File created.

-- In asmcmd
-- The DB_UNKNOWN directory structure gets created

ASMCMD> pwd
+dg1


ASMCMD> ls
DB_UNKNOWN/
V1020/


ASMCMD> ls DB_UNKNOWN/
PARAMETERFILE/


ASMCMD> ls DB_UNKNOWN/PARAMETERFILE/
SPFILE.259.613339345

或者 在直接建立spfile.ora,这个文件会自动指向/DB_UNKNOWN/
PARAMETERFILE /spfile****文件。如下

SQL> create spfile='+DG1/V1020/spfileV1020.ora' from pfile;

ASMCMD> pwd
V1020

ASMCMD> ls -lta
Type           Redund  Striped  Time             Sys  Name
                                                 Y    TEMPFILE/

                                                 Y    ONLINELOG/
                                                 Y    DATAFILE/
                                                 Y    CONTROLFILE/
                                                 N 
   spfileV1020.ora => +DG1/DB_UNKNOWN/PARAMETERFILE/spfile.259.613339813



-- Remove the parameter file from the ASM diskgroup

ASMCMD> rm DB_UNKNOWN/PARAMETERFILE/SPFILE.259.613339345

-- Now the DB_UNKNOWN directory structure gets automatically removed (删除文件的同时,目录也被删除了)


[B]open database connection to the ASM instance

-- In the database instance
-- Open a connection to the ASM instance by accessing a datafile in an ASM diskgroup

-- In this example, a tablespace with a datafile in an ASM diskgroup is onlined
(其实不用特意去访问数据文件来达到连接的效果,好像rdbms应该可以建立到ASM的session连接,可以从V$asm_client视图可以看到)

SQL> alter tablespace ts1 online;

Tablespace altered.

SQL> select * from v$asm_client;

GROUP_NUMBER INSTANCE_NAM DB_NAME STATUS SOFTWARE
------------ ------------ -------- ------------ -
1 +ASM V1020 CONNECTED 10.2.0.3.0 10.2.0.0.0

-- In the ASM instance

SQL> select * from v$asm_client;

GROUP_NUMBER INSTANCE_NAM DB_NAME STATUS SOFTW
------------ ------------ -------- -----------
1 V1020 V1020 CONNECTED 10.2.0.3.0 10.2.0.1.0

-- In the database instance

SQL> create spfile='+DG1' from pfile;

File created.

-- In asmcmd

ASMCMD> pwd
+dg1
ASMCMD> ls
V1020/
ASMCMD> ls V1020/
DATAFILE/
PARAMETERFILE/
ASMCMD> ls V1020/PARAMETERFILE/
spfile.259.613339813

-- Result:
- The spfile is located in the directory //PARAMETERFILE
- No DB_UNKNOWN directory structure got created

或者 在直接建立spfile.ora,这个文件会自动指向//PARAMETERFILE /spfile****文件。


SQL> create spfile='+DG1/V1020/spfileV1020.ora' from pfile;

 

ASMCMD> pwd
+dg1


ASMCMD> ls
V1020/


ASMCMD> ls V1020/
DATAFILE/
PARAMETERFILE/

spfileV1020.ora'

ASMCMD> ls -lta
Type           Redund  Striped  Time             Sys  Name
                                                 Y    TEMPFILE/
                                                 Y    PARAMETERFILE/
                                                 Y    ONLINELOG/
                                                 Y    DATAFILE/
                                                 Y    CONTROLFILE/
                                                 N    spfileV1020.ora => +DG1/LV1020/PARAMETERFILE/spfile.259.613339813
ASMCMD> ls V1020/PARAMETERFILE/
spfile.259.613339813

ASMCMD> ls V1020/PARAMETERFILE/
spfile.259.613339813

最后别忘了在$ORACLE_HOME/dbs/iniit.ora文件里写入'spfile=''+DG1/....',让rdbms能找到spfile文件就行了【上述的TESTCASE A 和TASTCASE B 都适用】,这样以后rdbms就可以启动了。

请使用浏览器的分享功能分享到微信等