锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲成人影院在线观看,亚洲成人福利在线,www.亚洲色图http://m.tkk7.com/orangehf/<span style="color:#000000">What the hell is going on?!</span>zh-cnMon, 12 May 2025 01:53:19 GMTMon, 12 May 2025 01:53:19 GMT60Understanding Binary, Decimal and Hexadecimal - A Tutorialhttp://m.tkk7.com/orangehf/archive/2012/12/18/393139.html緲斿崡緲斿崡Tue, 18 Dec 2012 04:56:00 GMThttp://m.tkk7.com/orangehf/archive/2012/12/18/393139.htmlhttp://m.tkk7.com/orangehf/comments/393139.htmlhttp://m.tkk7.com/orangehf/archive/2012/12/18/393139.html#Feedback0http://m.tkk7.com/orangehf/comments/commentRss/393139.htmlhttp://m.tkk7.com/orangehf/services/trackbacks/393139.html
Repost from http://east82.com/howto/ip_addressing/bin_dec_hex.htm 

BIND DNS UbuntuUnderstanding Binary, Decimal and Hexadecimal - A Tutorial

"There are 10 kinds of people in the world ...those who understand binary and those who do not"

A primer in numbering systems

There are four basic numbering systems that are used in the human, networking, and computer science worlds. Binary, octal, decimal and hexadecimal. Decimal, the numbering system we are most familiar with has a base, or radix, of 10 and to us this is natural. Why 10? Most of us have 10 fingers and that is how it was selected as our numbering system; it's as simple as that. The Yuki people of California on the other hand (pun intended) use an octal numbering system, counting the spaces between their fingers and not the fingers themselves. Pretty cool, huh?

The other systems widely in use in the networking and computer science world are binary, octal and hexadecimal (See table below). In this tutorial we'll concern ourselves only with binary, decimal and hexadecimal, ignoring octal altogether. As a side note, one use of octal numbering is with Linux and UNIX systems to set file permissions using the chmod command.
Binary Octal Decimal Hexadecimal numbering systems

It's all just ones and zeros - bits and nibbles and bytes oh my!

Yes, we're talking binary here. I start here by asking that you don't think of a binary number as being a just series of 1's and 0's, such as 01000001 (65 decimal), but rather as a valid numbering system. So, why binary and not decimal? Take our previous example of 01000001. It's really a sort of computer Morse code, but instead of dots and dashes, it's the presence or absence of state, on or off; whether it be electrical pulses on an Cat5 cable or the state of transistors within a CPU or memory stick. Individually a bit, that is a 1 or 0, is pretty useless. However, put them together in a byte (8 bits) for example, then you have something. With our previous example, the byte 01000001 represents the character 'A'. With the computer's ability to process and transmit millions of bytes in miliseconds it can give us letters, words, pictures, music, videos and oodles of other things almost instantly. No matter what we type or create via keyboard or mouse, eventually it all gets translated into a numerical series of 1's and 0's to represent our intent. So, you see it IS all just 1's and 0's! Oh, I almost forgot ...a nibble is half a byte, 4 bits.

Thinking in binary

With the decimal numbering system we have 10 digits to work with, 0 thru 9 and when we count we start at 0, then 1, then 2 and so on until we reach 9. Then what? Well, we've run out of digits. So, we start again at 0, but we place a 1 to the left giving us 10 (ten). And once the 1's and 10's columns reach 9 and 9 (99) they  both flip, giving us 100. Same thing goes with binary except we only have 2 digits to work with, 1 and 0.

The principal is the same we start at 0 then 1, then ...well, we've run out of digits haven't we? So, we flip that 1 to 0 and place a 1 to the left giving us 10 (two). Increment by 1 again and we have 11 (three) and once again they both flip and we move into a new column giving us 100 (four). This is probably not so bad for small numbers, but once you get past 8 or so binary digits it becomes unmanageable. I mean what does 10011100 equate to in human terms? Don't even mention that binary numbers are unwieldy; 3,000 is 101110111000 in binary ...geez! So, while it is true that we need to think in binary, we can represent these binary numbers in a more human friendly form. Anyone say decimal? Fortunately we have the ability (and absolute need) to convert between the two. 

Converting binary to decimal

For this section I'll start by examining and explaining the table below.
Binary byte decimal table

  • First thing  to take note of is that there are 8 individual bits giving us a byte. When working with IP addresses, networking folks refer to this as an octet. Obviously, binary numbers can be larger than a simple byte. However, the byte is the most basic representation of data and as such, for the most part, we'll stay at the byte level.

  • The 'Bit Set' row is for our binary digits, either 0 or 1. Here they are all 1.

  • The 'Exponent Value' row is how we arrive mathematically at the 'Decimal Value' row. An exponential value such as 23 means 2 x 2 x 2 = 8. By the way, any number with an exponent of 0 ALWAYS equates to 1 (2= 1 and 4000 also = 1).    

  • The 'Decimal Value' row represents positionally the decimal value of the binary digit in question. It's imperative that you commit this row to memory. Practice by writing it down over and over 'till its part of your DNA :-)

128           64           32            16           8           4           2           1
  • The labels 'MSB' and 'LSB' stand for 'Most Significant Bit' and 'Least Significant Bit' respectively. This lets us know which end of the binary number we are talking about. For example, if I had a binary number of 11010101 and I say 'Starting at bit 1' ...that might be confusing. However, if I say 'Starting with the bit at LSB 1'. Well, you get the picture.

Previously we talked about thinking in binary means knowing how to count in binary and that still holds valid, but now, in order to convert between the two, we are going to only concern ourselves with the position of each binary digit as it relates to its decimal equivalent. What?? OK, take for example the binary number 00001010. Referring to the table above just add the positional decimal equivalents where the 1's occur. So, 00001010 means 128 (no), 64 (no), 32 (no), 16 (no), 8 (yes), 4 (no), 2 (yes) 1 (no). Given that, we see that 8 + 2 =10. In other words 00001010 binary is 10 decimal. Here are a few more examples.

  • 11000000 - 128 + 64 = 192

  • 00000001 - = 1

  • 00110011 - 32 + 16 + 2 + 1 = 51

  • 11011011 - 128 + 64 + 16 + 8 + 2 + 1 = 219

  • 00000000 - = 0

  • 11111111 - 128 + 64 + 32 +16 + 8 + 4 + 2 + 1 = 255

If you encounter a binary number less than a byte such as 11001 (25 decimal), just pad the missing binary digits with 0's, making the number 00011001, a complete byte. Also, if you are presented with a binary number larger than a byte then double the decimal number with each subsequent binary position to the left. See table below. Later, when we work with subnetting, we'll use these larger values. Expanded binary to decimal table

At this point you should be comfortable with converting binary to decimal. Now let's go the other way, decimal to binary. I'll show you two different methods. Use the one that best works for you.

Method 1 - Process of Elimination

This method is pretty straight forward. The first thing to do is write down the decimal value row previously covered.

128           64           32            16           8           4           2           1

Next, somewhere off to the side, write down your decimal number. With a byte, or octet, the smallest number is 0 and the largest 255, so your number must be within this range. Next, follow the procedure below:

Compare the decimal number with the MSB (128). If your number is larger than or equal to 128 then place a 1 under the 128 column, subtract 128 from your number and move to the next position (64). However, if your number is less than 128 then place a 0 under the 128 column and move to the next number (64) without subtracting.

Repeat the above process with 64, 32, 16 etc. until your original number is reduced to zero. If you reach zero before reaching the LSB (1) fill in the remaining columns with 0's. below are a few examples:
Decimal to binary conversion examples

Method 2 - Divide and Conquer

