PFILE与SPFILE的一点区别

如果是使用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/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值