查询初始化参数的方法很多,比如SHOW PARAMETER,或查询V$PARAMETER等,这里简单总结一下。

这一篇描述CREATE PFILE的方法检查初始化参数。

前面介绍了很多种方法,这些方法都是在数据库中查询初始化参数的设置。其实还有一种方法更加的一目了然,就是CREATE PFILE的方式:

SQL> show parameter spfile

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

spfile                               string      +DATA/test/spfiletest.ora

SQL> create pfile = '/export/home/oracle/inittest1.ora' from spfile;

文件已创建。

SQL> host more /export/home/oracle/inittest1.ora

test2.__db_cache_size=541065216

test1.__db_cache_size=524288000

test2.__java_pool_size=4194304

test1.__java_pool_size=4194304

test2.__large_pool_size=4194304

test1.__large_pool_size=4194304

test1.__oracle_base='/data/oracle'#ORACLE_BASE set from environment

test2.__oracle_base='/data/oracle'#ORACLE_BASE set from environment

test2.__pga_aggregate_target=260046848

test1.__pga_aggregate_target=260046848

test2.__sga_target=775946240

test1.__sga_target=775946240

test2.__shared_io_pool_size=0

test1.__shared_io_pool_size=0

test2.__shared_pool_size=218103808

test1.__shared_pool_size=234881024

test2.__streams_pool_size=0

test1.__streams_pool_size=0

*.audit_file_dest='/data/oracle/admin/test/adump'

*.audit_trail='db'

*.cluster_database=true

*.cluster_database_instances=3

*.compatible='11.1.0.0.0'

*.control_files='+DATA/test/controlfile/current.529.684067899'

*.db_block_size=8192

*.db_create_file_dest='+DATA'

*.db_domain=''

*.db_name='test'

*.diagnostic_dest='/data/oracle'

test1.instance_number=1

test2.instance_number=2

*.log_archive_config=''

*.log_archive_dest_1='LOCATION=/data/oracle/oradata/test/archivelog'

*.open_cursors=300

test1.open_cursors=500

test2.open_cursors=700

*.pga_aggregate_target=256901120

*.processes=150

*.remote_login_passwordfile='EXCLUSIVE'

test1.remote_login_passwordfile='SHARED'

*.sga_target=772800512

test1.thread=1

test2.thread=2

*.undo_tablespace='UNDOTBS1'

test2.undo_tablespace='UNDOTBS2'

使用了这个语句,所有的SPFILE中设置的初始化参数设置都一目了然。

除了CREATE PFILE FROM SPFILE外,11g还增加了CREATE PFILE FROM MEMORY选项,使得用户可以直接从数据库当前生效的参数来生成PFILE文件,利用这个方法,就可以解决上一篇文章最后介绍的PFILE中设置的实例级参数覆盖SPFILE中数据库级参数的情况:

SQL> create pfile = '/export/home/oracle/inittest1.ora' from memory;

文件已创建。

SQL> host more /export/home/oracle/inittest1.ora

# Oracle init.ora parameter file generated by instance test1 on 06/12/2009 15:18:46

test1.__db_cache_size=500M

test2.__db_cache_size=516M

*.__java_pool_size=4M

*.__large_pool_size=4M

*.__oracle_base='/data/oracle' # ORACLE_BASE set from environment

*.__pga_aggregate_target=248M

*.__sga_target=740M

*.__shared_io_pool_size=0

test1.__shared_pool_size=224M

test2.__shared_pool_size=208M

*.__streams_pool_size=0

*._always_anti_join='CHOOSE'

*._always_semi_join='CHOOSE'

*._b_tree_bitmap_plans=TRUE

*._bloom_filter_enabled=TRUE

*._bloom_pruning_enabled=TRUE

*._complex_view_merging=TRUE

*._convert_set_to_join=FALSE

*._cost_equality_semi_join=TRUE

*._cpu_to_io=0

*._dimension_skip_null=TRUE

*._eliminate_common_subexpr=TRUE

*._enable_type_dep_selectivity=TRUE

*._fast_full_scan_enabled=TRUE

*._first_k_rows_dynamic_proration=TRUE

*._gby_hash_aggregation_enabled=TRUE

