Sunday, June 15, 2014

Scan and Add SAN disks in Linux (Redhat & Centos) without reboot

This small guide will try to explain how to scan and add SAN disks to a Centos / Redhat server. To detect new disks that been added (zoned) to the server run the following commands.
for i in `seq 0 10`; do echo 1 > /sys/class/scsi_device/device$i/scan; done
for i in `seq 0 10`; do echo "- - -" > /sys/class/scsi_host/host$i/scan; done
The commands will loop thru all scsi_devices and activate a rescan. Note: if scsi_host does not exists, use fc_host instead.

If you have the sg3_utils package installed you can run this instead:
/usr/bin/rescan-scsi-bus.sh -l
But then LUN0 must be the first mapped logical unit for it to work.

To see the newly scanned disks run:
lsscsi 
or
fdisk -l 


If you are using multipath i also recommend you to run this to force a devmap reload:
multipath -r


Check that the new disks shows up with:
multipath -l


Now we can proceed with creating a LVM volume on those disks.

Show locks in a Netezza Database

This SQL statement when run in Aginity or nzsql will show you all sessions that cause locks in a database.
select sessionid, 
       clientip,
       username, 
       relname as table_name, 
       requesttime as lock_request_time,
       granttime as lock_acquired_time, 
       command as sql, 
       lockstate  
from _t_pg_locks 
where relid in ( select relid from _t_pg_locks where lockstate='WAIT') 
order by requesttime, granttime
To kill a session / transaction you can simply right click it under current sessions in Netezza Administrator.

Monday, May 26, 2014

Unlock APEX admin user (when apxchpwd.sql doesn't work)

First we need to find the Apex admin accounts user_id. We do that with the following statement.
You might have two. Mine was the second one
select user_id from APEX_040200.WWV_FLOW_FND_USER where user_name = 'ADMIN' order by last_update_date desc;

Set a new password for the Apex Admin with the user_id we selected.
update APEX_040200.WWV_FLOW_FND_USER
set web_password = 'password'
where user_name = 'ADMIN'
and user_id = 56502607595642;
commit;

Then we unlock the Admin account with this statement.
alter session set current_schema = APEX_040200;
begin
wwv_flow_security.g_security_group_id := 10;
wwv_flow_fnd_user_api.UNLOCK_ACCOUNT('ADMIN');
commit;
end;

Saturday, January 11, 2014

Install Oracle Data Modeler 4.0 on Ubuntu 14.04

This little HOW-TO will explain how to install Oracle's Data Modeler 4.0 on Ubuntu 14.04
First download the Oracle Data Modeler 4 rpm from Oracle's website http://www.oracle.com

Install alien to be able to convert .rpm packages to .deb
sudo apt-get install alien

Convert and install the Data Modeler 4 .rpm
This way you will be able to link the program on the launcher
sudo alien --scripts datamodeler-4.0.*.rpm 
sudo dpkg -i datamodeler_4.0.*.deb 

Fix an install bug and the startscript for Data Modeler so it won't crash on startup

Edit /usr/local/bin/datamodeler and add:
unset -v GNOME_DESKTOP_SESSION_ID to the first line in the start script.
sudo touch /opt/datamodeler/datamodeler/types/defaultdomains.xml
sudo chown username.username /opt/datamodeler/datamodeler/types/defaultdomains.xml
sudo vi /usr/local/bin/datamodeler
Done! Now you can find and start it in unity!
Web Analytics