[转帖]如何使用nmap扫描工具

使用 nmap 套件:注意安全!

 

在本机上面观察 port 最好是使用 netstat 啦!因为他安全又可靠!但是,由于可能有某些 port 会寻找不到,或者不晓得那些 port 是干嘛用的,尤其是 /etc/services 里头没有提到的几个 port 对应的服务!这个时候怎么办?!没关系,不要紧,我们这个时候可以使用那个很流行的‘黑客指令’,就是 nmap 这个东西啦!nmap 的套件说明之名称为:‘Network exploration tool and security scanner’,顾名思义,这个东西是被系统管理员用来管理系统安全性查核的工具!他的具体描述当中也提到了, nmap 可以经由内部自行定义的几个 port 对应的指纹资料,来查出该 port 的服务为何,所以我们也可以藉此了解我们主机的 port 到底是干嘛用的!如果您是安装 Linux 是 Red Hat 版本的话,那么这个 nmap 套件应该已经安装妥当了,万一没有这个套件的话,也可以来到底下的网站下载: 

[root@test root]# nmap <扫瞄类型> <扫瞄参数> <Hosts 位址与范围>
参数说明:
<扫瞄类型>:主要的扫瞄类型有底下几种:
  -sT:扫瞄 TCP 封包已建立的连线 connect() !
  -sS:扫瞄 TCP 封包带有 SYN 标签的资料
  -sP:以 ping 的方式进行扫瞄
  -sU:以 UDP 的封包格式进行扫瞄
  -sO:以 IP 的协定 ( protocol ) 进行主机的扫瞄
<扫瞄参数>:主要的扫瞄参数有几种:
  -PT:使用 TCP 里头的 ping 的方式来进行扫瞄,可以获知目前有几部
     电脑存活(较常用)
  -PI:使用实际的 ping (带有 ICMP 封包的) 来进行扫瞄
  -p :这个是 port range ,例如 1024-, 80-1023, 30000-60000 等等的使用方式
<Hosts 位址与范围>:这个有趣多了,有几种类似的类型
  192.168.0.100  :直接写入 HOST IP 而已,仅检查一部;
  192.168.0.0/24 :为 C Class 的型态,
  192.168.*.*  :嘿嘿!则变为 B Class 的型态了!扫瞄的范围变广了!
  192.168.0.0-50,60-100,103,200 :这种是变形的主机范围啦!很好用吧!
范例:例题一:扫瞄单一部电脑!
[root@test root]# nmap localhost  
# 没有加上任何参数,由 nmap 的预设参数来进行扫瞄
Starting nmap V. 2.54BETA22 ( www.insecure.org/nmap/ )
Interesting ports on vbird.adsldns.org (127.0.0.1):
(The 1539 ports scanned but not shown below are in state: closed)
Port       State       Service
21/tcp     open        ftp
22/tcp     open        ssh
23/tcp     open        telnet
Nmap run completed — 1 IP address (1 host up) scanned in 1 second
# 由上面可以看出我的系统目前共有 21, 22, 23 这三个 port 开放!而且
# 各 port 对应的服务也被查出来了!例题二:扫瞄单一部电脑的较少数 port 号码!
[root@test root]# nmap -p 1024-65535 localhost
# 仅扫瞄较少数的 port 啦!
Starting nmap V. 2.54BETA22 ( www.insecure.org/nmap/ )
Interesting ports on pc510.ev.ncku.edu.tw (127.0.0.1):
(The 64511 ports scanned but not shown below are in state: closed)
Port       State       Service
3306/tcp   open        mysql <==只有这个 port 被找出来啰!
Nmap run completed — 1 IP address (1 host up) scanned in 11 seconds例题三:直接以 Ping 的方式扫瞄数个电脑!
[root @test /root]# nmap -PT 192.168.1.171-177 
# 看到了吧!扫瞄一个区段的活着的电脑!Starting nmap V. 2.54BETA22 ( www.insecure.org/nmap/ )
Interesting ports on linux172 (192.168.1.172):
(The 1536 ports scanned but not shown below are in state: closed)
Port       State       Service
110/tcp    open        pop-3
135/tcp    open        loc-srv
139/tcp    open        netbios-ssn
445/tcp    open        microsoft-ds
1025/tcp   open        listen
1110/tcp   open        nfsd-statusInteresting ports on linux174 (192.168.1.174):
(The 1537 ports scanned but not shown below are in state: closed)
Port       State       Service
110/tcp    open        pop-3
135/tcp    open        loc-srv
139/tcp    open        netbios-ssn
445/tcp    open        microsoft-ds
1025/tcp   open        listen

