How To grep n Lines Before In Solaris

Hi,

I like to show how to get the n lines before a pattern search using grep in Solaris. First of all, Solaris grep command not have a option to get the lines before or after from a match. You must use ggrep compliance to unix standard. Let me see show a pair of examples;

Test 1, this comamnd show the four previous lines from match ‘ORA-00313’;

cat alert_db.log | /usr/sfw/bin/ggrep -B 4 ORA-00313

Test 2, this command show the previous line from match ‘ORA-00313’;

cat alert_db.log | /usr/sfw/bin/ggrep -B 1 ORA-00313

HTH – Antonio NAVARRO

 

Advertisements

Better To Move Than To Copy

Yesterday a person was copying a file, in order to change location, in this case it is a unix system, but in windows it happens the same. In this example we are going to see copy times (cp command) versus move (mv command), to see the difference. This post is designed for people who start and do not know very well the difference between copy and move. For example I have used the compressed oracle engine, but for large files you can go the time from minutes to hours.

Copying the file to another path, we see that in this case it takes almost 18 seconds;

oracle12@mortages-1:~/soft_12c_sparc$ time cp solaris.sparc64_12102_database_1of2.zip ./soft_12c_sparc

real    0m17.82s
user    0m0.00s
sys     0m4.67s

Move the same file to the same path, we see that the time is 0 seconds;

oracle12@mortages-1:~/soft_12c_sparc$ time mv solaris.sparc64_12102_database_1of2.zip ./soft_12c_sparc

real    0m0.00s
user    0m0.00s
sys     0m0.00s

The explanation is simple. The cp moves the file physically (from the first byte to the last) to the new location. With mv what we do is leave the file where it is and change in index of directories (at OS level) the logical direction that we see.

HTH – Antonio NAVARRO

I Cannot Delete Into ASMCMD

A coworker ask me about a problem he had when trying delete into the asmcmd. At shell prompt he can deleted without problems but from asmcmd doesn’t. He get the control and interrogation symbol like show below;

 
grid@mortir./grid/home/grid $ asmcmd -p                   
ASMCMD [+] > lsdg dddssss^?^?^?^?                                                                                                                  
ASMCMD-8001: diskgroup 'ddd' does not exist or is not mounted
ASMCMD [+] > exit                                            

The problem here is that the erase is not set correct. He needed to define the stty erase for the backspace key.

 
grid@mortir./grid/home/grid $
grid@mortir./grid/home/grid $ stty erase ^?

HTH – Antonio NAVARRO

Error When Deploy Agent In EM12c Because Of Trash

Today I was deploying agents in several machines when one of them failed in remote validations. The error text is the next;

El directorio base de instalación “/agent12c” no está vacío.

Of course, it is in spanish. Translate to English would be similar to;

The base directory “/agente12c” is not empty.

I opened a ssh to the machine and take a look at /agente12c, it had a file, maybe created to validate permissions on this directory for the agent user. The solution so easy like remove the file;

 
mortadela-1:/agent12c$ ls -rlt
total 1
-rw-r--r--   1 agente12c  oinstall       0 Apr 10 09:42 dummy.txt
mortadela-1:/agent12c$ rm dummy.txt
mortadela-1:/agent12c$ ls -rlt
total 0
mortadela-1:/agent12c$ pwd
/agent12c

HTH – Antonio NAVARRO.

11.2 RunInstaller Fails With Java Error libXm.so

Today I was intalling an Oracle 11.2.0.3 on Solaris 11. When I started the runInstaller I get an error from java installer tell me it don’t found the libXm.so library.

In my case the  “libmawt.so” library no exist, sorry I mean that this library is not installed at operating system level. For install it you must install the next package;

pkg://solaris/library/motif

You must be root to install the package as show below;

pkg install pkg://solaris/library/motif

HTH – Antonio NAVARRO