ITPub博客

首页 > 应用开发 > IT综合 > 和参数相关的一些视图!

和参数相关的一些视图!

原创 IT综合 作者:warehouse 时间:2009-05-04 15:47:23 0 删除 编辑
oracle有好几个和参数相关的视图,它们之间到底有啥区别,下面通过试验以及结合doc来理解一下。[@more@]

1.v$spparameter
这里的sp就是server parameter
doc对它的解释是:

This view displays the current contents of the server parameter file. The view returns FALSE values in the ISSPECIFIED column if a server parameter file is not being used by the instance.

验证一下:

SQL> connect / as sysdba
已连接。
SQL> show parameter spfile

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string E:ORACLEPRODUCT10.2.0DB_1
DATABASESPFILEORCL.ORA
SQL> create pfile from spfile;

文件已创建。

SQL> shutdown immediate
数据库已经关闭。
已经卸载数据库。
ORACLE 例程已经关闭。
SQL> host
Microsoft Windows XP [版本 5.1.2600]
(C) 版权所有 1985-2001 Microsoft Corp.

C:>e:

E:>cd E:ORACLEPRODUCT10.2.0DB_1database

E:oracleproduct10.2.0db_1database>dir
驱动器 E 中的卷没有标签。
卷的序列号是 F6E5-4B31

E:oracleproduct10.2.0db_1database 的目录

2009-05-04 15:10

.
2009-05-04 15:10 ..
2009-04-20 20:18 archive
2009-04-20 20:53 2,048 hc_orcl.dat
2009-05-04 15:10 1,187 INITorcl.ORA
2005-06-25 03:18 31,744 oradba.exe
2009-05-04 08:41 4,233 oradim.log
2009-04-26 00:12 1,536 PWDorcl.ora
2009-05-03 09:46 7,061,504 SNCFORCL.ORA
2009-05-04 14:53 3,584 SPFILEORCL.ORA
7 个文件 7,105,836 字节
3 个目录 2,317,418,496 可用字节

E:oracleproduct10.2.0db_1database>del spfileorcl.ora

E:oracleproduct10.2.0db_1database>dir
驱动器 E 中的卷没有标签。
卷的序列号是 F6E5-4B31

E:oracleproduct10.2.0db_1database 的目录

2009-05-04 15:11

.
2009-05-04 15:11 ..
2009-04-20 20:18 archive
2009-04-20 20:53 2,048 hc_orcl.dat
2009-05-04 15:10 1,187 INITorcl.ORA
2005-06-25 03:18 31,744 oradba.exe
2009-05-04 08:41 4,233 oradim.log
2009-04-26 00:12 1,536 PWDorcl.ora
2009-05-03 09:46 7,061,504 SNCFORCL.ORA
6 个文件 7,102,252 字节
3 个目录 2,317,422,592 可用字节

E:oracleproduct10.2.0db_1database>exit

SQL> startup
ORACLE 例程已经启动。

Total System Global Area 167772160 bytes
Fixed Size 1247900 bytes
Variable Size 79693156 bytes
Database Buffers 83886080 bytes
Redo Buffers 2945024 bytes
数据库装载完毕。
数据库已经打开。
SQL> select distinct isspecified from v$spparameter ;

ISSPEC
------
FALSE
SQL> show parameter spfile

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
spfile string
很显然当实例启动时没有使用spfile启动的时候,isspecified的值都为false,如果
使用spfile启动实例,那么spfile文件中出现的参数其对应的isspecified的值都为true
2.V$SYSTEM_PARAMETER
V$SYSTEM_PARAMETER displays information about the initialization parameters that are currently in effect for the instance. A new session inherits parameter values from the instance-wide values.
这个视图记录的参数是实例受影响的参数,一个session的参数是继承实例的参数的
3.V$PARAMETER
V$PARAMETER displays information about the initialization parameters that are currently in effect for the session. A new session inherits parameter values from the instance-wide values displayed by the V$SYSTEM_PARAMETER view.
针对V$SYSTEM_PARAMETER和V$PARAMETER的介绍,我们简单验证一下:
SQL> select name,value from v$system_parameter where name='sort_area_size';

NAME VALUE
--------------- ---------------------------------------
sort_area_size 65536

SQL> alter session set sort_area_size=1024;

会话已更改。

SQL> select name,value from v$parameter where name='sort_area_size';

NAME VALUE
--------------- ---------------------------------------
sort_area_size 1024
改变session的sort_area_size值之后,我们发现实例的不会变化,呵呵,这个验证其实是多此一举的,地球人都知道。
再来看看修改实例的参数timed_statistic之后,看看session的对应参数是否变化,通过验证的结果来看
当然是随着实例的参数而发生变化
SQL> select name,value from v$system_parameter where name='timed_statistics';

NAME VALUE
--------------- ---------------------------------------
timed_statistic TRUE

SQL> select name,value from v$parameter where name='timed_statistics';

NAME VALUE
--------------- ---------------------------------------
timed_statistic TRUE

SQL> alter system set timed_statistics=false;

系统已更改。

SQL> select name,value from v$system_parameter where name='timed_statistics';

NAME VALUE
--------------- ---------------------------------------
timed_statistic FALSE

SQL> select name,value from v$parameter where name='timed_statistics';

NAME VALUE
--------------- ---------------------------------------
timed_statistic FALSE

SQL>
4.和V$PARAMETER对应的视图还有一个是V$PARAMETER2,
和V$SYSTEM_PARAMETER对应的视图还有一个是V$SYSTEM_PARAMETER,
他们比较好理解了,先看doc的解释:
V$PARAMETER2 This view displays the values of parameters currently in effect. It is easier to distinguish list parameter values in this view because each list parameter value appears as a row.
举个例子来说:
SQL> show parameter control_files

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_files string E:ORACLEPRODUCT10.2.0ORADA
TAORCLCONTROL01.CTL, E:ORAC
LEPRODUCT10.2.0ORADATAORCL
CONTROL02.CTL, E:ORACLEPROD
UCT10.2.0ORADATAORCLCONTRO
L03.CTL
参数control_files有3个值,在视图v$parameter中出现1行,在v$parameter2中出现3行,这就是他们的区别
V$SYSTEM_PARAMETER和V$SYSTEM_PARAMETER2如同v$parameter和v$parameter2
4.v$parameter_valid_values
这个视图非常有用,只是可能人们所重视,它列出来
的是每个参数的可取值。
5.V$OBSOLETE_PARAMETER
这个视图里记录了oracle被废弃的参数

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/19602/viewspace-1021666/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-12-07

  • 博文量
    717
  • 访问量
    5366344