Interesting ports on linux176 (192.168.1.176):
(The 1537 ports scanned but not shown below are in state: closed)
Port       State       Service
110/tcp    open        pop-3
135/tcp    open        loc-srv
139/tcp    open        netbios-ssn
445/tcp    open        microsoft-ds
1025/tcp   open        listen

Nmap run completed — 7 IP addresses (3 hosts up) scanned in 1 second
瞧!我要侦测的只有七部电脑,所以这七部电脑只会回应给我啰!而其中只有三部有启动,所以当然就只会有三段回应啦!这个方式蛮适合一次扫瞄您的子网域内的所有电脑呢! ^_^”

 

 

 

进行ping扫描,打印出对扫描做出响应的主机,不做进一步测试(如端口扫描或者操作系统探测):
nmap -sP 192.168.1.0/24
仅列出指定网络上的每台主机,不发送任何报文到目标主机:
nmap -sL 192.168.1.0/24
探测目标主机开放的端口,可以指定一个以逗号分隔的端口列表(如-PS22,23,25,80):
nmap -PS 192.168.1.234
使用UDP ping探测主机:
nmap -PU 192.168.1.0/24
使用频率最高的扫描选项:SYN扫描,又称为半开放扫描,它不打开一个完全的TCP连接,执行得很快:
nmap -sS 192.168.1.0/24
当SYN扫描不能用时,TCP Connect()扫描就是默认的TCP扫描:
nmap -sT 192.168.1.0/24
UDP扫描用-sU选项,UDP扫描发送空的(没有数据)UDP报头到每个目标端口:
nmap -sU 192.168.1.0/24
确定目标机支持哪些IP协议 (TCP,ICMP,IGMP等):
nmap -sO 192.168.1.19
探测目标主机的操作系统:
nmap -O 192.168.1.19
nmap -A 192.168.1.19
另外,nmap官方文档中的例子:
nmap -v scanme.nmap.org
这个选项扫描主机scanme.nmap.org中 所有的保留TCP端口。选项-v启用细节模式。
nmap -sS -O scanme.nmap.org/24
进行秘密SYN扫描,对象为主机Saznme所在的“C类”网段 的255台主机。同时尝试确定每台工作主机的操作系统类型。因为进行SYN扫描 和操作系统检测,这个扫描需要有根权限。
nmap -sV -p 22,53,110,143,4564 198.116.0-255.1-127
进行主机列举和TCP扫描,对象为B类188.116网段中255个8位子网。这 个测试用于确定系统是否运行了sshd、DNS、imapd或4564端口。如果这些端口 打开,将使用版本检测来确定哪种应用在运行。
nmap -v -iR 100000 -P0 -p 80
随机选择100000台主机扫描是否运行Web服务器(80端口)。由起始阶段 发送探测报文来确定主机是否工作非常浪费时间,而且只需探测主机的一个端口,因 此使用-P0禁止对主机列表。
nmap -P0 -p80 -oX logs/pb-port80scan.xml -oG logs/pb-port80scan.gnmap 216.163.128.20/20
扫描4096个IP地址,查找Web服务器(不ping),将结果以Grep和XML格式保存。
host -l company.com | cut -d -f 4 | nmap -v -iL –
进行DNS区域传输,以发现company.com中的主机,然后将IP地址提供给 Nmap。上述命令用于GNU/Linux — 其它系统进行区域传输时有不同的命令。
其他选项:
-p <port ranges> (只扫描指定的端口)
单个端口和用连字符表示的端口范 围(如 1-1023)都可以。当既扫描TCP端口又扫描UDP端口时,可以通过在端口号前加上T: 或者U:指定协议。 协议限定符一直有效直到指定另一个。例如,参数 -p U:53,111,137,T:21-25,80,139,8080 将扫描UDP 端口53,111,和137,同时扫描列出的TCP端口。
-F (快速 (有限的端口) 扫描)

