Wednesday, March 17, 2010

How to relink Oracle when "relink all" fails.

Are you trying to relink oracle and getting
"make: *** No rule to make target `install'. Stop."

or something similar?

The problem is due to "relink all" trying relink all the products in the Oracle Home without checking whether they are actually installed or not.

This does not always work as some makefiles take different arguments, and some Oracle Home installations do not have the components installed for which there are makefiles.

This relinking problem has been addressed in 11.2 with the 11.2 installer getting a -relink option.

Assuming you are not using 11.2, then what to do? Well...

I offer this only as what I currently do. I haven't seen this problem properly discussed anwhere, so this is a 'works for me'.

Each Oracle Home has a file:
 $ORACLE_HOME/inventory/make/makeorder.xml

This file lists the correct order to run the make files, and the targets to use. From this we can build up a list of makefile commands that should be run.

Alternatively you can run the relink command with all the other valid parameters - some will fail if the component is not installed, but theoretically this should compile everything.

At the moment though I am not 100% confidant this is the case, and so for a bit of paranoid DBA practice I also run the make files as listed in makeorder.xml

IMPORTANT NOTE: After relinking, login as root (or use sudo if configured) to execute the $ORACLE_HOME/root.sh script to reset the appropriate file permissions/flags.

By way of example from my last relink - after upgrading from OEL5 U2 to OEL5 U4:

Note that relinking is done as the oracle home owner, not root.

Step 0: Before doing anything check umask is 022. If not:
$ umask 022

Relink database home works (mostly) but fails on relinking ODBC at the end.


