oracle实例启动的参数文件选择顺序为spfile$ORACLE_SID.ora -> spfile.ora -> init$ORACLE_SID.ora。
下面做实验验证。
[oracle@localhost dbs]$ echo $ORACLE_SID
iloveqhdb
[oracle@localhost dbs]$ export ORACLE_SID=hellokitty
[oracle@localhost dbs]$ echo $ORACLE_SID
hellokitty
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed May 25 08:25:44 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> ! ls
afiedt.buf hc_iloveqhdb.dat hc_wangfeng.dat initiloveqhdb.ora init.ora lkILOVEQHDlkILOVEQHDB orapwiloveqhdb
SQL> ! cp initiloveqhdb.ora spfile$ORACLE_SID.ora
SQL> ! ls
afiedt.buf hc_iloveqhdb.dat hc_wangfeng.dat initiloveqhdb.ora init.ora lkILOVEQHDlkILOVEQHDB orapwiloveqhdb spfilehellokitty.ora
SQL> startup nomount
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/11.2.0.4/db_home1/dbs/inithellokitty.ora'
SQL> exit
Disconnected
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$ cat spfilehellokitty.ora
iloveqhdb.__db_cache_size=574619648
iloveqhdb.__java_pool_size=4194304
iloveqhdb.__large_pool_size=16777216
iloveqhdb.__pga_aggregate_target=268435456
iloveqhdb.__sga_target=805306368
iloveqhdb.__shared_io_pool_size=0
iloveqhdb.__shared_pool_size=197132288
iloveqhdb.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/iloveqhdb/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='+DATA/iloveqhdb/controlfile/current.261.912462939','+DATA/iloveqhdb/controlfile/current.260.912462939'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain='wf'
*.db_name='iloveqhd'
*.db_recovery_file_dest='+DATA'
*.db_recovery_file_dest_size=4385144832
*.db_unique_name='iloveqhdb'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=iloveqhdbXDB)'
*.local_listener='LISTENER_ILOVEQHDB'
*.open_cursors=300
*.pga_aggregate_target=268435456
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=805306368
*.undo_tablespace='UNDOTBS1'
[oracle@localhost dbs]$ source $HOME/.bash_profile
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed May 25 08:28:28 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Automatic Storage Management option
SQL> create spfile from spfile;
create spfile from spfile
*
ERROR at line 1:
ORA-00922: missing or invalid option
SQL> create spfile from memory;
File created.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Automatic Storage Management option
[oracle@localhost dbs]$ ls
afiedt.buf hc_wangfeng.dat init.ora lkILOVEQHDB spfilehellokitty.ora
hc_iloveqhdb.dat initiloveqhdb.ora lkILOVEQHD orapwiloveqhdb spfileiloveqhdb.ora
[oracle@localhost dbs]$ rm spfilehellokitty.ora
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$
[oracle@localhost dbs]$ export ORACLE_SID=hellokitty
[oracle@localhost dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Wed May 25 08:30:20 2016
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> ! ls
afiedt.buf hc_iloveqhdb.dat hc_wangfeng.dat initiloveqhdb.ora init.ora lkILOVEQHDlkILOVEQHDB orapwiloveqhdb spfileiloveqhdb.ora
SQL> startup nomount
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/11.2.0.4/db_home1/dbs/inithellokitty.ora'
SQL> ! cp spfileiloveqhdb.ora spfile$ORACLE_SID.ora
SQL> ! ls
afiedt.buf hc_wangfeng.dat init.oralkILOVEQHDBspfilehellokitty.ora
hc_iloveqhdb.dat initiloveqhdb.ora lkILOVEQHD orapwiloveqhdb spfileiloveqhdb.ora
SQL> startup nomount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 801701888 bytes
Fixed Size 2257520 bytes
Variable Size 281021840 bytes
Database Buffers 511705088 bytes
Redo Buffers 6717440 bytes
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> ! cp spfilehellokitty.ora spfile.ora
SQL> !ls
afiedt.buf hc_iloveqhdb.dat initiloveqhdb.oralkILOVEQHD orapwiloveqhdb spfileiloveqhdb.ora
hc_hellokitty.dat hc_wangfeng.dat init.ora lkILOVEQHDB spfilehellokitty.ora spfile.ora
SQL> startup nomount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 801701888 bytes
Fixed Size 2257520 bytes
Variable Size 281021840 bytes
Database Buffers 511705088 bytes
Redo Buffers 6717440 bytes
SQL> show parametet pfile
SP2-0158: unknown SHOW option "parametet"
SP2-0158: unknown SHOW option "pfile"
SQL> show parameter pfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string/u01/app/oracle/11.2.0.4/db_ho
me1/dbs/spfilehellokitty.ora
SQL> ! rm spfilehellokitty.ora
SQL> ! ls
afiedt.buf hc_iloveqhdb.dat initiloveqhdb.oralkILOVEQHD orapwiloveqhdb spfile.ora
hc_hellokitty.dat hc_wangfeng.dat init.ora lkILOVEQHDB spfileiloveqhdb.ora
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount
ORA-32004: obsolete or deprecated parameter(s) specified for RDBMS instance
ORACLE instance started.
Total System Global Area 801701888 bytes
Fixed Size 2257520 bytes
Variable Size 281021840 bytes
Database Buffers 511705088 bytes
Redo Buffers 6717440 bytes
SQL> show parameter pfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string/u01/app/oracle/11.2.0.4/db_ho
me1/dbs/spfile.ora
SQL>
SQL> ! rm spfile.ora
SQL> ! ls
afiedt.buf hc_hellokitty.dat hc_iloveqhdb.dat hc_wangfeng.dat initiloveqhdb.ora init.ora lkILOVEQHD lkILOVEQHDBorapwiloveqhdbspfileiloveqhdb.ora
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> startup nomount
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/11.2.0.4/db_home1/dbs/inithellokitty.ora'
SQL> ! echo "db_name=hellokitty">init$ORACLE_SID.ora
SQL> !ls
afiedt.buf hc_iloveqhdb.dat inithellokitty.ora init.ora lkILOVEQHDB spfileiloveqhdb.ora
hc_hellokitty.dat hc_wangfeng.dat initiloveqhdb.oralkILOVEQHD orapwiloveqhdb
SQL> startup nomount
ORA-01127: database name 'hellokitty' exceeds size limit of 8 characters
SQL> ! echo "db_name=kitty">init${ORACLE_SID}.ora
SQL> ! ls
afiedt.buf hc_iloveqhdb.dat inithellokitty.ora init.ora lkILOVEQHDB spfileiloveqhdb.ora
hc_hellokitty.dat hc_wangfeng.dat initiloveqhdb.oralkILOVEQHD orapwiloveqhdb
SQL> startup nomount
ORACLE instance started.
Total System Global Area 263090176 bytes
Fixed Size 2252256 bytes
Variable Size 205521440 bytes
Database Buffers 50331648 bytes
Redo Buffers 4984832 bytes
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> ! cp initiloveqhdb.ora pfile.ora
SQL> !ls
afiedt.buf hc_iloveqhdb.dat inithellokitty.ora init.ora lkILOVEQHDB pfile.ora
hc_hellokitty.dat hc_wangfeng.dat initiloveqhdb.oralkILOVEQHD orapwiloveqhdb spfileiloveqhdb.ora
SQL> startup pfile='pfile.ora' nomount
ORACLE instance started.
Total System Global Area 801701888 bytes
Fixed Size 2257520 bytes
Variable Size 276827536 bytes
Database Buffers 515899392 bytes
Redo Buffers 6717440 bytes
SQL> show parameter pfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string
SQL> shutdown immediate
ORA-01507: database not mounted
ORACLE instance shut down.
SQL> ! ls -l
total 60
-rw-r--r--. 1 oracle oinstall 66 May 22 06:28 afiedt.buf
-rw-rw----. 1 oracle asmadmin 1544 May 25 09:11 hc_hellokitty.dat
-rw-rw----. 1 oracle asmadmin 1544 May 22 10:29 hc_iloveqhdb.dat
-rw-rw----. 1 oracle asmadmin 1544 May 25 08:10 hc_wangfeng.dat
-rw-r--r--. 1 oracle oinstall 14 May 25 08:40 inithellokitty.ora
-rw-r-----. 1 oracle oinstall 990 May 22 02:41 initiloveqhdb.ora
-rw-r--r--. 1 oracle oinstall 2851 May 15 2009 init.ora
-rw-r-----. 1 oracle asmadmin 24 May 21 21:46 lkILOVEQHD
-rw-r-----. 1 oracle asmadmin 24 May 21 21:46 lkILOVEQHDB
-rw-r-----. 1 oracle oinstall 1536 May 22 06:50 orapwiloveqhdb
-rw-r-----. 1 oracle oinstall 990 May 25 08:43 pfile.ora
-rw-r-----. 1 oracle asmadmin 14848 May 25 08:29 spfileiloveqhdb.ora
SQL> ! rm pfile
rm: cannot remove ‘pfile’: No such file or directory
SQL> ! rm pfile.ora
SQL> ! cat inithellokitty.ora
db_name=kitty
SQL> ! rm inithellokitty.ora
SQL> ! touch inithellokitty.ora
SQL> startup nomount
ORA-01506: missing or illegal database name
SQL>