在11g的cluster中,我们往往用dbs下的初始化文件(pfile),来指定asm中实际存在的spfile
[oracle@ol6-112-rac1 dbs]$ cd /u01/app/oracle/product/11.2.0.4/db_1/dbs
[oracle@ol6-112-rac1 dbs]$ ls
hc_acfsdb.dat hc_cdbrac_1.dat hc_cdbrac_2.dat initcdbrac_1.ora initcdbrac_1.ora.orig init.ora orapwacfsdb spfileacfsdb.ora
[oracle@ol6-121-rac1 dbs]$ cat initcdbrac_1.ora
SPFILE='+DATA/cdbrac/spfilecdbrac.ora'
[oracle@ol6-112-rac1 dbs]$
1
2
3
4
5
6
[oracle@ol6-112-rac1dbs]$cd/u01/app/oracle/product/11.2.0.4/db_1/dbs
[oracle@ol6-112-rac1dbs]$ls
hc_acfsdb.dathc_cdbrac_1.dathc_cdbrac_2.datinitcdbrac_1.orainitcdbrac_1.ora.originit.oraorapwacfsdbspfileacfsdb.ora
[oracle@ol6-121-rac1dbs]$catinitcdbrac_1.ora
SPFILE='+DATA/cdbrac/spfilecdbrac.ora'
[oracle@ol6-112-rac1dbs]$
但是在12c中,如果我去修改dbs下的pfile指定spfile,这个设置就不会生效了,如我将文件指定到/tmp目录下,你会发现启动之后,它还是用到了asm上的spfile:
[oracle@ol6-121-rac1 dbs]$ cat initcdbrac_1.ora
SPFILE='/tmp/pfile.ora'
[oracle@ol6-121-rac1 dbs]$
[oracle@ol6-121-rac1 dbs]$ sqlplus "/ as sysdba"
SQL*Plus: Release 12.1.0.1.0 Production on Thu Jun 23 11:24:12 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1219260416 bytes
Fixed Size 2287768 bytes
Variable Size 838862696 bytes
Database Buffers 369098752 bytes
Redo Buffers 9011200 bytes
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string +DATA/cdbrac/spfilecdbrac.ora
SQL> exit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
[oracle@ol6-121-rac1dbs]$catinitcdbrac_1.ora
SPFILE='/tmp/pfile.ora'
[oracle@ol6-121-rac1dbs]$
[oracle@ol6-121-rac1dbs]$sqlplus"/ as sysdba"
SQL*Plus:Release12.1.0.1.0ProductiononThuJun2311:24:122016
Copyright(c)1982,2013,Oracle.Allrightsreserved.
Connectedto:
OracleDatabase12cEnterpriseEditionRelease12.1.0.1.0-64bitProduction
WiththePartitioning,RealApplicationClusters,AutomaticStorageManagement,OLAP,
AdvancedAnalyticsandRealApplicationTestingoptions
SQL>shutdownabort
ORACLEinstanceshutdown.
SQL>startupnomount
ORACLEinstancestarted.
TotalSystemGlobalArea1219260416bytes
FixedSize2287768bytes
VariableSize838862696bytes
DatabaseBuffers369098752bytes
RedoBuffers9011200bytes
SQL>showparameterspfile
NAMETYPEVALUE
-----------------------------------------------------------------------------
spfilestring+DATA/cdbrac/spfilecdbrac.ora
SQL>exit
这是因为在12c的cluster中,spfile的信息已经固定在ocr中,不会去考虑dbs目录下的配置。
[oracle@ol6-121-rac1 dbs]$ srvctl config database -d cdbrac |grep spfile
Spfile: +DATA/cdbrac/spfilecdbrac.ora
[oracle@ol6-121-rac1 dbs]$
1
2
3
[oracle@ol6-121-rac1dbs]$srvctlconfigdatabase-dcdbrac|grepspfile
Spfile:+DATA/cdbrac/spfilecdbrac.ora
[oracle@ol6-121-rac1dbs]$
如果要修改spfile的路径,就必须修改ocr中的信息了:
[oracle@ol6-121-rac1 dbs]$ srvctl modify database -d cdbrac -spfile '/tmp/pfile.ora'
[oracle@ol6-121-rac1 dbs]$
[oracle@ol6-121-rac1 dbs]$
[oracle@ol6-121-rac1 dbs]$ sqlplus "/ as sysdba"
SQL*Plus: Release 12.1.0.1.0 Production on Thu Jun 23 11:27:48 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Advanced Analytics and Real Application Testing options
SQL> shutdown abort
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1219260416 bytes
Fixed Size 2287768 bytes
Variable Size 838862696 bytes
Database Buffers 369098752 bytes
Redo Buffers 9011200 bytes
SQL>
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /tmp/pfile.ora
SQL> shutdown abort
ORACLE instance shut down.
SQL> exit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
[oracle@ol6-121-rac1dbs]$srvctlmodifydatabase-dcdbrac-spfile'/tmp/pfile.ora'
[oracle@ol6-121-rac1dbs]$
[oracle@ol6-121-rac1dbs]$
[oracle@ol6-121-rac1dbs]$sqlplus"/ as sysdba"
SQL*Plus:Release12.1.0.1.0ProductiononThuJun2311:27:482016
Copyright(c)1982,2013,Oracle.Allrightsreserved.
Connectedto:
OracleDatabase12cEnterpriseEditionRelease12.1.0.1.0-64bitProduction
WiththePartitioning,RealApplicationClusters,AutomaticStorageManagement,OLAP,
AdvancedAnalyticsandRealApplicationTestingoptions
SQL>shutdownabort
ORACLEinstanceshutdown.
SQL>startupnomount
ORACLEinstancestarted.
TotalSystemGlobalArea1219260416bytes
FixedSize2287768bytes
VariableSize838862696bytes
DatabaseBuffers369098752bytes
RedoBuffers9011200bytes
SQL>
SQL>showparameterspfile
NAMETYPEVALUE
-----------------------------------------------------------------------------
spfilestring/tmp/pfile.ora
SQL>shutdownabort
ORACLEinstanceshutdown.
SQL>exit
oracle 12c舍弃dbs下用init.ora中写spfile的路径,我估计是因为12c中有flex cluster。也就是说,instance1 可以跑到节点2主机,那么在节点2主机的dbs目录下,如果按照原来的模式,是有initsid2.ora这个文件,就调不起来instance 1。所以干脆就废弃使用dbs目录下的init文件了。