Tuesday, November 20, 2007

how to send a message to a user on another Linux terminal

I've googled this several time already, but keep on forgetting the commands. Hope this note will help next time I try to search it again :)
Taken from here http://www.htmlforums.com/archive/index.php/t-64292.html

command write
http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=w/write
Initiate or respond to an interactive conversation with user. A write session is terminated with EOF. If the user is logged into more than one terminal, specify a tty number. See also talk; use mesg to keep other users from writing to your terminal.

command talk
http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=t/talk
Talk to another user. person is either the login name of someone on your own machine or user@host on another host. To talk to a user who is logged in more than once, use ttyname to indicate the appropriate terminal name. Once communication has been established, the two parties may type simultaneously, with their output appearing in separate windows. To redraw the screen, type Ctrl-L. To exit, type your interrupt character; talk then moves the cursor to the bottom of the screen and restores the terminal.

command mesg
http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=m/mesg
Change the ability of other users to send write messages to your terminal. With no options, display the permission status.

and of course wall
http://www.linuxdevcenter.com/linux/cmd/cmd.csp?path=w/wall
Write to all users. Depending on your Linux distribution, wall uses one of the two syntaxes shown. In both versions, the default is for wall to read a message from standard input and send the message to all users currently logged in, preceded by "Broadcast Message from..."

Saturday, November 17, 2007

How to enable XA transactions in Oracle

Thanks to David P. for this guide.

You need to login to the oracle server as the sys user:

my-server# sqlplus SYS as SYSDBA

and run the sql included in these two files:

$ORACLE_HOME/javavm/install/initxa.sql
$ORACLE_HOME/javavm/install/initjvm.sql

From sqlplus it looks like:
SQL> @/opt/oracle/10.2.0/javavm/install/initxa.sql
SQL> @/opt/oracle/10.2.0/javavm/install/initjvm.sql

It is possible that initjvm.sql has already been run by installer so second script may fail with such warning.

You then need to run the following grant statements:

grant select on pending_trans$ to public;
grant select on dba_2pc_pending to public;
grant select on dba_pending_transactions to public;

Then execute the following grant statement once for each oracle user you want to participate in XA transaction

grant execute on dbms_system to ;

where is your username (don't include the angle brackets)

Configuring autostart of Oracle10g on Linux

Change /etc/oratab so each database has Y for autostart
ORCL10:/opt/oracle/10.2.0:Y

Create the following script as /etc/init.d/oracle
The script starts listener, database and enterprise manager.
dbstart is also able to start listener automatically in Oracle10g if ORACLE_HOME_LISTNER env. variable is set

---cut here---
#!/bin/bash
#
# chkconfig: 345 79 79
# description: Starts oracle listener and database

ORA_HOME=/opt/oracle/10.2.0/
ORA_OWNER=oracle

case "$1" in
start) echo "Starting Oracle Database(s) "
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start; $ORA_HOME/bin/dbstart; $ORA_HOME/bin/emctl start dbconsole"
# su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start; $ORA_HOME/bin/dbstart"
touch /var/lock/subsys/oracle
;;
stop) echo "Shutting down Oracle Database(s) "
rm -f /var/lock/subsys/oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut; $ORA_HOME/bin/lsnrctl stop; $ORA_HOME/bin/emctl stop dbconsole"
# su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut; $ORA_HOME/bin/lsnrctl stop"
;;
*)
echo "usage: $0 {start|stop}"
exit
;;

esac
---cut here---

Change permissions:
chmod 750 /etc/init.d/oracle

Add the script to autostart:
chkconfig --add oracle

Instalation of Oracle10g 64bit on CentOS5 64bit

I used official Oracle docs as well as the following guide

http://www.dizwell.com/prod/node/681?page=0%2C3

Installed all packages recommended. Configured all users, env variables etc.
However, I've got several install failures (info from the install log):

Problem 1: crt1.o could not been found
Resolution: install glibc-devel 32bit package and add /usr/lib64 to oracle user PATH

Problem 2: libstdc++.so.5 could not been found
Resolution: install compat-libstdc++-33-3.2.3-61 rpm

That's it

Thursday, November 15, 2007

free NX port configuration

Problem: nxagent uses ports from 7000 so when second user logs in it take port 7001 which is used by WebLogic.

Resolution: By default freenx uses DISPLAY_BASE + 6000 = 7000 port.
To change this you need to modify the following parameters in /etc/nxserver/node.conf file.

#16000 base port will be used
DISPLAY_BASE=10000

Then restart nx server with:

nxserver --restart

Thursday, November 8, 2007

how to change user/schema in SQL query on MSSQL 200*

Thanks to my friend Oleksy who is the champion in googling :)

Here is how to change user/schema in SQL query on MSSQL 200*
For instance I connected with "sa" and my schema is "dbo". I want to query tables from schema "teamworks", but don't want to specify "teamworks" prefix.

SETUSER 'teamworks'

SELECT
MY_TABLE.GROUP_ID
FROM
MY_TABLE

SETUSER

Thursday, November 1, 2007

GTalk Conference Bot setup

Our project needed a project-wide chat with as minimal hassle as possible i.e. not programs to install, minimum user configuration etc.
I started to look at Jabber right away. Jabber standalone server seemed a very cool and robust solution (ejabberd, for instance, has a lot of features). However, own jabber server, in order to function properly (s2s), requires SRV DNS record and permission from our IT department to enable port forwarding for 5223 port (our server is behind firewall). So I focused on something based on google talk and found the Gtalk Conference Bot (http://coders.meta.net.nz/~perry/jabber/confbot.php) -
Small and very neat python program which uses ordinary gmail account as proxy. Each messages sent to the address gets re-sent to all users in the account contact list.
Install was very easy. Couple of notes:
  • when running ./confbot.py for the first time GTalk account should be specified without domain name, i.e. just myconference
  • confbot.ini has several parameters which are better to be changed;
    private=1 - to make the chat private so the program authors won't be bothered with my chat notification (thank you guys for the program btw);
    debug=0 - it is better to switch off debug logging to improve performance and avoid logs growing too fast
  • Useful commands
    /invite googleusername - invite a user
    /names - show registered with the chat users
    /reload - reload changes from confbot.ini
    )help - command help
  • I've added it to start automatically via rc.local. Not sure how stable it is yet, so probably I will move it under init. If it is stable then I better create a proper init.d script

Saturday, October 27, 2007

С чего начать...

Сам не знаю зачем мне этот блог. Была мысль вести здесь ежедневные заметки по работе и не только, чтобы потом можно было легко найти необходимую информацию. Посмотрим как пойдёт...