Friday, September 28, 2012

ORA-27121: unable to determine size of shared memory segment


Installing Oracle 10G on Ubuntu this morning...
Got the following error:
Code:
ERROR:
 
ORA-01034: ORACLE not available
 
ORA-27121: unable to determine size of shared memory segment
 
Linux Error: 13: Permission denied
This is caused by Oracle installer not setting setuid on $ORACLE_HOME/bin/oracle. To fix do:
Code:
$ cd $ORACLE_HOME/bin
$ chmod 6751 oracle

Thursday, September 6, 2012

screen - open multiple "windows" in one session, detach, reattach later.

screen

Start a screen session. Then hit space to get past the intro screen. (If you want to use screen on a remote server, SSH to the server before running screen.) Now you have a shell open in screen. Do stuff, whatever. When you want another "window"...

CTRL-a c

Create a new shell instance. Maybe you want to name the current window?

CTRL-a A

Triggers a prompt to enter a name for the window. Do stuff in your current window. Then...

CTRL-a CTRL-a

Switch back to last screen window.
CTRL-a "

Display list of screen windows. Use arrows and enter to select.
CTRL-a p

Switch to the previous screen window.
CTRL-a n

Switch to the next screen window. Now, suppose you want to shut down your laptop but not lose all the windows in your session. (Or perhaps you've SSH'ed into a server somewhere and are running screen there but now you want to close the connection.)

CTRL-a CTRL-d

Detach from screen. (If you set "autodetach on" in .screenrc, this will happen automatically when you close your terminal.) And when you want to come back and reattach to all your screen sessions?

screen -d -r

Start up screen and reattach to existing windows. If you want to close a screen window, 'exit' like you would normally. When you exit the last window, screen will close.
Note: This is how I solve the "I need to use the bathroom at this coffee shop and take the MBP with me so no one steals it but I don't want to lose all my sessions by closing my laptop" problem... :)
And to see a list of open sessions on a machine...

screen -ls
Hat tip: http://freebsd.munk.me.uk/archives/185-Improve-Your-Shell-Life-With-Scre... (thanks!)
You can create a ~/.screenrc file to specify settings and default behaviors for screen. Do a web search for examples.
My .screenrc
# Screen command settings.

autodetach on
startup_message off
defscrollback 5000
vbell_msg "* ding *"

# Fix scrolling, in case we don't want to use CTRL+a [
# Assumes xterm or a variant like OSX's xterm-color
termcapinfo xterm* ti@:te@

# Statusline (should be one-line)
hardstatus alwayslastline '%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{=b kR}[%{W}%n%f %t%?(%u)%?%{=b kR}]%{= kw}%?%+Lw%?%?%= %{g}][%{Y}%l%{g}]%{=b C}[ %D %m/%d %C%a ]%{W}'

Sunday, September 2, 2012

How To Add New Disk To The Hardware Raid Controller Without Rebooting The Server In Linux


First find out your RAID hardware as we will need appropriate OS utility to manage the same
from the same vendor. In our case it was lsi which can be managed via Megacli utility.
 [root@server 8.02.21_Linux_MegaCLI]# lspci | grep -i raid
07:00.0 RAID bus controller: LSI Logic / Symbios Logic MegaRAID SAS 2108 [Liberator] (rev 05)
Lets first install the utilty :
To do this we need to install the Megacli utility on our server Centos 6.2.
Step:1. Install the below two packages.
(downlaod from http://www.lsi.com/downloads/Public/MegaRAID%20Common%20Files/8.02.21_MegaCLI.zip) .
#rpm -ivh Lib_Utils-1.00-09.noarch.rpm
#rpm -ivh MegaCli-8.02.21-1.noarch.rpm
Step:2. By default the utility is placed at location as below..
[root@server 8.02.21_Linux_MegaCLI]# cd /opt/MegaRAID/MegaCli/
[root@server MegaCli]# ls
install.log MegaCli64 MegaSAS.log
Step:3. Run the below command before adding the brand new disk drive.
[root@server MegaCli]# /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll | grep -e “Enclosure Device ID” -e Slot
Enclosure Device ID: 252
Slot Number: 0
Enclosure Device ID: 252
Slot Number: 1
Step:4. Run the command again after injecting the new HDD in drive slot.
[root@server MegaCli]# /opt/MegaRAID/MegaCli/MegaCli64 -PDList -aAll | grep -e “Enclosure Device ID” -e Slot
Enclosure Device ID: 252
Slot Number: 0
Enclosure Device ID: 252
Slot Number: 1
Enclosure Device ID: 252
Slot Number: 3
Step:5. Now you have the following information the Enclosure Device ID: 252 and Slot Number: 3 for the newly added drive.
 Step:6. Once added the new drive will be in foreign state. Give the below command to clear the foreign status.
[root@server MegaCli]#/opt/MegaRAID/MegaCli/MegaCli64 -CfgForeign -Clear -aALL
Step:7. Add the new drive to the desired RAID level by running below command.
#/opt/MegaRAID/MegaCli/MegaCli64 -CfgLdAdd -r0 [252:3] -a0
Options:
-r1 = RAID1
252 = Enclosure Device ID
2 and 3 = Slot Number
-a0 = Adapter
In our case :
-r0 = RAID0
252 = Enclosure Device ID
3 = Slot Number
-a0 = Adapter
Step:8. tail the /var/log/messages for the new disk
sd 0:2:1:0: [sdb] Mode Sense: 1f 00 00 08
sd 0:2:1:0: [sdb] Write cache: enabled, read cache: enabled, doesn’t support DPO or FUA
sdb: sdb1 sdb2
sd 0:2:1:0: [sdb] Attached SCSI disk
Now you can use the new disk as any other normal drive.