BSM (OMi) 9.2x Linux Tips and Tricks Siggi Gladitsch EMEA BSM(OMi) Backline Team (last update : 12/06/2013) © 2008 Hewlett-Packard Development Company, L.P. The information contained herein.

Download Report

Transcript BSM (OMi) 9.2x Linux Tips and Tricks Siggi Gladitsch EMEA BSM(OMi) Backline Team (last update : 12/06/2013) © 2008 Hewlett-Packard Development Company, L.P. The information contained herein.

BSM (OMi) 9.2x
Linux
Tips and Tricks
Siggi Gladitsch
EMEA BSM(OMi) Backline Team
(last update : 12/06/2013)
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Agenda
•
Overview
•
Installing BSM on Linux
•
Installing a BSM patch on Linux
•
Managing BSM when it runs on Linux
•
Linux Tips and Tricks
•
Installing Oracle on Linux
•
Setting up BSM with an Oracle Database
•
Accessing an Oracle database
•
Useful Oracle / SQL commands
Overview
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Overview
• this
is NOT an indepth Linux class
• this
is NOT an indepth Oracle class
• no
fancy slides with animations
• the
purpose is to help users usually working on Windows platforms to
install BSM and Linux on Oracle and find their way through the system
• Linux
Gurus will get bored here
• Oracle
DBAs will get bored here as well
• Windows
• All
Gurus will scratch their head
others – stay tuned
Linux
versus
Windows
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Linux versus Windows
from the native Linux user’s point of view
Linux versus Windows
• General
Note:
In Linux there are MANY ways to get to the same result.
There are different command shells, graphical interfaces, commands,
utilities, packages, tools.
Talk to five Linux or Unix people, they know ten different ways to get
to the same result, and each way is the best one.
All here is based on RHEL 5.6 / 5.8 with using the bash shell,
VNC as X server, and VNCViewer as client or telnet to access the
system.
Linux versus Windows
• Linux
is case-sensitive!
• Linux
uses slash “/”, no backward slash “\”
(some shells can deal with both types of characters)
• And,
• the
Linux is case-sensitive!
Administrator is called root on Linux
• root
HAS ALL PERMISSIONS and can do all and everything!
(root can easily delete the complete BSM installation
while BSM is running!)
Linux versus Windows
• dir
= ls / ls –l
• cd
= cd
• mkdir
= mkdir
• taskmanager
= ps –ef
• view
a file
more / cat / tail (from the end) / page (one page at a time)
• Notepad
= vi (okay, not really), emacs
– filter output of previous command
(doesn‘t exist on Windows out of the box)
• grep
Linux versus Windows
• dots
„.“ (current directory) and „..“ (directory one level up) are very
important
the concept is available in Windows as well, but not used as intensive
as in Linux
• executing
a command as root user in the current working directory
(cwd) usually requires „./“ in front of the command name,
because the user root has no reference to the current working
directory in the path defined, which has been done for security
reasons.
Linux versus Windows
# ls *.bin
HPBsm922_9.22_setup.bin
# HPBsm922_9.22_setup.bin
-bash: HPBsm922_9.22_setup.bin: command not found
# echo $PATH
/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin
:/usr/sbin:/sbin:/usr/bin:/bin:/root/bin
# ./HPBsm922_9.22_setup.bin
Preparing to install...
Extracting the JRE from the installer archive...
Linux versus Windows
• Linux
is case-sensitive!
• It‘s
not a big deal, but can cause a big headache,
for example – is meruryas up and running?
• „ps
–e“ list all processes
then pipe the output of the ps command and grep all lines with the
string mercuryas in it („| grep mercuryas“)
# ps -e | grep mercuryas
nothing?? But BSM is up and running??
# ps -e | grep MercuryAS
25126 ?
1-17:26:00 MercuryAS
• „mercuryas“
• „grep
is actually „MercuryAS“
–i“ = ignore case
# ps -e | grep -i mercuryas
25126 ?
1-17:26:00 MercuryAS
Linux versus Windows
• Linux
• or,
is case-sensitive!
what was the EXACT logfile name again?
# cd /opt/HP/BSM/log
# tail gdegatewayclient.log
tail: cannot open 'gdegatewayclient.log' for reading: No such
file or directory
# ls –l | grep –i gde
-rw-rw-rw- 1 root root
# tail gdeGatewayClient.log
or
# tail gde*.log
0 May
2 18:20 gdeGatewayClient.log
Linux versus Windows
• How to get help on Linux
from the shell prompt
man command-name
command-name –help
info command-name
•
for example
#man uname
#uname –help
#info uname
• Google
•A
(that’s what I always use …)
Sysadmin's Unixersal Translator (ROSETTA STONE)
http://bhami.com/rosetta.html
Linux versus Windows
• Linux
server start / stop / restart
• start
switch on the box
• stop
#shutdown –h now
• restart
#reboot
• commands
need to be executed by root
Linux versus Windows
• accessing
• via
a Linux system
“command line” - use telnet / ssh / putty / …
•
# telnet vm17083.deu.hp.com
•
Trying 16.58.17.83...
•
Connected to vm17083.deu.hp.com (16.58.17.83).
•
Escape character is '^]'.
•
vm17083 (Linux release 2.6.18-274.el5 #1 SMP Fri Jul 8 17:36:59 EDT 2011) (6)
•
login: root
•
Password:
•
Last login: Fri May 10 22:20:41 from vm25177
•
Kickstart-installed RedHat 5.7Server - LinuxCOE 4.3 Thu Nov 24 12:00:44 CET 2011
•
You have new mail.
•
vm17083:/root
Linux versus Windows
• telnet
fails on your Windows 7 COE PC
•
• telnet
needs to be enabled first
Linux versus Windows
• enable
/ activate telnet
• Windows
• select
-> Control Panel -> Programs and Features
Turn Windows Features on or off
Linux versus Windows
• find
Telnet Client in the list, check the checkbox and click OK
Linux versus Windows
• now
it works
Linux versus Windows
• main
limitation of telnet (and similar) access:
no graphics, so tools like bsmbrowser or the installation wizard fail to
run:
Linux versus Windows
• use
VNCViewer to connect to the Linux system
Linux versus Windows
• root
logs in either at the login prompt
•
# telnet vm17083.deu.hp.com
•
..
•
login: root
•
Password:
Linux versus Windows
• or
using the su (switchuser) command after one is logged in already
•
[oracle@vm17016 ~]$ id
•
uid=1003(oracle) gid=1003(oracle) groups=1003(oracle)
•
[oracle@vm17016 ~]$ su -
•
Password:
•
[root@vm17016 ~]# id
•
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
•
[root@vm17016 ~]#
•
vm17083:/root
• usually
systems don’t allow root to login at the login prompt, here one
needs to login via a “more safe” user and then use the su command to
become root
Linux versus Windows
• what
Linux version is running here
•
# uname -a
•
Linux vm17083 2.6.18-274.el5 #1 SMP Fri Jul 8 17:36:59 EDT 2011 x86_64 x86_64 x86_64
GNU/Linux
•
Linux – well, it’s Linux
vm17083 – the hostname
2.6.18-274.el5 – kernel version
x86_64 x86_64 x86_64 – hardware platform
# lsb_release -a
•
LSB Version:
:core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0amd64:graphics-4.0-ia32:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0ia32:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description:
Red Hat Enterprise Linux Server release 5.9 (Tikanga)
Release:
5.9
Codename:
Tikanga
Linux versus Windows
• drives
and paths
• other
than Windows, Linux doesn’t use drives and paths
(so no C:\HPBSM) but filesystems / paths only
(like /opt/HP/BSM)
• when
adding a new drive / partition to a Linux system, it is usually
added as a new filesystem / path, for example
#df -h
Filesystem
Size
Used Avail Use% Mounted on
/dev/sda2
93G
75G
14G
/dev/sda1
251M
7.9M
230M
tmpfs
2.8G
1.8G
1.1G
34G
14G
85% /
4% /boot
61% /dev/shm
/dev/mapper/vg01-lvoradata2
50G
• drive1
– drive2
72% /oradata2
Installing BSM on
Linux
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Installing BSM on Linux
• as
of BSM 9.22, we support
RedHat Enterprise Linux 5.3 or any later 5.x version
(Intel x64 64 bit)
(BSM 9.22 can easily be installed on RHEL6, but it will simply not
work!)
• CPE
case QCIM1I86642 ER to support RHEL 6.x
• CPE
case QCIM1I86643 ER to support SUSE Linux 11
• Oracle
Enterprise Linux 5.5 (x86-64)
(never seen an installation until now)
• MS
SQL Server 2008
=> no support for Windows Authentication
Installing BSM on Linux
• Before
installing BSM on a Linux machine, make sure that SELinux
will not block it.
(SELinux = Security Enhanced Linux)
• You
can do this by either disabling SELinux,
or configuring it to enable java 32-bit to run.
• To
disable SELinux, open the /etc/selinux/config file, set the value of
SELINUX=disabled, and reboot the machine.
• To
configure SELinux to enable java 32-bit to run, execute the
command setsebool –P allow_execmod on
• You
might encounter errors like this with SELinux enabled:
Executing Script: ./product_upgrade_wizard.sh
..
Finalize action for com.hp.ov.installer.ovapp.core.ActionRunner@f6d773
Error: dl failure on line 864
Error: failed /opt/HP/BSM/JRE/lib/i386/client/libjvm.so, because
/opt/HP/BSM/JRE/lib/i386/client/libjvm.so: cannot restore segment prot
after reloc: Permission denied
Installing BSM on Linux
• You
must be a root user to install BSM on the server machine.
• BSM
must be run as a root user
• Starting
with BSM 9.23 BSM can also be run as non-root user!
Installing BSM on Linux
• BSM’s
installation path on Linux is
/opt/HP/BSM
and cannot be changed. This is because of the installation framework
(OVII) used by BSM.
• The
same is true for
HP shared content
/opt/OV
and
data directory for HP shared content
/var/opt/OV
Installing BSM on Linux
• If
another path is required, for example for disk space reasons, a
symbolic link can be created PRIOR to the installation of BSM.
• Symbolic
links are a special file type in which the link file actually
refers to a different file, by name. For most operations (opening,
reading, writing, …) that are passed the symbolic link file, the kernel
automatically "dereferences" the link and operates on the target of the
link. But some operations (e.g., removing) work on the link file itself,
rather than on its target.
• In
the following example the directory /HP/BAC is created, and
/opt/HP is linked to this directory, so the installation will go into
/HP/BAC, but can be accessed at /opt/HP:
Installing BSM on Linux
# mkdir /BAC/HP
# ln -s /BAC/HP /opt/HP
do not ln -s /BAC/HP /opt/HP
# cd /BAC/HP
# ll / > sgtest1
# ll
total 16
drwxrwxr-x
2 root root 4096 May 29 14:51 ./
drwxr-x--- 23 root root 4096 May 29 14:51 ../
-rw-rw-r--
1 root root 1582 May 29 14:51 sgtest1
# ll /opt/HP
lrwxrwxrwx 1 root root 12 May 29 14:51 /opt/HP -> /BAC/HP
# ll /opt/HP/*
-rw-rw-r-- 1 root root 1582 May 29 14:51 /opt/HP/sgtest1
Installing BSM on Linux
# cd /opt/HP
# ll
total 16
drwxrwxr-x
2 root root 4096 May 29 14:51 ./
drwxr-x--- 23 root root 4096 May 29 14:51 ../
-rw-rw-r--
1 root root 1582 May 29 14:51 sgtest1
# mkdir newdir
# ll
..
drwxrwxr-x
2 root root 4096 May 29 14:58 newdir/
..
## ll /BAC/HP
..
drwxrwxr-x
..
2 root root 4096 May 29 14:58 newdir/
Installing BSM on Linux
• As
Linux doesn‘t support Microsoft IIS (obviously), on Linux one only
can use Apache as BSM Web Server
Installing BSM on Linux
• The
DISPLAY environment variable must be properly configured on
the BSM server machine.
• The
machine from which you are installing must be running a X-Server
unless you are installing BSM in silent mode
• Don‘t
use for example Exceed, it is known to cause issues, for
example the selection buttons disappear within the menu or make
them unselectable
• VNCServer
is part of RHEL5 and works fine
Installing BSM on Linux
Setting up VNCServer
#vi /etc/sysconfig/vncservers
VNCSERVERS="1:root"
VNCSERVERARGS[1]="-geometry 1024x768„
#service vncserver start | stop
#chkconfig vncserver on
(forces the service to start on reboot)
executing
#vncpasswd
is required to set the password for root ;-)
Installing BSM on Linux
to enable copy & paste from vncviewer window to e.g.
a Windows system or the other way around, run
#vncconfig
Installing BSM on Linux
# ps -ef | grep vnc
root
4281
1 0 May02 ?
00:01:25 Xvnc :1 -desktop vm17083:1
(root) -httpd /usr/share/vnc/classes -auth /root/.Xauthority -geometry
1024x768 -depth 16 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5901
-pn
root
9823
4606
0 May03 pts/0
00:00:00 vncconfig
Installing BSM on Linux
• the
remaining bit missing now is a viewer for VNC,
for example RealVNC from
http://www.realvnc.com/download/viewer/
• or
TightVNC (uses less resources than RealVNC) from
http://www.tightvnc.com/
Installing BSM on Linux
• BSM
9.20 comes on multiple DVDs, the Linux bits reside on the DVD
Software_HP_BSM_9.20_Installation_for_Linux_TB998-15018 (DVD 2)
• if
the DVD is mounted, execute
„DVD2”/linux_setup/HPBsm_9.20_setup.bin
Installing BSM on Linux
if you have an .iso image saved as (for example)
/tmp/TB998-15018.iso
you need to mount the image:
create a directory for the “DVD” to show up
#mkdir /BSM920
#mount -o loop /tmp/TB998-15018.iso /BSM920
#cd /BSM920
#cd Linux_Setup
#./HPBsm_9.20_setup.bin
after the installation is completed
#umount /BSM920
#rmdir /BSM920
Installing BSM on Linux
• Config
Wizard fails with
Exception in thread “main” java.lang.UnsatisfiedLinkError:
/opt/HP/BSM/JRE/lib/xawt/libmawt.so: libXrender.so.1: cannot
open shared object file: No such file or directory
• One
or more libraries are missing. Simply check with Google for the
library name and “RedHat” to find out what package is missing, or
leave it to the tools to find out:
# yum install libXrender.so.1
In this case you also can use the package
“GNOME Desktop Environment” and install the whole package /
group:
# yum groupinstall "GNOME Desktop Environment“
• yum
is
Yellowdog Update Modified
an interactive, rpm-based package manager.
Installing BSM on Linux
• Postinstall
fails with
/opt/HP/BSM/postinstall-common.sh: /opt/HP/BSM/JRE/bin/java:
/lib/ld-linux.so.2:bad ELF interpreter. No such file or
directory.
• again,
run
# yum install lib/ld-linux.so.2
Yum will then look for any package containing that file and offer to
install it.
(Here actually the issue was that the customer tried to install BSM on
RedHat 6, thus installing the library didn’t help).
Installing a BSM
patch on Linux
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Installing a BSM patch on Linux
• you
have BSM 9.20 installed and now need to upgrade to BSM 9.22;
the patch is BAC_00816
• download
• create
• #cd
a directory and extract the patch
tmp
• #mkdir
• #cd
the patch to /tmp/BAC_00816.zip
BAC_00816
BAC_00816
• #unzip
../BAC_00816.zip
• change
permissions on the installer file
#chown +x /tmp/BAC_00816/HPBsm922_9.22_setup.bin
• execute
the installer
#/tmp/BAC_00816/HPBsm922_9.22_setup.bin
Installing a BSM patch on Linux
# ll BAC*
-rw-r--r-- 1 root root 1338127517 May 28 14:57 BAC_00816.zip
# mkdir BAC_00816
# cd BAC_00816
# unzip ../BAC_00816.zip
Archive:
../BAC_00816.zip
inflating: Get_Documentation.htm
inflating: HPBsm922_9.22_setup.bin
creating: packages/
inflating: packages/HPBsm922AM-9.22.111-Linux2.6_64.rpm
..
inflating: packages/HPOvXpl-11.10.051-Linux2.6_64-release.rpm
inflating: packages/HPOvXpl-11.10.051-Linux2.6_64-release.rpm.xml
Installing a BSM patch on Linux
# ls *.bin
HPBsm922_9.22_setup.bin
# ./HPBsm922_9.22_setup.bin
-bash: ./HPBsm922_9.22_setup.bin: Permission denied
-rw-rw-r-- 1 root root 57796918 Apr 12 20:51 HPBsm922_9.22_setup.bin
# chmod +x HPBsm922_9.22_setup.bin
# ll HPBsm*
-rwxrwxr-x 1 root root 57796918 Apr 12 20:51 HPBsm922_9.22_setup.bin*
(bash shell shows executable files in green)
#./HPBsm922_9.22_setup.bin
Preparing to install...
Extracting the JRE from the installer archive...
Managing BSM
when it runs on
Linux
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Managing BSM when it runs on Linux
• xyz.bat
is xyz.sh on Linux (and yes, it is case-sensitive)
for example:
Windows : bsmbrowser.bat
Linux : bsmbrowser.sh
• Windows
:
Start -> All Programs -> HP Business Service Management ->
Administration -> Configure HP Business Service Management
Linux :
execute /opt/HP/BSM/bin/config-server-wizard.sh
Managing BSM when it runs on Linux
• scripts
as part of alert actions
Linux cannot execute DOS / Windows .bat files,
but shell scripts only
The Online Help
(Application Administration > End User Management > End User Management Alerts Administration
> EUM Alerts Administration User Interface > Run Executable File Dialog)
unfortunately only states
..
You can embed predefined alert parameters into a custom command line that runs an
executable file when an alert is triggered. For example:
C:\Bin\MyAlertReporter.exe –title "Alert <<Alert Name>> for <<Entity Name>>" –Text
"<<User Message>>"
The command uses the MyAlertReporter exe file located in C:\Bin. It uses the name of
the alert, the name of the entity, and the message to the user as parameters.
..
Managing BSM when it runs on Linux
• This
of course wouldn’t work.
For Linux this might be something like
/tmp/scripts/MyAlertReporter.sh “Alert <<Alert name>> ..
Managing BSM when it runs on Linux
• Note:
adding an alert is logged to
<BSM>/log/alerts/ evb_alerts_ui.log
2013-06-13 09:41:33,032 [ajp-0.0.0.0-8009-10]
(AlertsAdminServerImpl.java:160) INFO - Customer '1': Add alert: sgtest,
type: bpm.transaction.alert.type, severity: Critical, related ci: SG Test,
enabled send for every trigger, dont send clear alert , groupby: [],
trigger config: all required [false], state [type [Empty]], triggers
[{TransactionRespTimeOnce=type [OneFieldNumeric], id
[TransactionRespTimeOnce], sample [trans_t], field [dResponseTime], is
grater [true], threshold [0.00]}], filter config: related entity [field
name [application_id], type [Binary], values
[[4505844a39610284c84fba484e8afd82]]], filters [[field name
[u_iLocationId], type [Binary], values [[]], field name [szDeviceId], type
[Long], values [[]], field name [u_iTransactionId], type [Binary], values
[[]]]], exe: [/tmp/scripts/MyAlertReporter.sh "Alert <<Alert Name>> for
<<Entity Name>>" "<<User Message>>"], id:
3db4dff2148ebca0960b3e492c59c72d.
•
Managing BSM when it runs on Linux
• /tmp/scripts/MyAlertReporter.sh
(needs to reside on the DPS!!!)
#/bin/sh
# this is a ridicolous script simply logging date and time into a file
# followed by the first four parameters passed in via the command line
date >> /tmp/scripts/MyAlertReporter.log
if [ "$1" != "" ]; then
echo $1 >> /tmp/scripts/MyAlertReporter.log
fi
if [ "$2" != "" ]; then
echo $2 >> /tmp/scripts/MyAlertReporter.log
fi
if [ "$3" != "" ]; then
echo $3 >> /tmp/scripts/MyAlertReporter.log
fi
if [ "$4" != "" ]; then
echo $4 >> /tmp/scripts/MyAlertReporter.log
fi
exit 0
Managing BSM when it runs on Linux
• alert
has been triggered, script has been executed:
# more MyAlertReporter.log
Thu Jun 13 10:11:44 CEST 2013
"Alert
sgtest
for
SG_Google_SSO"
• The
output shows that either the alert definition or the script needs
some fine tuning to get all parameters sent / received the right way.
Spaces are delimiters, so usually quotes help here.
Managing BSM when it runs on Linux
• start
/ stop / restart BSM
/opt/HP/BSM/scripts/run_hpbsm start / stop / restart
start: (if executed on the GW start the WebServer)
ulimit -n 8192;
sysctl -p;
${TOPAZ_HOME}/WebServer/bin/apache2start.sh;
followed by (for all BSM servers)
./run_nanny_as_nobody start >>
$BSMPRODUCT_HOME/log/hpbsm_start.log &
[root@vm17057 ~]# /opt/HP/BSM/scripts/run_hpbsm start
Setting NLS_LANG to AMERICAN_AMERICA.UTF8
starting Apache web server...
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
Managing BSM when it runs on Linux
• start
/ stop / restart BSM
kernel.sysrq = 0
kernel.core_uses_pid = 1
kernel.core_pattern = /tmp/core.%e.%p
fs.suid_dumpable = 2
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
fs.file-max = 364500
Starting HP BSM...
Please check the Status page at
file:///opt/HP/BSM/tools/bsmstatus/bsmstatus.sh to verify BSM is
ready.
Managing BSM when it runs on Linux
• start
/ stop / restart BSM
to easily monitor the startup process, execute
#tail –f /opt/HP/BSM/log/supervisor/nannyStatus.log
and wait for the last line to show up:
...
2013-05-29 15:51:21,029
OPR
STOPPED
2013-05-29 15:51:21,029
OPR
LAUNCHED
2013-05-29 15:51:26,707
OPR
STARTING
2013-05-29 15:51:26,708
OPR
STARTED
2013-05-29 15:51:27,080
businessImpact_service
STOPPED
2013-05-29 15:51:27,080
businessImpact_service
LAUNCHED
2013-05-29 15:51:33,596
businessImpact_service
STARTING
2013-05-29 15:51:33,596
businessImpact_service
STARTED
2013-05-29 15:51:33,615
All services started in 5m:40s
Managing BSM when it runs on Linux
• start
/ stop / restart BSM
stop: (if executed on the GW stop the WebServer)
${TOPAZ_HOME}/WebServer/bin/apache2stop.sh
followed by (for all BSM servers)
./run_nanny_as_nobody stop
[root@vm17016 scripts]# ./run_hpbsm stop
Setting NLS_LANG to AMERICAN_AMERICA.UTF8
stopping Apache web server...
calling stop script...
Stopping hpbsmd...
Waiting for hpbsmd to exit...
..
Waiting for hpbsmd to exit...
Stopped hpbsmd.
Managing BSM when it runs on Linux
• start
/ stop / restart BSM
restart: it simply executes stop followed by start
Managing BSM when it runs on Linux
• start
/ stop / restart BSM
/etc/init.d/hpbsmd start / stop / restart
start: simply calls /opt/HP/BSM/scripts/run_hpbsm start
to run in the background using the command daemon
same for stop and restart
• the
script is mainly used for the automatic start and stop of BSM
Managing BSM when it runs on Linux
• automatic
• this
• for
BSM start/stop with system start/stop
is setup during installation:
BSM the script /etc/init.d/hpbsmd is being used
• in
/etc/rc.d/rc#.d links point to scripts which gets executed when Linux
gets to Runlevel #
(# = there are Runlevels 0 – 6
0 is to stop the system
3 is like all is up and running)
• thus
there are entries to start BSM, and entries to stop BSM
Managing BSM when it runs on Linux
/etc/rc.d/rc3.d – S## = Start / boot activation priority
..
lrwxrwxrwx 1 root root 14 Nov
7
2012 S58ntpd -> ../init.d/ntpd
lrwxrwxrwx 1 root root 16 Mar 19
2012 S65hpbsmd -> ../init.d/hpbsmd
lrwxrwxrwx 1 root root 18 Nov 24
2011 S80sendmail -> ../init.d/sendmail
..
on system startup the OS executes ../init.d/hpbsmd start
/etc/rc.d/rc0.d – K## = kill / activation priority
..
lrwxrwxrwx 1 root root 18 Nov 24
2011 K30sendmail -> ../init.d/sendmail
lrwxrwxrwx 1 root root 16 Mar 19
2012 K35hpbsmd -> ../init.d/hpbsmd
lrwxrwxrwx 1 root root 13 Nov 24
2011 K35smb -> ../init.d/smb
..
on system shutdown the OS executes ../init.d/hpbsmd stop
Managing BSM when it runs on Linux
• command
line tool to manage BSM
/opt/HP/BSM/opr/support/opr-support-utils.sh
Topics:
/opt/HP/BSM/opr/support/opr-support-utils.sh –help
Setting Utility:
License Checker:
Process Status Util:
Hac Status Lister:
Retrieve uCMDB Capacity:
Event Pipeline Statistics:
Managing BSM when it runs on Linux
• command
line tool to manage BSM
Process Status Util:
-startAll
-stopAll
-start <servicename>
-stop <servicename>
-restart <servicename>
-getServiceInfo [-gi] <servicename>
-listServices [-la]
-listAllServicesStatus [-ls]
-listStatusAsHTML [-lh]
Managing BSM when it runs on Linux
• command
line tool to manage BSM
/opt/HP/BSM/opr/support/opr-support-utils.sh –listAllServicesStatus
..
Service Name= schedulergw
Process Name= schedulergw
Process Status= STARTED
Execution Order= 20
------------------------------------Service Name= mercuryAS
Process Name= MercuryAS
Process Status= STARTED
Execution Order= 6
------------------------------------..
Managing BSM when it runs on Linux
• same
set of tools exists under /opt/HP/BSM/tools
• but
Windows-specific tools and outdated tools have not been ported to
Linux and thus don‘t run
(for example TimeDiff, NannyCmd)
• DCSniffer
works with BSM 9.2x
• Loggrabber:
Windows : <BSM>\tools\loggrabber\go.bat
Linux
: /opt/HP/BSM/tools/loggrabber/saveLogs.sh
Managing BSM when it runs on Linux
When using BSM 9.22 Logging Administrator under Linux by invoking
http://<BSM Gateway Server>/topaz/logAdminBsm.jsp
and then creating a file, the GUI states that it creates the file under
C:/HPBSM/log/temp/
but in reality it is created under
/opt/HP/BSM/bin/C:/HPBSM/log/temp/
(strange path? yes, this is Linux!)
Similar when running the tool on Windows:
the GUI states that it creates the file under
C:/HPBSM/log/temp/
and it creates it there, even if BSM is installed on E:\HPBSM
CR QCCR1I86654 BSM 9.22 on Linux - Logging Administrator creates
logfiles under /opt/HP/BSM/bin/C:/HPBSM/log/temp/“
Managing BSM when it runs on Linux
BSM Status
BSM 9.1x
- open Firefox and access
http://<server>:8080/myStatus/myStatus.html
(this however doesn't always work due to a security restriction in FF,
the issue has been fixed in BSM 9.20)
BSM 9.2x
- execute /opt/HP/BSM/tools/bsmstatus/bsmstatus.sh
Managing BSM when it runs on Linux
BSM Status
another option
http://<server>:11021/invoke?operation=showServiceStatusAsHTML&
objectname=Foundations%3Atype%3DNannyManager
Managing BSM when it runs on Linux
and the HAC Status
http://<server>:8080/jmxconsole/HtmlAdaptor?action=invokeOpByName&name=Topaz%3Aservice%3
Dhac-manager&methodName=listMyStatus
Managing BSM when it runs on Linux
• Running
• Login
Sonic Console on Linux
to the Data Processing Server (DPS) and execute
/opt/HP/BSM/Sonic/MQ7.6/bin/startmc.sh (BSM 9.13)
/opt/HP/BSM/Sonic/MQ8.5/bin/startmc.sh (BSM 9.22)
When prompted to insert the credentials, everything should remain by
default:
Connection Name
Domain Name
Connection URL(s)
User Name
Password
: Connection1
: Domain1
: tcp://localhost:2506
:
:
leave "User Name" and "Password" empty and click "OK" to connect
Managing BSM when it runs on Linux
• Running
Sonic Console on Linux
Managing BSM when it runs on Linux
• Running
Sonic Console on Linux
Managing BSM when it runs on Linux
• Running
Sonic Console on Linux
to get all durable subscribers
Manage .> Containers -> <hostname> -> Durable
Subscriptions -> then click on the empty line above
[[Trinity]]dc.*.Default Client.*
Managing BSM when it runs on Linux
• Running
Sonic Console on Linux
Linux
Tips and Tricks
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Linux Tips and Tricks
• remove
all files and directories without prompt under /opt/HP/BSM
(you shouldn’t do this!)
# rm -rf /opt/HP/BSM
• check
whether a specific process is running
# ps -e | grep – i mercuryas
# ps -ef | grep –i mercuryas
• list
all running processes
# ps -ef | more
Linux Tips and Tricks
• show
BSM process tree
•
# ps -e | grep wrapper
•
23941 ?
•
# pstree 23941
00:00:00 wrapper
Linux Tips and Tricks
• show
•
process tree
# ps –efH | more
root
root
root
root
root
root
root
root
root
root
root
root
root
root
23941
23943
24006
24044
24116
24155
24193
24448
24513
24520
24526
24574
24586
24601
1
23941
23943
24006
24044
23943
24155
24193
23943
24513
24520
23943
24574
24586
0
0
0
0
0
0
0
0
0
0
1
0
0
0
May29
May29
May29
May29
May29
May29
May29
May29
May29
May29
May29
May29
May29
May29
?
?
?
?
?
?
?
?
?
?
?
?
?
?
00:00:00
00:08:35
00:00:00
00:00:00
00:08:13
00:00:00
00:00:00
00:17:51
00:00:00
00:00:00
02:57:20
00:00:00
00:00:00
00:00:00
/opt/HP/BSM/supervisor/wrapper
/opt/HP/BSM/JRE/bin/hpbsmd /bin/sh /opt/HP/BSM/Sonic/
/bin/sh ./startcontainer
/opt/HP/BSM/JRE/bin/Do
/bin/sh /opt/HP/BSM/Sonic/
/bin/sh ./startmsgcontai
/opt/HP/BSM/JRE/bin/Me
/bin/sh /opt/HP/BSM/bin/od
/bin/sh ./service_manage
/opt/HP/BSM/JRE64/bin/
/bin/sh /opt/HP/BSM/EJBCon
/bin/sh ./mercury_run.sh
/bin/sh ./run.sh -c me
Linux Tips and Tricks
• top CPU consumer
# top (type „q“ to exit)
Linux Tips and Tricks
• case-sensitive
search for an object on the system (file, directory, ..)
under /opt/HP/BSM
# cd /opt/HP/BSM
# find . -name topaz_all.ejb.log
• search case-insensitive
# find . -iname topaz_all.ejb.log
• same but with wildcard
# find . -iname topaz*log
• same, but search the complete
# find / -iname topaz*log
• search files only / search
# find –type f ...
# find –type d ...
system
directories only
Linux Tips and Tricks
• search
for a string in a directory
# find . -type f -exec grep -qi "failed to get data from server" {} \; -print
this translates to:
find
. = current working directory
-type f = all files
-exec = for each file found execute
-grep –qi = find the string quietly (print filename only), ignore case
-print = display the result, in this case the filename
# cd /opt/HP/BSM/log
# find . -type f -exec grep -qi "license" {} \; -print
./EJBContainer/licensemgr.log
./EJBContainer/appcore.log
./EJBContainer/tvb.log
./EJBContainer/repositories.log.1
…
Linux Tips and Tricks
• search
for a string in a directory, a shorter and more easy way
# grep –rli “failed to get data from server“ *
this translates to:
grep find
-rli = recursive search through all subdirectories
print file name only
ignore case
# cd /opt/HP/BSM/log
# grep –rli “failed to get data from server“ *
./EJBContainer/licensemgr.log
./EJBContainer/appcore.log
./EJBContainer/tvb.log
./EJBContainer/repositories.log.1
…
Linux Tips and Tricks
• this
can also be used to find in what file we refer to what resource
under what name:
# cd /opt/HP/BSM
# find . -type f -exec grep -qi "not all required fields were completed" {}
\; -print
./AppServer/resources/ApplicationResources2_en.properties
./AppServer/resources/ApplicationResources2.properties
./AppServer/resources/analytics_en.properties
./AppServer/resources/analytics.properties
Linux Tips and Tricks
• here
it is :
# grep -i "not all required"
./AppServer/resources/analytics.properties
error.text.invalid=Not all required fields were completed.
• and
now we can search for the code using this resource variable:
# find . -type f -exec grep -qi "error.text.invalid" {} \; -print
./AppServer/webapps/TopazAdminCenter.ear/TopazAdminCenter.war/WEB
-INF/lib/acweb_web.jar
Linux Tips and Tricks
Linux Tips and Tricks
• what users are logged
# who
root
pts/0
root
pts/1
root
pts/2
root
pts/3
root
pts/4
root
pts/5
root
pts/6
• what’s my login
# who am I
root
pts/6
in
2013-05-02
2013-05-02
2013-05-02
2013-05-08
2013-05-10
2013-05-27
2013-05-28
16:50
16:50
17:02
09:48
22:20
13:43
10:40
(:1.0)
(:1.0)
(:1.0)
(vm17083)
(vm25177)
(:1.0)
(vm17083)
2013-05-28 10:40 (vm17083)
Linux Tips and Tricks
• how
can I login as a different user quickly
# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
# su – oracle
(yes, su space – space username)
$ id
uid=1003(oracle) gid=1003(oracle) groups=1003(oracle)
• but
$ who am i
root
• get
pts/3
2013-04-29 13:06 (:1.0)
back to original user
$ exit
# id
uid=0(root) gid=0(root)
groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
Linux Tips and Tricks
• quickly
become root
$ su –
(yes, su space -)
Password:
#
• execute
a command as root user without the need to login as root,
of course you need to enter the root password
$ sudo <command>
Password:
Linux Tips and Tricks
• what
shell do I use
# grep "$USER" /etc/passwd
root:x:0:0:root:/root:/bin/bash
• what
shells are available
# more /etc/shells
/bin/sh
/bin/bash
/sbin/nologin
/bin/tcsh
/bin/csh
/bin/ksh
/bin/zsh
Linux Tips and Tricks
• change
the login shell for a specific user
# chsh -s /bin/ksh root
Changing shell for root.
Shell changed.
• change
the login shell if you are not root
# sudo chsh -s /bin/ksh <username>
Linux Tips and Tricks
• what’s
my free disk space
# df
Filesystem
1K-blocks
Used Available Use% Mounted on
/dev/sda4
93363944
36456304
52088580
/dev/sda1
256666
8017
235397
2929648
0
2929648
tmpfs
• and
42% /
4% /boot
0% /dev/shm
for human interpretation
# df -h
Filesystem
Size
Used Avail Use% Mounted on
/dev/sda4
90G
35G
50G
/dev/sda1
251M
7.9M
230M
4% /boot
tmpfs
2.8G
0
2.8G
0% /dev/shm
42% /
Linux Tips and Tricks
• what
directories use most of the space. human format
# du –h /opt/HP/BSM
4.8M
/opt/HP/BSM/EJBContainer/lib/endorsed
8.4M
/opt/HP/BSM/EJBContainer/lib
26M
/opt/HP/BSM/EJBContainer/client
4.0K
/opt/HP/BSM/EJBContainer/log/EJBContainer
8.0K
/opt/HP/BSM/EJBContainer/log
Linux Tips and Tricks
• to
show the top disk consumers first
(doesn’t work good with the –h switch)
# du /opt/HP/BSM | sort –gr
8510524 /opt/HP/BSM
1979044 /opt/HP/BSM/AppServer
1918852 /opt/HP/BSM/AppServer/webapps
1378612 /opt/HP/BSM/log
1369192 /opt/HP/BSM/installation
1365760 /opt/HP/BSM/installation/HPBsm922
1340012 /opt/HP/BSM/installation/HPBsm922/backup
1126180 /opt/HP/BSM/Sonic
Linux Tips and Tricks
• to
find all files with a size > 100 MB in /opt/BSM
# find /opt/HP/ -size +100000k -print0 | xargs -0 ls -l
-rwxr--r-- 1 root root 157320757 Jul 29
2012 /opt/HP/BSM/dat/ip_ranges.v4.csv.zip
-r--r--r-- 1 root root 110223682 Aug
8
2012 /opt/HP/BSM/installation/HPBsm922/backup/opr/webapps/opr-web.war
-rwxrw-r-- 1 root root 110312804 May
2 18:09 /opt/HP/BSM/odb/content/content_packs/CP11.zip
-rwxrw-r-- 1 root root 110312804 May
2 18:09 /opt/HP/BSM/odb/content/CP.zip
-rw-rw-r-- 1 root root 209715200 Jul
1 10:29 /opt/HP/BSM/Sonic/Containers/Domain1.DomainManager/log/recoverylog1.bin
-rw-rw-r-- 1 root root 209715200 Jun 21 21:48 /opt/HP/BSM/Sonic/Containers/Domain1.DomainManager/log/recoverylog2.bin
-rwxr--r-- 1 root root 487862850 Jun 24
2012 /opt/HP/BSM/Sonic/installation/SonicMQ8.5/install.bin
-rwxr--r-- 1 root root 439502776 Jun 24
2012 /opt/HP/BSM/Sonic/installation/SP1/install.bin
-rwxr-xr-- 1 root root 209715200 Jul
1 11:07 /opt/HP/BSM/Sonic/runtime/MsgBroker/log/recoverylog1.bin
-rwxr-xr-- 1 root root 209715200 Jun 21 21:49 /opt/HP/BSM/Sonic/runtime/MsgBroker/log/recoverylog2.bin
Linux Tips and Tricks
• count
the number of messages in a file (wordcount –lines)
# grep “Warning” /opt/HP/BSM/log/jboss_boot.log | wc –l
17
• count
the number of .jar files in /opt/HP/BSM/lib
# ls -l /opt/HP/BSM/lib/*.jar | wc -l
589
• sort
list of files by modification date (newest one on the top)
# ls -tl | more
total 18092
-rw-r--r-- 1 root root 3049339 Jun 13 09:49 alert_statistics.ejb.log
-rw-r--r-- 1 root root
1430 Jun 13 09:41 alerts.rules.init.log
-rw-r--r-- 1 root root
133 Jun 13 09:41 alerts.rules.log
-rw-r--r-- 1 root root
1868 Jun 13 09:41 evb_alerts_ui.log
Linux Tips and Tricks
• what
process locks / uses a certain file
[root@vm17016 log]# fuser jk.2013-06-12-14.log
jk.2013-06-12-14.log: 30176
[root@vm17016 log]# ps 30176
PID TTY
30176 ?
STAT
TIME COMMAND
S
0:00 /opt/HP/BSM/WebServer/bin/rotatelogs /opt/HP/BSM/log/
Linux Tips and Tricks
rpm – RedHat Packet/Package Manager
• show
all packages installed
# rpm -query -a (or short rpm -qa)
• list all BSM packages installed
# rpm -qa | grep '^HP' | egrep -i 'bsm|opr|ov|eum|diag' | sort
HPBsm922AM-9.22.111-1
..
HPBSM_BPIPkg-9.20.019-1
HPBsmDocCom-9.30.092-1
..
HPDiagInt-9.20.105-1
..
HPEumCom-9.20.191-1
..
HPOprAdmin-9.20.197-1
..
HPOvSecCS-11.10.054-1
HPOvXpl-11.10.051-1
Linux Tips and Tricks
• list
all SystemHealth packages installed
# rpm -qa | grep -i systemhealth
SystemHealth1-9.22.010-1
SystemHealthDoc-9.22.000-1
..
Linux Tips and Tricks
• remove
a packages
# rpm -e <package>
# rpm -e HPBsmSonic-9.12.140-1
error: Failed dependencies:
HPBsmSonic >= 9.12.140 is needed by (installed)
HPBsmSonicSP2-9.12.140-1.i386
# rpm -e HPBsmSonicSP2-9.12.140-1
# rpm -e HPBsmSonic-9.12.140-1
• OR
(the lazy way, only do this if you know EXACTLY what you are doing)
# rpm -qa | grep -i hpbsm | xargs rpm -e
Installing Oracle
on Linux
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Installing Oracle on Linux
• in
the following Oracle 11.1.0.6.0 is installed on
vm17057 which is running
Red Hat Enterprise Linux Server 5.9 (Tikanga)
Installing Oracle on Linux
• Oracle
installer (no matter whether it's the database or the client)
requires X, here we use VNC as X server
• as
• cd
user root:
/data/Oracle-11.1.0.6.0
• unzip
linux.x64_11gR1_database_1013.zip
• xhost
+
Installing Oracle on Linux
• next
• su
steps as user oracle:
- oracle
• export
DISPLAY=`hostname`:1
• xclock
(for a test of X)
• cd
(if using vnc)
/data/Oracle-11.1.0.6.0/database
• ./runInstaller
Installing Oracle on Linux
Oracle 11.1 Enterprise Edition
pre-installation check
Checking for libaio-devel-0.3.106; Not found. Failed <<<<
Checking for sysstat-7.0.0; Not found.
Failed <<<<
Downloaded the missing packages from the Internet
# rpmbuild --rebuild /tmp/sysstat-7.0.0-3.el5.src.rpm
Installing /tmp/sysstat-7.0.0-3.el5.src.rpm
..
Wrote: /usr/src/redhat/RPMS/x86_64/sysstat-7.0.0-3.x86_64.rpm
Wrote: /usr/src/redhat/RPMS/x86_64/sysstat-debuginfo-7.0.0-3.x86_64.rpm
# rpm -i -f /usr/src/redhat/RPMS/x86_64/sysstat-7.0.0-3.x86_64.rpm
rpm -query -a
..
sysstat-7.0.0-3
..
Installing Oracle on Linux
Checking for semopm=100; semopm=32. Failed <<<<
# ipcs -ls
------ Semaphore Limits -------max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 32
semaphore max value = 32767
sysctl -w kernel.sem="250 32000 100 128"
# ipcs -ls
------ Semaphore Limits --------
max number of arrays = 128
max semaphores per array = 250
max semaphores system wide = 32000
max ops per semop call = 100
semaphore max value = 32767
Installing Oracle on Linux
Checking for ip_local_port_range=1024 - 65000; ip_local_port_range=32768 - 61000.
Failed <<<<
vi /etc/sysctl.conf
# increase system IP port limits
net.ipv4.ip_local_port_range = 1024 65535
Checking for rmem_default=4194304; rmem_default=126976. Failed <<<<
Checking for rmem_max=4194304; rmem_max=131071.
Failed <<<<
Checking for wmem_default=262144; wmem_default=126976.
Failed <<<<
Checking for wmem_max=262144; wmem_max=131071. Failed <<<<
vi /etc/sysctl.conf file
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 262144
Installing Oracle on Linux
after successful installation:
Oracle Base Location - /home/oracle/app/oracle
Oracle Home Location - /home/oracle/app/oracle/product/11.1.0/db_1
UNIX DBA Group
- oracle
Global Database Name
- orcl
Database Password
- orcl
System Identifier (SID) – orcl
SID : orcl, Username : system Password : orcl
Server Parameter Filename /home/oracle/app/oracle/product/11.1.0/db_1/dbs/spfileorcl.ora
Database Control URL - https://vm17057:1158/em (login as system / orcl)
Encyption key
/home/oracle/app/oracle/product/11.1.0/db_1/vm17057_orcl/sysman/config/emkey.ora
adding the statements below to user oracle's .bashprofile
export ORACLE_HOME=/home/oracle/app/oracle/product/11.1.0/db_1
export ORACLE_SID=orcl
Installing Oracle on Linux
Starting Oracle
$su - oracle
$ORACLE_HOME/bin/lsnrctl start
$ORACLE_HOME/bin/dbstart
Installing Oracle on Linux
Starting Oracle
[oracle@vm17057 ~]$ $ORACLE_HOME/bin/lsnrctl start
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 10-JUN-2013 18:12:54
Copyright (c) 1991, 2007, Oracle.
All rights reserved.
Starting /home/oracle/app/oracle/product/11.1.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.1.0.6.0 - Production
System parameter file is /home/oracle/app/oracle/product/11.1.0/db_1/network/adm
in/listener.ora
Log messages written to /home/oracle/app/oracle/product/11.1.0/db_1/log/diag/tns
lsnr/vm17057/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vm17057)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
Installing Oracle on Linux
Starting Oracle
STATUS of the LISTENER
-----------------------Alias
LISTENER
Version
TNSLSNR for Linux: Version 11.1.0.6.0 - Production
Start Date
10-JUN-2013 18:12:54
Uptime
0 days 0 hr. 0 min. 0 sec
Trace Level
off
Security
ON: Local OS Authentication
SNMP
OFF
Listener Parameter File
/home/oracle/app/oracle/product/11.1.0/db_1/network/ad
min/listener.ora
Listener Log File
/home/oracle/app/oracle/product/11.1.0/db_1/log/diag/t
nslsnr/vm17057/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vm17057)(PORT=1521)))
The listener supports no services
The command completed successfully
Installing Oracle on Linux
Starting Oracle
[oracle@vm17057 ~]$ $ORACLE_HOME/bin/dbstart
ORACLE_HOME_LISTNER is not SET, unable to auto-start Oracle Net Listener
Usage: /home/oracle/app/oracle/product/11.1.0/db_1/bin/dbstart ORACLE_HOME
Processing Database instance "orcl": log file /home/oracle/app/oracle/product/11
.1.0/db_1/startup.log
Installing Oracle on Linux
Stopping Oracle
#su - oracle
$ORACLE_HOME/bin/sqlplus “connect / as sysdba”
shutdown (immediate / abort)
$ORACLE_HOME/bin/dbshut
$ORACLE_HOME/bin/lsnrctl stop
Installing Oracle on Linux
Stopping Oracle
#su - oracle
[oracle@vm17057 ~]$ ORACLE_HOME/bin/sqlplus “connect / as sysdba”
..
SQL > connect / as sysdba
Connected.
SQL> shutdown abort;
ORACLE instance shut down.
SQL> exit;
Disconnected from Oracle Database 11g Enterprise Edition …
[oracle@vm17057 ~]$ $ORACLE_HOME/bin/dbshut
ORACLE_HOME_LISTNER is not SET, unable to auto-stop Oracle Net Listener
Usage: /home/oracle/app/oracle/product/11.1.0/db_1/bin/dbshut ORACLE_HOME
Processing Database instance "orcl": log file /home/oracle/app/oracle/product/11
.1.0/db_1/shutdown.log
Installing Oracle on Linux
Stopping Oracle
[oracle@vm17057 ~]$ $ORACLE_HOME/bin/lsnrctl stop
LSNRCTL for Linux: Version 11.1.0.6.0 - Production on 10-JUN-2013 18:10:43
Copyright (c) 1991, 2007, Oracle.
All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
Setting up BSM
with an Oracle
Database
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Setting up BSM with an Oracle Database
• after
BSM and Oracle have been installed,
you need to create the tablespaces
• scripts
for the creation of Oracle tablespaces for BSM are
located at
/opt/HP/BSM/AppServer/webapps/site.war/DataBases/OR
A_DB_Utils/
• oracle_tablespace_create.sh
• oracle_tablespace_create.sql
• oracle_user_create.sh
• oracle_user_create.sql
• and
so on
Setting up BSM with an Oracle Database
• the
.sh scripts simply call SQLPLus and execute the
corresponding .sql script, for example
oracle_tablespace_create.sh
calls
sqlplus -s $1/$2@$3 @oracle_tablespace_create.sql $4 $5 $6
oracle_tablespace_create.sql
CREATE TABLESPACE "&&1"
LOGGING
DATAFILE
'&&2' SIZE &&3 REUSE
EXTENT MANAGEMENT LOCAL
SEGMENT SPACE MANAGEMENT AUTO
Setting up BSM with an Oracle Database
• modify
oracle_tablespace_create.sh and fully qualify the path to
SQLPLUS
old
sqlplus …
new
/home/oracle/app/oracle/product/11.1.0/db_1/bin/sqlplus ...
• if
the DB server doesn‘t have BSM installed (which should be the case
for all serious BSM installations) you might need to copy the script
files over to the DB server, or perform all the steps manually
Setting up BSM with an Oracle Database
• create
a directory with PLENTY of space holding the datafiles
$ mkdir /oradata2
$ chmod 777 /oradata2
$ export ORACLE_HOME=/home/oracle/app/oracle/product/11.1.0/db_1
$ export ORACLE_SID=orcl
Setting up BSM with an Oracle Database
• create
the tablespace for the Management Database
[root@vm17057 ORA_DB_Utils]# ./oracle_tablespace_create.sh system
orcl orcl BSMVM83MGMT /oradata2/BSMVM83MGMT.dbf 5G
BATCH START !!
Creating tablespace BSMVM83MGMT into file:
/oradata2/BSMVM83MGMT.dbf with size of 5G
old
1: CREATE TABLESPACE "&&1"
new
1: CREATE TABLESPACE "BSMVM83MGMT"
old
4:
'&&2' SIZE &&3 REUSE
new
4:
'/oradata2/BSMVM83MGMT.dbf‘ SIZE 5G REUSE
[root@vm17057 ~]# ll /oradata2
-rw-r----- 1 oracle oracle
• Depending
time
5368717312 Jun 12 17:15 BSMVM83MGMT.dbf
on the size of the file this operation can take quite some
Setting up BSM with an Oracle Database
• do
the same for all other databases
./oracle_tablespace_create.sh system orcl orcl BSMVM83RTSM
/oradata2/BSMVM83RTSM.dbf 1G
./oracle_tablespace_create.sh system orcl orcl BSMVM83RTSMHIST
/oradata2/BSMVM83RTSMHIST.dbf 500M
./oracle_tablespace_create.sh system orcl orcl BSMVM83BPI
/oradata2/BSMVM83BPI.dbf 10M
./oracle_tablespace_create.sh system orcl orcl BSMVM83OPR
/oradata2/BSMVM83OPR.dbf 3G
./oracle_tablespace_create.sh system orcl orcl BSMVM83PROFDEF
/oradata2/BSMVM83PROFDEF.dbf 10G
• the
sizing requirements are listed in the Database Guide
Setting up BSM with an Oracle Database
Setting up BSM with an Oracle Database
• BSM
9.x – first provide the general database parameters
Setting up BSM with an Oracle Database
• BSM
9.x – then the parameters per database
New Schema Name
New Schema Password
Confirm Password
Default Tablespace
Temp Tablespace
:
:
:
:
:
BSMVM83MGMT
BSMVM83MGMT
BSMVM83MGMT
BSMVM83MGMT
TEMP
Setting up BSM with an Oracle Database
• to
setup a database for Service Health Analyzer
./oracle_tablespace_create.sh system orcl orcl BSMVM83SHA1
/oradata2/BSMVM83SHA1.dbf 10G
$ORACLE_HOME/bin/sqlplus -s system/orcl
@/opt/HP/BSM/AppServer/webapps/site.war/DataBases/ORA_DB_Utils/o
racle-db-creation_SHA.sql
/opt/HP/BSM/DbVerify/bin/generate_create_script.sh SHA_script.sql
Oracle Analytics 1
Script SHA_script.sql successfully created
$ORACLE_HOME/bin/sqlplus -s BSMVM83SHA1/BSMVM83SHA1
@/opt/HP/BSM/AppServer/webapps/site.war/DataBases/ORA_DB_Utils/S
HA_script.sql
Setting up BSM with an Oracle Database
• to
setup a database for Service Health Analyzer
BSM -> Admin -> Platform -> Setup and Maintenance ->
Manage Analytics Databases
Accessing an
Oracle database
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Accessing an Oracle database
• accessing
the BSM databases
• /opt/HP/BSM/tools/bsmbrowser/bsmbrowser.sh
limited to Management and Profile database
• Oracle‘s
SQLplus
nasty character mode interface, but required to use for some basic
operations like starting a database
• Oracle
SQL Developer
graphical interface
Accessing an Oracle database
• BSMBrowser
• /opt/HP/BSM/tools/bsmbrowser/bsmbrowser.sh
• with
„Topaz Connect“ it takes login information out of
/opt/HP/BSM/conf/TopazInfra.ini
Accessing an Oracle database
• Oracle’s
sqlplus
[root@vm17057 ~]# su - oracle
[oracle@vm17057 ~]$ $ORACLE_HOME/bin/sqlplus "connect / as sysdba"
SQL*Plus: Release 11.1.0.6.0 - Production on Wed Jun 5 19:55:12 2013
Copyright (c) 1982, 2007, Oracle.
All rights reserved.
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
Accessing an Oracle database
• Oracle’s
sqlplus
[root@vm17057 ~]# su – oracle
[oracle@vm17057 ~]$ $ORACLE_HOME/bin/sqlplus
SQL*Plus: Release 11.1.0.6.0 - Production on Wed Jun 5 19:56:05 2013
Copyright (c) 1982, 2007, Oracle.
All rights reserved.
Enter user-name: system
Enter password:
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> connect / as sysdba
Connected.
SQL>
Accessing an Oracle database
• Oracle’s
• to
sqlplus
access a specific database – logon to it:
[oracle@vm17057 ~]$ $ORACLE_HOME/bin/sqlplus
Enter user-name: BSM910MGMT
Enter password:
SQL> select SESSION_ID,SESSION_NAME from sessions;
SESSION_ID
SESSION_NAME
----------
------------
3
Unassignedvm17057.deu.hp.comBSM910PROFSISBSM910PROFSIS
4
Unassignedvm17057.deu.hp.comBSM910PROFBPMBSM910PROFBPM
..
8 rows selected.
SQL>
Accessing an Oracle database
• Oracle’s
• execute
sqlplus
a SQL script
SQL> @/path/script
Accessing an Oracle database
• Oracle
• install
SQL Developer
JDK SE < 1.7, for example 1.6.0_30 into /opt/jdk1.6.0_30
• download
Oracle SQL Developer from
http://www.oracle.com/technetwork/developer-tools/sqldeveloper/downloads/index.html
• install
as documented, when being asked for the location of the JDK,
enter
/opt/jdk1.6.0_30
• to
start the tool, run
<path to sqldeveloper>/sqldeveloper.sh
Accessing an Oracle database
• Oracle
SQL Developer
to connect to one specific database
Connection Name (whatever you like, for example "BSM910MGMT")
Username : name of the schema (for example "BSM910MGMT")
Password : corresponding password
(make sure to check “Save Password”)
Connection Type : Basic
Role : default
Hostname : name of the server running the DB, for example
vm17057.deu.hp.com
Port : usually 1521
SID : the DB SID, I used ORCL when creating the DB
if this connection has been established and saved, you can then
access all tables within the database "BSM910MGMT"
Accessing an Oracle database
• Oracle
SQL Developer
Accessing an Oracle database
• Oracle SQL Developer
database name -> right mouse click -> Manage Databases
allows a very good overview
on all the tablespaces and
their utilization
Accessing an Oracle database
• Oracle
SQL Developer
Accessing an Oracle database
• Oracle SQL Developer
viewing contents of Mgmt DB table SESSIONS
Accessing an Oracle database
• Oracle SQL Developer
executing SQL commands
Accessing an Oracle database
• Oracle SQL Developer
executing SQL commands
Useful Oracle /
SQL commands
© 2008 Hewlett-Packard Development Company, L.P.
The information contained herein is subject to change without notice.
Useful Oracle / SQL commands
• show
/ delete a user
when creating a BSM database and encountering an error, the next
time the creation might fail with
“… already exists”
Oracle creates a user which is used as reference, so this one needs to
be deleted. Here I’m struggling with the database “BSMVM83SHA1”:
SQL> select * from all_users;
USERNAME
USER_ID CREATED
------------------------------ ---------- --------BSMVM83PROFDEF
138 29-APR-13
BSMVM83OPR
137 29-APR-13
BSMVM83SHA1
133 29-APR-13
SQL> drop user BSMVM83SHA1 cascade;
Useful Oracle / SQL commands
• show
/ delete a tablespace
SQL> select tablespace_name from dba_tablespaces;
TABLESPACE_NAME
-----------------------------SYSTEM
SYSAUX
BSMVM83SHA1
...
SQL > drop tablespace BSMVM83SHA1 including contents and
datafiles cascade constraints;
Useful Oracle / SQL commands
• show
/ drop a view
SQL> select text from dba_views where view_name='BPM_TRANS';
TEXT
-------------------------------------------------------------------------------select "SAMPLETIME","TUID","DBDATE","CUSTOMER_ID","INTERNAL_TRANSACTION_ID",
...
,"DOWNTIME_STATE","ERROR_COUNT","AVAILABILITY_STATUS" from BPM_TRANS_90000
<TEXT> then contains the complete SQL statement to create the view
SQL > drop view BPM_TRANS CASCADE CONSTRAINTS;
SQL > create view BPM_TRANS as <TEXT>;
Useful Oracle / SQL commands
• show
/ drop a view
SQL> select text from dba_views where view_name = 'SGTEST';
select "SAMPLETIME","AVAILABILITY_STATUS" from
BSMVM83PROFDEF.BPM_TRANS_90000
SQL> drop view SGTEST cascade constraints;
View dropped.
SQL> create view sgtest as select
"SAMPLETIME","AVAILABILITY_STATUS" from
BSMVM83PROFDEF.BPM_TRANS_90000 ;
View created.
Useful Oracle / SQL commands
• show
/ enlarge tablespaces
if you see this red mark, it‘s time to increase the tablespace
SQL > select * from dba_tablespaces
SQL > SELECT TABLESPACE_NAME, STATUS, CONTENTS FROM
USER_TABLESPACES;
SQL > SELECT TABLESPACE_NAME, FILE_NAME, BYTES FROM
DBA_DATA_FILES;
SQL > alter tablespace <name> add datafile …
Useful Oracle / SQL commands
• show
/ enlarge tablespace SYSTEM / SYSAUX
SQL> SELECT FILE_NAME, BYTES FROM DBA_DATA_FILES where
tablespace_name = 'SYSTEM';
FILE_NAME
BYTES
-------------------------------------------------- ---------/home/oracle/app/oracle/oradata/orcl/system01.dbf
1352663040
/home/oracle/app/oracle/oradata/orcl/system02.dbf
104857600
/home/oracle/app/oracle/oradata/orcl/system03.dbf
524288000
/oradata2/system04.dbf
524288000
SQL > alter tablespace SYSTEM add datafile
'/oradata2/system05.dbf' size 500m;
for SYSAUX tablespace replace “SYSTEM” with “SYSAUX”
Useful Oracle / SQL commands
• show
/ enlarge tablespace TEMP
SQL> SELECT FILE_NAME FROM DBA_TEMP_FILES;
FILE_NAME
-------------------------------------------------/home/oracle/app/oracle/oradata/orcl/temp01.dbf
/home/oracle/app/oracle/oradata/orcl/temp02.dbf
SQL > alter tablespace TEMP ADD TEMPFILE
'/home/oracle/app/oracle/oradata/orcl/temp03.dbf' SIZE 500M;
Useful Oracle / SQL commands
• move
datafiles to a different location, for example if one drive runs out
of space. The current location of the datafiles can be queried from the
V$DATAFILE view:
SQL> SELECT name FROM v$datafile;
NAME
--------------------------------------------------------/oradata/BSM910SHA1.dbf
..
shutdown the database
SQL> shutdown abort;
Useful Oracle / SQL commands
move the physical file on the OS
$ mv /oradata/BSM910SHA1.dbf /oradata2/BSM910SHA1.dbf
start the database in mount mode
SQL> startup mount;
SQL> ALTER DATABASE RENAME FILE '/oradata/BSM910SHA1.dbf' to
'/oradata2/BSM910SHA1.dbf';
SQL> ALTER DATABASE OPEN;
SQL> SELECT name FROM v$datafile;
NAME
--------------------------------------------------------/oradata2/BSM910SHA1.dbf
Useful Oracle / SQL commands
• password
expired and BSM doesn’t work anymore
for example in nanny_all.log
Failed to create a connection for pool: dbType=(ORACLE Server);
..
[mercury][Oracle JDBC Driver][Oracle]ORA-28001: the password has expired
• to
alter the password expiry policy for a certain user in Oracle first
check which profile the user is in using:
SQL> select profile from DBA_USERS where username = ‘BSM910MGMT’;
DEFAULT
SQL> select * from dba_profiles where profile='DEFAULT';
PROFILE
RESOURCE_NAME
RESOURCE
LIMIT
------------------------------ -------------------------------- --------
--------
DEFAULT
60
PASSWORD_LIFE_TIME
PASSWORD
Useful Oracle / SQL commands
• password
• now
expired and BSM doesn’t work anymore
you can change the limit to “never expire” using:
SQL> alter profile DEFAULT limit password_life_time UNLIMITED;
Profile altered.
• apply
the change for the user
SQL> ALTER USER BSM910MGMT IDENTIFIED BY BSM910MGMT;
User altered.
Useful Oracle / SQL commands
• list
all tables
SQL> select * from user_objects where object_type = 'TABLE' order
by object_name;
• table
definiton / layout
SQL> describe BPM_TRANS;
• list
all constraints for some tables
SQL> select * from user_constraints uc where uc.constraint_name
like ('BPM_TRANS%');
• list
all indexes for some tables
SQL> select * from user_indexes where table_name like
'BPM_TRANS%‘;
Useful Oracle / SQL commands
• lowest
/ highest entry (timestamp) in a table
(do we have current data from BPM)
SQL> select min(sampletime) from bpm_trans;
SQL> select max(sampletime) from bpm_trans;
MAX(SAMPLETIME)
--------------1371117323
• how
to convert 1371117323 to a human readable date and time
http://www.epochconverter.com/
Useful Oracle / SQL commands
• newest
(timestamp) 10 entries in a table
SQL > select * from bpm_trans where rownum < 10
order by sampletime desc ;
• date and time in a SELECT statement
SQL> delete from pm_catalog where pm_entity='M_MR01F1_F' and
pm_creation_date=to_date('2013-01-14 10:18:27', 'yyyy-mm-dd
hh:mi:ss‘);
Useful Oracle / SQL commands
• number
of entries per transaction (from profile db)
SQL> select internal_transaction_id, count(*) as cnt from
bpm_trans group by internal_transaction_id having count(*) > 1;
INTERNAL_TRANSACTION_ID
CNT
----------------------- ---------6
4181
11
4188
SQL> select INTERNAL_TRANSACTION_ID, TRANSACTION_NAME from
transactions_dim ;
INTERNAL_TRANSACTION_ID TRANSACTION_NAME
----------------------- -----------------------------6
Step 2 - SSO
11
SG_Step_1_KoeJe
Useful Oracle / SQL commands
• find
the SQL command executed by a certain process
SQL> select sql_id,schemaname,osuser from v$session where sql_id
<> ' ';
SQL_ID
USERNAME
SCHEMANAME
OSUSER
------------- ------------------------------ ------------------------------ -------7asy8fd1291jn SYSTEM
SYSTEM
root
bsjf3qxa0bqgv SYS
SYS
oracle
f5u5tbj17bhr7 BSM910RTSM
BSM910RTSM
root
c5brdpybgqss6
SYS
oracle
SQL> select sql_text from v$sqltext where sql_id = 'f5u5tbj17bhr7';
SQL_TEXT
---------------------------------------------------------------TRUNCATE TABLE TOPOLOGY_CHANGES_1 REUSE STORAGE
Power Points will be uploaded to
http://rndwiki.atlanta.hp.com/confluence/display/bsmtrouble/BSM+Support+Te
am+Troubleshooting+Page
You can also download them from the Virtual Room now