61阅读

关闭默认共享-关闭默认共享的最安全 方法

发布时间:2017-09-13 所属栏目:Windows系列

一 : 关闭默认共享的最安全 方法

打开记事本,输入以下内容(记得每行最后要回车):
??  net share ipc$ /delete
??  net share admin$ /delete
??  net share c$ /delete
??  net share d$ /delete
??  net share e$ /delete
??  ……(你有几个硬盘分区就写几行这样的命令)
??  保存为NotShare.bat(注意后缀!),然后把这个批处理文件拖到“程序”→“启动”项,将该文件或其快捷方式放到C:\ Documents and Settings\All Users\「开始」菜单(Start Menu)\ 程序(Programs)\启动文件夹之中即可。重启计算机即可开机自动关闭这些特殊共享资源。这样每次开机就会运行它,也就是通过net命令关闭共享。
此方法为建立批处理的方法

二 : x$kghlu、x$ksmss、x$ksmsp关于共享池

x$kghlu、x$ksmss、x$ksmsp关于共享池

1:x$kghlu可以查看各子池的chunk使用情况

主要字段:

kghlushrpool:

=1: shared pool subpools

=0: java pool

KGHLUIDX:sub-pool

KGHLUDUR:sub-sub-pool

kghlurcr:recurrent chunks

kghlutrn:transient chunks

kghlufsh:flushed chunks

kghluops:pins and releases chunks

kghlunfu:ora-4031 chunks

kghlunfs:last error chunk size

SQL> select INDX,INST_ID,KGHLUIDX,KGHLUDUR,KGHLUSHRPOOL,KGHLUNFU from x$kghlu where KGHLUSHRPOOL=1;

INDX INST_ID KGHLUIDX KGHLUDUR KGHLUSHRPOOL KGHLUNFU

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

0 1 7 0 1 5851

1 1 6 0 1 63070

2 1 5 0 1 71666

3 1 4 0 1 9528

4 1 3 0 1 69590

5 1 2 0 1 6186

6 1 1 0 1 62860

7 rows selected.

2:x$ksmss可以获得各个sub pool中空间信息

主要字段:

ksmdsidx:

=0:表示内部使用内存

=1:表示sub pool

SQL> select ksmdsidx sub_pool,sum(ksmsslen) bytes from x$ksmss where ksmsslen>0 group by ksmdsidx order by sub_pool;

SUB_POOL BYTES

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

1 1509950680

2 1543505304

3 4206462328

4 1577059984

5 1610618352

6 1442841952

7 1543505736

7 rows selected.

SQL>

具体的子池使用及内存情况

SELECT 'shared pool (' || NVL (DECODE(TO_CHAR(ksmdsidx), '0', '0 - Unused', ksmdsidx),'Total') || '):' sub_pool,

SUM(ksmsslen) BYTES, ROUND(SUM(ksmsslen)/1048576, 2) mb

FROM x$ksmss WHERE ksmsslen > 0 GROUP BY ROLLUP (ksmdsidx) ORDER BY sub_pool ASC;

查看各个子池的剩余内存,有可能是零散的碎片:

SELECT sub_pool, NAME, SUM(BYTES), ROUND(SUM(BYTES)/1048576, 2) mb FROM (

SELECT 'shared pool (' || DECODE(TO_CHAR(ksmdsidx), '0', '0 - Unused', ksmdsidx)|| '):' sub_pool, ksmssnam NAME, ksmsslen BYTES

FROM x$ksmss WHERE ksmsslen>0 AND LOWER(ksmssnam) LIKE LOWER('%free memory%'))

GROUP BY subpool, NAME ORDER BY sub_pool ASC, SUM(BYTES) DESC;

3:x$ksmsp可以监控共享池碎片的情况,每条记录表示共享池的每个chunk,此视图可能过度耗用cpu。

主要字段:

ksmchcom:每个chunk的注释

ksmchsiz:每个chunk的大小

ksmchcls:表示类型

=FREE:不包含任何对象的chunk,可以任意分配

=RECR:chunk中对象可以移出内存,需要时可以重建

=FREEABL:会话周期等调用的对象,其chunk随后可以全部或部分提前释放

=PERM:chunk包含永久对象,不能独立释放

select count(1) from x$ksmsp;

select ksmchsiz,ksmchcom from x$ksmsp where ksmchsiz>10000 and ksmchcom like &#39;%PL/SQL%&#39;; <ksmchcom: free memory / permanent memor>

select a.ksmchcom,sum(a.chunk) chunk,sum(a.recr) recr,sum(a.freeabl) freeabl,sum(a.sum) sum

from (

select ksmchcom,count(ksmchcom) chunk,decode(ksmchcls,&#39;recr&#39;,sum(ksmchsiz),null) recr,

decode(ksmchcls,&#39;freeabl&#39;,sum(ksmchsiz),null) freeabl,sum(ksmchsize) sum from x$ksmsp group by ksmchcom,ksmchcls) a

group by a.ksmchcom;

SELECT ksmchidx "SubPool", &#39;sga heap(&#39; || ksmchidx || &#39;,0)&#39; sga_heap,

ksmchcom chunkcomment,

DECODE (ROUND (ksmchsiz / 1000),0, &#39;0-1K&#39;, 1, &#39;1-2K&#39;,2, &#39;2-3K&#39;,3, &#39;3-4K&#39;,4, &#39;4-5K&#39;, 5, &#39;5-6k&#39;,6, &#39;6-7k&#39;, 7, &#39;7-8k&#39;,8, &#39;8-9k&#39;,9, &#39;9-10k&#39;, &#39;> 10K&#39;) "size",

COUNT (*), ksmchcls status, SUM (ksmchsiz) BYTES

FROM x$ksmsp WHERE ksmchcom = &#39;free memory&#39;

GROUP BY ksmchidx, ksmchcls, &#39;sga heap(&#39; || ksmchidx || &#39;,0)&#39;,ksmchcom, ksmchcls,

DECODE (ROUND (ksmchsiz / 1000),0, &#39;0-1K&#39;, 1, &#39;1-2K&#39;,2, &#39;2-3K&#39;,3, &#39;3-4K&#39;,4, &#39;4-5K&#39;, 5, &#39;5-6k&#39;,6, &#39;6-7k&#39;, 7, &#39;7-8k&#39;,8, &#39;8-9k&#39;,9, &#39;9-10k&#39;, &#39;> 10K&#39; );

备注:此例7个子池,7个shared pool latch

SQL> select child#, gets from v$latch_children where name = &#39;shared pool&#39; order by child#;

CHILD# GETS

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

1 1965105585

2 2083784908

3 1304423260

4 2197281833

5 2205897428

6 2001096469

7 1999951480

7 rows selected.

SQL>

三 : 关闭win7默认共享

在运行对话框中输入“regedit”并回车,打开注册表编辑器,在左侧面板中
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanServer\parameters在该位置下新建一个名为“AutoShareWks”的DWORD32键值,并将其数值设置为“0”重启系统后所有的默认共享都将被自动删除,并且不会继续创建.


1.先在管理-->共享中手动停止所有默认共享,如果不修改注册表,重新启动电脑后,还是会有默认共享。
2.修改注册表:
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Lanmanserver\Parameters]
"AutoShareWks"=dword:00000000
如果没有此项键值,新建一个DWORD (32-bit)位键值,名称为AutoShareWks,值为0
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa]
"restrictanonymous"=dword:00000001
本文标题:关闭默认共享-关闭默认共享的最安全 方法
本文地址: http://www.61k.com/1061117.html

61阅读| 精彩专题| 最新文章| 热门文章| 苏ICP备13036349号-1