The error that initiated this post: Tried a relink all on an ASM home.
Resulted in
 make: *** No rule to make target `install'. Stop."

when trying to link the ODBC driver.

Solution: Well see below, for what I did in teh ASM case, however if you want to relink ODBC this is what I found in a Metalink note:
cd $ORACLE_HOME/odbc/lib
cp $ORACLE_HOME/lib/sqoci.a .
cp $ORACLE_HOME/lib/sqora.a .
cp $ORACLE_HOME/lib/utility.a .
make -f ins_odbc.mk isqora
cp libsqora.so* $ORACLE_HOME/lib

Relink ASM home


. oraenv [+ASM]
cdo
# Note: cdo is a shell alias defined as: alias cdo='cd $ORACLE_HOME'

relink oracle
relink client_sharedlib
relink client
relink utilities
relink ldap
#relink oemagent - no target
relink network
relink ctx
relink interMedia

DBA Paranoia: To be doubly sure, run make files as listed in $ORACLE_HOME/inventory/make/makeorder.xml
make -f rdbms/lib/ins_rdbms.mk ioracle
make -f rdbms/lib/ins_rdbms.mk client_sharedlib
make -f sqlplus/lib/ins_sqlplus.mk install
make -f network/lib/ins_net_client.mk preinstall
make -f network/lib/ins_net_client.mk itnsping
make -f rdbms/lib/ins_rdbms.mk "irman"
make -f plsql/lib/ins_plsql.mk "install"
make -f network/lib/ins_net_client.mk "nnfgt.o"
make -f network/lib/ins_net_client.mk "mkldflags"
make -f rdbms/lib/ins_rdbms.mk "utilities"
make -f ldap/lib/ins_ldap.mk "clientonlyinstall"
make -f network/lib/ins_net_client.mk "ntcontab.o"
make -f network/lib/ins_net_client.mk  "nnfgt.o"
make -f network/lib/ins_net_client.mk  "install"  
make -f network/lib/ins_nau.mk "ioklist"
make -f network/lib/ins_nau.mk  "iokinit"
make -f network/lib/ins_nau.mk "iokdstry"
make -f sysman/lib/ins_emagent.mk "agent"
make -f sysman/lib/ins_emagent.mk "nmb"
make -f sysman/lib/ins_emagent.mk  "nmo"
make -f sysman/lib/ins_emagent.mk "nmhs"
make -f sysman/lib/ins_emagent.mk "tclexec"
make -f rdbms/lib/ins_rdbms.mk "all_no_orcl"
make -f srvm/lib/ins_srvm.mk "install"
make -f racg/lib/ins_has.mk  "racg_install"
make -f network/lib/ins_net_server.mk "install"
make -f rdbms/lib/ins_rdbms.mk "ctx_on"
make -f ctx/lib/ins_ctx.mk "install"
make -f rdbms/lib/ins_rdbms.mk  "ipc_g"
make -f sysman/lib/ins_emagent.mk "emsubagent"
make -f network/lib/ins_net_client.mk "mkldflags"
make -f rdbms/lib/ins_rdbms.mk "idg4odbc"
make -f precomp/lib/ins_precomp.mk "links"
make -f precomp/lib/ins_precomp.mk "relink"
make -f precomp/lib/ins_precomp.mk  "gen_pcscfg"
make -f rdbms/lib/ins_rdbms.mk "svr_tool"
make -f rdbms/lib/ins_rdbms.mk "patchset_opt"

Execute the $ORACLE_HOME/root.sh script to reset the appropriate file permissions/flags:
sudo $ORACLE_HOME/root.sh

Startup Oracle listener
Start up ASM instance

Relink agent home


# agentenv is a custom script that sets Oracle environment variables appropriately 
# for the agent home - all homes are using the one OS user - 'oracle'.
# Normally I recommend one OS user per home.

. agentenv
relink client
relink oemagent

DBA Paranoia: To be doubly sure, run make files as listed in $ORACLE_HOME/inventory/make/makeorder.xml
cdo
make -f network/lib/ins_net_client.mk itnsping
make -f network/lib/ins_net_client.mk nnfgt.o
make -f network/lib/ins_net_client.mk mkldflags
make -f network/lib/ins_net_client.mk client_sharedlib
make -f sysman/lib/ins_emagent.mk agent
make -f sysman/lib/ins_emagent.mk nmb
make -f sysman/lib/ins_emagent.mk nmo
make -f sysman/lib/ins_emagent.mk nmhs
make -f sysman/lib/ins_emagent.mk emsubagent

Execute the $ORACLE_HOME/root.sh script to reset the appropriate file permissions/flags:
sudo $ORACLE_HOME/root.sh

Relink OMS HOme


Note omsenv is a custom script setting shell vriables for the OEM/OMS home.
. omsenv
cdo

relink client
relink network
relink client_sharedlib
relink oemagent
relink utilities

DBA Paranoia: To be doubly sure, run make files as listed in $ORACLE_HOME/inventory/make/makeorder.xml
make -f network/lib/ins_net_client.mk "nnfgt.o"
make -f network/lib/ins_net_client.mk "mkldflags"
make -f network/lib/ins_net_client.mk "client_sharedlib"
make -f sysman/lib/ins_sysman.mk agent
make -f sysman/lib/ins_sysman.mk nmo
make -f sysman/lib/ins_sysman.mk nmb
make -f sqlplus/lib/ins_sqlplus.mk install
make -f network/lib/ins_net_client.mk install
make -f network/lib/network/lib/ins_nau.mk ioklist
make -f network/lib/network/lib/ins_nau.mk iokinit
make -f network/lib/network/lib/ins_nau.mk iokdstry
make -f webcache/lib/ins_calypso.mk install

Execute the $ORACLE_HOME/root.sh script to reset the appropriate file permissions/flags:
sudo $ORACLE_HOME/root.sh

References


Howto Relink an Agent ? [ID 805495.1]

Oracle 11gR2 Relink New Feature [ID 883299.1]

Thursday, March 4, 2010

Fun query cancelling using TCP out-of-band signalling

How to CANCEL a query running in another session using an interesting  dodgy method.

How to CANCEL a query running in another session? - Tanel Poder's blog

See also

Sending and Receiving Out-of-band Data
Chapter 3 Advanced Topics for Stream Sockets
HP 9000 Networking: BSD Sockets Interface Programmer's Guide
http://docs.hp.com/en/B2355-90136/ch03s07.html

Killing Database Sessions - tips from Tanel on killing at the OS level & using oradebug

Tanel Poder in one of his blog entries detailed his preferred approach for killing database sessions - in particular the annoying ones that wont die.

In short:
1) Verify whether you’re killing the right session first (Naturally)

2) ALTER SYSTEM KILL SESSION

3) If that doesn’t work immediately then check whether the target session has acknowledged the kill and is rolling back its (large) transaction.

4) If there’s no rollback happening and session just seems to be stuck, then its time to kill that session’s process from OS level.

5) If couple of minutes after killing the process from OS level that sessions and its locks & resources are still not released then attach to your own process with oradebug and run “ORADEBUG WAKEUP 2″ a couple of times (and checking if the session has gone + waiting few seconds between each invocation).

See Tanel's post for full details.

Alter system kill session and ORA-00031: session marked for kill