﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>语源科技BlogJava-&lt;span style="color:#000000"&gt;oh.. nice!&lt;/span&gt;</title><link>http://www.blogjava.net/orangehf/</link><description>&lt;span style="color:#000000"&gt;What the hell is going on?!&lt;/span&gt;</description><language>zh-cn</language><lastBuildDate>Tue, 28 Apr 2026 22:27:30 GMT</lastBuildDate><pubDate>Tue, 28 Apr 2026 22:27:30 GMT</pubDate><ttl>60</ttl><item><title>Understanding Binary, Decimal and Hexadecimal - A Tutorial</title><link>http://www.blogjava.net/orangehf/archive/2012/12/18/393139.html</link><dc:creator>翔南</dc:creator><author>翔南</author><pubDate>Tue, 18 Dec 2012 04:56:00 GMT</pubDate><guid>http://www.blogjava.net/orangehf/archive/2012/12/18/393139.html</guid><wfw:comment>http://www.blogjava.net/orangehf/comments/393139.html</wfw:comment><comments>http://www.blogjava.net/orangehf/archive/2012/12/18/393139.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/orangehf/comments/commentRss/393139.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/orangehf/services/trackbacks/393139.html</trackback:ping><description><![CDATA[<h2><br /><span style="font-weight: normal; font-size: 12pt; ">Repost from&nbsp;<a href="http://east82.com/howto/ip_addressing/bin_dec_hex.htm"><span style="font-size: 12pt; ">http://east82.com/howto/ip_addressing/bin_dec_hex.htm</span></a>&nbsp;</span><br /><br /><img alt="BIND DNS Ubuntu" height="73" src="http://east82.com/images/check.png" width="72" style="vertical-align: middle; " />Understanding Binary, Decimal and Hexadecimal - A Tutorial</h2><p style="font-family: Verdana; margin-left: 80px; font-size: small; line-height: normal; ">"<em>There are 10 kinds of people in the world ...those who understand binary and those who do not"</em></p><h3>A primer in numbering systems</h3><p style="font-family: Verdana; font-size: small; line-height: normal; ">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?</p><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.<br /><img alt="Binary Octal Decimal Hexadecimal numbering systems" height="200" src="http://east82.com/howto/ip_addressing/images/number_systems.png" width="600" /></p><h3>It's all just ones and zeros - bits and nibbles and bytes oh my!</h3><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.</p><h3>Thinking in binary</h3><p style="font-family: Verdana; font-size: small; line-height: normal; ">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&nbsp; both flip, giving us 100. Same thing goes with binary except we only have 2 digits to work with, 1 and 0.</p><p style="font-family: Verdana; font-size: small; line-height: normal; ">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&nbsp;<em>is</em>&nbsp;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.&nbsp;</p><h3>Converting binary to decimal</h3><p style="font-family: Verdana; font-size: small; line-height: normal; ">For this section I'll start by examining and explaining the table below.<br /><img alt="Binary byte decimal table" height="112" src="http://east82.com/howto/ip_addressing/images/binary_table.png" width="625" /></p><ul style="font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; "><li><p style="font-family: Verdana; ">First thing&nbsp; 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.</p></li><li><p style="font-family: Verdana; ">The 'Bit Set' row is for our binary digits, either 0 or 1. Here they are all 1.</p></li><li><p style="font-family: Verdana; ">The 'Exponent Value' row is how we arrive mathematically at the 'Decimal Value' row. An exponential value such as 2<sup>3</sup>&nbsp;means 2 x 2 x 2 = 8. By the way, any number with an exponent of 0 ALWAYS equates to 1 (2<sup>0&nbsp;</sup>= 1 and 400<sup>0</sup>&nbsp;also = 1).&nbsp;&nbsp;&nbsp;&nbsp;</p></li><li><p style="font-family: Verdana; ">The 'Decimal Value' row represents<em>&nbsp;positionally</em>&nbsp;the decimal value of the binary digit in question. It's imperative that you&nbsp;<strong>commit this row to memory</strong>. Practice by writing it down over and over 'till its part of your DNA :-)</p></li></ul><div style="text-align: center; font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; "><span style="font-size: medium; ">128&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1</span></div><ul style="font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; "><li><p style="font-family: Verdana; ">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.</p></li></ul><p style="font-family: Verdana; font-size: small; line-height: normal; ">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, 0000<strong>1</strong>0<strong>1</strong>0 means 128 (no), 64 (no), 32 (no), 16 (no), 8 (<strong>yes</strong>), 4 (no), 2 (<strong>yes</strong>) 1 (no). Given that, we see that 8 + 2 =10. In other words 00001010 binary is 10 decimal. Here are a few more examples.</p><ul style="font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; "><li><p style="font-family: Verdana; ">11000000 - 128 + 64 =&nbsp;<strong>192</strong></p></li><li><p style="font-family: Verdana; ">00000001 - =&nbsp;<strong>1</strong></p></li><li><p style="font-family: Verdana; ">00110011 - 32 + 16 + 2 + 1 =&nbsp;<strong>51</strong></p></li><li><p style="font-family: Verdana; ">11011011 - 128 + 64 + 16 + 8 + 2 + 1 =<strong>&nbsp;219</strong></p></li><li><p style="font-family: Verdana; ">00000000 - =&nbsp;<strong>0</strong></p></li><li><p style="font-family: Verdana; ">11111111 - 128 + 64 + 32 +16 + 8 + 4 + 2 + 1 =<strong>&nbsp;255</strong></p></li></ul><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.&nbsp;<img alt="Expanded binary to decimal table" height="204" src="http://east82.com/howto/ip_addressing/images/expanded_binary_table.png" width="625" /></p><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.</p><h4>Method 1 - Process of Elimination</h4><p style="font-family: Verdana; font-size: small; line-height: normal; ">This method is pretty straight forward. The first thing to do is write down the decimal value row previously covered.<br /></p><div style="text-align: center; font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; "><span style="font-size: medium; ">128&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1</span></div><p style="font-family: Verdana; font-size: small; line-height: normal; ">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:</p><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.</p><p style="font-family: Verdana; font-size: small; line-height: normal; ">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:<br /><img alt="Decimal to binary conversion examples" height="445" src="http://east82.com/howto/ip_addressing/images/decimal_to_binary_01.png" width="600" /></p><h4>Method 2 - Divide and Conquer</h4><p style="font-family: Verdana; font-size: small; line-height: normal; ">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:<br /><img alt="Decimal to binary conversion division example" height="528" src="http://east82.com/howto/ip_addressing/images/decimal_to_binary_02.png" width="589" />Refer to the example above. Given the decimal number 41 and the divide-and-conquer method, we derive its binary equivalent with the following logic:</p><ul style="font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; "><li><p style="font-family: Verdana; ">41 divided by 2 is 20, remainder&nbsp;<span style="color: #800000; "><strong>1</strong></span>. Place a 1 in the remainder column and 20 in the division column. This is the LSB and will be the rightmost binary digit.</p></li><li><p style="font-family: Verdana; ">20 divided by 2 is 10, remainder<strong>&nbsp;0</strong>. Place a 0 in the remainder column and 10 in the division column.</p></li><li><p style="font-family: Verdana; ">10 divided by 2 is 5, remainder<strong>&nbsp;0</strong>. Place a 0 in the remainder column and 5 in the division column.</p></li><li><p style="font-family: Verdana; ">5 divided by 2 is 2, remainder&nbsp;<strong>1</strong>. Place a 1 in the remainder column and 2 in the division column.</p></li><li><p style="font-family: Verdana; ">2 divided by 2 is 1, remainder&nbsp;<strong>0</strong>. Place a 0 in the remainder column and 1 in the division column.</p></li><li><p style="font-family: Verdana; ">1 divided by 2 is 0, remainder&nbsp;<strong>1</strong>. Place a 1 in the remainder column and we're done ...</p></li></ul><p style="font-family: Verdana; font-size: small; line-height: normal; ">... 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<strong>&nbsp;always</strong>&nbsp;be 1/2 = 0, remainder 1. Here a couple more examples:<br /><img alt="Decimal to binary conversion" height="551" src="http://east82.com/howto/ip_addressing/images/decimal_to_binary_03.png" width="600" /><br /><strong>&nbsp;</strong></p><h4>Binary and decimal numbers larger than a byte</h4><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.</p><div style="text-align: center; font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; "><span style="font-size: medium; ">128&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 64&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 32&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 16&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1</span></div><p style="font-family: Verdana; font-size: small; line-height: normal; ">now becomes the following if we have a 12 bit binary number:</p><div style="text-align: center; font-size: medium; font-family: Arial, Helvetica, sans-serif; line-height: normal; ">2048&nbsp;&nbsp;&nbsp;&nbsp; 1024&nbsp;&nbsp;&nbsp;&nbsp; 512&nbsp;&nbsp;&nbsp;&nbsp; 256&nbsp;&nbsp;&nbsp;&nbsp; 128&nbsp;&nbsp;&nbsp;&nbsp; 64&nbsp;&nbsp;&nbsp;&nbsp; 32&nbsp;&nbsp;&nbsp;&nbsp; 16&nbsp;&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp; 1</div><p style="font-family: Verdana; font-size: small; line-height: normal; ">Here is a sample conversion from binary to decimal using process of elimination:<br /><img alt="Large decimal number to binary conversion" height="357" src="http://east82.com/howto/ip_addressing/images/large_decimal_to_binary_conversion.png" width="600" /></p><h3>Moving on to hexadecimal</h3><p style="font-family: Verdana; font-size: small; line-height: normal; ">Just when you got your head around binary and decimal, along comes&nbsp;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.</p><p style="font-family: Verdana; font-size: small; line-height: normal; ">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&nbsp;<em>could</em>&nbsp;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 my<a href="http://east82.com/howto/ip_addressing/docs/ASCII%20Table.pdf" target="_blank" style="color: #446699; ">extended ASCII table</a>; it will help with the following illustration and serve as a useful refernece for your studies:<br /><img alt="Memory dump" height="349" src="http://east82.com/howto/ip_addressing/images/memory_dump.png" width="600" /><br />&nbsp;This screenshot is a memory dump of my computer. Imagine if those numbers were represented in binary!</p><p style="font-family: Verdana; font-size: small; line-height: normal; ">Let's get on with it.</p><h4>What the hex are you talking about?</h4><p style="font-family: Verdana; font-size: small; line-height: normal; ">Below is a hex table with decimal equivalents:<br /><img alt="Hexadecimal decimal table" height="79" src="http://east82.com/howto/ip_addressing/images/hex_decimal_table.png" width="600" /></p><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.&nbsp;<strong>0xF + 0x1 = 0x10</strong>. 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.</p><h4>Binary to hex - nibbles and bits</h4><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.<br /><img alt="Binary hex range" height="151" src="http://east82.com/howto/ip_addressing/images/binary_hex_range.png" width="366" /></p><p style="font-family: Verdana; font-size: small; line-height: normal; ">Here's some examples:<br /><img alt="Binary to hex conversion examples" height="207" src="http://east82.com/howto/ip_addressing/images/binary_to_hex_conversion.png" width="600" /><br /></p><h4>Binary to hex - bits and nibbles</h4><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.<br /><img alt="Hexadecimal to binary conversion examples" height="204" src="http://east82.com/howto/ip_addressing/images/hex_to_binary_conversion.png" width="600" /></p><p style="font-family: Verdana; font-size: small; line-height: normal; ">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&nbsp;<strong>00</strong>1001100101. A few illustrations:<img alt="Large binary and hex conversions" height="278" src="http://east82.com/howto/ip_addressing/images/large_binary_hex_conversions.png" width="600" /></p><h4>Decimal to hex - tens to sixteens</h4><p style="font-family: Verdana; font-size: small; line-height: normal; ">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&nbsp; Look at these decimal / hex equivalents:<br />16 = 0x10&nbsp; |&nbsp; 34 = 0x22&nbsp; |&nbsp; 214 = 0xD6&nbsp; |&nbsp; 175 = 0xAF<br />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.<br /><img alt="decimal to hex conversion example" height="191" src="http://east82.com/howto/ip_addressing/images/decimal_to_hex_01.png" width="600" /></p><ul style="font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal; "><li><p style="font-family: Verdana; ">225 divided by 16 is 14, remainder&nbsp;<strong><span style="color: #800000; ">0x1</span></strong>. Place a 0x1 in the remainder column and 14 in the division column. This is our rightmost hex digit.</p></li><li><p style="font-family: Verdana; ">14 divided by 16 is 0, remainder<strong>&nbsp;14</strong>. Since we are converting to hex we use&nbsp;<strong>0xE</strong>. Place 0xE in the remainder column and we're done.</p></li><li><p style="font-family: Verdana; ">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</p></li></ul><p style="font-family: Verdana; font-size: small; line-height: normal; ">How easy is that? Here are a few more:<br /><img alt="Decimal to hexadecimal convert examples" height="310" src="http://east82.com/howto/ip_addressing/images/decimal_to_hex_02.png" width="600" /><br /></p><p style="font-family: Verdana; font-size: small; line-height: normal; ">It's no different with numbers larger than a byte:<br /><img alt="Decimal to hexadecimal conversion" height="208" src="http://east82.com/howto/ip_addressing/images/decimal_to_hex_03.png" width="600" /></p><h4>Hex to decimal - sixteens to tens</h4><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.<br />(10 x 16<sup>3</sup>) + (5 x 16<sup>2</sup>) + (9 x 16<sup>1</sup>) + (12 x 16<sup>0</sup>) = 43,296. Here's how it breaks down:<br /><img alt="Hexidecimal to decimal conversion example" height="315" src="http://east82.com/howto/ip_addressing/images/hex_to_decimal_conversion.png" width="600" /></p><p style="font-family: Verdana; font-size: small; line-height: normal; ">...And a few more:<br /><img alt="Hexadecimal to decimal conversion examples" height="354" src="http://east82.com/howto/ip_addressing/images/hex_to_decimal_conversion_01.png" width="600" /></p><p style="font-family: Verdana; font-size: small; line-height: normal; ">I encourage you to practice, practice, practice. Download&nbsp;<a href="http://east82.com/howto/ip_addressing/docs/Conversion_Worksheet.pdf" target="_blank" style="color: #446699; ">this worksheet</a>&nbsp;to work thru various conversion exercises.</p><p style="font-family: Verdana; font-size: small; line-height: normal; ">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.</p><p style="font-family: Verdana; font-size: small; line-height: normal; "><em><strong>Coming soon - Part II Understanding IP addresses, subnet masks and subnetting.</strong></em></p><p style="font-family: Verdana; font-size: small; line-height: normal; "><strong><span style="font-family: 'Courier New', Courier, monospace; font-size: medium; ">./Robert</span></strong></p><img src ="http://www.blogjava.net/orangehf/aggbug/393139.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/orangehf/" target="_blank">翔南</a> 2012-12-18 12:56 <a href="http://www.blogjava.net/orangehf/archive/2012/12/18/393139.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>shell之“&gt;/dev/null 2&gt;&amp;1”</title><link>http://www.blogjava.net/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://www.blogjava.net/orangehf/archive/2011/12/01/365262.html</guid><wfw:comment>http://www.blogjava.net/orangehf/comments/365262.html</wfw:comment><comments>http://www.blogjava.net/orangehf/archive/2011/12/01/365262.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/orangehf/comments/commentRss/365262.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/orangehf/services/trackbacks/365262.html</trackback:ping><description><![CDATA[<div><font size="2" face="Tahoma">shell中可能经常能看到：&gt;/dev/null 2&gt;&amp;1</font></div>
<div><font size="2" face="Tahoma">命令的结果可以通过%&gt;的形式来定义输出</font></div>
<div><font size="2" face="Tahoma">分解这个组合：&#8220;&gt;/dev/null 2&gt;&amp;1&#8221; 为五部分。</font></div>
<div><font color="#ff6600" size="2" face="Tahoma">1：&gt; 代表重定向到哪里，例如：echo "123" &gt; /home/123.txt<br />2：/dev/null 代表空设备文件<br />3：2&gt; 表示stderr标准错误<br />4：&amp; 表示等同于的意思，2&gt;&amp;1，表示2的输出重定向等同于1<br />5：1 表示stdout标准输出，系统默认值是1，所以"&gt;/dev/null"等同于 "1&gt;/dev/null"</font></div>
<div><font size="2" face="Tahoma">因此，&gt;/dev/null 2&gt;&amp;1也可以写成&#8220;1&gt; /dev/null 2&gt; &amp;1&#8221;</font></div>
<div><font size="2" face="Tahoma">那么本文标题的语句执行过程为：<br />1&gt;/dev/null ：首先表示标准输出重定向到空设备文件，也就是不输出任何信息到终端，说白了就是不显示任何信息。<br />2&gt;&amp;1 ：接着，标准错误输出重定向 到 标准输出，因为之前标准输出已经重定向到了空设备文件，所以标准错误输出也重定向到空设备文件。</font></div>
<div><font size="2" face="Tahoma">说清楚了吗，大家理解下吧！</font></div>
<div><font color="#ff6600" size="2" face="Tahoma">顺便对比述说下这么用的好处！</font></div>
<div><font size="2" face="Tahoma">&nbsp;&nbsp; 最常用的方式有：</font></div>
<div><font color="#ff0000" size="2" face="Tahoma">command &gt; file 2&gt;file&nbsp; 与command &gt; file 2&gt;&amp;1</font></div>
<div><font size="2" face="Tahoma">它们&nbsp;有什么不同的地方吗？</font></div>
<div><br /><font size="2" face="Tahoma">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 首先command &gt; file 2&gt;file 的意思是将命令所产生的标准输出信息,和错误的输出信息送到file 中.command&nbsp; &gt; file 2&gt;file 这样的写法,stdout和stderr都直接送到file中, file会被打开两次,这样stdout和stderr会互相覆盖,这样写相当使用了FD1和FD2两个同时去抢占file 的管道。<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 而command &gt;file 2&gt;&amp;1 这条命令就将stdout直接送向file, stderr 继承了FD1管道后,再被送往file,此时,file 只被打开了一次,也只使用了一个管道FD1,它包括了stdout和stderr的内容。<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 从IO效率上,前一条命令的效率要比后面一条的命令效率要低,所以在编写shell脚本的时候,较多的时候我们会command &gt; file 2&gt;&amp;1 这样的写法。</font></div><br /><br />转自：<a href="http://ppp1013.blog.51cto.com/927700/271043">http://ppp1013.blog.51cto.com/927700/271043</a><img src ="http://www.blogjava.net/orangehf/aggbug/365262.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/orangehf/" target="_blank">翔南</a> 2011-12-01 09:54 <a href="http://www.blogjava.net/orangehf/archive/2011/12/01/365262.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>iostat来对linux硬盘IO性能进行了解</title><link>http://www.blogjava.net/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://www.blogjava.net/orangehf/archive/2011/11/02/362534.html</guid><wfw:comment>http://www.blogjava.net/orangehf/comments/362534.html</wfw:comment><comments>http://www.blogjava.net/orangehf/archive/2011/11/02/362534.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/orangehf/comments/commentRss/362534.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/orangehf/services/trackbacks/362534.html</trackback:ping><description><![CDATA[<p>转自: <a title="iostat来对linux硬盘IO性能进行了解" href="http://www.php-oa.com/2009/02/03/iostat.html">http://www.php-oa.com/2009/02/03/iostat.html</a> 
<p>&nbsp;以前一直不太会用这个参数。现在认真研究了一下iostat，因为刚好有台重要的服务器压力高,所以放上来分析一下.下面这台就是IO有压力过大的服务器</p>
<p>&nbsp;</p>
<div>
<div id="highlighter_972160" class="syntaxhighlighter nogutter  bash ie">
<div class="toolbar"><span><a class="toolbar_item command_help help" href="http://www.php-oa.com/2009/02/03/iostat.html#">?</a></span></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash plain">$iostat -x 1 </code></div>
<div class="line number2 index1 alt1"><code class="bash plain">Linux 2.6.33-fukai (fukai-laptop)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _i686_&nbsp;&nbsp;&nbsp; (2 CPU) </code></div>
<div class="line number3 index2 alt2"><code class="bash plain">avg-cpu:&nbsp; %user&nbsp;&nbsp; %</code><code class="bash functions">nice</code> <code class="bash plain">%system %iowait&nbsp; %steal&nbsp;&nbsp; %idle </code></div>
<div class="line number4 index3 alt1"><code class="bash spaces">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</code><code class="bash plain">5.47&nbsp;&nbsp;&nbsp; 0.50&nbsp;&nbsp;&nbsp; 8.96&nbsp;&nbsp; 48.26&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp; 36.82 </code></div>
<div class="line number5 index4 alt2"><code class="bash spaces">&nbsp;</code>&nbsp;</div>
<div class="line number6 index5 alt1"><code class="bash plain">Device:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rrqm</code><code class="bash plain">/s</code>&nbsp;&nbsp; <code class="bash plain">wrqm</code><code class="bash plain">/s</code>&nbsp;&nbsp;&nbsp;&nbsp; <code class="bash plain">r</code><code class="bash plain">/s</code>&nbsp;&nbsp;&nbsp;&nbsp; <code class="bash plain">w</code><code class="bash plain">/s</code>&nbsp;&nbsp; <code class="bash plain">rsec</code><code class="bash plain">/s</code>&nbsp;&nbsp; <code class="bash plain">wsec</code><code class="bash plain">/s</code> <code class="bash plain">avgrq-sz avgqu-sz&nbsp;&nbsp; await&nbsp; svctm&nbsp; %util </code></div>
<div class="line number7 index6 alt2"><code class="bash plain">sda&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6.00&nbsp;&nbsp; 273.00&nbsp;&nbsp; 99.00&nbsp;&nbsp;&nbsp; 7.00&nbsp; 2240.00&nbsp; 2240.00&nbsp;&nbsp;&nbsp; 42.26&nbsp;&nbsp;&nbsp;&nbsp; 1.12&nbsp;&nbsp; 10.57&nbsp;&nbsp; 7.96&nbsp; 84.40 </code></div>
<div class="line number8 index7 alt1"><code class="bash plain">sdb&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp; 4.00&nbsp;&nbsp;&nbsp; 0.00&nbsp; 350.00&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp; 2068.00&nbsp;&nbsp;&nbsp;&nbsp; 5.91&nbsp;&nbsp;&nbsp;&nbsp; 0.55&nbsp;&nbsp;&nbsp; 1.58&nbsp;&nbsp; 0.54&nbsp; 18.80</code></div></div></td></tr></tbody></table></div></div>
<p><strong>rrqm/s:</strong>&nbsp;&nbsp; 每秒进行 merge 的读操作数目（当系统调用需要读取数据的时候，VFS将请求发到各个FS，如果FS发现不同的读取请求读取的是相同Block的数据，FS会将这个请求合并Merge）。即 delta(rmerge)/s<br /><strong>wrqm/s:</strong>&nbsp; 每秒进行 merge 的写操作数目。即 delta(wmerge)/s<br /><strong>r/s:</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 每秒完成的读 I/O 设备次数。即 delta(rio)/s<br /><strong>w/s:</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 每秒完成的写 I/O 设备次数。即 delta(wio)/s<br /><strong>rsec/s:</strong>&nbsp;&nbsp;&nbsp; 每秒读扇区数。即 delta(rsect)/s<br /><strong>wsec/s:&nbsp; </strong>每秒写扇区数。即 delta(wsect)/s<br /><strong>rkB/s: &nbsp;</strong> &nbsp;&nbsp; 每秒读K字节数。是 rsect/s 的一半，因为每扇区大小为512字节。(需要计算)<br /><strong>wkB/s:</strong>&nbsp;&nbsp;&nbsp; 每秒写K字节数。是 wsect/s 的一半。(需要计算)<br /><strong>avgrq-sz: </strong>平均每次设备I/O操作的数据大小 (扇区)。delta(rsect+wsect)/delta(rio+wio)<br /><strong>avgqu-sz:</strong> 平均I/O队列长度。即 delta(aveq)/s/1000 (因为aveq的单位为毫秒)。<br /><strong>await:</strong>&nbsp;&nbsp;&nbsp; 平均每次设备I/O操作的等待时间 (毫秒)。即 delta(ruse+wuse)/delta(rio+wio)<br /><strong>svctm:&nbsp;&nbsp; </strong>平均每次设备I/O操作的服务时间 (毫秒)。即 delta(use)/delta(rio+wio)<br /><strong>%util:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </strong>一秒中有百分之多少的时间用于 I/O 操作，或者说一秒中有多少时间 I/O 队列是非空的。即 delta(use)/s/1000 (因为use的单位为毫秒)</p>
<p><strong>如果 %util 接近 100%，说明产生的I/O请求太多，I/O系统已经满负荷，该磁盘<br />可能存在瓶颈。<br />idle小于70% IO压力就较大了,一般读取速度有较多的wait.</strong><br /><strong>同时可以结合vmstat 查看查看b参数(<font size="2" face="verdana, arial, helvetica">等待资源的进程数</font>)和wa参数(<font size="2" face="verdana, arial, helvetica">IO等待所占用的CPU时间的百分比,高过30%时IO压力高</font>)</strong><br /><strong>另外 await 的参数也要多和 svctm 来参考。差的过高就一定有 IO 的问题。<br />avgqu-sz 也是个做 IO 调优时需要注意的地方，这个就是直接每次操作的数据的大小，如果次数多，但数据拿的小的话，其实 IO 也会很小.如果数据拿的大，才IO 的数据会高。也可以通过 avgqu-sz &#215; ( r/s or w/s ) = rsec/s or wsec/s.也就是讲，读定速度是这个来决定的。</strong></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>另外还可以参考</strong><br />svctm 一般要小于 await (因为同时等待的请求的等待时间被重复计算了)，svctm 的大小一般和磁盘性能有关，CPU/内存的负荷也会对其有影响，请求过多也会间接导致 svctm 的增加。await 的大小一般取决于服务时间(svctm) 以及 I/O 队列的长度和 I/O 请求的发出模式。如果 svctm 比较接近 await，说明 I/O 几乎没有等待时间；如果 await 远大于 svctm，说明 I/O 队列太长，应用得到的响应时间变慢，如果响应时间超过了用户可以容许的范围，这时可以考虑更换更快的磁盘，调整内核 elevator 算法，优化应用，或者升级 CPU。<br />队列长度(avgqu-sz)也可作为衡量系统 I/O 负荷的指标，但由于 avgqu-sz 是按照单位时间的平均值，所以不能反映瞬间的 I/O 洪水。</p>
<p><strong><br />&nbsp; 别人一个不错的例子.(I/O 系统 vs. 超市排队)</strong></p>
<p>举一个例子，我们在超市排队 checkout 时，怎么决定该去哪个交款台呢? 首当是看排的队人数，5个人总比20人要快吧? 除了数人头，我们也常常看看前面人购买的东西多少，如果前面有个采购了一星期食品的大妈，那么可以考虑换个队排了。还有就是收银员的速度了，如果碰上了连 钱都点不清楚的新手，那就有的等了。另外，时机也很重要，可能 5 分钟前还人满为患的收款台，现在已是人去楼空，这时候交款可是很爽啊，当然，前提是那过去的 5 分钟里所做的事情比排队要有意义 (不过我还没发现什么事情比排队还无聊的)。</p>
<p>I/O 系统也和超市排队有很多类似之处:</p>
<p>r/s+w/s 类似于交款人的总数<br />平均队列长度(avgqu-sz)类似于单位时间里平均排队人的个数<br />平均服务时间(svctm)类似于收银员的收款速度<br />平均等待时间(await)类似于平均每人的等待时间<br />平均I/O数据(avgrq-sz)类似于平均每人所买的东西多少<br />I/O 操作率 (%util)类似于收款台前有人排队的时间比例。</p>
<p>我们可以根据这些数据分析出 I/O 请求的模式，以及 I/O 的速度和响应时间。</p>
<p><strong>下面是别人写的这个参数输出的分析</strong></p>
<div>
<div id="highlighter_536534" class="syntaxhighlighter nogutter  bash ie">
<div class="toolbar"><span><a class="toolbar_item command_help help" href="http://www.php-oa.com/2009/02/03/iostat.html#">?</a></span></div>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td class="code">
<div class="container">
<div class="line number1 index0 alt2"><code class="bash comments"># iostat -x 1 </code></div>
<div 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 class="line number3 index2 alt2"><code class="bash plain">16.24 0.00 4.31 79.44 </code></div>
<div 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 class="line number5 index4 alt2"><code class="bash plain">/dev/cciss/c0d0</code></div>
<div 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 操作: 总IO(io)/s = r/s(读) +w/s(写) = 1.02+27.55 = 28.57 (次/秒) 其中写操作占了主体 (w:r = 27:1)。</p>
<p>平均每次设备 I/O 操作只需要 5ms 就可以完成，但每个 I/O 请求却需要等上 78ms，为什么? 因为发出的 I/O 请求太多 (每秒钟约 29 个)，假设这些请求是同时发出的，那么平均等待时间可以这样计算:</p>
<p>平均等待时间 = 单个 I/O 服务时间 * ( 1 + 2 + &#8230; + 请求总数-1) / 请求总数</p>
<p>应用到上面的例子: 平均等待时间 = 5ms * (1+2+&#8230;+28)/29 = 70ms，和 iostat 给出的78ms 的平均等待时间很接近。这反过来表明 I/O 是同时发起的。</p>
<p>每秒发出的 I/O 请求很多 (约 29 个)，平均队列却不长 (只有 2 个 左右)，这表明这 29 个请求的到来并不均匀，大部分时间 I/O 是空闲的。</p>
<p>一秒中有 14.29% 的时间 I/O 队列中是有请求的，也就是说，85.71% 的时间里 I/O 系统无事可做，所有 29 个 I/O 请求都在142毫秒之内处理掉了。</p>
<p>delta(ruse+wuse)/delta(io) = await = 78.21 =&gt; delta(ruse+wuse)/s =78.21 * delta(io)/s = 78.21*28.57 = 2232.8，表明每秒内的I/O请求总共需要等待2232.8ms。所以平均队列长度应为 2232.8ms/1000ms = 2.23，而 iostat 给出的平均队列长度 (avgqu-sz) 却为 22.35，为什么?! 因为 iostat 中有 bug，avgqu-sz 值应为 2.23，而不是 22.35。</p><!--[syntaxhighlighter]--><!--代码高亮，请勿编辑-->
<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://www.blogjava.net/orangehf/aggbug/362534.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/orangehf/" target="_blank">翔南</a> 2011-11-02 15:14 <a href="http://www.blogjava.net/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)</title><link>http://www.blogjava.net/orangehf/archive/2011/09/28/359689.html</link><dc:creator>翔南</dc:creator><author>翔南</author><pubDate>Wed, 28 Sep 2011 06:01:00 GMT</pubDate><guid>http://www.blogjava.net/orangehf/archive/2011/09/28/359689.html</guid><wfw:comment>http://www.blogjava.net/orangehf/comments/359689.html</wfw:comment><comments>http://www.blogjava.net/orangehf/archive/2011/09/28/359689.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/orangehf/comments/commentRss/359689.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/orangehf/services/trackbacks/359689.html</trackback:ping><description><![CDATA[<div align="left"><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">This 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.<br /><br />Though the installation instructions tell them what to do, they have no idea <em>what those steps actually do</em>. This article shall explain the basics of software installation. After reading this article you would feel more at home when installing your next software.<br /><br />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.<br /><br /><strong><br />Details :<br /><br /></strong>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<br /><br /><strong>$ tar xfvz game.tgz<br /><br /></strong>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 &amp; 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<br /><br />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<br /><br /><strong>$ ./configure<br /><br /></strong>The above command makes the shell run the script named ' <em>configure</em> ' 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. <br /><br />The main job of the configure script is to create a ' <em>Makefile</em> ' . 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.<br /><br />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<br /><br /><strong>$ make<br /><br /></strong>' <em>make</em> ' 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)<br /><br />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.<br /><br />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.<br /><br />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.<br /><br /><em>One of the labels present in the Makefile happens to be named ' <strong>install</strong> ' .</em><br /><br />If make ran successfully then you are almost done with the installation. Only the last step remains which is<br /><br /></font><strong><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">$ make install<br /><br /></font></strong><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">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 <em>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.</em><br /><br /></font><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">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.<br /><br /></font><font size="-1" face="Verdana, Arial, Helvetica, sans-serif">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.</font></div><br />原文地址：<a href="http://www.codecoffee.com/tipsforlinux/articles/27.html">http://www.codecoffee.com/tipsforlinux/articles/27.html</a><img src ="http://www.blogjava.net/orangehf/aggbug/359689.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/orangehf/" target="_blank">翔南</a> 2011-09-28 14:01 <a href="http://www.blogjava.net/orangehf/archive/2011/09/28/359689.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>oracle rman</title><link>http://www.blogjava.net/orangehf/archive/2011/09/15/358724.html</link><dc:creator>翔南</dc:creator><author>翔南</author><pubDate>Thu, 15 Sep 2011 08:54:00 GMT</pubDate><guid>http://www.blogjava.net/orangehf/archive/2011/09/15/358724.html</guid><wfw:comment>http://www.blogjava.net/orangehf/comments/358724.html</wfw:comment><comments>http://www.blogjava.net/orangehf/archive/2011/09/15/358724.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/orangehf/comments/commentRss/358724.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/orangehf/services/trackbacks/358724.html</trackback:ping><description><![CDATA[<a href="http://www.bccn.net/Article/sjk/oracle/200601/3470_2.html">http://www.bccn.net/Article/sjk/oracle/200601/3470_2.html</a><br /><a href="http://www.beifenruanjian.com/oracle/redhat-linux-as4-on-the-use-of-rman-for-backup-and-recovery-testing/">http://www.beifenruanjian.com/oracle/redhat-linux-as4-on-the-use-of-rman-for-backup-and-recovery-testing/</a><br /><a href="http://blog.sina.com.cn/s/blog_3fb41b900100h7sg.html">http://blog.sina.com.cn/s/blog_3fb41b900100h7sg.html</a><br /><a href="http://database.e800.com.cn/articles/2008/116/1200428070211771370_1.html">http://database.e800.com.cn/articles/2008/116/1200428070211771370_1.html</a><br /><a href="http://blog.csdn.net/tianlesoftware/article/details/4699320">http://blog.csdn.net/tianlesoftware/article/details/4699320</a> <br /><br />rman 恢复：<br /><a href="http://space.itpub.net/9765498/viewspace-237930">http://space.itpub.net/9765498/viewspace-237930</a> <br /><a href="http://space.itpub.net/8334342/viewspace-521139">http://space.itpub.net/8334342/viewspace-521139</a><img src ="http://www.blogjava.net/orangehf/aggbug/358724.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/orangehf/" target="_blank">翔南</a> 2011-09-15 16:54 <a href="http://www.blogjava.net/orangehf/archive/2011/09/15/358724.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Oracle 表解锁 </title><link>http://www.blogjava.net/orangehf/archive/2011/08/22/357052.html</link><dc:creator>翔南</dc:creator><author>翔南</author><pubDate>Mon, 22 Aug 2011 08:04:00 GMT</pubDate><guid>http://www.blogjava.net/orangehf/archive/2011/08/22/357052.html</guid><wfw:comment>http://www.blogjava.net/orangehf/comments/357052.html</wfw:comment><comments>http://www.blogjava.net/orangehf/archive/2011/08/22/357052.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/orangehf/comments/commentRss/357052.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/orangehf/services/trackbacks/357052.html</trackback:ping><description><![CDATA[1.获取锁住的表的信息
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><img id="Codehighlighter1_7_17_Open_Image" onclick="this.style.display='none'; Codehighlighter1_7_17_Open_Text.style.display='none'; Codehighlighter1_7_17_Closed_Image.style.display='inline'; Codehighlighter1_7_17_Closed_Text.style.display='inline';" align="top" src="http://www.blogjava.net/images/OutliningIndicators/ExpandedBlockStart.gif"><img style="display: none" id="Codehighlighter1_7_17_Closed_Image" onclick="this.style.display='none'; Codehighlighter1_7_17_Closed_Text.style.display='none'; Codehighlighter1_7_17_Open_Image.style.display='inline'; Codehighlighter1_7_17_Open_Text.style.display='inline';" align="top" src="http://www.blogjava.net/images/OutliningIndicators/ContractedBlock.gif"><span style="color: #0000ff">SELECT</span><span style="color: #000000">&nbsp;</span><span style="border-bottom: #808080 1px solid; border-left: #808080 1px solid; background-color: #ffffff; display: none; border-top: #808080 1px solid; border-right: #808080 1px solid" id="Codehighlighter1_7_17_Closed_Text">/**/</span><span id="Codehighlighter1_7_17_Open_Text"><span style="color: #008080">/*</span><span style="color: #008080">+&nbsp;rule&nbsp;</span><span style="color: #008080">*/</span></span><span style="color: #000000"><br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;s.username,<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;decode(l.type,&nbsp;</span><span style="color: #ff0000">'</span><span style="color: #ff0000">TM</span><span style="color: #ff0000">'</span><span style="color: #000000">,&nbsp;</span><span style="color: #ff0000">'</span><span style="color: #ff0000">TABLE&nbsp;LOCK</span><span style="color: #ff0000">'</span><span style="color: #000000">,&nbsp;</span><span style="color: #ff0000">'</span><span style="color: #ff0000">TX</span><span style="color: #ff0000">'</span><span style="color: #000000">,&nbsp;</span><span style="color: #ff0000">'</span><span style="color: #ff0000">ROW&nbsp;LOCK</span><span style="color: #ff0000">'</span><span style="color: #000000">,&nbsp;</span><span style="color: #0000ff">NULL</span><span style="color: #000000">)&nbsp;LOCK_LEVEL,<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;o.owner,<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;o.</span><span style="color: #ff00ff">object_name</span><span style="color: #000000">,<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;o.object_type,<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;s.sid,<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;s.serial#,<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;s.terminal,<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;s.machine,<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;s.program,<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;s.osuser<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">FROM</span><span style="color: #000000">&nbsp;v$session&nbsp;s,&nbsp;v$lock&nbsp;l,&nbsp;dba_objects&nbsp;o<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;</span><span style="color: #0000ff">WHERE</span><span style="color: #000000">&nbsp;l.sid&nbsp;</span><span style="color: #808080">=</span><span style="color: #000000">&nbsp;s.sid<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #808080">AND</span><span style="color: #000000">&nbsp;l.id1&nbsp;</span><span style="color: #808080">=</span><span style="color: #000000">&nbsp;o.</span><span style="color: #ff00ff">object_id</span><span style="color: #000000">(</span><span style="color: #808080">+</span><span style="color: #000000">)<br /><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #808080">AND</span><span style="color: #000000">&nbsp;s.username&nbsp;</span><span style="color: #0000ff">is</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">NOT</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">Null</span></div><br /><br />2.进行解锁 <br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">1</span><img alt="" align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif" /><span style="color: #0000ff">alter</span><span style="color: #000000">&nbsp;system&nbsp;</span><span style="color: #0000ff">kill</span><span style="color: #000000">&nbsp;session&nbsp;</span><span style="color: #ff0000">'</span><span style="color: #ff0000">sid,serial#</span><span style="color: #ff0000">'</span><span style="color: #000000">;</span></div><img src ="http://www.blogjava.net/orangehf/aggbug/357052.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/orangehf/" target="_blank">翔南</a> 2011-08-22 16:04 <a href="http://www.blogjava.net/orangehf/archive/2011/08/22/357052.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>ORACLE批量绑定FORALL与BULK COLLECT </title><link>http://www.blogjava.net/orangehf/archive/2011/08/22/357028.html</link><dc:creator>翔南</dc:creator><author>翔南</author><pubDate>Mon, 22 Aug 2011 04:55:00 GMT</pubDate><guid>http://www.blogjava.net/orangehf/archive/2011/08/22/357028.html</guid><wfw:comment>http://www.blogjava.net/orangehf/comments/357028.html</wfw:comment><comments>http://www.blogjava.net/orangehf/archive/2011/08/22/357028.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/orangehf/comments/commentRss/357028.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/orangehf/services/trackbacks/357028.html</trackback:ping><description><![CDATA[转自：<a href="http://log-cd.iteye.com/blog/411122">http://log-cd.iteye.com/blog/411122</a><br /><br />FORALL与BULK COLLECT的使用方法: <br />1．使用FORALL比FOR效率高，因为前者只切换一次上下文，而后者将是在循环次数一样多个上下文间切换。 <br /><br />2．使用BLUK COLLECT一次取出一个数据集合，比用游标条取数据效率高，尤其是在网络不大好的情况下。但BLUK COLLECT需要大量内存。 <br /><br />例子: 
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">1</span><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /><span style="color: #0000ff">create</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">table</span><span style="color: #000000">&nbsp;test_forall&nbsp;(&nbsp;</span><span style="color: #ff00ff">user_id</span><span style="color: #000000">&nbsp;</span><span style="color: #000000; font-weight: bold">number</span><span style="color: #000000">(</span><span style="color: #800000; font-weight: bold">10</span><span style="color: #000000">),&nbsp;</span><span style="color: #ff00ff">user_name</span><span style="color: #000000">&nbsp;</span><span style="color: #000000; font-weight: bold">varchar2</span><span style="color: #000000">(</span><span style="color: #800000; font-weight: bold">20</span><span style="color: #000000">));</span></div><strong><br />select into 中使用bulk colle<strong>ct</strong> 
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">&nbsp;1</span><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /><span style="color: #0000ff">DECLARE</span><span style="color: #000000">&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;2</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;TYPE&nbsp;table_forall&nbsp;</span><span style="color: #0000ff">IS</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">TABLE</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">OF</span><span style="color: #000000">&nbsp;test_forall</span><span style="color: #808080">%</span><span style="color: #000000">ROWTYPE;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;3</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;v_table&nbsp;table_forall;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;4</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">BEGIN</span><span style="color: #000000">&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;5</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">SELECT</span><span style="color: #000000">&nbsp;mub.</span><span style="color: #ff00ff">user_id</span><span style="color: #000000">,mub.</span><span style="color: #ff00ff">user_name</span><span style="color: #000000">&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;6</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">BULK</span><span style="color: #000000">&nbsp;COLLECT&nbsp;</span><span style="color: #0000ff">INTO</span><span style="color: #000000">&nbsp;v_table&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;7</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">FROM</span><span style="color: #000000">&nbsp;mag_user_basic&nbsp;mub&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;8</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">WHERE</span><span style="color: #000000">&nbsp;mub.</span><span style="color: #ff00ff">user_id</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">BETWEEN</span><span style="color: #000000">&nbsp;</span><span style="color: #800000; font-weight: bold">10000</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">AND</span><span style="color: #000000">&nbsp;</span><span style="color: #800000; font-weight: bold">10100</span><span style="color: #000000">;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;9</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;FORALL&nbsp;idx&nbsp;</span><span style="color: #808080">IN</span><span style="color: #000000">&nbsp;</span><span style="color: #800000; font-weight: bold">1</span><span style="color: #000000">..v_table.</span><span style="color: #ff00ff">COUNT</span><span style="color: #000000">&nbsp;&nbsp;<br /></span><span style="color: #008080">10</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">INSERT</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">INTO</span><span style="color: #000000">&nbsp;test_forall&nbsp;</span><span style="color: #0000ff">VALUES</span><span style="color: #000000">&nbsp;v_table(idx);&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">11</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008080">--</span><span style="color: #008080">VALUES(v_table(idx).user_id,v_table(idx).user_name);Error&nbsp;&nbsp;&nbsp;</span><span style="color: #008080"><br /></span><span style="color: #008080">12</span><span style="color: #008080"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008080">--</span><span style="color: #008080">在PL/SQL中，BULK&nbsp;In-BIND与RECORD，%ROWTYPE是不能在一块使用的，&nbsp;&nbsp;&nbsp;</span><span style="color: #008080"><br /></span><span style="color: #008080">13</span><span style="color: #008080"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008080">--</span><span style="color: #008080">也就是说，BULK&nbsp;In-BIND只能与简单类型的数组一块使用&nbsp;&nbsp;&nbsp;</span><span style="color: #008080"><br /></span><span style="color: #008080">14</span><span style="color: #008080"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">COMMIT</span><span style="color: #000000">;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">15</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;<br /></span><span style="color: #008080">16</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />EXCEPTION&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">17</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">WHEN</span><span style="color: #000000">&nbsp;OTHERS&nbsp;</span><span style="color: #0000ff">THEN</span><span style="color: #000000">&nbsp;&nbsp;<br /></span><span style="color: #008080">18</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">ROLLBACK</span><span style="color: #000000">;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">19</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">20</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">END</span><span style="color: #000000">;&nbsp;&nbsp;<br /></span><span style="color: #008080">21</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span></div></strong><br /><strong>f<strong>etch into 中使用bulk collect</strong> <br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><span style="color: #008080">&nbsp;1</span><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /><span style="color: #0000ff">DECLARE</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;2</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;TYPE&nbsp;table_forall&nbsp;</span><span style="color: #0000ff">IS</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">TABLE</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">OF</span><span style="color: #000000">&nbsp;test_forall</span><span style="color: #808080">%</span><span style="color: #000000">ROWTYPE;<br /></span><span style="color: #008080">&nbsp;3</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;v_table&nbsp;table_forall;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;4</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;5</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">CURSOR</span><span style="color: #000000">&nbsp;c1&nbsp;</span><span style="color: #0000ff">IS</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;6</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">SELECT</span><span style="color: #000000">&nbsp;mub.</span><span style="color: #ff00ff">user_id</span><span style="color: #000000">,mub.</span><span style="color: #ff00ff">user_name</span><span style="color: #000000"><br /></span><span style="color: #008080">&nbsp;7</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">FROM</span><span style="color: #000000">&nbsp;mag_user_basic&nbsp;mub<br /></span><span style="color: #008080">&nbsp;8</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">WHERE</span><span style="color: #000000">&nbsp;mub.</span><span style="color: #ff00ff">user_id</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">BETWEEN</span><span style="color: #000000">&nbsp;</span><span style="color: #800000; font-weight: bold">10000</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">AND</span><span style="color: #000000">&nbsp;</span><span style="color: #800000; font-weight: bold">10100</span><span style="color: #000000">;<br /></span><span style="color: #008080">&nbsp;9</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">BEGIN</span><span style="color: #000000"><br /></span><span style="color: #008080">10</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">OPEN</span><span style="color: #000000">&nbsp;c1;<br /></span><span style="color: #008080">11</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #008080">--</span><span style="color: #008080">在fetch&nbsp;into中使用bulk&nbsp;collect</span><span style="color: #008080"><br /></span><span style="color: #008080">12</span><span style="color: #008080"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">FETCH</span><span style="color: #000000">&nbsp;c1&nbsp;</span><span style="color: #0000ff">BULK</span><span style="color: #000000">&nbsp;COLLECT&nbsp;</span><span style="color: #0000ff">INTO</span><span style="color: #000000">&nbsp;v_table;<br /></span><span style="color: #008080">13</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">14</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;FORALL&nbsp;idx&nbsp;</span><span style="color: #808080">IN</span><span style="color: #000000">&nbsp;</span><span style="color: #800000; font-weight: bold">1</span><span style="color: #000000">..v_table.</span><span style="color: #ff00ff">COUNT</span><span style="color: #000000"><br /></span><span style="color: #008080">15</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">INSERT</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">INTO</span><span style="color: #000000">&nbsp;test_forall&nbsp;</span><span style="color: #0000ff">VALUES</span><span style="color: #000000">&nbsp;v_table(idx);<br /></span><span style="color: #008080">16</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">COMMIT</span><span style="color: #000000">;<br /></span><span style="color: #008080">17</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /><br /></span><span style="color: #008080">18</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />EXCEPTION<br /></span><span style="color: #008080">19</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">WHEN</span><span style="color: #000000">&nbsp;OTHERS&nbsp;</span><span style="color: #0000ff">THEN</span><span style="color: #000000"><br /></span><span style="color: #008080">20</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">ROLLBACK</span><span style="color: #000000">;<br /></span><span style="color: #008080">21</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">END</span><span style="color: #000000">;</span></div></strong><br /><strong>在returning into中使用bulk collect</strong> <br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><strong><span style="color: #008080">&nbsp;1</span><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /><span style="color: #0000ff">CREATE</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">TABLE</span><span style="color: #000000">&nbsp;test_forall2&nbsp;</span><span style="color: #0000ff">AS</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">SELECT</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">*</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">FROM</span></strong><strong><span style="color: #000000">&nbsp;test_forall;<br /></span><span style="color: #008080">&nbsp;2</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #008080">--</span><span style="color: #008080">--在returning&nbsp;into中使用bulk&nbsp;collect</span></strong><span style="color: #008080"><br /></span><strong><span style="color: #008080">&nbsp;3</span><span style="color: #008080"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">DECLARE</span></strong><span style="color: #000000"><br /></span><strong><span style="color: #008080">&nbsp;4</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;TYPE&nbsp;IdList&nbsp;</span><span style="color: #0000ff">IS</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">TABLE</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">OF</span><span style="color: #000000">&nbsp;test_forall.</span><span style="color: #ff00ff">User_Id</span><span style="color: #808080">%</span></strong><strong><span style="color: #000000">TYPE;<br /></span><span style="color: #008080">&nbsp;5</span></strong><strong><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;enums&nbsp;IdList;<br /></span><span style="color: #008080">&nbsp;6</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;TYPE&nbsp;NameList&nbsp;</span><span style="color: #0000ff">IS</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">TABLE</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">OF</span><span style="color: #000000">&nbsp;test_forall.</span><span style="color: #ff00ff">user_name</span><span style="color: #808080">%</span></strong><strong><span style="color: #000000">TYPE;<br /></span><span style="color: #008080">&nbsp;7</span></strong><strong><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;names&nbsp;NameList;<br /></span><span style="color: #008080">&nbsp;8</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">BEGIN</span></strong><span style="color: #000000"><br /></span><strong><span style="color: #008080">&nbsp;9</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">DELETE</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">FROM</span><span style="color: #000000">&nbsp;test_forall2&nbsp;</span><span style="color: #0000ff">WHERE</span><span style="color: #000000">&nbsp;</span><span style="color: #ff00ff">user_id</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">=</span><span style="color: #000000">&nbsp;</span><span style="color: #800000; font-weight: bold">10100</span></strong><span style="color: #000000"><br /></span><strong><span style="color: #008080">10</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;RETURNING&nbsp;</span><span style="color: #ff00ff">user_id</span><span style="color: #000000">,&nbsp;</span><span style="color: #ff00ff">user_name</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">BULK</span><span style="color: #000000">&nbsp;COLLECT&nbsp;</span><span style="color: #0000ff">INTO</span></strong><strong><span style="color: #000000">&nbsp;enums,&nbsp;names;<br /></span><span style="color: #008080">11</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;dbms_output.put_line(</span><span style="color: #ff0000">'</span><span style="color: #ff0000">Deleted&nbsp;</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">||</span><span style="color: #000000">&nbsp;SQL</span><span style="color: #808080">%</span><span style="color: #0000ff">ROWCOUNT</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">||</span><span style="color: #000000">&nbsp;</span><span style="color: #ff0000">'</span><span style="color: #ff0000">&nbsp;rows:</span><span style="color: #ff0000">'</span></strong><strong><span style="color: #000000">);<br /></span><span style="color: #008080">12</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">FOR</span><span style="color: #000000">&nbsp;i&nbsp;</span><span style="color: #808080">IN</span></strong><strong><span style="color: #000000">&nbsp;enums.FIRST&nbsp;..&nbsp;enums.LAST<br /></span><span style="color: #008080">13</span></strong><strong><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;LOOP<br /></span><span style="color: #008080">14</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;dbms_output.put_line(</span><span style="color: #ff0000">'</span><span style="color: #ff0000">User&nbsp;#</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">||</span><span style="color: #000000">&nbsp;enums(i)&nbsp;</span><span style="color: #808080">||</span><span style="color: #000000">&nbsp;</span><span style="color: #ff0000">'</span><span style="color: #ff0000">:&nbsp;</span><span style="color: #ff0000">'</span><span style="color: #000000">&nbsp;</span><span style="color: #808080">||</span></strong><strong><span style="color: #000000">&nbsp;names(i));<br /></span><span style="color: #008080">15</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">END</span></strong><strong><span style="color: #000000">&nbsp;LOOP;<br /></span><span style="color: #008080">16</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">COMMIT</span></strong><strong><span style="color: #000000">;<br /></span><span style="color: #008080">17</span></strong><strong><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">18</span></strong><strong><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />EXCEPTION<br /></span><span style="color: #008080">19</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">WHEN</span><span style="color: #000000">&nbsp;OTHERS&nbsp;</span><span style="color: #0000ff">THEN</span></strong><span style="color: #000000"><br /></span><strong><span style="color: #008080">20</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">ROLLBACK</span></strong><strong><span style="color: #000000">;<br /></span><span style="color: #008080">21</span></strong><strong><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">22</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #0000ff">END</span><span style="color: #000000">;</span></strong></div><br /><strong>批量更新中，将for改成forall</strong> <br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><strong><span style="color: #008080">&nbsp;1</span><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /><span style="color: #0000ff">DECLARE</span></strong><strong><span style="color: #000000">&nbsp;<br /></span><span style="color: #008080">&nbsp;2</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;TYPE&nbsp;NumList&nbsp;</span><span style="color: #0000ff">IS</span><span style="color: #000000">&nbsp;VARRAY(</span><span style="color: #800000; font-weight: bold">20</span><span style="color: #000000">)&nbsp;</span><span style="color: #0000ff">OF</span><span style="color: #000000">&nbsp;</span><span style="color: #000000; font-weight: bold">NUMBER</span></strong><strong><span style="color: #000000">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;3</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;depts&nbsp;NumList&nbsp;:</span><span style="color: #808080">=</span><span style="color: #000000">&nbsp;NumList(</span><span style="color: #800000; font-weight: bold">10</span><span style="color: #000000">,&nbsp;</span><span style="color: #800000; font-weight: bold">30</span><span style="color: #000000">,&nbsp;</span><span style="color: #800000; font-weight: bold">70</span></strong><strong><span style="color: #000000">,&nbsp;<img src="http://www.blogjava.net/Images/dot.gif"  alt="" />);<br /></span><span style="color: #008080">&nbsp;4</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;</span><span style="color: #008080">--</span><span style="color: #008080">&nbsp;department&nbsp;numbers&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></strong><span style="color: #008080"><br /></span><strong><span style="color: #008080">&nbsp;5</span><span style="color: #008080"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">BEGIN</span></strong><strong><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;6</span></strong><strong><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://www.blogjava.net/Images/dot.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br /></span><span style="color: #008080">&nbsp;7</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">FOR</span><span style="color: #000000">&nbsp;i&nbsp;</span><span style="color: #808080">IN</span></strong><strong><span style="color: #000000">&nbsp;depts.FIRST..depts.LAST<br /></span><span style="color: #008080">&nbsp;8</span></strong><strong><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LOOP<br /></span><span style="color: #008080">&nbsp;9</span></strong><strong><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://www.blogjava.net/Images/dot.gif"  alt="" /><br /></span><span style="color: #008080">10</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008080">--</span><span style="color: #008080">UPDATE&nbsp;statement&nbsp;is&nbsp;sent&nbsp;to&nbsp;the&nbsp;SQL&nbsp;engine&nbsp;</span></strong><span style="color: #008080"><br /></span><strong><span style="color: #008080">11</span><span style="color: #008080"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #008080">--</span><span style="color: #008080">&nbsp;with&nbsp;each&nbsp;iteration&nbsp;of&nbsp;the&nbsp;FOR&nbsp;loop!</span></strong><span style="color: #008080"><br /></span><strong><span style="color: #008080">12</span><span style="color: #008080"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #000000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">UPDATE</span><span style="color: #000000">&nbsp;emp&nbsp;</span><span style="color: #0000ff">SET</span><span style="color: #000000">&nbsp;sal&nbsp;</span><span style="color: #808080">=</span><span style="color: #000000">&nbsp;sal&nbsp;</span><span style="color: #808080">*</span><span style="color: #000000">&nbsp;</span><span style="color: #800000; font-weight: bold">1.10</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">WHERE</span><span style="color: #000000">&nbsp;deptno&nbsp;</span><span style="color: #808080">=</span></strong><strong><span style="color: #000000">&nbsp;depts(i);<br /></span><span style="color: #008080">13</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">END</span></strong><strong><span style="color: #000000">&nbsp;LOOP:&nbsp;<br /></span><span style="color: #008080">14</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000ff">END</span><span style="color: #000000">;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span></strong></div><br />
<div style="border-bottom: #cccccc 1px solid; border-left: #cccccc 1px solid; padding-bottom: 4px; background-color: #eeeeee; padding-left: 4px; width: 98%; padding-right: 5px; font-size: 13px; word-break: break-all; border-top: #cccccc 1px solid; border-right: #cccccc 1px solid; padding-top: 4px"><!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--><strong><span style="color: #008080">1</span><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /><span style="color: #008080">--</span><span style="color: #008080">UPDATE&nbsp;statement&nbsp;is&nbsp;sent&nbsp;to&nbsp;the&nbsp;SQL&nbsp;engine&nbsp;just&nbsp;once,&nbsp;with&nbsp;the&nbsp;entire&nbsp;nested&nbsp;table</span></strong><span style="color: #008080"><br /></span><strong><span style="color: #008080">2</span><span style="color: #008080"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" /></span><span style="color: #000000">FORALL&nbsp;i&nbsp;</span><span style="color: #808080">IN</span></strong><strong><span style="color: #000000">&nbsp;depts.FIRST..depts.LAST&nbsp;<br /></span><span style="color: #008080">3</span><span style="color: #000000"><img align="top" src="http://www.blogjava.net/images/OutliningIndicators/None.gif"  alt="" />&nbsp;&nbsp;</span><span style="color: #0000ff">UPDATE</span><span style="color: #000000">&nbsp;emp&nbsp;</span><span style="color: #0000ff">SET</span><span style="color: #000000">&nbsp;sal&nbsp;</span><span style="color: #808080">=</span><span style="color: #000000">&nbsp;sal&nbsp;</span><span style="color: #808080">*</span><span style="color: #000000">&nbsp;</span><span style="color: #800000; font-weight: bold">1.10</span><span style="color: #000000">&nbsp;</span><span style="color: #0000ff">WHERE</span><span style="color: #000000">&nbsp;deptno&nbsp;</span><span style="color: #808080">=</span><span style="color: #000000">&nbsp;depts(i);&nbsp;</span></strong></div><br />
<div class="bar">&nbsp;To maximize performance, rewrite your programs as follows: <br />a. If an INSERT, UPDATE, or DELETE statement executes inside a loop and References collection elements, move it into a FORALL statement. <br />b. If a SELECT INTO, FETCH INTO, or RETURNING INTO clause references a <br />Collection, incorporate the BULK COLLECT clause. <br />c. If possible, use host arrays to pass collections back and forth between your Programs and the database server. <br />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.</div><img src ="http://www.blogjava.net/orangehf/aggbug/357028.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/orangehf/" target="_blank">翔南</a> 2011-08-22 12:55 <a href="http://www.blogjava.net/orangehf/archive/2011/08/22/357028.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>亚太互联网络信息中心，查询ip网址</title><link>http://www.blogjava.net/orangehf/archive/2011/08/15/356556.html</link><dc:creator>翔南</dc:creator><author>翔南</author><pubDate>Mon, 15 Aug 2011 04:42:00 GMT</pubDate><guid>http://www.blogjava.net/orangehf/archive/2011/08/15/356556.html</guid><wfw:comment>http://www.blogjava.net/orangehf/comments/356556.html</wfw:comment><comments>http://www.blogjava.net/orangehf/archive/2011/08/15/356556.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/orangehf/comments/commentRss/356556.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/orangehf/services/trackbacks/356556.html</trackback:ping><description><![CDATA[<a href="http://www.apnic.net/apnic-info/whois_search">http://www.apnic.net/apnic-info/whois_search</a><img src ="http://www.blogjava.net/orangehf/aggbug/356556.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/orangehf/" target="_blank">翔南</a> 2011-08-15 12:42 <a href="http://www.blogjava.net/orangehf/archive/2011/08/15/356556.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>oracle查看表分区情况sql</title><link>http://www.blogjava.net/orangehf/archive/2011/08/10/356249.html</link><dc:creator>翔南</dc:creator><author>翔南</author><pubDate>Wed, 10 Aug 2011 08:38:00 GMT</pubDate><guid>http://www.blogjava.net/orangehf/archive/2011/08/10/356249.html</guid><wfw:comment>http://www.blogjava.net/orangehf/comments/356249.html</wfw:comment><comments>http://www.blogjava.net/orangehf/archive/2011/08/10/356249.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/orangehf/comments/commentRss/356249.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/orangehf/services/trackbacks/356249.html</trackback:ping><description><![CDATA[<div class="tit7"></div>
<div style="line-height: 1.3" id="detail" class="detail">
<p>select * from user_tab_subpartitions t where t.table_name = upper('tablename');<br />select * from user_tab_partitions t where t.table_name = upper('tablename'); 
<div></div>
<p>&nbsp;</p></div><img src ="http://www.blogjava.net/orangehf/aggbug/356249.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/orangehf/" target="_blank">翔南</a> 2011-08-10 16:38 <a href="http://www.blogjava.net/orangehf/archive/2011/08/10/356249.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>oracle存储过程被锁定的解决方法</title><link>http://www.blogjava.net/orangehf/archive/2011/08/04/355815.html</link><dc:creator>翔南</dc:creator><author>翔南</author><pubDate>Thu, 04 Aug 2011 09:13:00 GMT</pubDate><guid>http://www.blogjava.net/orangehf/archive/2011/08/04/355815.html</guid><wfw:comment>http://www.blogjava.net/orangehf/comments/355815.html</wfw:comment><comments>http://www.blogjava.net/orangehf/archive/2011/08/04/355815.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/orangehf/comments/commentRss/355815.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/orangehf/services/trackbacks/355815.html</trackback:ping><description><![CDATA[1.在plsql会话中kill掉使用该存储过程的session<br /><br />2.若该存储过程还被锁定，使用sys登录数据库，执行如下语句，得到进程id<br />select spid from <br />sys.v$process p, sys.v$session s <br />where p.addr = s.paddr<br />and s.status='KILLED'<br /><br />3.在OS下kill掉这个进程<br />kill -9 14936 <img src ="http://www.blogjava.net/orangehf/aggbug/355815.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/orangehf/" target="_blank">翔南</a> 2011-08-04 17:13 <a href="http://www.blogjava.net/orangehf/archive/2011/08/04/355815.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>