1) 查看参数文件情况,创建pfile
[oracle@ocmu ~]$ cd $ORACLE_HOME/dbs
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
ls: spfile.ora*: No such file or directory
ls: initQQ.ora*: No such file or directory
ls: spfileQQ.ora*: No such file or directory
[oracle@ocmu dbs]$
[oracle@ocmu dbs]$ echo db_name=QQ > initQQ.ora
[oracle@ocmu dbs]$ cat initQQ.ora
db_name=QQ
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
ls: spfile.ora*: No such file or directory
ls: spfileQQ.ora*: No such file or directory
initQQ.ora
[oracle@ocmu dbs]$
2) 利用pfile生成spfile
[oracle@ocmu ~]$ cd $ORACLE_HOME/dbs
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
ls: spfile.ora*: No such file or directory
ls: spfileQQ.ora*: No such file or directory
initQQ.ora
[oracle@ocmu dbs]$ export ORACLE_SID=QQ
[oracle@ocmu dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 5 22:25:52 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SYS@QQ>create spfile from pfile;
File created.
SYS@QQ>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
ls: spfile.ora*: No such file or directory
initQQ.ora spfileQQ.ora
[oracle@ocmu dbs]$
3) 拷贝spfile$ORACLE_SID.ora生成spfile.ora
[oracle@ocmu dbs]$ cp spfileQQ.ora spfile.ora
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
initQQ.ora spfile.ora spfileQQ.ora
[oracle@ocmu dbs]$
4) 启动QQ实例(spfile$ORACLE_SID.ora)
[oracle@ocmu dbs]$ export ORACLE_SID=QQ
[oracle@ocmu dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 5 22:29:27 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SYS@QQ>startup nomount;
ORACLE instance started.
Total System Global Area 146472960 bytes
Fixed Size 1335080 bytes
Variable Size 92274904 bytes
Database Buffers 50331648 bytes
Redo Buffers 2531328 bytes
SYS@QQ>
SYS@QQ>show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0/db_1/dbs/spfileQQ.ora
SYS@QQ>
SYS@QQ>show parameter job
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes integer 1000
SYS@QQ>
SYS@QQ>shutdown abort;
ORACLE instance shut down.
SYS@QQ>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ocmu dbs]$
5) 重命名spfileQQ.ora参数文件
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
initQQ.ora spfile.ora spfileQQ.ora
[oracle@ocmu dbs]$ mv spfileQQ.ora spfileQQ.ora.bak
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
initQQ.ora spfile.ora spfileQQ.ora.bak
[oracle@ocmu dbs]$
6) 启动QQ实例(spfile.ora)
[oracle@ocmu dbs]$ export ORACLE_SID=QQ
[oracle@ocmu dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 5 22:33:30 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SYS@QQ>startup nomount;
ORACLE instance started.
Total System Global Area 146472960 bytes
Fixed Size 1335080 bytes
Variable Size 92274904 bytes
Database Buffers 50331648 bytes
Redo Buffers 2531328 bytes
SYS@QQ>
SYS@QQ>show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string /u01/app/oracle/product/11.2.0/db_1/dbs/spfile.ora
SYS@QQ>show parameter job;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes integer 1000
SYS@QQ>
SYS@QQ>shutdown abort;
ORACLE instance shut down.
SYS@QQ>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ocmu dbs]$
7) 重命名spfile.ora参数文件(同时pfile文件中增加一个参数job_queue_processes=50)
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
initQQ.ora spfile.ora spfileQQ.ora.bak
[oracle@ocmu dbs]$ mv spfile.ora spfile.ora.bak
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
initQQ.ora spfile.ora.bak spfileQQ.ora.bak
[oracle@ocmu dbs]$ echo job_queue_processes=50 >> initQQ.ora
[oracle@ocmu dbs]$ cat initQQ.ora
db_name=QQ
job_queue_processes=50
[oracle@ocmu dbs]$
8) 启动QQ实例(init$ORACLE_SID.ora)
[oracle@ocmu dbs]$ export ORACLE_SID=QQ
[oracle@ocmu dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 5 22:37:37 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SYS@QQ>startup nomount;
ORACLE instance started.
Total System Global Area 146472960 bytes
Fixed Size 1335080 bytes
Variable Size 92274904 bytes
Database Buffers 50331648 bytes
Redo Buffers 2531328 bytes
SYS@QQ>
SYS@QQ>show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string
SYS@QQ>show parameter job;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
job_queue_processes integer 50
SYS@QQ>
SYS@QQ>shutdown abort;
ORACLE instance shut down.
SYS@QQ>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ocmu dbs]$
9) 重命名pfile,再次启动QQ实例
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
initQQ.ora spfile.ora.bak spfileQQ.ora.bak
[oracle@ocmu dbs]$ mv initQQ.ora initQQ.ora.bak
[oracle@ocmu dbs]$ ls spfile.ora* initQQ.ora* spfileQQ.ora*
initQQ.ora.bak spfile.ora.bak spfileQQ.ora.bak
[oracle@ocmu dbs]$ export ORACLE_SID=QQ
[oracle@ocmu dbs]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Wed Sep 5 22:39:21 2012
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SYS@QQ>startup nomount;
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initQQ.ora'
SYS@QQ>
小结:
通过上面的实验,我们会发现,oracle在启动的时候,会优先使用spfile$ORACLE_SID.ora,如果spfile$ORACLE_SID.ora不存在的话,那么会使用spfile.ora,如果spfile.orau不存在的话,那么会使用init$ORACLE_SID.ora(即pfile)。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/685769/viewspace-742758/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/685769/viewspace-742758/