This method has you repeatedly dividing a decimal number by 2 and saving the remainder, either 1 or 0, as a binary digit. Keep doing this until, again, your original number has been reduced to 0. It's not as confusing as it sounds. Let's walk through an example:
Decimal to binary conversion division exampleRefer to the example above. Given the decimal number 41 and the divide-and-conquer method, we derive its binary equivalent with the following logic:

  • 41 divided by 2 is 20, remainder 1. Place a 1 in the remainder column and 20 in the division column. This is the LSB and will be the rightmost binary digit.

  • 20 divided by 2 is 10, remainder 0. Place a 0 in the remainder column and 10 in the division column.

  • 10 divided by 2 is 5, remainder 0. Place a 0 in the remainder column and 5 in the division column.

  • 5 divided by 2 is 2, remainder 1. Place a 1 in the remainder column and 2 in the division column.

  • 2 divided by 2 is 1, remainder 0. Place a 0 in the remainder column and 1 in the division column.

  • 1 divided by 2 is 0, remainder 1. Place a 1 in the remainder column and we're done ...

... well almost. Our solution came out to be only 6 binary digits long. Since we are working with bytes, just pad the left with 0's until the binary number is 8 digits in length. One more thing. Your last operation will always be 1/2 = 0, remainder 1. Here a couple more examples:
Decimal to binary conversion
 

Binary and decimal numbers larger than a byte

At times you might have a binary or decimal that is larger than a byte. Don't panic. All you need to do is extend the binary byte row to the left, doubling as you go along.

128           64           32            16           8           4           2           1

now becomes the following if we have a 12 bit binary number:

2048     1024     512     256     128     64     32     16     8     4    2     1

Here is a sample conversion from binary to decimal using process of elimination:
Large decimal number to binary conversion

Moving on to hexadecimal

Just when you got your head around binary and decimal, along comes hexadecimal, hex for short. Before, I mentioned that everything in the computing and networking arena is nothing more that 1's and 0's and that axiom remains unchanged. We now know how to convert back and forth between binary (what the computer speaks) and decimal (what we speak), so why do we even need hex? Besides being an efficient numbering system, hexadecimal is widely used to represent to us humans the 1's and 0's that traverse circuits and wires. A few examples where hex numbers are used are colors, memory references, IPv6 addresses and MAC addresses. Let's explore this a little more in detail.

A binary byte is exactly eight digits long, e.g. 00101110 and a hex byte number is exactly two digits in length, e.g. 6A. A decimal byte on the other hand is anywhere between one and three digits long, e.g. 4, 64 or 233. Yes, you could pad these with 0's making 004, 064 and 233, but this is still not as efficient or as practical as hex. (as we'll see when we start converting hex and binary numbers). Download myextended ASCII table; it will help with the following illustration and serve as a useful refernece for your studies:
Memory dump
 This screenshot is a memory dump of my computer. Imagine if those numbers were represented in binary!

Let's get on with it.

What the hex are you talking about?

Below is a hex table with decimal equivalents:
Hexadecimal decimal table

With hex, the first 10 digits, 0 thru 9, are the same as decimal. However, 10 thru 15 decimal are represented as a single hex digit A thru F. The number 5 in decimal is 5 in hex and the number 13 in decimal is D in hex. What happens when we reach F (15 decimal) and need to increment by 1 is that, just like with all other numbering systems, we flip that to 0 and place a one to the left. 0xF + 0x1 = 0x10. What is this 0x business? Placing 0x in front of a hex number is the typical way to indicate it's really hex. It makes it clear that 11 (decimal) and 0x11 (hex) are two different numbers entirely. So, from here on out I'll use the 0x to indicate hexadecimal numbers. Sometimes you'll see the hex numbers 0xA thru 0xF written in lower case (0xa thru 0xf). There's nothing wrong with that and it does not change the numerical value of the number in question. I use caps in this how-to.

Binary to hex - nibbles and bits

To convert a binary byte to hex byte, first split the binary number into two nibbles, treating them as separate numbers, and then compute the hex equivalent for each half. Finally, concatenate the two hex numbers into a single solution. This works perfectly because a nibble has a value from 0 thru 15 or 0x0 thru 0xF.
Binary hex range

Here's some examples:
Binary to hex conversion examples

Binary to hex - bits and nibbles

The conversion process from hex to binary is not much different, we just reverse the process. A picture is worth a thousand words. Here's 4,000 of them.
Hexadecimal to binary conversion examples

Once in a while you may find yourself presented with a binary or hex number larger than a byte. The methods are the same, just expanded. If you have a binary number to convert then you may have to pad the MSB with 0's in order to have a binary number that falls on nibble boundaries, multiples of 4. For example, the binary number 1001100101 won't convert correctly, because it's ten digits in length. Add two 0's making the number 001001100101. A few illustrations:Large binary and hex conversions

Decimal to hex - tens to sixteens

Up to now we've been able to accomplish our conversions armed with only paper and pencil. It's time to break out your calculator for converting decimal to hex and vice versa. Take  Look at these decimal / hex equivalents:
16 = 0x10  |  34 = 0x22  |  214 = 0xD6  |  175 = 0xAF
Here's how we get from the decimal value on the left of the = sign to its hexadecimal equivalent on the right. Remember the divide and conquer method we used for converting decimal to binary? We are going to use the same method except that we are going to be dividing by 16 rather than 2. The upside is that the process is a lot shorter.
decimal to hex conversion example

  • 225 divided by 16 is 14, remainder 0x1. Place a 0x1 in the remainder column and 14 in the division column. This is our rightmost hex digit.

  • 14 divided by 16 is 0, remainder 14. Since we are converting to hex we use 0xE. Place 0xE in the remainder column and we're done.

  • If you have a small decimal number such as 12, you'll have your answer on the first divide. 12 / 16 = 0, remainder 12 or 0xC. Place a leading 0 in from of the C to keep things uniform. So, the answer would be 0x0C

How easy is that? Here are a few more:
Decimal to hexadecimal convert examples

It's no different with numbers larger than a byte:
Decimal to hexadecimal conversion

Hex to decimal - sixteens to tens

Whew! Nearly done. This is our last number conversion segment, hexadecimal to decimal. With a hex number each position represents a power of 16 and what we do is calculate each position's decimal equivalent and then add them all up. We are going to use a large hex number to illustrate this concept. Given the hex number 0xA59C we find its decimal equivalent with the following logic.
(10 x 163) + (5 x 162) + (9 x 161) + (12 x 160) = 43,296. Here's how it breaks down:
Hexidecimal to decimal conversion example

...And a few more:
Hexadecimal to decimal conversion examples

I encourage you to practice, practice, practice. Download this worksheet to work thru various conversion exercises.

Parting shot - If you are an aspiring network or systems admin then make sure you understand without question binary and decimal conversion through and through.

Coming soon - Part II Understanding IP addresses, subnet masks and subnetting.

./Robert



