RollingPig
自我介绍
切换风格
订阅我的Blog
博客日历
文章归档...
最新发表...
博客统计...
网站链接...
资源
===========================================================
让sqlplus 里的show parameter 直接显示oracle隐含参数
===========================================================

Oracle 启动用到了初始化参数,通常我们都可以在sqlplus里用show parameter 来获得。而Oracle为了debug 或者解决一些特殊的问题,还提供了一些以“_”开头的隐含参数。 网络上有一些script可以让我们轻松检查这些隐含参数. 但是,有没有想过,我们可以直接在sqlplus 用show parameter 来获取这些隐含参数呢?

答案是可以的。

下面,我将演示一下如何用sqlplus 里的 show parameter来直接查看Oracle隐含参数.


1。首先,我们先要知道,sqlplus怎样通过show parameter获得参数的。通过sql_trace的方式可以发现。

sqlplus serol/luo

alter session set sql_trace=true;

show parameter optimizer

NAME TYPE VALUE
------------------------------------ -------------------------------- ------------------------------

optimizer_dynamic_sampling integer 1
optimizer_features_enable string 9.2.0.1
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 1
optimizer_max_permutations integer 2000
optimizer_mode string RULE

exit

到udump底下找到trace文件,里面的最主要的语句是:

SELECT NAME name_col_plus_show_param,DECODE(TYPE,1,'boolean',2,'string',3,'integer',4,'file',6,'big
integer','unknown') TYPE,VALUE value_col_plus_show_param FROM V$PARAMETER WHERE UPPER(NAME) LIKE UPP
ER('%optimizer%') ORDER BY name_col_plus_show_param,ROWNUM

可以看到,sqlplus的show parameter实际上就是查询V$PARAMETER .

2. 看看 v$parameter的定义。

SELECT * FROM v$fixed_view_definition
WHERE view_name = 'V$PARAMETER';

select NUM , NAME , TYPE , VALUE , ISDEFAULT , ISSES_MODIFIABLE , ISSYS_MODIFIABLE , ISMODIFIED , ISADJUSTED , DESCRIPTION, UPDATE_COMMENT from GV$PARAMETER where inst_id = USERENV('Instance')

SELECT * FROM v$fixed_view_definition
WHERE view_name = 'GV$PARAMETER';

select x.inst_id,x.indx+1,ksppinm,ksppity,ksppstvl,ksppstdf,
decode(bitand(ksppiflg/256,1),1,'TRUE','FALSE'),
decode(bitand(ksppiflg/65536,3),1,'IMMEDIATE',2,'DEFERRED',
3,'IMMEDIATE','FALSE'), decode(bitand(ksppstvf,7),1,'MODIFIED',4,'SYSTEM_MOD','FALSE'),
decode(bitand(ksppstvf,2),2,'TRUE','FALSE'), ksppdesc, ksppstcmnt
from x$ksppi x, x$ksppcv y
where (x.indx = y.indx) and ( (translate(ksppinm,'_','#') not like '#%') or (ksppstdf = 'FALSE') )

看到上面最关键的 (translate(ksppinm,'_','#') not like '#%')的条件了吗?,就是它把开头为"_" 的隐含参数给过滤掉了。当然,ksppstdf = 'FALSE' 的条件是为了保证如果已经手动改过隐含参数,show parameter还会显示改隐含参数

3。我们可以伪造一个v$parameter, 去掉过滤"_"的条件,就可以大功告成了。

不过,毕竟是改动系统的内部设置,大家一定要小心为上。

一定要以一个仅用于数据库管理,不会参加任何程序活动的管理性数据库用户来伪造这个v$parameter,以免发生意外。而且,最好是在测试环境中玩,而不要跑到生产环境里面。下面假设这个用户名为:rollingpig.

以sys 登陆

connect / as sysdba

create view my_v$parameter_with_hidden (NUM,NAME , TYPE , Value , ISDEFAULT , ISSES_MODIFIABLE , ISSYS_MODIFIABLE ,ISMODIFIED , ISADJUSTED, DESCRIPTION, UPDATE_COMMENT)

as

select x.indx+1,ksppinm,ksppity,ksppstvl,ksppstdf,
decode(bitand(ksppiflg/256,1),1,'TRUE','FALSE'),
decode(bitand(ksppiflg/65536,3),1,'IMMEDIATE',2,'DEFERRED',
3,'IMMEDIATE','FALSE'), decode(bitand(ksppstvf,7),1,'MODIFIED',4,'SYSTEM_MOD','FALSE'),
decode(bitand(ksppstvf,2),2,'TRUE','FALSE'), ksppdesc, ksppstcmnt
from x$ksppi x, x$ksppcv y
where (x.indx = y.indx);

grant select on my_v$parameter_with_hidden to rollingpig;

以 rollingpig 用户连接,创建同义词:

create synonym v$parameter for sys.my_v$parameter_with_hidden ;

4。大功告成,测试一下吧

以rollingpig 用户登陆:

show parameter optimizer

SQL> show parameter optimizer

NAME TYPE VALUE
------------------------------------ -------------------------------- ------------------------------
_optimizer_adjust_for_nulls boolean TRUE
_optimizer_choose_permutation integer 0
_optimizer_cost_model string CHOOSE
_optimizer_degree integer 0
_optimizer_dyn_smp_blks integer 32
_optimizer_join_sel_sanity_check boolean FALSE
_optimizer_mode_force boolean TRUE
_optimizer_new_join_card_computation boolean TRUE
_optimizer_percent_parallel integer 101
_optimizer_search_limit integer 5
_optimizer_skip_scan_enabled boolean TRUE
_optimizer_sortmerge_join_enabled boolean TRUE
_optimizer_system_stats_usage integer 0
_optimizer_undo_changes boolean FALSE
_optimizer_undo_cost_change string 9.2.0.1
optimizer_dynamic_sampling integer 1
optimizer_features_enable string 9.2.0.1
optimizer_index_caching integer 0
optimizer_index_cost_adj integer 1
optimizer_max_permutations integer 2000
optimizer_mode string RULE

以"_"开头的隐含参数一个给跑出来了,optimizer开头的还真不少 :D

还有一些明显是测试用的hidden parameter

SQL> show parameter test

NAME TYPE VALUE
------------------------------------ -------------------------------- ------------------------------
_ipc_test_failover integer 0
_ipc_test_mult_nets integer 0
_test_ksusigskip integer 5
_test_param_1 integer 25
_test_param_2 string
_test_param_3 string
_test_param_4 string
_test_param_5 integer 25
_test_param_6 big integer 0

最后重申一点:

是在测试环境中玩,不要跑到生产环境里面中玩哦……

rollingpig 发表于:2007.07.25 14:52 ::分类: ( My Oracle Article ) ::阅读:(4170次) :: 评论 (18) :: 引用 (0)
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

这些隐含参数不敢随便使用!不过还是挺有意思的!

Fenggu 评论于:2007.08.02 09:29
Paxil is a selective serotonin reuptake inhibitor (SSRI) used to treat depression, panic attacks, obsessive compulsive disorders (OCD), social anxiety disorder marijuana and paxil [回复]

Paxil is a selective serotonin reuptake inhibitor (SSRI) used to treat depression, panic attacks, obsessive compulsive disorders (OCD), social anxiety disorder
marijuana and paxil

Graham 评论于:2008.05.18 05:00
Viagra is the brand name for sildenafil. The impotence drugs work by inhibiting enzymes that degrade cGMP, thereby enhancing a mans ability to obtain and sustain a suitable erection. der kleine nils viagra [回复]

Viagra is the brand name for sildenafil. The impotence drugs work by inhibiting enzymes that degrade cGMP, thereby enhancing a mans ability to obtain and sustain a suitable erection.
der kleine nils viagra

Sam 评论于:2008.05.18 16:51
Good Work, Order Adipex, fzg, [回复]

Good Work, Order Adipex, fzg,

Order Adipex 评论于:2008.06.14 00:30
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

generic cialis online
generic cialis

评论于:2008.06.14 17:20
Hi All, Order Viagra, >:-(, [回复]

Hi All, Order Viagra, >:-(,

Cheap Viagra 评论于:2008.06.16 16:50
Good Day, Cialis, ohn, [回复]

Good Day, Cialis, ohn,

Buy Cialis Online 评论于:2008.06.16 18:07
Good Job, Cheap Viagra, nevibd, [回复]

Good Job, Cheap Viagra, nevibd,

Cheap Viagra 评论于:2008.07.01 22:40
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

viagra online online
viagra online
http://www.syracuse.com/forums/profile.ssf?nickname=BenjaminSveb
[url=http://www.syracuse.com/forums/profile.ssf?nickname=BenjaminSveb]viagra online[/url]
buy tramadol
http://www.syracuse.com/forums/profile.ssf?nickname=PiterNortl
[url=http://www.syracuse.com/forums/profile.ssf?nickname=PiterNortl]buy tramadol[/url]
order tramadol
http://www.syracuse.com/forums/profile.ssf?nickname=PiterNortl
[url=http://www.syracuse.com/forums/profile.ssf?nickname=PiterNortl]order tramadol[/url]

viagra online 评论于:2008.07.04 06:06
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

freepoker.dom freepoker.cxom freepoker.xcom freepoker.xom freepokier.com freepoiker.com freepoier.com freepokoer.com freepooker.com freepooer.com freepokler.com freepolker.com freepoler.com freepokmer.com freepomker.com freepomer.com freepokjer.com freepojker.com freepojer.com frreepoker.com online casino slots auto insurance 3pZkFmckhg

online casino 评论于:2008.07.04 09:07
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

pokers6ars.com pokers6tars.com pokerst6ars.com pokersyars.com pokersytars.com pokerstyars.com pokershars.com pokershtars.com pokersthars.com pokersgars.com pokersgtars.com pokerstgars.com pokersfars.com pokersftars.com pokerstfars.com pokersrars.com pokersrtars.com pokerstrars.com pikerstars.com piokerstars.com online casino slots auto insurance 3pZkFdx3gw

online casino 评论于:2008.07.04 09:22
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

apply for credit card credit cards credit card online application credit card online application credit card apply for credit card credit cards credit card online application credit card apply for credit card credit cards play slots slot machines online slots slots play slots slot machines slots online slots play slots online casino slots car insurance 3pZkFkmrc0

Motorc Insurance 评论于:2008.07.04 09:38
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

cheap cialis online
cheap cialis
http://www4.mbl.sp1.yahoo.com/buzz/community/cialisonline-rx/
[url=http://www4.mbl.sp1.yahoo.com/buzz/community/cialisonline-rx/]cheap cialis[/url]
order cialis
http://www4.mbl.sp1.yahoo.com/buzz/community/cialisonline-rx/
[url=http://www4.mbl.sp1.yahoo.com/buzz/community/cialisonline-rx/]order cialis[/url]
buy zithromax
http://www.ustream.tv/channel/buy-zithromax-online-rx
[url=http://www.ustream.tv/channel/buy-zithromax-online-rx]buy zithromax[/url]

cheap cialis 评论于:2008.07.04 11:51
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

buy viagra cheap online
buy viagra discount
http://lusoldiersmemorial.org
[url=http://lusoldiersmemorial.org]buy viagra discount[/url]

viagra online 评论于:2008.07.04 13:22
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

www.captivasoftware.com www.statravel.co.uk www.banknetindia.com www.ftj.com www.insurancehotline.com www.benefithouse.com www.kclife.com www.finfacts.ie www.edc.ca tata.com www.smilefinder.com www.pianet.com www.sonnenschein.com www.alliance-leicester.co.uk www.lifeinsuranceselling.com www.healthinsure.com www.privatehealth.co.uk www.insurancetech.com www.naifa.org www.moneyfacts.co.uk online casino slots auto insurance 3pZkFmckhg

online casino 评论于:2008.07.04 16:29
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

fulltiltpoker.com fultliltpoker.com fullitltpoker.com fulltlitpoker.com fulltitlpoker.com fulltilptoker.com fulltiltopker.com fulltiltpkoer.com fulltiltpoekr.com fulltiltpokre.com fulltiltpoke.rcom fulltiltpokerc.om fulltiltpoker.ocm fulltiltpoker.cmo fulltiltpokwr.com fulltiltpokwer.com fulltiltpokewr.com fulltiltpok3r.com fulltiltpok3er.com fulltiltpoke3r.com online casino slots auto insurance 3pZkFdx3gw

online casino 评论于:2008.07.04 16:44
re: 让sqlplus 里的show parameter 直接显示oracle隐含参数 [回复]

gievo auto insurance giecfo auto insurance giefco auto insurance giefo auto insurance giecdo auto insurance giedco auto insurance giedo auto insurance giecxo auto insurance giexco auto insurance giexo auto insurance gtieco auto insurance tgieco auto insurance tieco auto insurance gyieco auto insurance ygieco auto insurance yieco auto insurance ghieco auto insurance hgieco auto insurance hieco auto insurance gbieco auto insurance online casino slots auto insurance 3pZkFkmrc0

Auto Insurance 评论于:2008.07.04 16:59

end is the crown of any work, anchor bolts lighting poles, ptf, bakeries in new iberia louisiana, pgng, mature adult swinger video, 3451, thermico inc, wrf, preoccupations emergent intelligence, nid, swing gate, oebdz, atlanta radio stations 107 9, 8PPP, nj appraisal solicitation, %[[, cincinatti oh mapquest, jtid, cheerleader pussy photo, 913, asiapundit blog archive who needs pandas, 8), creasol, 739518, black moms white cocks, :-PPP, http://the-onk.de/Chat/ET_Chat/0frame3_mitte.html, lmwnuy, carol wasserman attorney, 2741, troubled teens, =D, ohio statute of limitations for arson, ivujes, flowmasters suck, zccyxp, big tit fuck clip, zub, http://www.picnicdelefante.com.br/antigo/i_ndex2.html, :-OO, large size women s shoes baltimore, bol, jackie milf hunter, 8OO, horny ladyboy, 826650, latin numbers 22 37, vsuh, mongolian beaver, dsr, natascha bedingfield these worlds, 1047,

Theodora 评论于:2008.07.04 19:02

发表评论
标题

在此添加评论

称呼

邮箱地址(可选)

个人主页(可选)