Friday, October 27, 2017

Oracle installer 12 on Xming copy paste keyboard problem

Was running a few Oracle Installers via SSH X tunnel forward and Xming client on local Windows 10 box. I noticed that in some installers keyboard does not work.

Its ok sometimes, but Oracle HTTP Server installer needs username and password input. Took a few days (maybe its just me), but looks like Windows Paste is mapped to a middle mouse button. I've found some hints confirming this in forum here. Although selecting and cutting did not work.

Editing still does not work, so some settings have to be changed manually after installation, but username and password can be prepared in Notepad or wherever and middle-clicked into fields. Be sure to pick exact values since its not possible to change them, they will be merged with previous Paste and you will have to run installer from the start.

Thursday, October 26, 2017

Unix (Solaris) display forwarding after user switch (su)

Using X forward via SSH, Xming client running locally on Windows box. After login to SSH with your preferred tool (Putty or SSH Secure Shell) X applications do work, but they stop working after you switch to another user.
My objective was to run Oracle Installer without having root access or Oracle user via SSH only. User is not part of DBA group and new Oracle user (ora12213) does not have X access.

bash-4.1$ xclock
Error: Can't open display: localhost:10.0

Found plenty of resources online, but all of them missing something, here is a full list of steps to make it work.

1) setup your SSH tool for X forwarding (settings, checkbox)
2) save settings and restart the tool and connection (it appears that setting is only activated after a new connection or window is opened)
3) test xclock

bash-4.1$ xclock

4) echo these variables:

-bash-4.1$ xauth list
solserv102/unix:10  MIT-MAGIC-COOKIE-1  2359b71c685cf706bf4dec49e4136558
-bash-4.1$ echo $DISPLAY

5) do the user switch with parameters, minus is essential. Username is "ora12213":

-bash-4.1$ sudo su - ora12213
Oracle Corporation      SunOS 5.11      11.2    March 2015

6) export the variables listed above, looks like error can be ignored. In most of the tested examples "xauth add" part was not working, but after user switching with su, it looks like it okayed:

-bash-4.1$ xauth add solserv102/unix:10  MIT-MAGIC-COOKIE-1  2359b71c685cf706bf4dec49e4136558
xauth:  file /export/home/ora12213/.Xauthority does not exist
-bash-4.1$ export DISPLAY=localhost:10.0

7) test the X, should be working just fine.

-bash-4.1$ xclock


Run the Solaris installer executable (it was downloaded, unzipped, moved to /stage_oracle folder, owned by DBA group):

-bash-4.1$ cd /stage_oracle/
-bash-4.1$ ./fmw_12.
Launcher log file is /var/tmp/OraInstall2017-10-26_09-46-21AM/launcher2017-10-26_09-46-21AM.log.
Checking if CPU speed is above 300 MHz.   Actual 3600 MHz    Passed
Checking monitor: must be configured to display at least 256 colors.   Actual 16777216    Passed
Checking swap space: must be greater than 512 MB.   Actual 85678 MB    Passed
Checking if this platform requires a 64-bit JVM.   Actual 64    Passed
Checking temp space: must be greater than 300 MB.   Actual 1672 MB    Passed
Preparing to launch the Oracle Universal Installer from /var/tmp/OraInstall2017-10-26_09-46-21AM
Log: /var/tmp/OraInstall2017-10-26_09-46-21AM/install2017-10-26_09-46-21AM.log


Stephen Hawking dissertation for download

Cambridge university made recently made Stepen Hawkings 1966 PhD thesis available online. Hawking was 24 when he wrote it. Due to high demand university library had issues with server load. This exceptional work is open for viewing, 51 years have passed and some theories where proven wrong, some where ahead of their time and some physicists didnt agree back then.

You can download original copy from Cambridge library repository.
An alternative copy is stored here for download.

In a statement, Hawking said that he hoped the thesis would "inspire people around the world to look up at the stars and not down at their feet," and added that everyone should have free access to all research.

Tuesday, November 1, 2016

Simple Centos unzip problem

[root@storage Bilder_JB]# unzip 
unzip:  cannot find or open, or
[root@storage Bilder_JB]# ll -h
total 12G
-rwxr-xr-x.  1 root root  12G Oct 31 17:30

Was trying to unzip large file, started with 2G, 4G, then 12G - looks like unzip has some kind of a limit. Solution is rather simple: JAVA

[root@storage Bilder_JB]# jar xvf 

Friday, July 29, 2016

Viewing csv files in Linux (custom separated)

column -t -s $'|' sSak.csv | less --chop-long-lines

Friday, July 22, 2016

Nagios custom script checklist


#cd /usr/lib64/nagios/plugins
- create script with EXIT 0/1/2  ie "check_raid_disks"
#nano /etc/nagios/nrpe.cfg
- define command[check_raid_disks]=/usr/bin/sudo /usr/lib64/nagios/plugins/check_raid_disks
#/etc/init.d/nrpe restart