緲斿崡 2012-12-18 12:56 鍙戣〃璇勮
]]>
shell涔嬧?gt;/dev/null 2>&1鈥?/title><link>http://m.tkk7.com/orangehf/archive/2011/12/01/365262.html</link><dc:creator>緲斿崡</dc:creator><author>緲斿崡</author><pubDate>Thu, 01 Dec 2011 01:54:00 GMT</pubDate><guid>http://m.tkk7.com/orangehf/archive/2011/12/01/365262.html</guid><wfw:comment>http://m.tkk7.com/orangehf/comments/365262.html</wfw:comment><comments>http://m.tkk7.com/orangehf/archive/2011/12/01/365262.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/orangehf/comments/commentRss/365262.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/orangehf/services/trackbacks/365262.html</trackback:ping><description><![CDATA[<div><font size="2" face="Tahoma">shell涓彲鑳界粡甯歌兘鐪嬪埌錛?gt;/dev/null 2>&1</font></div> <div><font size="2" face="Tahoma">鍛戒護(hù)鐨勭粨鏋滃彲浠ラ氳繃%>鐨勫艦寮忔潵瀹氫箟杈撳嚭</font></div> <div><font size="2" face="Tahoma">鍒嗚В榪欎釜緇勫悎錛?#8220;>/dev/null 2>&1” 涓轟簲閮ㄥ垎銆?/font></div> <div><font color="#ff6600" size="2" face="Tahoma">1錛?gt; 浠h〃閲嶅畾鍚戝埌鍝噷錛屼緥濡傦細(xì)echo "123" > /home/123.txt<br />2錛?dev/null 浠h〃絀鴻澶囨枃浠?br />3錛?> 琛ㄧずstderr鏍囧噯閿欒<br />4錛?amp; 琛ㄧず絳夊悓浜庣殑鎰忔濓紝2>&1錛岃〃紺?鐨勮緭鍑洪噸瀹氬悜絳夊悓浜?<br />5錛? 琛ㄧずstdout鏍囧噯杈撳嚭錛岀郴緇熼粯璁ゅ兼槸1錛屾墍浠?>/dev/null"絳夊悓浜?"1>/dev/null"</font></div> <div><font size="2" face="Tahoma">鍥犳錛?gt;/dev/null 2>&1涔熷彲浠ュ啓鎴?#8220;1> /dev/null 2> &1”</font></div> <div><font size="2" face="Tahoma">閭d箞鏈枃鏍囬鐨勮鍙ユ墽琛岃繃紼嬩負(fù)錛?br />1>/dev/null 錛氶鍏堣〃紺烘爣鍑嗚緭鍑洪噸瀹氬悜鍒扮┖璁懼鏂囦歡錛屼篃灝辨槸涓嶈緭鍑轟換浣曚俊鎭埌緇堢錛岃鐧戒簡(jiǎn)灝辨槸涓嶆樉紺轟換浣曚俊鎭?br />2>&1 錛氭帴鐫錛屾爣鍑嗛敊璇緭鍑洪噸瀹氬悜 鍒?鏍囧噯杈撳嚭錛屽洜涓轟箣鍓嶆爣鍑嗚緭鍑哄凡緇忛噸瀹氬悜鍒頒簡(jiǎn)絀鴻澶囨枃浠訛紝鎵浠ユ爣鍑嗛敊璇緭鍑轟篃閲嶅畾鍚戝埌絀鴻澶囨枃浠躲?/font></div> <div><font size="2" face="Tahoma">璇存竻妤氫簡(jiǎn)鍚楋紝澶у鐞嗚В涓嬪惂錛?/font></div> <div><font color="#ff6600" size="2" face="Tahoma">欏轟究瀵規(guī)瘮榪拌涓嬭繖涔堢敤鐨勫ソ澶勶紒</font></div> <div><font size="2" face="Tahoma">   鏈甯哥敤鐨勬柟寮忔湁錛?/font></div> <div><font color="#ff0000" size="2" face="Tahoma">command > file 2>file  涓巆ommand > file 2>&1</font></div> <div><font size="2" face="Tahoma">瀹冧滑 鏈変粈涔堜笉鍚岀殑鍦版柟鍚楋紵</font></div> <div><br /><font size="2" face="Tahoma">      棣栧厛command > file 2>file 鐨勬剰鎬濇槸灝嗗懡浠ゆ墍浜х敓鐨勬爣鍑嗚緭鍑轟俊鎭?鍜岄敊璇殑杈撳嚭淇℃伅閫佸埌file 涓?command  > file 2>file 榪欐牱鐨勫啓娉?stdout鍜宻tderr閮界洿鎺ラ佸埌file涓? file浼?xì)琚墦寮涓ゆ,榪欐牱stdout鍜宻tderr浼?xì)浜掔浉瑕嗙?榪欐牱鍐欑浉褰撲嬌鐢ㄤ簡(jiǎn)FD1鍜孎D2涓や釜鍚屾椂鍘繪姠鍗爁ile 鐨勭閬撱?br />      鑰宑ommand >file 2>&1 榪欐潯鍛戒護(hù)灝卞皢stdout鐩存帴閫佸悜file, stderr 緇ф壙浜?jiǎn)FD1綆¢亾鍚?鍐嶈閫佸線file,姝ゆ椂,file 鍙鎵撳紑浜?jiǎn)涓嬈?涔熷彧浣跨敤浜?jiǎn)涓涓閬揊D1,瀹冨寘鎷簡(jiǎn)stdout鍜宻tderr鐨勫唴瀹廣?br />      浠嶪O鏁堢巼涓?鍓嶄竴鏉″懡浠ょ殑鏁堢巼瑕佹瘮鍚庨潰涓鏉$殑鍛戒護(hù)鏁堢巼瑕佷綆,鎵浠ュ湪緙栧啓shell鑴氭湰鐨勬椂鍊?杈冨鐨勬椂鍊欐垜浠細(xì)command > file 2>&1 榪欐牱鐨勫啓娉曘?/font></div><br /><br />杞嚜錛?a >http://ppp1013.blog.51cto.com/927700/271043</a><img src ="http://m.tkk7.com/orangehf/aggbug/365262.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/orangehf/" target="_blank">緲斿崡</a> 2011-12-01 09:54 <a href="http://m.tkk7.com/orangehf/archive/2011/12/01/365262.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>iostat鏉ュlinux紜洏I(yè)O鎬ц兘榪涜浜?jiǎn)瑙?/title><link>http://m.tkk7.com/orangehf/archive/2011/11/02/362534.html</link><dc:creator>緲斿崡</dc:creator><author>緲斿崡</author><pubDate>Wed, 02 Nov 2011 07:14:00 GMT</pubDate><guid>http://m.tkk7.com/orangehf/archive/2011/11/02/362534.html</guid><wfw:comment>http://m.tkk7.com/orangehf/comments/362534.html</wfw:comment><comments>http://m.tkk7.com/orangehf/archive/2011/11/02/362534.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://m.tkk7.com/orangehf/comments/commentRss/362534.html</wfw:commentRss><trackback:ping>http://m.tkk7.com/orangehf/services/trackbacks/362534.html</trackback:ping><description><![CDATA[<p>杞嚜: <a title="iostat鏉ュlinux紜洏I(yè)O鎬ц兘榪涜浜?jiǎn)瑙? >http://www.php-oa.com/2009/02/03/iostat.html</a> <p> 浠ュ墠涓鐩翠笉澶細(xì)鐢ㄨ繖涓弬鏁般傜幇鍦ㄨ鐪熺爺絀朵簡(jiǎn)涓涓媔ostat錛屽洜涓哄垰濂芥湁鍙伴噸瑕佺殑鏈嶅姟鍣ㄥ帇鍔涢珮,鎵浠ユ斁涓婃潵鍒嗘瀽涓涓?涓嬮潰榪欏彴灝辨槸IO鏈夊帇鍔涜繃澶х殑鏈嶅姟鍣?/p> <p> </p> <div> <div class="egukbgy" id="highlighter_972160" class="syntaxhighlighter nogutter bash ie"> <div id="amhllpb" class="toolbar"><span><a class="toolbar_item command_help help" >?</a></span></div> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="code"> <div id="qdaajwm" class="container"> <div id="qvoeuve" class="line number1 index0 alt2"><code class="bash plain">$iostat -x 1 </code></div> <div id="idfzxrh" class="line number2 index1 alt1"><code class="bash plain">Linux 2.6.33-fukai (fukai-laptop)          _i686_    (2 CPU) </code></div> <div id="kecdigt" class="line number3 index2 alt2"><code class="bash plain">avg-cpu:  %user   %</code><code class="bash functions">nice</code> <code class="bash plain">%system %iowait  %steal   %idle </code></div> <div id="dnhqkmn" class="line number4 index3 alt1"><code class="bash spaces">           </code><code class="bash plain">5.47    0.50    8.96   48.26    0.00   36.82 </code></div> <div id="ktuvlfz" class="line number5 index4 alt2"><code class="bash spaces"> </code> </div> <div id="jegdeya" class="line number6 index5 alt1"><code class="bash plain">Device:         rrqm</code><code class="bash plain">/s</code>   <code class="bash plain">wrqm</code><code class="bash plain">/s</code>     <code class="bash plain">r</code><code class="bash plain">/s</code>     <code class="bash plain">w</code><code class="bash plain">/s</code>   <code class="bash plain">rsec</code><code class="bash plain">/s</code>   <code class="bash plain">wsec</code><code class="bash plain">/s</code> <code class="bash plain">avgrq-sz avgqu-sz   await  svctm  %util </code></div> <div id="hnwnpyz" class="line number7 index6 alt2"><code class="bash plain">sda               6.00   273.00   99.00    7.00  2240.00  2240.00    42.26     1.12   10.57   7.96  84.40 </code></div> <div id="ihjwxys" class="line number8 index7 alt1"><code class="bash plain">sdb               0.00     4.00    0.00  350.00     0.00  2068.00     5.91     0.55    1.58   0.54  18.80</code></div></div></td></tr></tbody></table></div></div> <p><strong>rrqm/s:</strong>   姣忕榪涜 merge 鐨勮鎿嶄綔鏁扮洰錛堝綋緋葷粺璋冪敤闇瑕佽鍙栨暟鎹殑鏃跺欙紝VFS灝嗚姹傚彂鍒板悇涓狥S錛屽鏋淔S鍙戠幇涓嶅悓鐨勮鍙栬姹傝鍙栫殑鏄浉鍚孊lock鐨勬暟鎹紝FS浼?xì)灏啒q欎釜璇鋒眰鍚堝茍Merge錛夈傚嵆 delta(rmerge)/s<br /><strong>wrqm/s:</strong>  姣忕榪涜 merge 鐨勫啓鎿嶄綔鏁扮洰銆傚嵆 delta(wmerge)/s<br /><strong>r/s:</strong>           姣忕瀹屾垚鐨勮 I/O 璁懼嬈℃暟銆傚嵆 delta(rio)/s<br /><strong>w/s:</strong>         姣忕瀹屾垚鐨勫啓 I/O 璁懼嬈℃暟銆傚嵆 delta(wio)/s<br /><strong>rsec/s:</strong>    姣忕璇繪墖鍖烘暟銆傚嵆 delta(rsect)/s<br /><strong>wsec/s:  </strong>姣忕鍐欐墖鍖烘暟銆傚嵆 delta(wsect)/s<br /><strong>rkB/s:  </strong>    姣忕璇籏瀛楄妭鏁般傛槸 rsect/s 鐨勪竴鍗婏紝鍥犱負(fù)姣忔墖鍖哄ぇ灝忎負(fù)512瀛楄妭銆?闇瑕佽綆?<br /><strong>wkB/s:</strong>    姣忕鍐橩瀛楄妭鏁般傛槸 wsect/s 鐨勪竴鍗娿?闇瑕佽綆?<br /><strong>avgrq-sz: </strong>騫沖潎姣忔璁懼I/O鎿嶄綔鐨勬暟鎹ぇ灝?(鎵囧尯)銆俤elta(rsect+wsect)/delta(rio+wio)<br /><strong>avgqu-sz:</strong> 騫沖潎I/O闃熷垪闀垮害銆傚嵆 delta(aveq)/s/1000 (鍥犱負(fù)aveq鐨勫崟浣嶄負(fù)姣)銆?br /><strong>await:</strong>    騫沖潎姣忔璁懼I/O鎿嶄綔鐨勭瓑寰呮椂闂?(姣)銆傚嵆 delta(ruse+wuse)/delta(rio+wio)<br /><strong>svctm:   </strong>騫沖潎姣忔璁懼I/O鎿嶄綔鐨勬湇鍔℃椂闂?(姣)銆傚嵆 delta(use)/delta(rio+wio)<br /><strong>%util:      </strong>涓縐掍腑鏈夌櫨鍒嗕箣澶氬皯鐨勬椂闂寸敤浜?I/O 鎿嶄綔錛屾垨鑰呰涓縐掍腑鏈夊灝戞椂闂?I/O 闃熷垪鏄潪絀虹殑銆傚嵆 delta(use)/s/1000 (鍥犱負(fù)use鐨勫崟浣嶄負(fù)姣)</p> <p><strong>濡傛灉 %util 鎺ヨ繎 100%錛岃鏄庝駭鐢熺殑I/O璇鋒眰澶錛孖/O緋葷粺宸茬粡婊¤礋鑽鳳紝璇ョ鐩?br />鍙兘瀛樺湪鐡墮銆?br />idle灝忎簬70% IO鍘嬪姏灝辮緝澶т簡(jiǎn),涓鑸鍙栭熷害鏈夎緝澶氱殑wait.</strong><br /><strong>鍚屾椂鍙互緇撳悎vmstat 鏌ョ湅鏌ョ湅b鍙傛暟(<font size="2" face="verdana, arial, helvetica">絳夊緟璧勬簮鐨勮繘紼嬫暟</font>)鍜寃a鍙傛暟(<font size="2" face="verdana, arial, helvetica">IO絳夊緟鎵鍗犵敤鐨凜PU鏃墮棿鐨勭櫨鍒嗘瘮,楂樿繃30%鏃禝O鍘嬪姏楂?/font>)</strong><br /><strong>鍙﹀ await 鐨勫弬鏁頒篃瑕佸鍜?svctm 鏉ュ弬鑰冦傚樊鐨勮繃楂樺氨涓瀹氭湁 IO 鐨勯棶棰樸?br />avgqu-sz 涔熸槸涓仛 IO 璋冧紭鏃墮渶瑕佹敞鎰忕殑鍦版柟錛岃繖涓氨鏄洿鎺ユ瘡嬈℃搷浣滅殑鏁版嵁鐨勫ぇ灝忥紝濡傛灉嬈℃暟澶氾紝浣嗘暟鎹嬁鐨勫皬鐨勮瘽錛屽叾瀹?IO 涔熶細(xì)寰堝皬.濡傛灉鏁版嵁鎷跨殑澶э紝鎵岻O 鐨勬暟鎹細(xì)楂樸備篃鍙互閫氳繃 avgqu-sz × ( r/s or w/s ) = rsec/s or wsec/s.涔熷氨鏄錛岃瀹氶熷害鏄繖涓潵鍐沖畾鐨勩?/strong></p> <p> </p> <p> </p> <p> </p> <p><strong>鍙﹀榪樺彲浠ュ弬鑰?/strong><br />svctm 涓鑸灝忎簬 await (鍥犱負(fù)鍚屾椂絳夊緟鐨勮姹傜殑絳夊緟鏃墮棿琚噸澶嶈綆椾簡(jiǎn))錛宻vctm 鐨勫ぇ灝忎竴鑸拰紓佺洏鎬ц兘鏈夊叧錛孋PU/鍐呭瓨鐨勮礋鑽蜂篃浼?xì)瀵瑰叾鏈夊奖鍝嶅Q岃姹傝繃澶氫篃浼?xì)闂存帴瀵艰?svctm 鐨勫鍔犮俛wait 鐨勫ぇ灝忎竴鑸彇鍐充簬鏈嶅姟鏃墮棿(svctm) 浠ュ強(qiáng) I/O 闃熷垪鐨勯暱搴﹀拰 I/O 璇鋒眰鐨勫彂鍑烘ā寮忋傚鏋?svctm 姣旇緝鎺ヨ繎 await錛岃鏄?I/O 鍑犱箮娌℃湁絳夊緟鏃墮棿錛涘鏋?await 榪滃ぇ浜?svctm錛岃鏄?I/O 闃熷垪澶暱錛屽簲鐢ㄥ緱鍒扮殑鍝嶅簲鏃墮棿鍙樻參錛屽鏋滃搷搴旀椂闂磋秴榪囦簡(jiǎn)鐢ㄦ埛鍙互瀹硅鐨勮寖鍥達(dá)紝榪欐椂鍙互鑰冭檻鏇存崲鏇村揩鐨勭鐩橈紝璋冩暣鍐呮牳 elevator 綆楁硶錛屼紭鍖栧簲鐢紝鎴栬呭崌綰?CPU銆?br />闃熷垪闀垮害(avgqu-sz)涔熷彲浣滀負(fù)琛¢噺緋葷粺 I/O 璐熻嵎鐨勬寚鏍囷紝浣嗙敱浜?avgqu-sz 鏄寜鐓у崟浣嶆椂闂寸殑騫沖潎鍊鹼紝鎵浠ヤ笉鑳藉弽鏄犵灛闂寸殑 I/O 媧按銆?/p> <p><strong><br />  鍒漢涓涓笉閿欑殑渚嬪瓙.(I/O 緋葷粺 vs. 瓚呭競(jìng)鎺掗槦)</strong></p> <p>涓句竴涓緥瀛愶紝鎴戜滑鍦ㄨ秴甯?jìng)鎺掗?checkout 鏃訛紝鎬庝箞鍐沖畾璇ュ幓鍝釜浜ゆ鍙板憿? 棣栧綋鏄湅鎺掔殑闃熶漢鏁幫紝5涓漢鎬繪瘮20浜鴻蹇惂? 闄や簡(jiǎn)鏁頒漢澶達(dá)紝鎴戜滑涔熷父甯哥湅鐪嬪墠闈漢璐拱鐨勪笢瑗垮灝戯紝濡傛灉鍓嶉潰鏈変釜閲囪喘浜?jiǎn)涓鏄熸湡椋熷搧鐨勫ぇ濡堬紝閭d箞鍙互鑰冭檻鎹釜闃熸帓浜?jiǎn)銆傝繕鏈夊氨鏄敹閾跺憳鐨勯熷害浜?jiǎn)锛屽鏋溂勵(lì)C笂浜?jiǎn)杩?閽遍兘鐐逛笉娓呮鐨勬柊鎵嬶紝閭e氨鏈夌殑絳変簡(jiǎn)銆傚彟澶栵紝鏃舵満涔熷緢閲嶈錛屽彲鑳?5 鍒嗛挓鍓嶈繕浜烘弧涓烘?zhèn)g殑鏀秼茟謴板Q岀幇鍦ㄥ凡鏄漢鍘繪ゼ絀猴紝榪欐椂鍊欎氦嬈懼彲鏄緢鐖藉晩錛屽綋鐒?dòng)灱屽墠鎻愭槸閭q囧幓鐨?5 鍒嗛挓閲屾墍鍋氱殑浜嬫儏姣旀帓闃熻鏈夋剰涔?(涓嶈繃鎴戣繕娌″彂鐜頒粈涔堜簨鎯呮瘮鎺掗槦榪樻棤鑱婄殑)銆?/p> <p>I/O 緋葷粺涔熷拰瓚呭競(jìng)鎺掗槦鏈夊緢澶氱被浼間箣澶?</p> <p>r/s+w/s 綾諱技浜庝氦嬈句漢鐨勬繪暟<br />騫沖潎闃熷垪闀垮害(avgqu-sz)綾諱技浜庡崟浣嶆椂闂撮噷騫沖潎鎺掗槦浜虹殑涓暟<br />騫沖潎鏈嶅姟鏃墮棿(svctm)綾諱技浜庢敹閾跺憳鐨勬敹嬈鵑熷害<br />騫沖潎絳夊緟鏃墮棿(await)綾諱技浜庡鉤鍧囨瘡浜虹殑絳夊緟鏃墮棿<br />騫沖潎I/O鏁版嵁(avgrq-sz)綾諱技浜庡鉤鍧囨瘡浜烘墍涔扮殑涓滆タ澶氬皯<br />I/O 鎿嶄綔鐜?(%util)綾諱技浜庢敹嬈懼彴鍓嶆湁浜烘帓闃熺殑鏃墮棿姣斾緥銆?/p> <p>鎴戜滑鍙互鏍規(guī)嵁榪欎簺鏁版嵁鍒嗘瀽鍑?I/O 璇鋒眰鐨勬ā寮忥紝浠ュ強(qiáng) I/O 鐨勯熷害鍜屽搷搴旀椂闂淬?/p> <p><strong>涓嬮潰鏄埆浜哄啓鐨勮繖涓弬鏁拌緭鍑虹殑鍒嗘瀽</strong></p> <div> <div class="blydqom" id="highlighter_536534" class="syntaxhighlighter nogutter bash ie"> <div id="vfvauox" class="toolbar"><span><a class="toolbar_item command_help help" >?</a></span></div> <table border="0" cellspacing="0" cellpadding="0"> <tbody> <tr> <td class="code"> <div id="nchirmd" class="container"> <div id="vtnhrck" class="line number1 index0 alt2"><code class="bash comments"># iostat -x 1 </code></div> <div id="tinzmkt" class="line number2 index1 alt1"><code class="bash plain">avg-cpu: %user %</code><code class="bash functions">nice</code> <code class="bash plain">%sys %idle </code></div> <div id="zfdxkmv" class="line number3 index2 alt2"><code class="bash plain">16.24 0.00 4.31 79.44 </code></div> <div id="fpfktoi" class="line number4 index3 alt1"><code class="bash plain">Device: rrqm</code><code class="bash plain">/s</code> <code class="bash plain">wrqm</code><code class="bash plain">/s</code> <code class="bash plain">r</code><code class="bash plain">/s</code> <code class="bash plain">w</code><code class="bash plain">/s</code> <code class="bash plain">rsec</code><code class="bash plain">/s</code> <code class="bash plain">wsec</code><code class="bash plain">/s</code> <code class="bash plain">rkB</code><code class="bash plain">/s</code> <code class="bash plain">wkB</code><code class="bash plain">/s</code> <code class="bash plain">avgrq-sz avgqu-sz await svctm %util </code></div> <div id="xsqvagl" class="line number5 index4 alt2"><code class="bash plain">/dev/cciss/c0d0</code></div> <div id="orlqgaf" class="line number6 index5 alt1"><code class="bash plain">0.00 44.90 1.02 27.55 8.16 579.59 4.08 289.80 20.57 22.35 78.21 5.00 14.29</code></div></div></td></tr></tbody></table></div></div> <p>涓婇潰鐨?iostat 杈撳嚭琛ㄦ槑縐掓湁 28.57 嬈¤澶?I/O 鎿嶄綔: 鎬籌O(io)/s = r/s(璇? +w/s(鍐? = 1.02+27.55 = 28.57 (嬈?縐? 鍏朵腑鍐欐搷浣滃崰浜?jiǎn)涓讳?(w:r = 27:1)銆?/p> <p>騫沖潎姣忔璁懼 I/O 鎿嶄綔鍙渶瑕?5ms 灝卞彲浠ュ畬鎴愶紝浣嗘瘡涓?I/O 璇鋒眰鍗撮渶瑕佺瓑涓?78ms錛屼負(fù)浠涔? 鍥犱負(fù)鍙戝嚭鐨?I/O 璇鋒眰澶 (姣忕閽熺害 29 涓?錛屽亣璁捐繖浜涜姹傛槸鍚屾椂鍙戝嚭鐨勶紝閭d箞騫沖潎絳夊緟鏃墮棿鍙互榪欐牱璁$畻:</p> <p>騫沖潎絳夊緟鏃墮棿 = 鍗曚釜 I/O 鏈嶅姟鏃墮棿 * ( 1 + 2 + … + 璇鋒眰鎬繪暟-1) / 璇鋒眰鎬繪暟</p> <p>搴旂敤鍒頒笂闈㈢殑渚嬪瓙: 騫沖潎絳夊緟鏃墮棿 = 5ms * (1+2+…+28)/29 = 70ms錛屽拰 iostat 緇欏嚭鐨?8ms 鐨勫鉤鍧囩瓑寰呮椂闂村緢鎺ヨ繎銆傝繖鍙嶈繃鏉ヨ〃鏄?I/O 鏄悓鏃跺彂璧風(fēng)殑銆?/p> <p>姣忕鍙戝嚭鐨?I/O 璇鋒眰寰堝 (綰?29 涓?錛屽鉤鍧囬槦鍒楀嵈涓嶉暱 (鍙湁 2 涓?宸﹀彸)錛岃繖琛ㄦ槑榪?29 涓姹傜殑鍒版潵騫朵笉鍧囧寑錛屽ぇ閮ㄥ垎鏃墮棿 I/O 鏄┖闂茬殑銆?/p> <p>涓縐掍腑鏈?14.29% 鐨勬椂闂?I/O 闃熷垪涓槸鏈夎姹傜殑錛屼篃灝辨槸璇達(dá)紝85.71% 鐨勬椂闂撮噷 I/O 緋葷粺鏃犱簨鍙仛錛屾墍鏈?29 涓?I/O 璇鋒眰閮藉湪142姣涔嬪唴澶勭悊鎺変簡(jiǎn)銆?/p> <p>delta(ruse+wuse)/delta(io) = await = 78.21 => delta(ruse+wuse)/s =78.21 * delta(io)/s = 78.21*28.57 = 2232.8錛岃〃鏄庢瘡縐掑唴鐨処/O璇鋒眰鎬誨叡闇瑕佺瓑寰?232.8ms銆傛墍浠ュ鉤鍧囬槦鍒楅暱搴﹀簲涓?2232.8ms/1000ms = 2.23錛岃?iostat 緇欏嚭鐨勫鉤鍧囬槦鍒楅暱搴?(avgqu-sz) 鍗翠負(fù) 22.35錛屼負(fù)浠涔?! 鍥犱負(fù) iostat 涓湁 bug錛宎vgqu-sz 鍊煎簲涓?2.23錛岃屼笉鏄?22.35銆?/p><!--[syntaxhighlighter]--><!--浠g爜楂樹寒錛岃鍕跨紪杈?-> <script type="text/javascript" src="http://www.php-oa.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shCore.js"></script><script type="text/javascript" src="http://www.php-oa.com/wp-content/plugins/ck-and-syntaxhighlighter/syntaxhighlighter/scripts/shBrushBash.js"></script><script type="text/javascript"> SyntaxHighlighter.defaults['class-name'] = ''; SyntaxHighlighter.defaults['smart-tabs'] = true; SyntaxHighlighter.defaults['tab-size'] = 4; SyntaxHighlighter.defaults['gutter'] = false; SyntaxHighlighter.defaults['quick-code'] = true; SyntaxHighlighter.defaults['collapse'] = false; SyntaxHighlighter.defaults['auto-links'] = true; SyntaxHighlighter.defaults['toolbar'] = true; SyntaxHighlighter.all(); </script> <!--[/syntaxhighlighter]--><!-- Start of add bookmark buttons created by wp_addbookmarks. Plugin by http://www.thinkagain.cn/ --><img src ="http://m.tkk7.com/orangehf/aggbug/362534.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://m.tkk7.com/orangehf/" target="_blank">緲斿崡</a> 2011-11-02 15:14 <a href="http://m.tkk7.com/orangehf/archive/2011/11/02/362534.html#Feedback" target="_blank" style="text-decoration:none;">鍙戣〃璇勮</a></div>]]></description></item><item><title>Understanding software Installation (configure, make, make install)http://m.tkk7.com/orangehf/archive/2011/09/28/359689.html緲斿崡緲斿崡Wed, 28 Sep 2011 06:01:00 GMThttp://m.tkk7.com/orangehf/archive/2011/09/28/359689.htmlhttp://m.tkk7.com/orangehf/comments/359689.htmlhttp://m.tkk7.com/orangehf/archive/2011/09/28/359689.html#Feedback0http://m.tkk7.com/orangehf/comments/commentRss/359689.htmlhttp://m.tkk7.com/orangehf/services/trackbacks/359689.htmlThis tutorial is aimed at those who have just started using Linux. Generally when users from the Windows background enter the Linux scene,they are totally stumped by the software installation method. They were used to the luxury of double clicking on a single file and getting their software installed. But now they have to type cryptic commands to do the same.