Know more about RAC GES STATISTICS

GES 全称为Global Enqueue Services是RAC中重要的全局队列锁服务,V$GES_STATISTICS 动态性能视图汇聚了主要的GES STATISTICS 统计信息。为了更好地理解GES STATISTICS ,我们可以通过下表理解这些统计项的含义:

 

V$GES_STATISTICS Reference (10.2.0.1.0)

 

0 messages sent directly         

 

Incremented when any process successfully sends a message to a remote instance without being blocked and without flow control.

 

1 messages flow controlled                 

 

Incremented when any process could not send a message directly because there were not enough tickets available.

 

2 messages sent indirectly

 

Incremented when any process is asked to flow-control the message (i.e. a process tried to send a message indirectly, even if a ticket was available). This can also be incremented when previous message to the same target node had failed or a GCS/GES operation is being frozen.

 

3 messages received logical

 

When LMS receives a GCS/GES message from remote or local client, this statistic is incremented.

 

61 messages received actual

 

When LMS receives a message from a remote instance, this is incremented. A single actual message can contain multiple logical messages. Note, that when remote messages are queued, because they are flow controlled or they are indirectly / intentionally queued, the LMS process tries to send them in batch instead of flushing them individually.

 

4 flow control messages sent

5 flow control messages received

 

Messages flow controlled due to lack of ticket.

 

6 gcs msgs received

7 gcs msgs process time(ms)

8 ges msgs received

9 ges process time(ms)

 

When LMS receives a message, and if the message is related to either GCS (Global Cache Service) or GES (Global Enqueue Service) activity, it is incremented. After a GCS/GES message is processed, the process (typically LMD or LMS) updates the following statistics.

 

  • gcs msgs received
  • gcs msgs process time(ms)
  • ges msgs received
  • ges msgs process time(ms)

 


10 msgs causing lmd to send msgs 

11 lmd msg send time(ms)

65 msgs causing lms to send msgs 

66 lms msg send time(ms)

 

Incremented when the LMD/LMS processes a GCS/GES message and it causes LMD/LMS to send one or more messages. For example, if LMS receives a message, and as part of processing it sends four more messages, the statistic will be incremented by 1, not 4. In order to get the exact number of messages sent by LMS, the session statistic ‘gcs messages sent’ and ‘ges messages sent’ needs to be retrieved for the session running LMS (from V$SESSTAT).

 

12 gcs side channel msgs actual

13 gcs side channel msgs logical

 

‘side channel msgs logical’ indicates the number of blocks shipped from this node to other nodes. ‘side channel msgs actual’ indicates the actual number of messages sent to other nodes. When CR blocks or current blocks are sent to a remote node, the sender actually sends another reliable message to the requestor, because the CR block or current block being shipped could be lost. For example, a node sends 100 CR blocks to another node (logical number of messages). The sender node then may send a message saying ‘I’ve sent 100 blocks’ in a single message (actual number of messages). The init.ora parameter ‘_side_channel_batch_size’ defines the number of side channel messages to be sent in a single message.  With reliable IPC technology such as RSM and HyperFabric, we do not need side channel messages, and this value should be 0. With non-reliable IPC technology like UDP, these should be increased.

 

14 gcs pings refused

 

Incremented when the master node sends a BAST to a holder node, and the holder node is not able to service the BAST for some reason (typically because the block is not present or the ping queue is full).

 

15 gcs writes refused

 

Same as above, except that this is for Writes. In RAC if the blocks are globally dirty the writes are mediated by the GCS.

 

16 gcs error msgs

 

Certain race conditions in the GCS this statistic to be updated. It usually involves sending some extra messages to resolve the race through the use of error messages.

 

17 gcs out-of-order msgs

 

With direct sends, it is possible for two messages, which are sent from the same instance, to be received out-of-order at the master node. This statistic is updated whenever that happens.

 

18 gcs immediate (null) converts

 

Incremented when NULL lock can be granted immediately

 

19 gcs immediate cr (null) converts

 

Incremented when NULL lock for CR request can be granted immediately

 

20 gcs immediate (compatible) converts

 

Incremented when shared lock can be granted immediately

 

21 gcs immediate cr (compatible) converts

 

Incremented when shared lock for CR request can be granted immediately

 

