Reset参数的使用
作者 :OoNiceDream【转载时请务必以超链接形式标明文章原始出处和作者信息】
链接:http://www.dbaroad.me/archives/2009/08/reset_parameter.html
链接:http://www.dbaroad.me/archives/2009/08/reset_parameter.html
Alter system reset用于重置SPFILE中的参数设置,常见的用法,例如我们为获取数据库信息而设置了EVENT参数,收集到相关信息后,需要重置EVENT参数。
既然是针对SPFILE的,那在SPFILE中就需要有相关条目了,否则就无内容可删了,所以操作前,可以先查查v$spparameter:
SQL> select sid,name,value,isspecified from v$spparameter 2 where name = 'event'; SID NAME VALUE ISSPEC ---------- -------------------- -------------------- ------ * event FALSE SQL> alter system reset event scope=spfile sid='*'; alter system reset event scope=spfile sid='*' * ERROR at line 1: ORA-32010: cannot find entry to delete in SPFILE |
同一个参数,如果在SPIFE中存在多个条目,这时根据指定的SID进行删除就可以了:
SQL> alter system set open_cursors=2000 scope=spfile sid='*'; System altered. SQL> alter system set open_cursors=2000 scope=spfile sid='TADBA'; System altered. SQL> select sid,name,value,isspecified from v$spparameter 2 where name = 'open_cursors'; SID NAME VALUE ISSPEC ---------- -------------------- -------------------- ------ * open_cursors 2000 TRUE TADBA open_cursors 2000 TRUE SQL> alter system reset open_cursors scope=spfile sid='*'; System altered. SQL> select sid,name,value,isspecified from v$spparameter 2 where name = 'open_cursors'; SID NAME VALUE ISSPEC ---------- -------------------- -------------------- ------ TADBA open_cursors 2000 TRUE SQL> alter system reset open_cursors scope=spfile sid='TADBA'; System altered. SQL> select sid,name,value,isspecified from v$spparameter 2 where name = 'open_cursors'; SID NAME VALUE ISSPEC ---------- -------------------- -------------------- ------ * open_cursors FALSE |
另外使用reset时,虽然可以指定scope为both或memory,但实际上对当前设置并不影响,仍然只作用于spfile,并且指定scope为both或memory时,SID还不能为*,所以一般用不到:
SQL> alter system set open_cursors=2000 scope=both sid='TADBA'; System altered. SQL> select sid,name,value,isspecified from v$spparameter 2 where name = 'open_cursors'; SID NAME VALUE ISSPEC ---------- -------------------- ------------------------------ ------ TADBA open_cursors 2000 TRUE SQL> select name,value,issys_modifiable from v$parameter 2 where name = 'open_cursors'; NAME VALUE ISSYS_MOD -------------------- ------------------------------ --------- open_cursors 2000 IMMEDIATE 以下可以看出reset只作用于spfile: SQL> alter system reset open_cursors scope=both sid='TADBA'; System altered. SQL> select sid,name,value,isspecified from v$spparameter 2 where name = 'open_cursors'; SID NAME VALUE ISSPEC ---------- -------------------- ------------------------------ ------ * open_cursors FALSE SQL> select name,value,issys_modifiable from v$parameter 2 where name = 'open_cursors'; NAME VALUE ISSYS_MOD -------------------- ------------------------------ --------- open_cursors 2000 IMMEDIATE SQL> |
以下可以看出,此时sid不能指定为*:
SQL> select sid,name,value,isspecified from v$spparameter 2 where name = 'open_cursors'; SID NAME VALUE ISSPEC ---------- -------------------- ------------------------------ ------ * open_cursors 2000 TRUE SQL> alter system reset open_cursors scope=both sid='*'; alter system reset open_cursors scope=both sid='*' * ERROR at line 1: ORA-32009: cannot reset the memory value for instance * from instance TADBA |
所以,使用reset关键就一点,查查v$spparameter,根据spfile设置进行操作就可以了。
— The End —
关键字: 基础知识


站内搜索