Tuesday, January 25, 2011

How To Tell If My Linux O/S is 64bit or 32bit

From the command prompt issue the "uname -m" command, if the output is i386 and/or i686 then it's 32bit, if it's x86_64 then it's 64bit.


$>uname -m
i686

Monday, January 24, 2011

A Tar Gzip Split

The issue:

We had a 350gbs text file that was gzip’ed down to 115gbs that needed to be move from one of our Linux servers to a client’s Lunix server. However, as usual they wanted it there yesterday. So to speed this movement up I wanted to split the file so that it could be sftp’ed in parallel. Of course unzipping and splitting and re-zipping would require a lot of time not to mention space that was not available. What to do…

The answer:

Here is what I did.

First I split the gzip’ed file using the following command:

tar cfz - |split -b 100m /u1/directoryname/somefilename.gz

This split the zipped source file into 11 pieces. Allowing them to be ftp’ed in parallel; thereby greatly reducing the overall transfer time. Once the 11 files were on the target server they were put back together and then they where uncompressed.

cat x* > somefilename.gz (note: it is important to use the x* as if you try to order the reconstruction of the files the resulted gzip’ed file will be corrupt).

Then this new file must be unzipped:

gunzip somefilename.gz

I go no errors and a quick head and wc –l on the file showed everything to be fine.
Thx

Friday, January 21, 2011

Fatal NI connect error 12170.

I recently installed an 11 R1 on a Linux box and after creating the database instance started getting the following error a lot in the alert log:

Fatal NI connect error 12170.

VERSION INFORMATION:
TNS for Linux: Version 11.1.0.7.0 - Production
Oracle Bequeath NT Protocol Adapter for Linux: Version 11.1.0.7.0 - Production
TCP/IP NT Protocol Adapter for Linux: Version 11.1.0.7.0 - Production
Time: 21-JAN-2011 09:26:53
Tracing not turned on.
Tns error struct:
ns main err code: 12535

TNS-12535: TNS:operation timed out
ns secondary err code: 12606
nt main err code: 0
nt secondary err code: 0
nt OS err code: 0
Client address: (ADDRESS=(PROTOCOL=tcp)(HOST=xx.xxx.x.xx)(PORT=xxxx))
WARNING: inbound connection timed out (ORA-3136)

This message is easily corrected by following the instruction in the Oracle document on Metalink:
Net Diagnostic Data Found in 11g Alert Log [ID 745167.1]

The boil down of the solution is to add the following parameter to your sqlnet.ora file to disable a new feature in 11 that is defaulted to ‘ON’:

DIAG_ADR_ENABLED =OFF

Tuesday, January 11, 2011

FLUSH BEFORE TESTING

When testing it can be important to ensure that you are not running your sql from cache as this may give you false results in regard to timing. You wouldn’t want to find yourself in production saying, “well, I it ran fast in test”. Anytime you are performing any type of performance tests it is important to try and duplicate your production environment as best as you can. This is even more important when you are talking about hdd disk reads (very time-consuming in relation to memory reads).

So you are doing testing and want to know how you can flush the buffer cache within Oracle without having to bounce the database instance?

The answer is to Flush the data buffer cache.

alter system flush buffer_cache;

This is for testing and wouldn’t be a very good idea to execute it on a production system as it could have an adverse effect on performance.

A QUICK LOOK AT WHY

The other day I got the following email:

***********
Sam,
Can you please take a look at this query? It’s been running twice as long as expected:

SID
738 aname bname SQL*Plus @@corvette 15,051 776.06 08-JAN-11 02:40:23 32 02:55:15 136
insert /*+ append */ into tmp_somename_tb select scheme. Id…

Thanks!
***********

Here is the quick pass I performed to see what was going on.

First the summary I gave:
As expected the insert is doing heavy direct path reads to temp and then once those slave buckets are full it does heavy direct path writes to temp. During the reads the box load is light (9 and 10), the cpu is light (51% used – 47% user and 4% system), the run queue not bad (4, 5); however, The cpu’s are waiting on i/o (25, 28). During the writes the box load is very high (126 and 152), the cpu is heavy (99% used – 94% user and 5% system), the run queue is very high (116, 122); The cpu’s are not waiting on i/o (0).

Now, the where I got it from:
Direct path reads/writes to temp:
Within grid control, under top activity, selected the sqlid in question, in the details section the summary block using the color codes to determine the direct path reads/writes to temp.

Box Load:
At the top of ‘top’: load average: 9.03, 10.93, 14.60

CPU: Also from ‘top’

Run Queue:
sfulke@corvette[gmdwhp]:/home/sfulke> vmstat 5 5
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
r b swpd free buff cache si so bi bo in cs us sy id wa
11 18 900 14836684 276388 4334588 0 0 37171 4913 0 0 32 7 49 11
9 22 900 14893188 276412 4334564 0 0 671667 54523 10845 18386 59 11 3 27
28 11 900 14684604 276424 4334552 0 0 624320 68223 7881 12968 48 8 14 30
33 13 900 14683636 276444 4334532 0 0 680810 320344 12198 14958 66 13 9 12
20 14 900 14682612 276492 4334484 0 0 739581 278236 10658 15601 57 12 14 17
sfulke@corvette[gmdwhp]:/home/sfulke>

The run queue is the first column from the vmastat output (remember to disregard the first line of output as it can be accumulative) ‘r’.

The last column from the vmstat output is the cpu’s waiting on i/o ‘wa’.


Here is a little more detail for each of the columns from the vmstat output:
Processes:
r: Processes waiting in line for some time on the CPU
b: Uninterruptble sleeping processes

Memory:
swpd: Virtual memory usage
free: Idle memory usage
buff: Buffer Memory
cache: Cache Memory

Swap:
si: Memory swapped in from disk
so: Memory swapped out to disk

IO:
bi: Blocks received hdd
bo: Blocks sent to hdd

System:
in: Number of interrupts per second
cs: Number of context switches per second

CPU:
us: Time used executing non-kernel code. (For example: User Time items like ‘nice’ – actual work)
sy: Time used executing kernel code. (For example: System Time items like ‘IO interrupts’- work management)
id: Time in idle state.
wa: Time used waiting for IO. Prior

Have a great day!