Though the installation instructions tell them what to do, they have no idea what those steps actually do. This article shall explain the basics of software installation. After reading this article you would feel more at home when installing your next software.

Generally beginners tend to search desperately for RPMs since installing RPMs is a real simple task. But this article doesn't talk about RPMs. It deals with the softwares that you generally get in the zipped formats as tarballs.


Details :

Generally you would get Linux software in the tarball format (.tgz) This file has to be uncompressed into any directory using tar command. In case you download a new tarball by the name game.tgz, then you would have to type the following command

$ tar xfvz game.tgz

This would create a directory within the current directory and unzip all the files within that new directory. Once this is complete the installation instructions ask you to execute the 3 (now famous) commands : configure, make & make install. Most of the users do this and successfully install their softwares. But most of the newbies have no idea what this really does. The rest of the article shall explain the meaning of these 3 commands

Each software comes with a few files which are solely for the purpose of installation sake. One of them is the configure script. The user has to run the following command at the prompt

$ ./configure

The above command makes the shell run the script named ' configure ' which exists in the current directory. The configure script basically consists of many lines which are used to check some details about the machine on which the software is going to be installed. This script checks for lots of dependencies on your system. For the particular software to work properly, it may be requiring a lot of things to be existing on your machine already. When you run the configure script you would see a lot of output on the screen , each being some sort of question and a respective yes/no as the reply. If any of the major requirements are missing on your system, the configure script would exit and you cannot proceed with the installation, until you get those required things.