*._generalized_pruning_enabled=TRUE

*._globalindex_pnum_filter_enabled=TRUE

*._gs_anti_semi_join_allowed=TRUE

*._improved_outerjoin_card=TRUE

*._improved_row_length_enabled=TRUE

*._index_join_enabled=TRUE

*._ksb_restart_policy_times='0'

*._ksb_restart_policy_times='60'

*._ksb_restart_policy_times='120'

*._ksb_restart_policy_times='240' # internal update to set default

*._left_nested_loops_random=TRUE

*._local_communication_costing_enabled=TRUE

*._minimal_stats_aggregation=TRUE

*._mmv_query_rewrite_enabled=TRUE

*._new_initial_join_orders=TRUE

*._new_sort_cost_estimate=TRUE

*._nlj_batching_enabled=1

*._optim_adjust_for_part_skews=TRUE

*._optim_enhance_nnull_detection=TRUE

*._optim_new_default_join_sel=TRUE

*._optim_peek_user_binds=TRUE

*._optimizer_adaptive_cursor_sharing=TRUE

*._optimizer_better_inlist_costing='ALL'

*._optimizer_cbqt_no_size_restriction=TRUE

*._optimizer_complex_pred_selectivity=TRUE

*._optimizer_compute_index_stats=TRUE

*._optimizer_connect_by_combine_sw=TRUE

*._optimizer_connect_by_cost_based=TRUE

*._optimizer_correct_sq_selectivity=TRUE

*._optimizer_cost_based_transformation='LINEAR'

*._optimizer_cost_hjsmj_multimatch=TRUE

*._optimizer_cost_model='CHOOSE'

*._optimizer_dim_subq_join_sel=TRUE

*._optimizer_distinct_elimination=TRUE

*._optimizer_enable_density_improvements=TRUE

*._optimizer_enable_extended_stats=TRUE

*._optimizer_enhanced_filter_push=TRUE

*._optimizer_extend_jppd_view_types=TRUE

*._optimizer_extended_cursor_sharing='UDO'

*._optimizer_extended_cursor_sharing_rel='SIMPLE'

*._optimizer_extended_stats_usage_control=240

*._optimizer_filter_pred_pullup=TRUE

*._optimizer_fkr_index_cost_bias=10

*._optimizer_group_by_placement=TRUE

*._optimizer_improve_selectivity=TRUE

*._optimizer_join_elimination_enabled=TRUE

*._optimizer_join_order_control=3

*._optimizer_join_sel_sanity_check=TRUE

*._optimizer_max_permutations=2000

*._optimizer_mode_force=TRUE

*._optimizer_multi_level_push_pred=TRUE

*._optimizer_native_full_outer_join='FORCE'

*._optimizer_new_join_card_computation=TRUE

*._optimizer_null_aware_antijoin=TRUE

*._optimizer_or_expansion='DEPTH'

*._optimizer_order_by_elimination_enabled=TRUE

*._optimizer_outer_to_anti_enabled=TRUE

*._optimizer_push_down_distinct=0

*._optimizer_push_pred_cost_based=TRUE

*._optimizer_rownum_bind_default=10

*._optimizer_rownum_pred_based_fkr=TRUE

*._optimizer_skip_scan_enabled=TRUE

*._optimizer_sortmerge_join_inequality=TRUE

*._optimizer_squ_bottomup=TRUE

*._optimizer_star_tran_in_with_clause=TRUE

*._optimizer_system_stats_usage=TRUE

*._optimizer_transitivity_retain=TRUE

*._optimizer_undo_cost_change='11.1.0.6'

*._or_expand_nvl_predicate=TRUE

*._ordered_nested_loop=TRUE

*._parallel_broadcast_enabled=TRUE

*._partition_view_enabled=TRUE

*._pivot_implementation_method='CHOOSE'

*._pre_rewrite_push_pred=TRUE

*._pred_move_around=TRUE

*._push_join_predicate=TRUE

*._push_join_union_view=TRUE

*._push_join_union_view2=TRUE

*._px_minus_intersect=TRUE

*._px_pwg_enabled=TRUE

*._px_ual_serial_input=TRUE

*._query_rewrite_setopgrw_enable=TRUE