22 gcs blocked converts

 

Incremented when the lock cannot be granted immediately. The lock is on the head of the convert queue.

 

23 gcs queued converts

 

Incremented when the lock cannot be granted immediately, and there is a conflicting lock in the convert queue ahead of this lock.

 

24 gcs blocked cr converts

 

Incremented when a CR request cannot be granted a lock because the lock is already being converted or the lock is in exclusive mode

 

25 gcs compatible basts

 

Number of BAST’s sent to holder node of a compatible lock.

 

26 gcs compatible cr basts (local)

 

CR request can be granted a lock, and BAST is sent to holder node. The lock is in local role.

 

60 gcs compatible cr basts (global)

 

This is incremented when the lock request is compatible but we can’t read from
disk because the block is globally dirty.

 

27 gcs cr basts to PIs

 

CR request is sent to an instance that has a PI buffer that satisfies this CR request.

 

28 dynamically allocated gcs resources

29 dynamically allocated gcs shadows

 

Number of gcs resources / shadows dynamically allocated after the startup of instance. We should not see these increasing at all.  _gcs_resources and _gcs_shadows could be used to change the default number of these resources to avoid dynamic allocation, but we should treat it as a bug (the default should be enough or it could be memory leak.).

 

30 gcs recovery claim msgs

 

Number of recovery claim messages processed by this instance.

 

31 gcs indirect ast

 

AST is sent to LMS instead of foreground process.

 


32 gcs dbwr write request msgs

33 gcs dbwr flush pi msgs

34 gcs lms write request msgs

35 gcs lms flush pi msgs

36 gcs write notification msgs

 

Messages related to flushing dirty XCUR / PI buffers. To flush PI buffers, request master node to write the most recent copy of the block in the global cache, which is ‘write request msgs’. Once the most recent copy of the block in the global cache is written to disk, PI buffers in the global cache can be purged, which is ‘flush pi msgs’. Once the most recent copy is written to disk, ‘write notification’ message is sent to the master node.

 

37 gcs retry convert request

 

Convert request had to be retried due to some race conditions.

 

38 gcs regular cr

 

CR for data blocks

 

39 gcs undo cr

 

CR for undo blocks

 

40 gcs assume no cvt

 

Assume was processed when the convert q is empty.

 

41 gcs assume cvt

 

Assume was processed when the convert q is non-empty.

 

42 broadcast msgs on commit(actual)

 

MCPD=0, number of messages sent to update the SCN.

 

43 broadcast msgs on commit(logical)

 

Same as 42, but logical (because the update may have been piggybacked).

 

44 broadcast msgs on commit(wasted)

 

Update SCN mesage is sent, but it is potentially a waste because receiver may have already updated the SCN.

 

45 acks for commit broadcast(actual)

46 acks for commit broadcast(logical)

 

Same as 42, 43 except that it applies to the receiving instance.

 

47 false posts waiting for scn acks

 

We posted LGWR because we thought MCPD broadcast completed, but it didn’t.

 

48 gcs forward cr to pinged instance

 

CR request is forwarded to the instance that is currently converting the GCS resource

 

49 gcs cr serve without current lock

 

CR block is served by the instance that does not have the current lock.

 

50 msgs sent queued

51 msgs sent queue time (ms)

 

Number of logical messages sent through send queue and their queuing time. Queuing time for queued messages: ‘msgs sent queue time (ms)’ / ‘msgs sent queued’  à Average message queuing time for flow controlled or indirectly sent messages. Note: this is calculated at ‘kjct’ layer (GCS/GES communication layer).

 

52 msgs sent queued on ksxp

53 msgs sent queue time on ksxp (ms)

 

Number of messages queued, and queuing time on ksxp layer. This includes all types of GCS/GES messages sent by any Oracle processes (foreground and background processes). Note: ‘msgs sent queued’ is a statistic from the kjct layer where we know if the messages are directly sent or indirectly sent.

 

54 msgs received queue time (ms)

55 msgs received queued

 

Elapsed time that a message is actually received until it is processed. Number of messages received  (logical). The ratio ‘msgs received queue time (ms)’ / ‘msgs received queued’ gives us the average queuing time between message arrival and start processing.

 

56 implicit batch messages sent