The main job of the configure script is to create a ' Makefile ' . This is a very important file for the installation process. Depending on the results of the tests (checks) that the configure script performed it would write down the various steps that need to be taken (while compiling the software) in the file named Makefile.

If you get no errors and the configure script runs successfully (if there is any error the last few lines of the output would glaringly be stating the error) then you can proceed with the next command which is

$ make

' make ' is actually a utility which exists on almost all Unix systems. For make utility to work it requires a file named Makefile in the same directory in which you run make. As we have seen the configure script's main job was to create a file named Makefile to be used with make utility. (Sometimes the Makefile is named as makefile also)

make would use the directions present in the Makefile and proceed with the installation. The Makefile indicates the sequence, that Linux must follow to build various components / sub-programs of your software. The sequence depends on the way the software is designed as well as many other factors.

The Makefile actually has a lot of labels (sort of names for different sections). Hence depending on what needs to be done the control would be passed to the different sections within the Makefile Or it is possible that at the end of one of the section there is a command to go to some next section.

Basically the make utility compiles all your program code and creates the executables. For particular section of the program to complete might require some other part of the code already ready, this is what the Makefile does. It sets the sequence for the events so that your program does not complain about missing dependencies.

One of the labels present in the Makefile happens to be named ' install ' .

If make ran successfully then you are almost done with the installation. Only the last step remains which is