*._remove_aggr_subquery=TRUE

*._right_outer_hash_enable=TRUE

*._selfjoin_mv_duplicates=TRUE

*._sql_model_unfold_forloops='RUN_TIME'

*._sqltune_category_parsed='DEFAULT' # parsed sqltune_category

*._subquery_pruning_enabled=TRUE

*._subquery_pruning_mv_enabled=FALSE

*._table_scan_cost_plus_one=TRUE

*._union_rewrite_for_gs='YES_GSET_MVS'

*._unnest_subquery=TRUE

*._use_column_stats_for_function=TRUE

*.audit_file_dest='/data/oracle/admin/test/adump'

*.audit_trail='DB'

*.cluster_database=TRUE

*.cluster_database_instances=3

*.compatible='11.1.0.0.0'

*.control_files='+DATA/test/controlfile/current.529.684067899'

test1.core_dump_dest='/data/oracle/diag/rdbms/test/test1/cdump'

test2.core_dump_dest='/data/oracle/diag/rdbms/test/test2/cdump'

*.db_block_size=8192

*.db_create_file_dest='+DATA'

*.db_domain=''

*.db_name='test'

*.diagnostic_dest='/data/oracle'

test1.instance_number=1

test2.instance_number=2

*.log_archive_config=''

*.log_archive_dest_1='LOCATION=/data/oracle/oradata/test/archivelog'

*.log_buffer=4197376 # log buffer update

*.open_cursors=500

*.optimizer_dynamic_sampling=2

*.optimizer_mode='ALL_ROWS'

*.pga_aggregate_target=245M

*.plsql_warnings='DISABLE:ALL' # PL/SQL warnings at init.ora

*.processes=150

*.query_rewrite_enabled='TRUE'

test1.remote_login_passwordfile='SHARED'

test2.remote_login_passwordfile='EXCLUSIVE'

*.resource_manager_plan=''

*.result_cache_max_size=3808K

*.sga_target=740M

*.skip_unusable_indexes=TRUE

test1.thread=1

test2.thread=2

test1.undo_tablespace='UNDOTBS1'

test2.undo_tablespace='UNDOTBS2'

但是这种方法显然也存在问题,首先从得到的结果看,里面除了包含用户设置的初始化参数外,还包含了大量的隐含参数。如果这些隐患参数是Oracle用于自动调整的双下划线参数也不奇怪,问题是大部分都是Oracle不推荐设置的单下划线隐含参数。不过这倒是一个查看Oracle隐患参数的好办法。

另外一个问题是,这个方法只对当前实例设置的参数有效,而无法合并多个实例的设置,对比上面的OPEN_CURSORS参数的设置和下面查询的结果就可以发现这个问题:

SQL> select sid, name, value

2  from v$spparameter

3  where name = 'open_cursors';

SID        NAME                           VALUE

---------- ------------------------------ --------------------------------------------------

*          open_cursors                   300

test1      open_cursors                   500

test2      open_cursors                   700

SQL> select inst_id, name, value

2  from gv$system_parameter

3  where name = 'open_cursors';

INST_ID NAME                           VALUE

---------- ------------------------------ --------------------------------------------------

1 open_cursors                   500

2 open_cursors                   500

显然CREATE PFILE获取的结果和SPFILE中的设置并不相符,下面修改一下初始化参数OPEN_CURSORS的值:

SQL> alter system set open_cursors = 400;

系统已更改。

SQL> create pfile = '/export/home/oracle/inittest1.ora' from memory;

文件已创建。

SQL> host more /export/home/oracle/inittest1.ora | grep open_cursors

*.open_cursors=400

从这个结果可以看到,CREATE PFILE获取的PFILE只对当前实例有效,虽然获取的结果包含多个实例的设置,但是这些设置可能和其他实例上的真正设置并不相符。

oracle视频教程请关注:http://u.youku.com/user_video/id_UMzAzMjkxMjE2.html

转载于:https://blog.51cto.com/19880614/1199763

