Showing posts from February, 2012

Oracle Partitioning

Oracle 11g R2 supports automatic partition management.
Creating Partitions

White paper

Mounting Red Hat LVM on Ubuntu

$ sudo apt-get install lvm2
$ sudo modprobe dm-mod

Scan your system for LVM volumes:
$ sudo vgscan

Activate the volume:
$ sudo vgchange -ay vg_troylt

Find the logical volume under LV column:
$ sudo lvs
LG VG ...
lv_root vg_troylt ...

Create a mount point for that volume:
$ sudo mkdir /mnt/rh_linux

Mount it:
$ sudo mount /dev/vg_troylt/lv_root /media/rh_linux -o ro,user

Oracle Unbreakable Linux (Red Hat Enterprise)

When installing, put the GRUB1 bootload onto the same partition or it will replace the Ubuntu GRUB2 bootloader.

When launching enter 'c' at grub menu to go into command line. Enter chainloader (hd0, and hit tab to list the partition options.

Select the Red Hat partition # (label it for easy identification) and close the command with )+1

chainloader (hd0, msdos4)+1

The firewall is not open for port 1521.
Make sure to set ORACLE_HOME and ORACLE_HOME_LISTENER in oracle .bash_profile
Use dbstart and dbshut to start and shutdown the database
Have to edit /etc/hosts to associate the host name and IP address, have to update it when DHCP changes.
Have to edit tns listener config file to point to the correct hostname or IP or it won't start.

Customizing Grub2 menu:
Add: menuentry "Redhat" {
insmod ext2
set root=(hd0,3)
linux /boot/vmlinuz-2.6.32-24-generic root=/dev/sda3 ro
initrd /boot/initrd.img-2.6.32-24-generic

Update grub2 menu:
sudo update-grub


Oracle Kill Sessions

Disconnect sessions:

select * from v$session; --single node
select * from gv$session; --RAC, multi-node

alter system kill session 'sid,serial#';BEGIN FOR c IN ( SELECT s.inst_id, s.sid, s.serial#, p.spid, s.username, s.program, s.machine, s.process, s.status, s.schemaname FROM gv$session s JOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id WHERE s.type != 'BACKGROUND' and s.USERNAME='SOME USER NAME' ) LOOP EXECUTE IMMEDIATE 'alter system kill session ''' || c.sid || ',' || c.serial# || ''''; END LOOP; END;

Oracle 11g on Ubuntu 11.10