$ make install

As indicated before make uses the file named Makefile in the same directory. When you run make without any parameters, the instruction in the Makefile begin executing from the start and as per the rules defined within the Makefile (particular sections of the code may execute after one another..thats why labels are used..to jump from one section to another). But when you run make with install as the parameter, the make utility searches for a label named install within the Makefile, and executes only that section of the Makefile.

The install section happens to be only a part where the executables and other required files created during the last step (i.e. make) are copied into the required final directories on your machine. E.g. the executable that the user runs may be copied to the /usr/local/bin so that all users are able to run the software. Similarly all the other files are also copied to the standard directories in Linux. Remember that when you ran make, all the executables were created in the temporary directory where you had unzipped your original tarball. So when you run make install, these executables are copied to the final directories.

Thats it !! Now the installation process must be clear to you. You surely will feel more at home when you begin your next software installation.
鍘熸枃鍦板潃錛?a >http://www.codecoffee.com/tipsforlinux/articles/27.html

緲斿崡 2011-09-28 14:01 鍙戣〃璇勮
]]>
oracle rmanhttp://m.tkk7.com/orangehf/archive/2011/09/15/358724.html緲斿崡緲斿崡Thu, 15 Sep 2011 08:54:00 GMThttp://m.tkk7.com/orangehf/archive/2011/09/15/358724.htmlhttp://m.tkk7.com/orangehf/comments/358724.htmlhttp://m.tkk7.com/orangehf/archive/2011/09/15/358724.html#Feedback0http://m.tkk7.com/orangehf/comments/commentRss/358724.htmlhttp://m.tkk7.com/orangehf/services/trackbacks/358724.htmlhttp://www.bccn.net/Article/sjk/oracle/200601/3470_2.html
http://www.beifenruanjian.com/oracle/redhat-linux-as4-on-the-use-of-rman-for-backup-and-recovery-testing/
http://blog.sina.com.cn/s/blog_3fb41b900100h7sg.html
http://database.e800.com.cn/articles/2008/116/1200428070211771370_1.html
http://blog.csdn.net/tianlesoftware/article/details/4699320