oracle技术之查询初始化参数的方法(六)相关推荐

  1. oracle并行查询结果不唯一,Oracle数据库并行查询出错的解决方法

    Oracle的并行查询是使用多个操作系统级别的Server Process来同时完成一个SQL查询,本文讲解Oracle数据库并行查询出错的解决方法如下: 1.错误描述 sql;"> ...

  2. oracle 查看并行数据库,Oracle数据库并行查询出错的解决方法

    Oracle的并行查询是使用多个操作系统级别的Server Process来同时完成一个SQL查询,本文讲解Oracle数据库并行查询出错的解决方法如下: 1.错误描述 ORA-12801: 并行查询 ...

  3. oracle 查询会话数量,Oracle会话数量查询及结束会话方法

    Oracle会话数量查询及结束会话方法 一.数据库会话数量查询 查询当前数据库会话数量:select * from v$session 修改数据库最大会话数量:alter system set pro ...

  4. oracle adjusting parallel,Oracle 并行相关的初始化参数

    Oracle数据库并行操作,特别是在RAC环境,一定程度上能够提升数据库的性能,所以对相关的初始化参数的了解是必要的,这篇文章将根据实际的案例讨论Oracle数据库的部分并行参数. Oracle数据库 ...

  5. oracle数据库gold,Oracle技术之goldedgate初始化数据

    一.mysql数据库初始化 1.source端配置 ADD EXTRACT EINI1, SOURCEISTABLE EDIT PARAMS EINI1 EXTRACT EINI1 sourcedb ...

  6. oracle的子查询分几种方法,oracle 子查询的几个种类

    1.where型子查询: select cat_id,good_id,good_name from goods where good_id in (selctmax(good_id)from good ...

  7. Oracle数据库的并行查询,解决Oracle数据库并行查询出错的方法

    当我们在使用Oracle数据库的时候会发现Oracle数据库并行查询出错这一问题,那么你知道如何解决Oracle数据库并行查询出错吗?下面就是解决Oracle数据库并行查询出错的方法介绍. Oracl ...

  8. oracle 从pflie启动,oracle初始化参数文件管理

    oracle实例是指运行状态下的oracle软件,是由内存结构跟一些进程结构组成的,主要实现数据库的访问跟控制功能,是oracle的核心. 初始化参数文件是oracle实例运行所需要的参数配置文件,o ...

  9. Servlet的初始化参数

    确保接收和输出的数据不出现乱码.需要对request和response进行转码 request.setCharacterEncoding(charset);response.setCharacterE ...

最新文章

  1. 《科学》十大年度科学突破反映的新动向
  2. AbstractQueuedSynchronizer理解之一(ReentrantLock)
  3. 转:验证curl_init() 返回 false时..
  4. python函数文档说明调用方式_Python函数参数调用
  5. hdu 1285 确定比赛名次
  6. BZOJ3707 圈地
  7. r语言degseq2_第二次RNA-seq实战总结(3)-用DESeq2进行基因表达差异分析
  8. 华为主题包hwt下载_hwtTool下载-华为主题开发工具下载 v9.0.2.301 官方版[百度网盘资源] - 安下载...
  9. ubuntu安装teamview
  10. 数据分析 | 多元线性回归
  11. 算法竞赛入门经典(第二版)_1入门
  12. 2020年《时间的朋友》跨年演讲金句集锦
  13. RuntimeWarning: divide by zero encountered in log错误解决
  14. android 高通手机精品游戏合集
  15. 虚拟机装vpn,主机通过虚拟机的vpn代理实现vpn共享
  16. linux下,代码阅读工具,understand
  17. XiaomiRouter自学之路(13-U-boot支持web更新firmware功能)
  18. android手机下开发摄像头拍摄
  19. 小猴吃桃matlab,大班美工区小猴吃桃教案反思
  20. 行业分析-全球与中国塑料垫料市场现状及未来发展趋势

热门文章

  1. uva 11269——Setting Problems
  2. 用栈和递归求解迷宫问题
  3. Linux USB札记
  4. 【C++学习笔记三】C++多态、抽象(接口)
  5. HDU6428-Calculate-数论函数
  6. BZOJ2115XOR——线性基
  7. Linux内核线程kernel thread详解--Linux进程的管理与调度
  8. Linux程序设计01:开发工具和开发平台
  9. 保驾护航金三银四,100%好评!
  10. 这些新技术你们都知道吗?成功收获美团,小米安卓offer