* please notice that command definition includes sudo, normally nrpe scripts do not require this, but here we will be running custom executable inside our script. If sudo is not used nrpe responds with "NRPE: Unable to read output". Sudo-ers workaroud follows:

#nano /etc/sudoers (add nrpe user rule, comment out TTY requirement)
   nrpe ALL=(ALL) NOPASSWD:/usr/lib64/nagios/plugins/check_raid_disks
   # Defaults    requiretty
#setenforce 0 (disable selinux)

Nagios server

#/usr/lib64/nagios/plugins/check_nrpe -H -c check_raid_disks
#nano /etc/nagios/servers/awsdb.cfg  (server name file)
- define service{
        use                             generic-service
        host_name                       awsdb
        service_description             Raid Disks
        check_command                   check_nrpe!check_raid_disks
#/etc/init.d/nagios restart

Example script


# Exit codes

# server awsDB - virtual drives (vd's) count: 3
# server awsDB - physical drives count: 8

hds=$(/root/bin/MegaCli64 -PDList -aALL | grep state | grep Online -c)
# echo $dds

# Check for missing parameters
if [[ -z "$hds" ]]; then
  echo "Script error, check setup, environment or parameters"
  exit 2
if [[ "$hds" = "8" ]]; then
  echo "OK - virtual disk count: $hds"
  exit 0

if [[ "$hds" -lt "8" ]]; then
  echo "CRITICAL - not all disks are Online: $hds/8"
  exit 2

echo "WARNING - Script error"
exit 1

Nagios debug command notes

#/usr/lib64/nagios/plugins/check_nrpe -H -c check_cpu
#nagios -v /etc/nagios/nagios.cfg

Friday, June 10, 2016

Apex 3.2 idle session cleanup and WWV_FLOW_DATA cleanup


When users login they get a temporary 'nobody' session with a few populated variables (or many if you have public translations or custom values), after login user gets an assigned session id and starts populating WWV_FLOW_DATA with item values.


If not maintained WWV_FLOW_DATA explodes and performance degrades.
I suspect that session idle setting is not working in Apex 3.2, tested many settings and checked Apex tables - nothing changes no matter what the settings are. Sessions pile up during the day, default cache purge procedures only allow cleaning up old sessions by date, not by idle period. Thus I can only run it at night or not at all (if environment gets international).


With this query we can find sessions which had no activity for more then 4 hours:

SELECT last, userid, session_id
(SELECT to_char(max(time_stamp),'DDMMYYYY HH24:MI') last, userid, session_id, max(time_stamp) mx
FROM apex_030200.wwv_flow_activity_log1$ l
--where userid = 'ADAM'
WHERE exists (select 1 from apex_030200.wwv_flow_sessions$ s where id = l.session_id)
GROUP BY userid, session_id
WHERE mx < sysdate-4/24;

Was digging Apex 3.2 packages for a couple of hours looking for a procedure to logout or cleanup. Looks like they where only introduced in 4.1. All the existing procedures are relying on Cookie values or session variables which I was not able to set manually.
Eureka moment. Even though Apex packages are wrapped - there was a comment or piece of code visible, that cleanup procedures simply delete from the views. So likely there are some instead triggers running which do the job.


1) grant delete on apex_030200.wwv_flow_sessions$ to ;
2) Create procedure in your schema:

create or replace procedure "S_CLEAR_SESSIONS"
  n NUMBER := 0;
  FOR c IN (SELECT last, userid, session_id
              (SELECT to_char(max(time_stamp),'DDMMYYYY HH24:MI') last, userid, session_id, max(time_stamp) mx
               FROM apex_030200.wwv_flow_activity_log1$ l
               --where userid = 'ADAM'
               WHERE exists (select 1 from apex_030200.wwv_flow_sessions$ s where id = l.session_id)
               GROUP BY userid, session_id
            WHERE mx < sysdate-4/24
            SELECT last, userid, session_id
              (SELECT to_char(max(time_stamp),'DDMMYYYY HH24:MI') last, userid, session_id, max(time_stamp) mx
               FROM apex_030200.wwv_flow_activity_log1$ l
               WHERE nvl(userid,'nobody') = 'nobody'
               AND exists (select 1 from apex_030200.wwv_flow_sessions$ s where id = l.session_id)
               GROUP BY userid, session_id
            WHERE mx < sysdate-1/24
    ---htp.p('dead session: '||c.userid || ' sess: '||c.session_id);
    DELETE FROM apex_030200.wwv_flow_sessions$
    WHERE id = c.session_id;

3) Run the procedure:


select count(*) from apex_030200.wwv_flow_data;

Returns 130364

begin S_CLEAR_SESSIONS(); end;
select count(*) from apex_030200.wwv_flow_data;

Returns 129318

And thats only while writing this article. My first drop was from 1300000 items to just 200000, then added a shorter 'nobody' session killer as you can see in the code.


Nightly cleanup used to look like this:

Implemented a session cleanup at 15:00:

And here is one more from couple of days later when I added 1 hour grace period for all 'nobody' sessions independent of their activity: