venerdì 25 febbraio 2011

Linux: boot with terminal

I've just finished installing "stuff" on a VM with Oracle Enterprise Linux and I need to configure the machine without the resource consuming X11 automatically loaded at startup.

The Linux boot process has six states of operation of which "0" is the shutdown state and "3" and above are fully operational with all essential processes running for user interaction. The init process is the last step of the boot procedure and it is identified by process with id=1; Init is responsible for starting system processes as defined in the "/etc/inittab" file.

Editing the inittab file, I changed the default line:

id:5:initdefault:

with the following:

id:3:initdefault:

Here there are the available states:

0 halt system (loaded the /etc/rc.d/rc0.d/ library)
1 single user (/etc/rc.d/rc1.d/)
2 multiuser with no network (...2.d)
3 terminal
4 reserved for local use
5 X11 GUI mode
6 reboot


After startup type "starx" or "init 5" to enter X11.

domenica 6 febbraio 2011

WLS: embedded LDAP client access

To view the entries of the embedded LDAP server through an LDAP client browser, first of all you have to change the embedded LDAP credentials:

1. Access WLS admin console
2. Expand the Domain node.
3. Select the Security-->Embedded LDAP tab.
4. Change the Credential attribute from its generated value to a new password
5. Click SAVE.
6. At last, reboot WebLogic Server.

Now configure a new connection in the LDAP browser (as a suggestion, I use Apache Directory Studio based on Eclipse).

Use the http server port 7001 (7002 if SSL is being used), "dc=[UCM_DOMAIN_NAME]" as the base dn, cn=Admin as the ldap administration user with the newly created password.

giovedì 8 aprile 2010

UCM: Rules and Profiles metadata

UCM do not store metadata of Rules and Profiles. To obtain those information you need to use IdcServices (or parse the rules/profiles HDA files).

Following a list of sample URLs:


All profiles:

http://HOSTNAME:PORT/idc/idcplg?IdcService=GET_DOCPROFILES&IsSoap=1

Rules vs single Profile:

http://HOSTNAME:PORT/idc/idcplg?IdcService=GET_DOCPROFILE&dpName=PROFILE_NAME&IsSoap=1

All rules:

http://HOSTNAME:PORT/idc/idcplg?IdcService=GET_DOCRULES&IsSoap=1

Attributes of a single rule:

http://HOSTNAME:PORT/idc/idcplg?IdcService=GET_DOCRULE&dpRuleName=RULE_NAME&IsSoap=1

UCM: Modify the check-in menu

To modify the "New check in" menu structure in UCM you have to customize the dynamic include "custom_finish_layout_init" using component wizard.

After creating the new resource and the new include use the javascript "navBuilder" object to modify the structure of the menu; use "navBuilder.getNodeById("NEW_CHECK_IN").childNodes" method to search the leafs of the node.

The leaf IDs of the new check in menu are usually named "MY_PERSONAL_CHECKINS_[n]" (with n starting from 0).


<$include super.custom_finish_layout_init$>
APChilds = new Array();
ARChilds = new Array();
var children = navBuilder.getNodeById("NEW_CHECK_IN").childNodes;
for (var i = 0; i < children.length; i++)
{
TEXT = children[i].getAttribute("label") ;
if (TEXT.match(/\bAR\b/i) != null)
{ arrLength =ARChilds.push(children[i].getAttribute("id")); }
if (TEXT.match(/\bAP\b/i) != null) {
arrLength =APChilds.push(children[i].getAttribute("id")); }}



Then you can add new nodes or collections using:

navBuilder.addChildNodeTo("NEW_CHECK_IN","collection","id==ACCOUNT_PAYABLES","label==Account payables","url==");

navBuilder.addChildNodeTo("NEW_CHECK_IN","item","id==ACCOUNT_PAYABLES","label==Account payables","url==http://oramack.blogspot.com");


If trying to add a new collection you can choose the position of the leaf specifying the sibling node:


navBuilder.addPrevSiblingNodeTo("MY_PERSONAL_CHECKINS_0","collection","id==ACCOUNT_RECEIVABLES","label==<$lc("wwACCOUNT_RECEIVABLES")$>","url==");

navBuilder.addPrevSiblingNodeTo("MY_PERSONAL_CHECKINS_0","collection","id==ACCOUNT_PAYABLES","label==<$lc("wwACCOUNT_PAYABLES")$>","url==");


then move check in profile into the newly created collections:


i=0;
while(i navBuilder.moveItemInto("ACCOUNT_RECEIVABLES",ARChilds[i]); i++;
}

i=0;
while(i navBuilder.moveItemInto("ACCOUNT_PAYABLES",APChilds[i]); i++;
}


Note: use the IDOC function "lc" for getting translation; example: <$lc("wwACCOUNT_RECEIVABLES")$>

Here is the include full code:


<$include super.custom_finish_layout_init$>


APChilds = new Array();
ARChilds = new Array();

var children = navBuilder.getNodeById("NEW_CHECK_IN").childNodes;
for (var i = 0; i < children.length; i++)
{
TEXT = children[i].getAttribute("label") ;
if (TEXT.match(/\bAR\b/i) != null) {
arrLength =ARChilds.push(children[i].getAttribute("id"));
}
if (TEXT.match(/\bAP\b/i) != null) {
arrLength =APChilds.push(children[i].getAttribute("id"));
}
}

navBuilder.addPrevSiblingNodeTo("MY_PERSONAL_CHECKINS_0","collection","id==ACCOUNT_RECEIVABLES","label==<$lc("wwACCOUNT_RECEIVABLES")$>","url==");
navBuilder.addPrevSiblingNodeTo("MY_PERSONAL_CHECKINS_0","collection","id==ACCOUNT_PAYABLES","label==<$lc("wwACCOUNT_PAYABLES")$>","url==");

i=0;
while(i navBuilder.moveItemInto("ACCOUNT_RECEIVABLES",ARChilds[i]); i++;
}

i=0;
while(i navBuilder.moveItemInto("ACCOUNT_PAYABLES",APChilds[i]); i++;
}


mercoledì 14 ottobre 2009

Search inside files

In order to search for a specific text pattern inside every file in every subdirectory of a given path in linux you can do:

grep -r "text_2_search" *

"-r" stands for "recursive."
Note that with "zgrep" util you can search recursively inside a .zip or .tar.gz file.

Linux resize screen resolution with xrandr

You can quickly resize the screen resolution using "xrandr" utility (/usr/bin/xrandr).

with xrandr -q you can see all the available resolutions

Input xrandr -s (size) to dynamically resize screen; for example:

xrandr -s 1440x900

mercoledì 9 aprile 2008

Oracle DB: Cold backup

A cold backup is a phisical backup and is done with the database in a shutdown state (not available to users).
The datafiles do not change during the copy so the database is in sync upon restore.

First of all, you need to shutdown your instance:

export TNS_ADMIN=/export/opt/oracle/8.1.7/network/admin
export ORACLE_SID=some_sid
export ORACLE_HOME=/export/opt/oracle/8.1.7

DT=`date +%Y.%m.%d`
PFILE=/export/opt/oracle/8.1.7/dbs/init$ORACLE_SID.ora

echo Backup for $DT
echo Selecting the files that must be backed up....

/export/opt/oracle/8.1.7/bin/sqlplus -S '/ as sysdba' [minor][minor]eofsql

set termout off
set pages 0
set lines 120
set feedback off
set trimspool on
spool files.2.backup
select name from v$datafile;
select name from v$controlfile;
select member from v$logfile;
select '$PFILE' from dual;
spool off
shutdown immediate
exit;
EOFSQL


then you should "tar" your datafiles, controlfiles and logfiles (so called "image copy"):

tar cfv - -I files.2.backup | gzip | rsh -l some_user some_host "cat - > /path/to/destdir/backup-$DT.tar.gz"


or you can direclty tar a folder; the following is an example on linux:

tar -zcvf ASRAC_20080409_00.tar.gz ASRAC /hera01/app/oracle/oradata/ASRAC

finally startup you instance:

/export/opt/oracle/8.1.7/bin/sqlplus -S '/ as sysdba' [minor][minor]eofsql
startup pfile=$PFILE
exit;
EOFSQL