rman 鎭㈠錛?br />http://space.itpub.net/9765498/viewspace-237930
http://space.itpub.net/8334342/viewspace-521139

緲斿崡 2011-09-15 16:54 鍙戣〃璇勮
]]>
Oracle 琛ㄨВ閿?http://m.tkk7.com/orangehf/archive/2011/08/22/357052.html緲斿崡緲斿崡Mon, 22 Aug 2011 08:04:00 GMThttp://m.tkk7.com/orangehf/archive/2011/08/22/357052.htmlhttp://m.tkk7.com/orangehf/comments/357052.htmlhttp://m.tkk7.com/orangehf/archive/2011/08/22/357052.html#Feedback0http://m.tkk7.com/orangehf/comments/commentRss/357052.htmlhttp://m.tkk7.com/orangehf/services/trackbacks/357052.htmlSELECT /*+ rule */
 s.username,
 decode(l.type, 
'TM''TABLE LOCK''TX''ROW LOCK'NULL) LOCK_LEVEL,
 o.owner,
 o.
object_name,
 o.object_type,
 s.sid,
 s.serial#,
 s.terminal,
 s.machine,
 s.program,
 s.osuser
  
FROM v$session s, v$lock l, dba_objects o
 
WHERE l.sid = s.sid
   
AND l.id1 = o.object_id(+)
   
AND s.username is NOT Null

2.榪涜瑙i攣
1alter system kill session 'sid,serial#';


緲斿崡 2011-08-22 16:04 鍙戣〃璇勮
]]>
ORACLE鎵歸噺緇戝畾FORALL涓嶣ULK COLLECT http://m.tkk7.com/orangehf/archive/2011/08/22/357028.html緲斿崡緲斿崡Mon, 22 Aug 2011 04:55:00 GMThttp://m.tkk7.com/orangehf/archive/2011/08/22/357028.htmlhttp://m.tkk7.com/orangehf/comments/357028.htmlhttp://m.tkk7.com/orangehf/archive/2011/08/22/357028.html#Feedback0http://m.tkk7.com/orangehf/comments/commentRss/357028.htmlhttp://m.tkk7.com/orangehf/services/trackbacks/357028.htmlhttp://log-cd.iteye.com/blog/411122

FORALL涓嶣ULK COLLECT鐨勪嬌鐢ㄦ柟娉?
1錛庝嬌鐢‵ORALL姣擣OR鏁堢巼楂橈紝鍥犱負(fù)鍓嶈呭彧鍒囨崲涓嬈′笂涓嬫枃錛岃屽悗鑰呭皢鏄湪寰幆嬈℃暟涓鏍峰涓笂涓嬫枃闂村垏鎹€?

2錛庝嬌鐢˙LUK COLLECT涓嬈″彇鍑轟竴涓暟鎹泦鍚堬紝姣旂敤娓告爣鏉″彇鏁版嵁鏁堢巼楂橈紝灝ゅ叾鏄湪緗戠粶涓嶅ぇ濂界殑鎯呭喌涓嬨備絾BLUK COLLECT闇瑕佸ぇ閲忓唴瀛樸?

渚嬪瓙:
1create table test_forall ( user_id number(10), user_name varchar2(20));

select into 涓嬌鐢╞ulk collect
 1DECLARE  
 2  TYPE table_forall IS TABLE OF test_forall%ROWTYPE;   
 3  v_table table_forall;   
 4BEGIN  
 5    SELECT mub.user_id,mub.user_name   
 6         BULK COLLECT INTO v_table   
 7    FROM mag_user_basic mub   
 8         WHERE mub.user_id BETWEEN 10000 AND 10100;   
 9    FORALL idx IN 1..v_table.COUNT  
10           INSERT INTO test_forall VALUES v_table(idx);   
11           --VALUES(v_table(idx).user_id,v_table(idx).user_name);Error   
12           --鍦≒L/SQL涓紝BULK In-BIND涓嶳ECORD錛?ROWTYPE鏄笉鑳藉湪涓鍧椾嬌鐢ㄧ殑錛?nbsp;  
13           --涔熷氨鏄錛孊ULK In-BIND鍙兘涓庣畝鍗曠被鍨嬬殑鏁扮粍涓鍧椾嬌鐢?nbsp;  
14    COMMIT;   
15  
16EXCEPTION   
17    WHEN OTHERS THEN  
18        ROLLBACK;   
19     
20END;  
21

fetch into 涓嬌鐢╞ulk collect
 1DECLARE
 2  TYPE table_forall IS TABLE OF test_forall%ROWTYPE;
 3  v_table table_forall;   
 4  
 5  CURSOR c1 IS
 6    SELECT mub.user_id,mub.user_name
 7         FROM mag_user_basic mub
 8           WHERE mub.user_id BETWEEN 10000 AND 10100;
 9BEGIN
