rasti.hil@hilandco.com +41 79 367-9677

Search This Blog

Install Hamachi on Oracle Unbreakable Linux 5.x

1) dowload Hamachi

wget http://files.hamachi.cc/linux/hamachi-0.9.9.9-20-lnx.tar.gz


2) unpack

tar -xvf hamachi-0.9.9.9-20-lnx.tar.gz
cd hamachi-0.9.9.9-20-lnx

3) change tuncfg

cd tuncfg
mv tuncfg tuncfg.backup
mcedit tuncfg.c

      replace

"ifconfig %s %u.%u.%u.%u ", ctx[i].dev,

      with

"/sbin/ifconfig %s %u.%u.%u.%u ", ctx[i].dev,

      recompile

gcc tuncfg.c -o tuncfg
killall tuncfg

4) install

cd ..
make install
/sbin/tuncfg

4) configure

hamachi-init -c /etc/hamachi
mcedit /etc/hamachi/config
KeepAlive 10

5) login and join to network

hamachi login
hamachi set-nick "nickname"
hamachi join "network id [numbers]"
hamachi go-online "network id [numbers]"

6) run Hamachi after boot
6.1)

mcedit /etc/init.d/hamachi_start
/usr/bin/hamachi -c /etc/hamachi start

6.2)

mcedit /etc/rc.local
/etc/init.d/hamachi_start

6.3) just in case ...

ln -s /etc/init.d/hamachi_start /etc/rc3.d/S99hamachi
ln -s /etc/init.d/hamachi_start /etc/rc5.d/S99hamachi

How to create your first Management Plug-in in Grid Control

1) Adding a Target Instance to the targets.xml File

Add this following line to %AGENT_HOME%\sysman\emd\targets.xml file:

<Target TYPE="first_task_type" NAME="first_task"/>

After that you have to reload:

%AGENT_HOME%\BIN> emctl reload

Or restart the agent:

%AGENT_HOME%\BIN> emctl stop agent
%AGENT_HOME%\BIN> emctl start agent

You can upload and see the status:

%AGENT_HOME%\BIN> emctl upload agent
%AGENT_HOME%\BIN> emctl status agent

2) Create target type metadata

%AGENT_HOME%\sysman\admin\metadata\first_task_type.xml

<?xml version="1.0" ?>
<!DOCTYPE TargetMetadata SYSTEM "../dtds/TargetMetadata.dtd">

<TargetMetadata META_VER="1.0" TYPE="first_task_type">
<Display>
<Label NLSID="my_name">first_task_type_label</Label>
</Display>

<AltSkipCondition METRIC="Response" COLUMN="State" />

<Metric NAME="Response" TYPE="TABLE">
<Display>
<Label NLSID="resp">Response</Label>
</Display>

<TableDescriptor>
<ColumnDescriptor NAME="Status" TYPE="NUMBER" IS_KEY="FALSE">
<Display>
<Label NLSID="resp_status">Status</Label>
</Display>
</ColumnDescriptor>
</TableDescriptor>

<QueryDescriptor FETCHLET_ID="OSLineToken">
<Property NAME="scriptsDir" SCOPE="SYSTEMGLOBAL">scriptsDir</Property>
<Property NAME="perlBin" SCOPE="SYSTEMGLOBAL">perlBin</Property>
<Property NAME="command" SCOPE="GLOBAL">
%perlBin%/perl %scriptsDir%/first_task_script.pl
</Property>
<Property NAME="startsWith" SCOPE="GLOBAL">em_result=</Property>
<!-- <Property NAME="delimiter" SCOPE="GLOBAL">|</Property>-->

</QueryDescriptor>
</Metric>

<InstanceProperties>
</InstanceProperties>

</TargetMetadata>


3) Create perl script which is used by the target type metadata file.

%AGENT_HOME%\sysman\admin\scripts\first_task_script.pl



# first_task_script.pl
#
# NAME
# first_task_script.pl - Returns an always up value
#
# DESCRIPTION
# Returns an always true value for every evaluation.


print "em_result=1\n";




4) Define the schedule of metric collection:

%AGENT_HOME%\sysman\admin\default_collection\first_task_collection.xml

<!DOCTYPE TargetCollection SYSTEM "../dtds/TargetCollection.dtd">
<TargetCollection TYPE="first_task_type" >
<CollectionItem NAME = "Response" REQUIRED="TRUE">
<Schedule>
<IntervalSchedule INTERVAL="5" TIME_UNIT="Min"/>
</Schedule>
<Condition COLUMN_NAME="Status" CRITICAL="0" OPERATOR="EQ" OCCURRENCES="2" />
</CollectionItem>
</TargetCollection>


5) Validation with ILint
Go to the directory:%AGENT_HOME%\BIN and run the following command:

emctl ilint
-m %AGENT_HOME%\sysman\admin\metadata\first_task_type.xml
-i %AGENT_HOME%\sysman\emd\targets.xml
-c %AGENT_HOME%\sysman\admin\default_collection\first_task_collection.xml
-t first_task
–r Response

6) Validation with emPDK
Go to the directory where you have installed emPDK.jar and run the following command:

emcli check_mp
-metadata_file="%AGENT_HOME%\sysman\admin\metadata\first_task_type.xml"
-collection_file="%AGENT_HOME%\sysman\admin\default_collection\first_task_collection.xml"


7) At finally you can see it in Grid Control
(go to Targets -> Host -> select the host -> Targets -> first_task


You can read more:
Developing a Management Plug-in

Management Plug-in Development Kit

Installing the emPDK


1) You can download emPDK.jar from Grid Control:
   HTTP(S)://host:port/em/console/emx/pdkDownload

2)Install emPDK:
   java -jar emPDK.jar client -install_dir="C:\Oracle_agent\10.2.0.5\agent10g\emPDK_folder"

3)Use the emPDK:
Go to the directory where you have installed emPDK.jar:
   emcli check_mp -metadata_file="C:\Oracle_agent\10.2.0.5\agent10g\sysman\admin\metadata\zsuzsi_echo.xml" -collection_file="C:\Oracle_agent\10.2.0.5\agent10g\sysman\admin\default_collection\zsuzsi_collection.xml"

Installing the EM CLI Client

1) You have to download emclikit.jar from Grid Control:
      HTTP(S)://host:port/em/console/emcli/download
You put this file: $ORACLE_HOME/sysman/jlib

2) Set your JAVA_HOME and PATH environment variable.
      >set JAVA_HOME=C:\Program Files\Java\jdk1.6.0_13
      >set PATH=%JAVA_HOME%\bin


And you can see it:
      >echo %JAVA_HOME%
      C:\Program Files\Java\jdk1.6.0_13
      >echo %PATH%
      C:\Program Files\Java\jdk1.6.0_13\bin

3) Install emcli:
Go to the directory where you have installed emclikit.jar:
      java -jar emclikit.jar client -install_dir=C:\Oracle_agent\10.2.0.5\agent10g\emcli_folder

4) Setup emcli:
      emcli setup -url="http[s]://host:port/em/" -username="username" -password="password" -dir="C:\Oracle_agent\10.2.0.5\agent10g\emcli_folder" -trustall -novalidate

You can read more:
EM CLI

Oracle & Perl

Connect to Oracle Database with DBD::Oracle


use strict;
use DBI;

my $user = 'username';
my $passwd = 'password';
my $SID = 'xxxx';
my $port = 'xxxx';

my $db = DBI->connect( "dbi:Oracle:localhost:$port/$SID", $user, $passwd )
|| die( $DBI::errstr . "\n" );

$db->{AutoCommit} = 0;
$db->{RaiseError} = 1;
$db->{ora_check_sql} = 0;
$db->{RowCacheSize} = 16;

END {
$db->disconnect if defined($db);
}


Select data from Oracle Database with DBD::Oracle

my $SQL = "select 1 from dual"; # SQL SELECT
my $sth = $db->prepare($SQL); # Prepare SELECT
$sth->execute(); # Execute SELECT

Running putty in a perl script


my $PUTTY = 'C:\Program Files\PuTTY\putty.exe';
my $sessionName = 'putty_session_name';
my $cmd = "start \"\" \"$PUTTY\" -load \"$sessionName\"";
system($cmd); #running command

ORA-28000: the account is locked


SELECT PROFILE FROM DBA_USERS WHERE USERNAME='PORTAL';

PROFILE
----------
DEFAULT

SELECT RESOURCE_NAME,LIMIT FROM DBA_PROFILES WHERE PROFILE='DEFAULT';

RESOURCE_NAME LIMIT
-------------------------------- ----------------------------------------
COMPOSITE_LIMIT UNLIMITED
SESSIONS_PER_USER UNLIMITED
CPU_PER_SESSION UNLIMITED
CPU_PER_CALL UNLIMITED
LOGICAL_READS_PER_SESSION UNLIMITED
LOGICAL_READS_PER_CALL UNLIMITED
IDLE_TIME UNLIMITED
CONNECT_TIME UNLIMITED
PRIVATE_SGA UNLIMITED
FAILED_LOGIN_ATTEMPTS 10
PASSWORD_LIFE_TIME UNLIMITED
PASSWORD_REUSE_TIME UNLIMITED
PASSWORD_REUSE_MAX UNLIMITED
PASSWORD_VERIFY_FUNCTION NULL
PASSWORD_LOCK_TIME UNLIMITED
PASSWORD_GRACE_TIME UNLIMITED

ALTER PROFILE DEFAULT LIMIT FAILED_LOGIN_ATTEMPTS UNLIMITED;
ALTER USER PORTAL ACCOUNT UNLOCK;

SyntaxHighlighter is now included into blog.hilandco.com

This blog entry is primarily for bloggers at Hil & Co IT Solutions.


FUNCTION SyntaxHighlighter() RETURN BOOLEAN AS
L_STRING VARCHAR2(256);
BEGIN
L_STRING := 'form now syntax highlighting is available';
-- below I'll describe how to use it
RETURN TURE;
END SyntaxHighlighter;

Step 1) go to SyntaxHighlighter Home Page to get familiar with SyntaxHighlighter.

Step 2) go to SyntaxHighlighter:Brushes to see available brushes.

Step 3) If you want to include some of this brushes into our blog:
      Go to Blog Dashboard -> Layout -> Edit HTML - > Edit Template, and scroll down until

...
<!-- **************************************************************************************************************** -->
<!-- SyntaxHighlighter START -->
<!-- BEGIN: MUST HAVE SECTION -->
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/>
<link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/>
<script language='javascript' src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js'/>
<!-- END: MUST HAVE SECTION -->

<!-- BEGIN: list of enabled brushes -->

<!-- javascript -->
<script language='javascript' src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js'/>
<!-- bash -->
<script language='javascript' src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushBash.js'/>

<!-- END: list of enabled brushes -->
<!-- BEGIN: MUST HAVE SECTION -->
<script type='text/javascript'>
SyntaxHighlighter.config.bloggerMode = true;
SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/current/scripts/clipboard.swf';
SyntaxHighlighter.all();
</script>
<!-- END: MUST HAVE SECTION -->
<!-- SyntaxHighlighter END-->
<!-- **************************************************************************************************************** -->
...

Step 4) create link for brush what will be newly included
      New link shoul look like tihs

<script language='javascript' src='http://alexgorbatchev.com/pub/sh/current/scripts/FILENAME'/>

where FILENAME should be equal to File name column at Step 2)

Step 5) the highlighted source should be enclosed in a HTML <pre> tag as the following example shows:

<pre class="brush: BRUSH_ALIASE">
  // some code
<pre/>

where BRUSH_ALIASE should be equal to Brush aliases column at Step 2)

Note[1]: I that you use Html Editing instead of Compose editing.
Note[2]: Using long string eg. <!-- ***...*** --> will not cause wrapping.
Note[3]: Thanks for Hosting and Developing to Alex .

janos.ujvari @02.02.2010

custom oraenv

cd $ORACLE_HOME/bin
vi oraenv

PATH=$PATH:$ORACLE_HOME/opmn/bin
export PATH


export ORACLE_SID=ORCL
export ORAENV_ASK=NO
. oraenv