Tuesday, April 21, 2009

Start screen after sudo su to another user

Sudo'ing to a user then running screen doesn't work out of the box.  Typically you get the following error:

Cannot open your terminal '/dev/pts/1' - please check.

From the blog, here's the procedure
sudo su - someuser
script /dev/null

Should work now.  

Wednesday, April 15, 2009

You never know how well your shoes fit...

... until you try someone elses out.

At some point I'll make a tabular layout of the most common unix commands and their windows counterparts... but for now lets just put a recent lil tool:

ps -ef | grep "something"


tasklist | findstr "something"

Good stuff!

I hear that taskkill is the kill -9 equivilent, but I need to test that to confirm it...

Monday, March 2, 2009

HangRMAN D_bug

Resolved an issue this afternoon, and in the process learned some things about debugging rman.

Issue description:  RMAN would hang on exit.  It was really slow on this server, but it would seem to hang on exit.  I say seem to, because I did leave one exit hanging while I went to lunch.  An hour or two after I got back from lunch, I noticed that the exit completed successfully.

Interesting, no?

Here's what things looked like:

$ rman target /

Recovery Manager: Release - Production on Mon Mar 2 18:35:32 2009

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

connected to target database: X (DBID=1)

RMAN> exit

Recovery Manager complete.
At that point RMAN would hang for 3 hours.  My initial thought and troubleshooting involved truss and lsof and whatnot, attempting to pin the problem on our avamar backup system -- nope.

Using the most excellent DocID: 412950.1 titled "How to determine if an RMAN failure or hang lies in the Media Manager Layer or not"

I found the following very easy way to trace runs of RMAN:

rman target / trace tracefilename.trc debug

You can also use catalog= in the example.  Anyhow, at the end of this trace file I found the following query which appeared to hang:

select round(sum(MBYTES_PROCESSED)) ,round(sum(INPUT_BYTES)) ,round(sum(OUTPUT_BYTES))  from V$RMAN_STATUS  start with (RECID=:b1 and STAMP=:b1)  connect by prior RECID=parent_recid

The trace was nice enough to also provide the bind vars.  Now the fun part, figuring out what to do.

Luckily, it was all spelled out in DocID 375386.1  "Rman Backup is Very Slow selecting from V$RMAN_STATUS".

The issue was resolved by refreshing fixed object stats.  Huzzah.    

One more thing, section 22 of 11g Database Backup and Recovery User's Guide titled "Troubleshooting RMAN Operations" was valuable as well.  

SSH Encrypted TOAD

Thanks to a post over at OraFAQ, I was able to encrypt a TOAD connection using SecureCRT.

Lest I forget:

Options >> Session Options

Port Forwarding >> Add

Name: something
Port: 1521
Port: 1521

Open up toad.  Use localhost for hostname.   

Monday, February 16, 2009

Goodbye vncserver, hello xming

For the last 8 or so years, the my team has been using a combination of vncserver on a utility box and vncclient on our desktops to draw xwindow objects from various hosts.

Typically you would see this while using the Oracle Universal Installer.

The following steps describe how to use Xming, a far simpler (and some would argue safer) method to perform the same function as vncserver:

1)  Download Xming:

2)  Install Xming, no special installation instructions.  (Screenshots of Xming are available:

3)  Make sure Xming is running (You should see a swirly X in the system tray)

4)  Enable SecureCRT X11 Forwarding
    - Connect a session
    - Options -> Session Options
    - Select Remote/X11
    - Put a checkmark in "Forward X11 Packets"
    - OK
    - Logout and log back in for that session

5)  Try "xclock" from the command line, if it doesn't work...
    - Check DISPLAY environment variable.  It should be set to something like localhost:10.0
    - Is the X in the system tray?
    - Did you setup X11 forwarding?  Did you logout and log back in?

Cool stuff.  The three tier process (server -> utility host -> desktop) was difficult to explain much less troubleshoot.  

Tuesday, January 27, 2009

Fun with clntsh

Installing iAS onto an Oracle oms grid control box.

Got the following error during linking, looks to be a Solaris 10 + 10R2 issue.

ld: fatal: file /u01/app/oracle/product/oms10g//lib32// unknown file type
ld: fatal: File processing errors. No output written to webcached
*** Error code 1
make: Fatal error: Command failed for target `webcached'

Here's the fix:

Edit $ORACLE_HOME/genclntsh
Change LD="ld -m -i -G -z text -L${ORACLE_HOME}/${LIB}"
to LD="ld -m -i -G -z text -L${ORACLE_HOME}/${LIB} -Bsymbolic"

Then run $ORACLE_HOME/bin/genclntsh

Then retry the linking phase.

Tuesday, January 20, 2009

Sometimes it's just a login issue.

Trying to install iAS on a server, I got the following error, among others, while updating OC4J:

ERROR: Caught exception while undeploying 'portletapp' from 'home':
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at Source)
at Source)
at Source)
at Source)
Caused by: com.evermind.client.orion.AdminCommandException: Could not connect to the remote server. Please check if the server is down or the client is using invalid host, ORMI port or password to connect: Connection refused
at com.evermind.client.orion.Oc4jAdminConsole.executeCommand(
Also got an error with wsrp-samples.

After spending quite a bit of time looking at log files, and finding nothing interesting, I realized it was a password issue.

Earlier in the day I had followed an oracle doc to reset ias_admin's password from emctl prior to installing the update.

Here's the thing -- to _really_ set the password, you have to login to iasconsole and change it there. Apparently that changes the passwords in more places than emctl does.

Problem solved.

Wednesday, January 7, 2009

Selecting on dates using the interval clause.

When I've wanted to select all records in the last day or the last couple hours I've done a query like the following:

-- select records from the last day
select count(*) from table where some_date > sysdate - 1;

-- Select records from the last 3 hours
select count(*) from table where some_date > sysdate - 3/24;

Starting in 9i there's another way to do this.

-- select records from the last day
select count(*) from table where some_date > sysdate - interval '1' day;

-- Select records from the last 3 hours
select count(*) from table where some_date > sysdate - interval '3' hour;