Linux Installing and Uninstalling RPM Packages

| Posted by watashii | Filed under Unix

Installing a package on Linux:  (Eg, MQSeriesRuntime-7.0.1-3.x86_64.rpm)

$ rpm -ivh MQSeriesRuntime-7.0.1-3.x86_64.rpm

Verify the package installed:  (The architecture x86_64 name is not required)

$ rpm -qa MQSeriesRuntime-7.0.1-3

Uninstall the package:

$ rpm -e MQSeriesRuntime-7.0.1-3

Note: Sudo maybe required for install, in this case, run sudo rpm …

Tags: , ,

Oracle SQLPlus Query Output to a File

| Posted by watashii | Filed under Database, Programming, Unix

Here is a simple way to output SQL query output into a file, via command line based SQLPlus.

Step 1: Nominate the output file location. In this case this is a Unix location.

SQL> spool /tmp/output.txt

Step 2: Perform your SQL query.

SQL> select * from tab;

Step 3: Close the file.

SQL> spool off

Tip: Use set lines statement to adjust output display

Read the rest of this entry »

Tags: , , , ,

Install & Uninstall Probes/Gateways on Netcool Omnibus

| Posted by watashii | Filed under Software, Unix

Installing probes & gateway for Netcool/Omnibus 7.2 and below (ie prior to 7.3) is done by using the nco_patch patch tool over an existing Netcool Omnibus installation, with the un-tarred path of the patch (Unix):

$ $NCHOME/omnibus/install/nco_patch -install /tmp/probe-nco-p-mttrapd-9_0/patch/probe-nco-p-mttrapd-9_0/

To list all the patch (ids) that has been already applied to the installation, run the following command:

$ $NCHOME/omnibus/install/nco_patch -print=id
gateway-nco-g-oracle-4_0
gateway-nco-g-remedy-8_0
probe-nco-p-mttrapd-9_0

To remove/uninstall the probe, we use the same nco_patch tool with the patch id :

$ $NCHOME/omnibus/install/nco_patch -remove probe-nco-p-mttrapd-9_0

Tags: , , ,

Starting / Shutdown Oracle Database in Unix

| Posted by watashii | Filed under Database, Unix

This simple guide to shows how to start /stop your Oracle database from Unix.  You must have logon access to do this.

Step 1

Unix login as oracle (usually the user that installed the database)

Step 2

Make sure your environment variables are set, eg:

ORACLE_SID=MYDBSID
ORACLE_BASE=/opt/oracle
ORACLE_HOME=/opt/oracle/product/11.2.0/dbhome_1
LD_LIBRARY_PATH=/opt/oracle/product/11.2.0/dbhome_1/lib
PATH=/usr/bin:/usr/sbin:/usr/ucb:/usr/local:/usr/local/bin:/usr/local/sbin:/opt/oracle/product/11.2.0/dbhome_1/bin

Step 3 – Start DB Instance

On the Unix command line, run sqlplus with sysdba, and simply type startup in the prompt to start it up.

oracle@db-srv-01 % sqlplus '/ as sysdba'

SQL*Plus: Release 11.2.0.1.0 Production on Tue Nov 30 12:06:47 2010

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area 3207790592 bytes
Fixed Size                  2152368 bytes
Variable Size            2449475664 bytes
Database Buffers          738197504 bytes
Redo Buffers               17965056 bytes
Database mounted.
Database opened.

Step 4 – Start Listener

To start the oracle listener (assuming listener.ora is setup), run lsnrctl start

oracle@db-srv-01 % lsnrctl start

LSNRCTL for Solaris: Version 11.2.0.1.0 - Production on 30-NOV-2010 12:00:34

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /opt/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...

TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
System parameter file is /opt/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/db-srv-01/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db-srv-01)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=db-srv-01)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version 11.2.0.1.0 - Production
Start Date                30-NOV-2010 12:00:35
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/db-srv-01/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=db-srv-01)(PORT=1521)))
The listener supports no services
The command completed successfully

Step 4 – Shutdown

Similarly, to shutdown the instance, type shudown normal within sqlplus.

Stop the listener, by running lsnrctl stop

Tags: , , , ,

Unix Bash Coloured Prompts

| Posted by watashii | Filed under Unix

To display coloured prompts upon user login (on Unix Bash shell, PuTTY client), perform the following modifications:

  1. Unix login and open the user’s profile in the home directory, eg /home/username/.profile
  2. In the .profile, add the following entry in a new line to execute the bash shell upon login, eg /usr/bin/bash
  3. The bash shell will refer to a .bashrc file.  If its not there, create it,  eg /home/username/.bashrc
  4. Add following entries in the .bashrc to enable the coloured prompt; showing the username, hostname and working directory:
    # Colored Prompts
    STARTGREEN='\[\e[0;32m\]';
    STARTBLUE='\[\e[1;34m\]';
    ENDCOLOR="\[\e[0m\]";
    PS1="$STARTGREEN\u@\h$ENDCOLOR:$STARTBLUE\w$ENDCOLOR $ ";

Tags: , , , ,

Unix Shell – Check If Directory Is Empty

| Posted by watashii | Filed under Programming, Unix

Here is a simple unix shell command to check if a directory, $dir, is empty.

export $dir=/tmp/myfiles/
if [ "$(ls -A $dir)" ];
then
    echo "$dir NOT Empty";
else
    echo "$dir IS Empty";
fi

Tags: , , ,

Unix LS Command With Colors… Without the —color Option

| Posted by watashii | Filed under Programming, Unix

lscolor03

Having command line text in colors makes things easier to read.  For example the ls command for listing directories and files.  In some Unix environments, the ls command may not support the –color option to let us do that (as it  requires GNU ls).  So how can we workaround this to add color to ls?

Here are my steps to make it happen. Note i’m no Unix guru, and I didn’t have time to perfect it.. but it gets the job done!

Read the rest of this entry »

Tags: , ,

BIAR File Command Line Import – Bypassing Import Wizard

| Posted by watashii | Filed under BusinessObjects, Software, Unix

The command line to import the BusinessObjects Enterprise (XIR2 Unix) exported biar file can be done using the following command:

java -jar <BOBJE_HOME>/bobje/java/lib/InstallEntSdkWrapper.jar 'cms_name' 'admininistrator' 'admin_password' 'secEnterprise' <PATH_TO>/MyBiarFile.biar

[InstallEntSdkWrapper.main] Connecting to CMS Development as administrator
[InstallEntSdkWrapper.main] BIAR Imported Successfully

Tags: , ,

How to untar a gz file in Unix

| Posted by watashii | Filed under Unix

untargz

For a .gz file,

$ gunzip myfile.gz

For .tar.gz file,

$ gzip -dc myfile.tar.gz | tar xvf -

Tags:

Exercise Your Idle System Doing Nothing

| Posted by watashii | Filed under Unix

sleepy_idle

Via Unix/Linux:

cat /dev/zero > /dev/null

or

cp /dev/zero  /dev/null

Explaination:

/dev/null is basically a black hole (a special null file), anything written to it goes down the drain.  Anything read from it will result in nothing returned.  /dev/zero is basically the same as /dev/null when writing to it, however reading it will result in a continuous stream of zeros without EOF.

Tags: , , ,