10   OPEN c1;
11   --鍦╢etch into涓嬌鐢╞ulk collect
12   FETCH c1 BULK COLLECT INTO v_table;
13   
14   FORALL idx IN 1..v_table.COUNT
15         INSERT INTO test_forall VALUES v_table(idx);
16    COMMIT;
17
18EXCEPTION
19    WHEN OTHERS THEN
20        ROLLBACK;
21END;

鍦╮eturning into涓嬌鐢╞ulk collect
 1CREATE TABLE test_forall2 AS SELECT * FROM test_forall;
 2----鍦╮eturning into涓嬌鐢╞ulk collect

 3DECLARE
 4   TYPE IdList IS TABLE OF test_forall.User_Id%TYPE;
 5
   enums IdList;
 6   TYPE NameList IS TABLE OF test_forall.user_name%
TYPE;
 7
   names NameList;
 8BEGIN

 9   DELETE FROM test_forall2 WHERE user_id = 10100
10        RETURNING user_iduser_name BULK COLLECT INTO enums, names;
11   dbms_output.put_line('Deleted ' || SQL%ROWCOUNT || ' rows:'
);
12   FOR i IN
 enums.FIRST .. enums.LAST
13
   LOOP
14     dbms_output.put_line('User #' || enums(i) || '' ||
 names(i));
15   END
 LOOP;
16   COMMIT
;
17
   
18
EXCEPTION
19    WHEN OTHERS THEN

20        ROLLBACK;
21
       
22END;

鎵歸噺鏇存柊涓紝灝唂or鏀規(guī)垚forall
 1DECLARE 
 2    TYPE NumList IS VARRAY(20OF NUMBER
;                                                
 3    depts NumList := NumList(103070
);
 4 -- department numbers                    

 5     BEGIN        
 6
                
 7       FOR i IN
 depts.FIRST..depts.LAST
 8
       LOOP
 9
       
10       --UPDATE statement is sent to the SQL engine 

11       -- with each iteration of the FOR loop!
12         UPDATE emp SET sal = sal * 1.10 WHERE deptno = depts(i);
13      END
 LOOP: 
14    END;          

1--UPDATE statement is sent to the SQL engine just once, with the entire nested table
2FORALL i IN depts.FIRST..depts.LAST 
3  UPDATE emp SET sal = sal * 1.10 WHERE deptno = depts(i); 

 To maximize performance, rewrite your programs as follows:
a. If an INSERT, UPDATE, or DELETE statement executes inside a loop and References collection elements, move it into a FORALL statement.
b. If a SELECT INTO, FETCH INTO, or RETURNING INTO clause references a
Collection, incorporate the BULK COLLECT clause.
c. If possible, use host arrays to pass collections back and forth between your Programs and the database server.
d. If the failure of a DML operation on a particular row is not a serious problem,Include the keywords SAVE EXCEPTIONS in the FORALL statement and report Or clean up the errors in a subsequent loop using the %BULK_EXCEPTIONS Attribute.


緲斿崡 2011-08-22 12:55 鍙戣〃璇勮
]]>
浜氬お浜掕仈緗戠粶淇℃伅涓績(jī)錛屾煡璇p緗戝潃http://m.tkk7.com/orangehf/archive/2011/08/15/356556.html緲斿崡緲斿崡Mon, 15 Aug 2011 04:42:00 GMThttp://m.tkk7.com/orangehf/archive/2011/08/15/356556.htmlhttp://m.tkk7.com/orangehf/comments/356556.htmlhttp://m.tkk7.com/orangehf/archive/2011/08/15/356556.html#Feedback0http://m.tkk7.com/orangehf/comments/commentRss/356556.htmlhttp://m.tkk7.com/orangehf/services/trackbacks/356556.htmlhttp://www.apnic.net/apnic-info/whois_search

緲斿崡 2011-08-15 12:42 鍙戣〃璇勮
]]>
oracle鏌ョ湅琛ㄥ垎鍖烘儏鍐祍qlhttp://m.tkk7.com/orangehf/archive/2011/08/10/356249.html緲斿崡緲斿崡Wed, 10 Aug 2011 08:38:00 GMThttp://m.tkk7.com/orangehf/archive/2011/08/10/356249.htmlhttp://m.tkk7.com/orangehf/comments/356249.htmlhttp://m.tkk7.com/orangehf/archive/2011/08/10/356249.html#Feedback0http://m.tkk7.com/orangehf/comments/commentRss/356249.htmlhttp://m.tkk7.com/orangehf/services/trackbacks/356249.html

select * from user_tab_subpartitions t where t.table_name = upper('tablename');
select * from user_tab_partitions t where t.table_name = upper('tablename');

 



緲斿崡 2011-08-10 16:38 鍙戣〃璇勮
]]>
oracle瀛樺偍榪囩▼琚攣瀹氱殑瑙e喅鏂規(guī)硶http://m.tkk7.com/orangehf/archive/2011/08/04/355815.html緲斿崡緲斿崡Thu, 04 Aug 2011 09:13:00 GMThttp://m.tkk7.com/orangehf/archive/2011/08/04/355815.htmlhttp://m.tkk7.com/orangehf/comments/355815.htmlhttp://m.tkk7.com/orangehf/archive/2011/08/04/355815.html#Feedback0http://m.tkk7.com/orangehf/comments/commentRss/355815.htmlhttp://m.tkk7.com/orangehf/services/trackbacks/355815.html
2.鑻ヨ瀛樺偍榪囩▼榪樿閿佸畾錛屼嬌鐢╯ys鐧誨綍鏁版嵁搴擄紝鎵ц濡備笅璇彞錛屽緱鍒拌繘紼媔d
select spid from
sys.v$process p, sys.v$session s
where p.addr = s.paddr
and s.status='KILLED'

3.鍦∣S涓媖ill鎺夎繖涓繘紼?br />kill -9 14936

緲斿崡 2011-08-04 17:13 鍙戣〃璇勮
]]>
主站蜘蛛池模板: 亚洲成在人线aⅴ免费毛片| 亚洲午夜久久久影院伊人| 成年女人男人免费视频播放| 蜜桃AV无码免费看永久| 日韩免费人妻AV无码专区蜜桃 | 久久久久亚洲精品无码蜜桃| 亚洲av日韩av天堂影片精品| 无码欧精品亚洲日韩一区| 国产亚洲精品国产| 老司机亚洲精品影院无码| 亚洲第一永久在线观看| 亚洲中文无码av永久| 亚洲中文字幕乱码AV波多JI| WWW国产亚洲精品久久麻豆| 无码毛片一区二区三区视频免费播放 | 大学生高清一级毛片免费| 成人免费福利电影| 国产aa免费视频| 亚洲最大av无码网址| 国产亚洲精品观看91在线| 亚洲精品在线视频观看| 久久久国产亚洲精品| 污污免费在线观看| 四虎国产精品免费永久在线| 91精品啪在线观看国产线免费| 国产精品免费观看| 国产无遮挡裸体免费视频| 国产午夜亚洲精品国产成人小说| 久久久久久久尹人综合网亚洲| 亚洲精品在线免费观看| 亚洲精品av无码喷奶水糖心| 一区二区三区在线免费| 久久久久久AV无码免费网站下载 | 在线看片免费人成视频播| 最近最好最新2019中文字幕免费| 18禁超污无遮挡无码免费网站国产| 国产色爽免费视频| 亚洲精品无码不卡在线播HE | 亚洲视频手机在线| 久久国产高潮流白浆免费观看| 日本视频一区在线观看免费|