57 implicit batch messages received

 

Number of messages sent/received that are batched implicitly. Note: messages that are queued because of flow control or because of indirect messages, can be batched.

 

58 gcs refuse xid

 

Number of lock request received but refused to process by this instance, because index split is in progress (new in Oracle9i Release 2)

 

59 gcs ast xid

 

Number of lock request canceled because of index split

 

62 process batch messages sent

63 process batch messages received

 

Number of messages sent/received in batch.  When LMS receives multiple remote messages at a time, it processes all of them first, and then sends messages in batch as a result, instead of sending the result for each request individually.

 

64 messages sent pbatched

 

This is the number of messages being sent through process batching. This is the logical number whereas “process batch messages sent” is the actual number of messages sent out. Process batching in 10g is used for multi-block read, newing, receiver direct send (LMD0, LMS*, LMON) and fusion write (DBW*).

 


67 global posts requested

 

AQ requested that a global post be delivered to another instance

 

68 global posts dropped

 

Post was dropped because there was no buffer space.

 

69 global posts queued

 

A post was queued to be sent to another instance

 

70 global posts sent

 

A post was actually sent to another instance

 

71 global posts queue time

 

Time difference between enqueuing and sending the post.

 

72 messages sent not implicit batched

 

This is the number of indirect sent messages not get any batching done from the send proxies due to various reason. For example, the message is big enough or is defined as non-batch type.

 

73 messages queue sent actual

 

Actual number of messages sent indirectly by send proxies.

 

74 messages queue sent logical

 

Logical number of messages sent indirectly by send proxies including the number of embedded message batched either through process batching or batching done in send proxies.

 

实际V$GES_STATISTICS的信息来源于X$KJISFT内部视图

11g新特性–自适应游标共享

使用绑定变量降低了分析SQL语句所需分配的共享内存量,因为绑定变量对于相同(或类似)SQL语句的多次执行重用单个游标。因为绑定变量减少了分析时间和内存使用,从而提高了数据库的性能和可伸缩性。特别是在具有大量并发用户时更是如此。初始化参数cursor_sharing确定哪些SQL语句可共享相同的游标。设置cursor_sharing参数为exact规定只有相同的SQL语句才能共享一个游标。设置它为FORCE表示某些字面值不同的语句可以共享一个游标。除非不同的字面值影响到执行计划的优化度,否则设置此参数为SIMILAR与设置它为FORCE的行为相同。

不过,游标共享与SQL优化具有固有的矛盾,因为指定字面值而不是绑定值给优化程序提供了更丰富的信息,使得能生成更好的计划。由于这个原因,强制游标共享极可能导致次优执行假话。在某些情形下,一条SQL语句的某些用户可能会到的很优

CTAS VS create table and then insert

很多情况下我们都会需要复制源表数据以达到冗余数据的目的,那么到底是使用CREATE TABLE AS SELECT的CTAS方式,还是先建好表的结构然后再插入数据好呢?

我们来看看这2种方式的不同表现:

SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for Linux: Version 10.2.0.4.0 - Production
NLSRTL Version 10.2.0.4.0 - Production

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     1
Next log sequence to archive   2
Current log sequence           2

/* 数据库处于归档模式下 */

SQL> select ss.name,ms.value  from v$mystat ms,v$sysstat ss
  2  where
  3  ms.statistic#=ss.statistic#
  4  and ss.name in ('undo change vector size','redo size');
NAME                                                                  VALUE
---------------------------------------------------------------- ----------
redo size                                                                 0
undo change vector size                                                   0

SQL> create table YOUYUS as select * from dba_objects;
Table created.

SQL> select ss.name,ms.value  from v$mystat ms,v$sysstat ss
  2  where
  3  ms.statistic#=ss.statistic#
  4  and ss.name in ('undo change vector size','redo size');
NAME                                                                  VALUE
---------------------------------------------------------------- ----------
redo size                                                           5783384
undo change vector size                                               15408

[Read more…]

Oracle常用的几个父栓

Oracle中的父闩大致可以分成2类:有子闩的父闩或者独居的父闩,我们来看看这些父闩的属性:

SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
PL/SQL Release 10.2.0.4.0 - Production
CORE    10.2.0.4.0      Production
TNS for IBM/AIX RISC System/6000: Version 10.2.0.4.0 - Productio
NLSRTL Version 10.2.0.4.0 - Production

SQL> select count(distinct name) from v$latch_children;
COUNT(DISTINCTNAME)
-------------------
                 82

/* 10.2.0.4下共有82种不同子闩,同比11.2.0.1是75种,要比10g中少一些,因为一部分闩在11g中被mutex替代了 */

[Read more…]

有趣的数字记录方式

著名的Tanel Poder最近在他的博客上发表了《Which number takes more space in an Oracle row?》;Oracle是如何存储数字类型字段的?如果我们惯性思维的话,存储数字123肯定要比存储数字10000000000000000所占用的空间少吧,事实是这样吗?

SQL> select vsize(123) from dual;
VSIZE(123)
----------
3

SQL> select dump(123,16) from dual;
DUMP(123,16)
--------------------
Typ=2 Len=3: c2,2,18

/* 可以看到Oracle存储数字123需要用到3个字节的空间,其16进程形式为c2,02,18 */

/* 如果是gooooogle(1后面跟n个零)呢?  * /

SQL> select vsize(power(10,38))  from dual;
VSIZE(POWER(10,38))
-------------------
                  2

[Read more…]

DNS设置引起的登录延迟

一套Linux上的11.1.0.7系统,操作系统管理人员最近对该服务器上的网络配置文件/etc/nsswitch.conf进行了调整,调整前其主机名解析选项为”hosts:files dns” ,调整后被修改成了”hosts:files [NOTFOUND=continue] dns”;此后应用人员尝试在该主机上使用
“sqlplus username/password@connect_string”远程登录数据库都会出现多达五分钟的延迟,使用lsnrctl status命令查看监听器状态,发现LISTENER一切正常;初步可以判断是dns解析导致了长时间的延迟。
[Read more…]

ORA-03137: TTC protocol internal error : [12333]错误一例

Oracle Solaris上的一套11.2.0.1.0最近出现以下告警记录:

Dump file /cnbbs01/app/oracle/diag/rdbms/nbbsprd1/nbbsprd1/incident/incdir_373041/nbbsprd1_ora_24754_i373041.trc
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
ORACLE_HOME = /cnbbs01/app/oracle/product/11.2.0/db_1
System name: SunOS
Node name: ut06db03
Release: 5.10
Version: Generic_142901-12
Machine: i86pc
Instance name: nbbsprd1
Redo thread mounted by this instance: 1
Oracle process number: 130
Unix process pid: 24754, image: oracle@ut06db03
*** 2010-08-25 02:01:19.169
*** SESSION ID:(1203.16390) 2010-08-25 02:01:19.169
*** CLIENT ID:() 2010-08-25 02:01:19.169
*** SERVICE NAME:(SYS$USERS) 2010-08-25 02:01:19.169
*** MODULE NAME:() 2010-08-25 02:01:19.169
*** ACTION NAME:() 2010-08-25 02:01:19.169

Dump continued from file: /cnbbs01/app/oracle/diag/rdbms/nbbsprd1/nbbsprd1/trace/nbbsprd1_ora_24754.trc
ORA-03137: TTC protocol internal error : [12333] [11] [120] [110] [] [] [] []

[Read more…]

V$RESOURCE_LIMIT

“V$RESOURCE_LIMIT” Reference Note

Oracle9i Information

  • This view displays information about global resource use for some of the system resources. Use this view to monitor the consumption of resources so that you can take corrective action, if necessary.Some resources, those used by DLM for example, have an initial allocation (soft limit), and the hard limit, which is theoretically infinite (although in practice it is limited by SGA size). During SGA reservation/initialization, a place is reserved in SGA for the INITIAL_ALLOCATION of resources, but if this allocation is exceeded, additional resources are allocated up to the value indicated by LIMIT_VALUE. The CURRENT_UTILIZATION column indicates whether the initial allocation has been exceeded. When the initial allocation value is exceeded, the additional required resources are allocated from the shared pool, where they must compete for space with other resources.A good choice for the value of INITIAL_ALLOCATION will avoid the contention for space. For most resources, the value for INITIAL_ALLOCATIONis the same as the LIMIT_VALUE. Exceeding LIMIT_VALUE results in an error.
    Column Datatype Description
    RESOURCE_NAME VARCHAR2(30) Name of the resource
    CURRENT_UTILIZATION NUMBER Number of (resources, locks, or processes) currently being used
    MAX_UTILIZATION NUMBER Maximum consumption of this resource since the last instance start-up
    INITIAL_ALLOCATION VARCHAR2(10) Initial allocation. This will be equal to the value specified for the resource in the initialization parameter file (UNLIMITED for infinite allocation).
    LIMIT_VALUE VARCHAR2(10) Unlimited for resources and locks. This can be greater than the initial allocation value (UNLIMITED for infinite limit).

    Table 3-2  Values for RESOURCE_NAME column
    Resource Name Corresponds to this Initialization Parameter
    DISTRIBUTED_TRANSACTIONS See <<Parameter:DISTRIBUTED_TRANSACTIONS>>
    DML_LOCKS See <<Parameter:DML_LOCKS>>
    ENQUEUE_LOCKS This value is computed by Oracle. Use <<View:V$ENQUEUE_LOCK>> to obtain more information about the enqueue locks.
    ENQUEUE_RESOURCES See <<Parameter:ENQUEUE_RESOURCES>>
    LM_PROCESSES Lock manager processes
    LM_LOCKS See <<Parameter:LOCAL_LISTENER>>
    MTS_MAX_SERVERS See <<Parameter:MTS_MAX_SERVERS>>
    PARALLEL_SLAVES See <<Parameter:PARALLEL_MAX_SERVERS>>
    PROCESSES See <<Parameter:PROCESSES>>
    ROLLBACK_SEGMENTS See <<Parameter:MAX_ROLLBACK_SEGMENTS>>
    SESSIONS See <<Parameter:SESSIONS>>
    SORT_SEGMENT_LOCKS This value is computed by Oracle
    TEMPORARY_LOCKS This value is computed by Oracle
    TRANSACTIONS See <<Parameter:TRANSACTIONS>>

Oracle10g Information

Resource Name Corresponds to
DML_LOCKS See “DML_LOCKS”
ENQUEUE_LOCKS This value is computed by the Oracle Database. See V$ENQUEUE_LOCK to obtain more information about the enqueue locks.
GES_LOCKS Global Enqueue Service locks
GES_PROCS Global Enqueue Service processes
GES_RESS Global Enqueue Service resources
MAX_SHARED_SERVERS See “MAX_SHARED_SERVERS”
PARALLEL_MAX_SERVERS See “PARALLEL_MAX_SERVERS”
PROCESSES See “PROCESSES”
SESSIONS See “SESSIONS”
SORT_SEGMENT_LOCKS This value is computed by the Oracle Database
TEMPORARY_LOCKS This value is computed by the Oracle Database
TRANSACTIONS See “TRANSACTIONS”

 

Support and Historical Notes for “V$RESOURCE_LIMIT”

  View Definition:
    Use the following SQL to see the view definition of the related GV$ view:

      SELECT view_definition FROM v$fixed_view_definition WHERE view_name='GV$RESOURCE_LIMIT';

Bug 3896119  CURRENT_UTILIZATION of V$RESOURCE_LIMIT may be too high

 

Affects:

Product (Component) Oracle Server (Rdbms)
Range of versions believed to be affected Versions < 10.2
Versions confirmed as being affected
Platforms affected Generic (all / most platforms affected)

Fixed:

This issue is fixed in

Symptoms:

Related To:

Description

CURRENT_UTILIZATION of processes in V$RESOURCE_LIMIT
may be too high.

Hdr: 3896119 9.2.0.5 RDBMS 9.2.0.5 VOS PRODID-5 PORTID-197
Abstract: CURRENT_UTILIZATION OF V$RESOURCE_LIMIT IS UNUSUAL BIGGER THAN PROCESSES

PROBLEM:
——–
JTAKABUC has already filed Bug#3893908 for TNS-12516 problem.
The cause of TNS-12516 seems to be the service handler is
in a “blocked” state (this relation is indicated in Note:240710.1).
This bug is filed for investigation of CurrentUtilization of
V$RESOURCE_LIMIT issue.

We checked CURRENT_UTILIZATION of V$RESOURCE_LIMIT.
The value of it seems to be unusual.
The number of Oracle processes was not increased, but
CURRENT_UTILIZATION of V$RESOURCE_LIMIT increased as time passes.

SYSDATE           v$resource_limit        v$process
CurrentUtilization        count(*)
20040915 02:11:09    366                    361
20040915 02:39:48    351                    346
20040915 03:04:52    358                    344
20040915 03:34:52    366                    349
20040915 04:04:52    368                    351
20040915 04:30:57    376                    352
20040915 05:00:57    384                    352
20040915 05:30:57    405                    372

20040916 14:02:00    751                    458
20040916 14:32:01    752                    459
20040916 15:02:01    754                    460
20040916 15:32:02    756                    462
20040916 16:02:02    766                    462
20040916 16:32:03    772                    462
20040916 17:02:04    771                    461
20040916 17:32:04    774                    464
20040916 18:02:05    781                    464
20040916 18:32:05    783                    466

The result of ps command was the same as the count of V$PROCESS.
It seems that some problem occurred in v$resource_limit.

DIAGNOSTIC ANALYSIS:
——————–
CURRENT_UTILIZATION of V$RESOURCE_LIMIT seems to be
increased/decreased when Oracle process was created/deleted.

So the value is CURRENT_UTILIZATION of V$RESOURCE_LIMIT
is almost same as the value of count(*) of V$PROCESS.
But it was not so.

Incorrect (always increasing) values showed in v$resource_limit for the transactions field

Applies to:

Oracle Server – Enterprise Edition – Version: 10.2.0.2
This problem can occur on any platform.

Symptoms

Values in v$resource_limit go way too high for the transactions value.
The value is continuously increasing, while it’s clear the actual number of transactions is not that big:

select * from v$resource_limittransactions 18593 18595 3965 UNLIMITED

while:

select count(*) from v$transactionCOUNT(*)
————
67

Cause

This is caused by:
bug: <<5768464>> V$RESOURCE_LIMIT TRANSACTIONS VALUE KEEPS INCREASING ALL THE TIME
probably a duplicate of:
Bug: <<4489041>> CURRENT_UTILIZATION IN V$RESOURCE_LIMIT BECOMES LARGER THAN CURRENT TRANSACTIONS

Solution

To implement the solution, please execute the following steps:

1. use the number of records in v$transaction instead of the value in v$resource_limit view.
2. monitor the evolution of:
Bug: <<4489041>> CURRENT_UTILIZATION IN V$RESOURCE_LIMIT BECOMES LARGER THAN CURRENT TRANSACTIONS
and
Bug: <<5768464>> V$RESOURCE_LIMIT TRANSACTIONS VALUE KEEPS INCREASING ALL THE TIME
on Metalink.

 

11g Multi-Column Correlation Stats and Dynamic Sampling

Oracle CBO优化模式中列的统计信息是一个十分重要的概念,但在11g之前我们所讨论的都是基于单列的统计信息或直方图,也就是说基于成本的优化器总是假设where子句后的谓词中列与列之间不存在联系。但是有的查询包含一个表的多个列,而每个列又都与不同的选择度。这些列中有的是相关的,但优化器并不知道这些关系。在这种情况下,优化器如果要估计出真实的基数(card),必须要了解增加另一列到某个给定列是否会引起结果集的减少。多列上的相关统计数据能提供比单列统计数据或直方图更好的基数估计。当2个列紧密相关时,增加额外的谓词可以减少结果集。Oracle database 11g中引入了扩展统计(也叫多列统计,multicolumn statistics),可以收集一组列上的统计数据,从而让优化器能准确地计算多个单列谓词的选择性。因为把紧密相关的列作为一个组才能正确地放映其组合选择性,所以把相关列作为一组,在其上(列祖)收集统计数据,这些信息足以让优化器能准确地进行选择性估计,在包含使用相关列的谓词查询中,这是我们实际关心的问题。多列统计的引入意味着,在11g中cbo优化器可以对具有多列复杂谓词判断的SQL语句做出更准确的成本估算,许多原本”误用”全表扫描的查询现在可以使用索引扫描的执行计划,语句将运行地更快速。

我们试看下例:
[Read more…]

沪ICP备14014813号-2

沪公网安备 31010802001379号