5.28.2006

default config files on HP-UX

Looking for default (factory delivered) copies of configuration files in HPUX:

/usr/newconfig .... subdirs underneath


kerberos integration with Active Directory(2000) on HP-UX

This is what I did to setup our HP UX11i box with Kerberos integration with AD


  1. create a service type user account in AD. In the case below the username is: kermit

  2. Run the ktpass command on a domain controller using the syntax below.

  3. Copy the krb5.keytab file to the HPUX box under /etc/krb5.keytab

  4. Edit the /etc/krb5.conf file, pointing to the correct domain and domain controller.



ktpass utility is included in the Windows 2000 support tools.


On domain controller:

E:\>ktpass -princ host/amisys@MYDOMAIN.COM -mapuser kermit -pass ***** -out krb5.keytab

Successfully mapped host/mybox to kermit.

Key created.

Output keytab to krb5.keytab:


Keytab version: 0x502

keysize 49 host/mybox@MYDOMAIN.COM ptype 1 (KRB5_NT_PRINCIPAL) vno 1 etype 0x1 (D

ES-CBC-CRC) keylength 8 (0x10ade54f832551ba)

Account has been set for DES-only encryption.


copied krb5.keytab to /etc/krb5.keytab and set owner: root:sys and permissions: 600


copied pam.krb5 to /etc/pam.conf


Setup Kerberos config file:

[libdefaults]

default_realm = MYDOMAIN.COM

default_tgs_enctypes = DES-CBC-CRC

default_tkt_enctypes = DES-CBC-CRC

ccache_type = 2


[realms]

MYDOMAIN.COM = {

kdc = camelot.MYDOMAIN.COM:88

kpasswd_server = camelot.MYDOMAIN.COM:464

}


[domain_realm]

.mydomain.com = MYDOMAIN.COM


[logging]

kdc = FILE:/var/log/krb5kdc.log

admin_server = FILE:/var/log/kadmin.log

default = FILE:/var/log/krb5lib.log


chmod 644 /etc/krb5.conf

Virtual Array 7100 / 7400 command view stuff

Managing SAN disk array subsystem:


NOTE: must run the following variable set in your telnet session in order to display X apps on your PC: export DISPLAY=myhostname:0 where 'myhostname' is your PC's name. You also must have the X client manager running on your PC.

Command View SDM (Storage Device Management) – software used to manage the array


VAnum1 – the 'alias' name of the Virtual Array disk system


directory of binaries: /opt/sanmgr/commandview/client/sbin


launcher – X client for managing the disk and creating LUNs. On LUN Management tab, Logical LUNs, you can create LUNs.

define LUN: This term is an acronym for Logical Unit. It is used as the primary means for dividing the entire capacity of the array into smaller, individually addressable, units. When created, contains no data. Read operations directed to this logical drive will return the format pattern until writes have been performed on the same locations.


cvui – command line menu based interface for managing the array. It's nice in the fact that it displays the command being run when you select a menu item. You can also log the commands and their results to a file if you wish.


cmdviewVA VAnum1 – Same as launcher, but skips first dialog listing the VA selection screen.


Then run sam, go under "Disks and File Systems/Disk Devices" to configure the volume group, logical volume(s), file system, etc.



listing free and used space on disks:

list kbytes of disk usage; use without 's' option to display all the files

du -sk /directory/path


pretty listing of total space allocated, used and free.

df -k /filesystem_mount

df -k /u* -- shows all /u00-u12 files system stats

oracle tips

Startup scripts:

/sbin/init.d/oracle

/sbin/init.d/sqlnet

/sbin/init.d/agentctl*

/sbin/init.d/oemctl*

(other similiary named files are in: /etc/rc.config.d)


Connecting to database with sysdba privledges from sqlplus command:

sqlplus "/ as sysdba"


Check if database started with a pfile or spfile:

in sqlplus:

SELECT DECODE(value, NULL, 'PFILE', 'SPFILE') "Init File Type"

FROM sys.v_$parameter WHERE name = 'spfile';


Check if database is in archive log mode:

in sqlplus do: archive log list


Converting from pfile to spfile or vice-verse:

CREATE PFILE FROM SPFILE;

CREATE SPFILE FROM PFILE;


Creating password file:

orapwd file=$ORACLE_HOME/dbs/orapw{SID} password=sys entries=1


Archive tips: http://www.cryer.co.uk/brian/oracle/SYMoixcal.htm


Archive log:

Must be in init{SID}.ora or spfile for archive log mode to be useful: LOG_ARCHIVE_START = true

alter system archive log start

alter system archive log stop

alter system switch logfile

select log_mode from v$database;

ALTER DATABASE ARCHIVELOG;

ALTER DATABASE NOARCHIVELOG;


Alert logs stored in: /u02/${ORACLE_SID{/bdump/alert_${ORACLE_SID}.log


Get some info on memory:

sqlplus> select * from V$SGASTAT;


Oracle management server startup:

NOTE: if changing username/password for the OEM database, YOU MUST edit oracle's .profile to reflect this change.


first start repository database:

export ORACLE_SID=OEMREP

sqlplus /nolog

connect / as sysdba

startup

exit


Then start the OMS server:


oemctl start oms

oemctl ping oms - shows status without having to issue username/password

oemctl stop oms sysman/{sysman's_password}


'oemctl start oms' output should be similar to:


mybox Oracle preprod1> oemctl start oms

OEMCTL for HP-UX: Version 9.2.0.1.0 Production

Copyright (c) 1998, 2002, Oracle Corporation. All rights reserved.

Starting the Oracle Management Server....


The OMS is now started and ready.




How does one start the Oracle Intelligent Agent?

One needs to start an OIA (Oracle Intelligent Agent) process on all machines that will to be managed via OEM. The agent needs to be stopped/started when a new database is created on that node. Databases that are removed will have to be deleted manually from the OEM console.

For OEM 9i and above:


agentctl start agent

agentctl stop agent

agentctl restart -- This doesn't seem to work.....


$ agentctl


Usage:

agentctl start|stop|status|restart [agent]

agentctl start|stop|status blackout [<target>]

[-d/uration <timefmt>] [-s/ubsystem <subsystems>]


The following are valid options for blackouts

<target> name of the target. Defaults to node target.

<timefmt> is specified as [days] hh:mm

<subsystem> is specified as [jobs events collections]

defaults to all subsystems



Creating a database

dbca - database configuration assistant X-gui app.

or

  1. Create an init file and proper directory structures for values in init file. Make sure remote_login_password=NONE

  2. Change /etc/tnsnames.ora and /etc/listener.ora to contain new database values. Reload the listener: lsnrctl, the reload.

  3. set ORACLE_HOME and ORACLE_SID to proper values for new database.

  4. run sqlplus and the following (/home/oracle/createdb.sql:

    • create database soup

    • logfile group 1 ('/ora/soup/redo01.log') SIZE 100M,

    • group 2 ('/ora/soup/redo02.log') SIZE 100M,

    • group 3 ('/ora/soup/redo03.log') size 100M

    • datafile '/ora/soup/system.dbf' SIZE 575M

    • character set WE8ISO8859P1

    • national character set utf8

    • extent management local

    • undo tablespace UNDOTBS1

    • datafile '/ora/soup/undotbs01.dbf'

    • SIZE 2000M

    • default temporary tablespace temp

    • tempfile '/ora/soup/temp01.dbf'

    • size 4000M autoextend on next 50M maxsize 7000M;


Starting EM (enterprise manager) from unix (x-gui):

oemapp console


OMS navigator needs to have databases deleted from it when the database is phyisically deleted. Refreshing the node won't remove the database from the navigator. In fact, it's best to delete the node from the navigator and re-add it again.


Stop Apache web server:

$ORACLE_HOME/Apache/Apache/bin/apachectl stop



What oracle version am I running?:

SQL> select * from v$version;


BANNER

----------------------------------------------------------------

Oracle9i Enterprise Edition Release 9.2.0.1.0 - 64bit Production

PL/SQL Release 9.2.0.1.0 - Production

CORE 9.2.0.1.0 Production

TNS for HPUX: Version 9.2.0.1.0 - Production

NLSRTL Version 9.2.0.1.0 - Production



Removing Oracle from a test server (sun box):

rm -r $ORACLE_HOME

rm -r /var/opt/oracle


Dropping a tempfile.

> sqlplus /nolog

sql> connect as sysdba


sql> alter database tempfile '/u08/mydb1/tempdave.dbf' drop;

-database altered


exit


drop tablespace logmnrts including contents;



CREATE

TEMPORARY TABLESPACE "TEMPNEW" TEMPFILE '/u09/mydb1/

TEMPNEW1.dbf' SIZE 5000M AUTOEXTEND

ON NEXT 640K MAXSIZE 7600M EXTENT MANAGEMENT LOCAL UNIFORM

SIZE 1024K;

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE "TEMPNEW"


THEN


CREATE

TEMPORARY TABLESPACE "TEMP" TEMPFILE '/u07/mydb1/

TEMP01.dbf' SIZE 2500M REUSE AUTOEXTEND

ON NEXT 640K MAXSIZE 7600M EXTENT MANAGEMENT LOCAL UNIFORM

SIZE 1024K;

ALTER DATABASE DEFAULT TEMPORARY TABLESPACE "TEMP"


RMAN topics:

Recovery Manager User's Guide = a96566.pdf

Quick Start to Recovery Manager: page 75

Duplicating a Database with Recovery Manager: page 365

Recovery Manager Quick Reference = A96564.pdf

Recovery Manager Reference = A96565.pdf


Duplicating DB / random RMAN thoughts:

get a good RMAN backup of Production (takes about 10 MINUTES):

. rman target /

r shutdown immediate;

r startup mount;

r backup database;

r alter database open;

r quit



Then duplicate this backup to the auxiliary instance:

Target database must be open; auxiliary database must be started, in nomount mode.

When RMAN duplicate is finished the auxiliary database is opened.

Duplicate takes about 15 minutes.


Before running duplicate command, get the tempdata file name:

$ find /u??/mydb1/ -name "temp*"


. sqlplus "sys/null@mydb1 as sysdba"

s shutdown normal;

s startup nomount;

s quit

. rman target / auxiliary sys/null@mydb1

r duplicate target database to mydb1;

r quit


Re-add any datafiles that belong to the temp tablespace, and finish up other tasks:

. sqlplus "sys/null@mydb1 as sysdba"

s ALTER TABLESPACE TEMP

s ADD TEMPFILE '/ora/soup/temp01.dbf' SIZE 4000M REUSE;



in the auxilary init{sid}.ora and it's spfile:

DB_FILE_NAME_CONVERT=('/u00/proddb1/','/u00/mydb1/',

'/u01/proddb1/','/u01/mydb1/',

'/u03/proddb1/system01.dbf','/u05/mydb1/system01.dbf',

'/u09/proddb1/undotbs01.dbf','/u07/mydb1/undotbs01.dbf',

'/u07/proddb1/myapp_data01.dbf','/u05/mydb1/myapp_data01.dbf',

'/u08/proddb1/indx01.dbf','/u06/mydb1/indx01.dbf',

'/u03/proddb1/myapp_data02.dbf','/u02/mydb1/myapp_data02.dbf',

'/u09/proddb1/indx02.dbf','/u10/mydb1/indx02.dbf',

'/u12/proddb1/core_repository.dbf','/u12/mydb1/core_repository.dbf',

'/u06/proddb1/myapp_data02.dbf','/u05/mydb1/myapp_data02.dbf',

'/u12/proddb1/myapp_data02.dbf','/u11/mydb1/myapp_data02.dbf')

LOG_FILE_NAME_CONVERT=('/u00/proddb1/','/u00/mydb1/',

'/u01/proddb1/','/u01/mydb1/',

'/u02/proddb1/','/u02/mydb1/',

'/u03/proddb1/','/u03/mydb1/',

'/u04/proddb1/','/u04/mydb1/',

'/u05/proddb1/','/u05/mydb1/',

'/u06/proddb1/','/u06/mydb1/',

'/u07/proddb1/','/u07/mydb1/',

'/u08/proddb1/','/u08/mydb1/',

'/u09/proddb1/','/u09/mydb1/',

'/u10/proddb1/','/u10/mydb1/',

'/u11/proddb1/','/u11/mydb1/',

'/u12/proddb1/','/u12/mydb1/')



CREATE SPFILE FROM PFILE='/u01/app/oracle/admin/DUP/pfile/init.ora';


recreate tempfile in temp tablespace.

delete tempfile in OS first.


/u02/mydb1/temp01.dbf


ALTER TABLESPACE "TEMP"

ADD TEMPFILE '/u02/mydb1/temp01.dbf' SIZE 4000M REUSE;


HP-UX performance utils

MeasureWare (aka HP OpenView Performance Agent (OVPA)) – MWA (agent)

(NOTE The name MeasureWare Agent (MWA) has been replaced with HP

OpenView Performance Agent (OV Performance Agent or OVPA) for

UNIX and the name PerfView for UNIX has been replaced with OV

Performance Manager for UNIX throughout this documentation.

However, the process names and software components operationally

remain MeasureWare Agent (MWA) and PerfView.)


/opt/perf/examples/ - example config files

/opt/perf/bin/perfstat – checks status of agent processes

/var/opt/perf/datafiles – raw binary data files kept here

/var/opt/perf - config files kept here

alarmdef – alarm definition config file

parm - overall parameters config file


/opt/perf/bin/utility – outputs data from logfiles to stdout or files

/opt/perf/bin/extract – makes copies of raw binary data files for archival purposes or exports data from log files to standard format (csv, etc.)


mwa stop servers - stop mwa servers: alarm server, scopeux, etc. -- needed if you see a defunct process continually coming up: possible alarmdef file setting screwed up or corrupt.


Usage = mwa <action> <subsys> <parms>

<action> = status, start, stop, restart, demo, version

<subsys> = scope, server, alarm, db, desktop, all

<parms> = -midaemon <miparms>

See man midaemon for <miparms>

<action> and <subsys> may be entered in any order,

but if <parms> is supplied, then it must be entered last

Defaults: <action>=start, <subsys>=all, <parms>=""

note: mwa stop alarm is not valid.

mwa stop server will stop alarms and servers.



ARM (Applicaton Response Measurement): tracking application response as a whole as apposed to opposed to monitoring individual process.

GlancePlus – glance or (x) gpm

top – display top processes

uptime - system load, users and time since last boot

PRM – Process Resource Management: assigns levels of CPU/MEM/DISK/Application resources to particular users or processes. Sounds kind-of cool

printing tips for HP-UX

Add/remove printers by using SAM.

Optionally you may add jetdirect connected printers via: /opt/hpnpl/admin/hppi


Directories:

/var/spool/lp/request/{printername} = spool area for print jobs


disable printername = disable lp subsystem from sending data to the printer

enable printername = enable lp subsystem to send data to the printer

(the above commands are like using the "pause printing" function in windows)


Start/stop users from sending print jobs to the queue.

accept printername = allow the lp spooler to accept requests for the printer

reject printername = do NOT allow the lp spooler to accept requests for the printer

(the above commands are similar to turning on/off sharing on a printer in windows)


lpstat –t = display all printers status and output jobs (full report)

lpstat -pprintername = displays the specified printer's status

lpstat -s = print summary status for all printers

lpstat -o = list all output jobs on all printers

lpstat -oprintername = list all output jobs on the specified printers

lpstat -d Lists the system default printer

lpstat (no options) Lists the user's outstanding printer requests


man net_ljx000 = displays man page for net_ljx000 model script which display options the printer can accept.


lp –d printername filename = prints filename to the printer named: printername


lp –d printername –o options filename = prints filename to the printer named: printername using the printer specific options (such as landscape, nb, etc.)


list of common –o options:

c = compressed text

letter = 8.5 X 11

legal = 8.5 X 14

fp# = font pitch; Set the font pitch to <#> characters per inch.

lpi<#> = Print specified lines per inch, where <#> is 1, 2, 3, 4, 5, 6, 12, 16, 24, or 48.

duplex = prints on both sides of page

landscape = landscape orientation

portrait = portrait orientation (standard, default)


To cancel jobs

Either hit the cancel button on the laserjet or use the cancel command:

commonly used:

cancel printer12-123 - Cancels the printer12-123 job request

cancel printer12 - Cancels the currently serviced job on printer: printer12

cancel -e printer12 - Cancels all jobs (all users) on printer: printer12

cancel -udavid printer12 -Cancels all jobs submitted by user: david on printer: printer12



cancel Man page:

cancel Command

The cancel command cancels requests that were made with the lp

command, even if they are currently printing. At least one id or

printer must be specified.

The cancellation of a request that is currently printing frees the

printer to print its next available request.

id ... Specifies one or more requests. id is a request ID

returned by lp or lpalt.


printer ... Specifies one or more printers. printer is the name of

a printer, not a class. Either cancel the request that

is currently printing on each printer, or, if an -a, -

e, or -u option is specified, specify the printer on

which to perform the corresponding operation.


-a Remove all requests the user owns on each printer. The

owner is determined by the user's login name and the

host name of the machine where the lp command was

invoked.


-e Empty the spool queue of all requests for each printer.

Only users with appropriate privileges can use this

option.


-i Cancel only local requests.


-uuser Remove any requests belonging to user. You can repeat

the -u option to specify more users. Only users with

appropriate privileges can use this option.



Sometimes users will receive the following:

From: lp@mybox.mydomain.com

To: david@mybox.mydomain.com


error code 2 in request printer12-555 on printer printer12



They receive the message because of either hitting cancel on the printer's control panel (most likely), or there's a problem with the Jetdirect timing.




reset or query the GSP on HP systems

Reset the GSP - basically reboots the GSP, it DOES NOT reboot the server itself.  Use this when you receive the message:  "Request for console write access failed":

stty +resetGSP < /dev/GSPdiag1

See if the GSP is functional:
stty +queryGSP < /dev/GSPdiag1

resources:
http://docs.hp.com/en/B3920-90091/ch03s07.html

vim tips - folding / mutiple windows (viewports)

multiple windows / "viewports" - http://www.linux.com/article.pl?sid=06/05/04/1544258
folding (collapsing) lines/sections - http://www.linux.com/article.pl?sid=06/05/18/1915233

5.27.2006

netsh error - winsock corrupt

If you get this error when opening netsh:
Initialization Function InitHelperDll in IPMONTR.DLL failed to start with error code 11003

and it pauses for a long time before bringing up the netsh> prompt, then most likely the Winsock2 is corrupt, to recover delete the Winsock and Winsock2 subtrees from CurrentControlSet\Services and reboot, then reinstall TCPIP:  http://support.microsoft.com/kb/811259

5.23.2006

sum / total column adding in HPUX yields floating point notation

awk on HP-UX seems to use exponent notation instead of floating point notation like I'm used to in Tru64.  For example adding up (summing) a column in HPUX with large numbers yields an exponent number, not very useful to me.  To fix this behavior, use the OMFT variable in awk.  See the man page for awk for more info.

example:
ll /tmp| awk -v OFMT="%.f" 'sum += $5 {print sum}'

5.22.2006

convert LF to CRLF

Use the following to convert Unix to dos text files in cygwin on windows:
awk '{ print $0 "\r"}' unix.txt > dos.txt

source: http://www.datasavantconsulting.com/roland/tr.html

\r - carriage return
\n - line feed

5.18.2006

passwd prompts for old password

HP-UX:  Created account with UID 0, tried to change password using passwd.  Passwd prompted for the "old password" even though I was logged in as root.  The man page for passwd explains why:
Superusers are not prompted for old passwords unless they are attempting to change the superuser's password in a trusted system.


5.17.2006

UNIX Rosetta Stone

http://bhami.com/rosetta.html compare various Unix commands. If you don't know what Rosetta Stone means, look it up: http://www.answers.com/rosetta+stone&r=67


tags: unix comparision guide *nix tru64 aix hp-ux solaris irix linux freebsd openbsd netbsd sco differences matrix

5.16.2006

job name not known error

In HP-UX when trying to suspend (CTRL-Z) a process/job or when running a job in the background i.e: sleep 30 &   then running the jobs command, if you get message: <job name not known> then you'll need to defined the HISTFILE and HISTSIZE variables to fix the issue.

$ sleep 30 &
[1]     19870

$ jobs
[1] +  Running                    <job name not known>

or suspending the running command with CTRL-Z

$ sleep 20
[1] + Stopped                     <job name not known>

fixed by setting HISTFILE and HISTSIZE:
http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=200334 (ITRC login required)

export HISTFILE=$HOME/.history
export HISTSIZE=2000

$ sleep 20
[1] + Stopped                     sleep 20

5.15.2006

tail the mail log in HP-UX

mtail - tails the mail.log file (/var/adm/syslog/mail.log) on HP-UX systems.  It may be found on other *nix systems...

5.02.2006

Extra line breaks problem - Outlook 2003

How to stop Outlook from removing and screwing up the format. query: extra line breaks message removed outlook 2003

Two ways: Put two space at the beginning of each line: Article that describes the problem

Or turn off the option in Outlook 2003: Tools, Options, E-mail Options, uncheck: remove extra line breaks in plain text messages. Found this from the Jan 11, 2006 response to the article from "David".

learn HP-UX

One way to learn HP-UX commands is to use the key shell (keysh).  If you have a terminal that supports function keys, such as Reflection for HP, key shell will turn those function keys into prompts for different commands.  Once a command is finished, you'll see the exact command that is submitted to the shell, which makes learning the options easy.

Another good way to get familiar with HP systems is to use the HP-UX Software Recovery Handbook.  You can find individual PDF chapters for the handbook on HP's ITRC (I.T. Resource Center):  http://itrc.hp.com  (login required).  Look under the "knowledge trees" for "HP-UX Software Recovery Handbook"

Disable USB mass storage in Windows

Article discusses data security issues with USB mass storage devices and links to a MS article showing how to disable the drivers:
TechRepublic Blog: How secure is your data?

HOWTO: Use Group Policy to disable USB, CD-ROM, Floppy Disk and LS-120 drivers

4.29.2006

windows 2003 sp1 bug in file sharing

I guess by default in Windows 2003 SP1, you must use the actual server name when connecting to it via SMB.  In other words, you can't use a dns CNAME record to connect to that box's shares unless you do the following registry change:

http://www.intelliadmin.com/blog/2006/01/cname-sharing-disabled-in-windows-2003.html

4.27.2006

Explorer Destroyer - Switch to Firefox, Make money from Adsense Referral

Very interesting... Get paid by Google to help switch people to Firefox. Google is doing this because the Firefox that's downloaded is bundled with the Google Toolbar. It requires a Google Adsense account: www.google.com/adsense

Explorer Destroyer - Switch to Firefox, Make money from Adsense Referral