如果是使用pfile,则对数据库参数的更改,都是相当于memory:
MEMORY indicates that the change is made in memory, takes effect immediately, and persists until the database is shut down. If you started up the database using a parameter file (pfile), then this is the only scope you can specify.
如果是使用spfile,则对数据库参数的更改,默认是both(memory+spfile)。
以下这句话道出了两者的区别:
If a server parameter file was used to start up the database, then BOTH is the default. If a parameter file was used to start up the database, then MEMORY is the default, as well as the only scope you can specify.
所以我们在更改参数时,如果是动态参数,最好先看看数据库是从pfile还是从spfile启动的,如果是从pfile启动,更改完了,还要记得手工修改pfile。之后最好执行:
create spfile from pfile。保证下次启动时,数据库从spfile中也能获得最新的参数设置。
[@more@]下面以设置cursor_sharing为例,看看两者的区别:
先看看从spfile启动:
SQL> show parameter cursor_sharing
NAME TYPE VALUE
------------------------------------ -------------------------------- ----------
cursor_sharing string FORCE
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ -------------------------------- ----------
spfile string %ORACLE_HO
SQL> alter system set cursor_sharing=exact;
系统已更改。
SQL> startup force;
ORACLE 例程已经启动。
Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
数据库装载完毕。
数据库已经打开。
SQL> show parameter cursor_sharing;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cursor_sharing string EXACT
SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
可以看出,参数已经更改。
下面看看从pfile启动:
SQL> startup pfile='D:oracleora92databaseINITsky.ORA';
ORACLE 例程已经启动。
Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
数据库装载完毕。
数据库已经打开。
SQL> show parameter spfile
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string
SQL> show parameter cursor_sharing;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cursor_sharing string EXACT
SQL> alter system set cursor_sharing=force
2 ;
系统已更改。
SQL> show parameter cursor_sharing
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cursor_sharing string FORCE
SQL> startup force;
ORACLE 例程已经启动。
Total System Global Area 135338868 bytes
Fixed Size 453492 bytes
Variable Size 109051904 bytes
Database Buffers 25165824 bytes
Redo Buffers 667648 bytes
数据库装载完毕。
数据库已经打开。
SQL> show parameter cursor_sharing
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cursor_sharing string EXACT
SQL> show parameter spfile;
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string %ORACLE_HOME%DATABASESPFILE%
由此可看从pfile中启动,没有发生变化。
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/13171581/viewspace-1001596/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/13171581/viewspace-1001596/