Dec 9, 2010

Ubuntu Grub Error 17 Solution

  1. Boot your computer up with Ubuntu CD
  2. Open a terminal window or switch to a tty.
  3. Go SuperUser (that is, type "sudo -s"). Enter root passwords as necessary.

  4. Type "grub"
  5. Type "find /boot/grub/stage1". You'll get a response like "(hd0,1)". Use whatever your computer spits out for the following lines.
  6. Type "root (hd0,1)", or whatever your hard disk + boot partition numbers are for Ubuntu.
  7. Type "setup (hd0)", to install GRUB to MBR, or "setup (hd0,1)" or whatever your hard disk + partition nr is, to install GRUB to a partition.
  8. Quit grub by typing "quit".
  9. Reboot and remove the bootable CD.
important files to change
/etc/fstab
/boot/grub/menu.lst
/boot/grub/device.map

hd0 will be the boot disk setted in fdisk

Nov 23, 2010

Change Ubuntu Server to Static IP Address

open up the /etc/network/interfaces file

sudo nano /etc/network/interfaces

Add the following setting:

auto eth0
iface eth0 inet static
address 192.168.1.100 <-- static ip netmask 255.255.255.0 <-- Netmask network 192.168.1.0 <-- Network, should be your gateway IP with last digit = 0 broadcast 192.168.1.255 <-- Network, should be your gateway IP with last digit = 255 gateway 192.168.1.1 <-- Gateway set the DNS :

sudo nano /etc/resolv.conf

On the line ‘name server xxx.xxx.xxx.xxx’ replace the x with the IP of your name server.

restart the network configuration :

sudo /etc/init.d/networking restart

Oct 7, 2010

Installing Oracle 11g on Ubuntu by fine tune kernel parameter

To install Oracle 11g, some of the kernel parameter needs to be fine tuned :

1) Open /etc/sysctl.conf and insert the following data :

kernel.sem = 250 32000 100 128
kernel.shmmax = 536870912
fs.file-max = 6815744
fs.aio-max-nr = 1048576

net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576

net.ipv4.ip_local_port_range = 9000 65500

run sudo /etc/sysctl -p


2) Open /etc/limits.conf and insert the following :

ges hard nofile 65536
ges soft nofile 65536
ges hard nproc 16384

Aug 11, 2010

HP UX CIFS (SAMBA) Mount to Windows

cd /opt/cifsclient/bin
cifsclient start

cifsmount //{Window-Server-Name}/{Shared-Folder} /{Mount-Point} -U {WINDOW-USER}

you need to set the Window-Server-Name & IP in the /etc/hosts, Window-Server-Name should be the Computer name of the Window.

Aug 4, 2010

Oracle 10g RMAN Delete archive log

export ORACLE_SID=
rman

RMAN > CONNECT TARGET /
RMAN > CROSSCHECK archivelog all;
RMAN > list archivelog all;
RMAN > delete archivelog until sequence=1236;

RMAN > Delete archivelog until time 'sysdate-1'; //Delete archive log before today

To Run RMAN in Scripts :

Prepare a sh script file & a command file :

sample script :
export ORACLE_SID={SID}
rman target / @cmdfile.txt


sample command file :
RUN {
delete archivelog until time 'sysdate-2';
}
EXIT;

Add the scripts to Crontab

Aug 3, 2010

Enabling ARCHIVELOG Mode

Lets start by checking the current archive mode.

SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE
------------
NOARCHIVELOG


SQL> startup mount
ORACLE instance started.

Total System Global Area 184549376 bytes
Fixed Size 1300928 bytes
Variable Size 157820480 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.

SQL> alter database archivelog;
Database altered.

SQL> alter database open;
Database altered.


Jul 20, 2010

install sun java in ubuntu 10.04

1. Enable access to the partner repository (replace nano with gedit in a desktop environment)

sudo nano /etc/apt/sources.list
Save and Exit nano (Ctrl+o+Ctrl+x)

2. Update the package manager to let it know of the packages available in the Partner Repository.

sudo aptitude update

3. Search to see what Sun packages are available

sudo aptitude search sun

4. Install the packages you'd like on your system.

sudo aptitude install sun-java6-jdk

for the JDK (which has it's own JRE)

sudo aptitude install sun-java6-jre

for the JRE

sudo aptitude install sun-java6-plugin

for the Mozilla Firefox Plug-in



Jul 11, 2010

How to Install a VNC Server in Ubuntu

1) Download vnc4server and xinetd:
sudo apt-get install vnc4server xinetd

2) Start the vnc4server:
vnc4server

You will be prompted for a password. This password will be used to log into the VNC session.

3) Stop the vnc4server
vnc4server -kill :

4) Open the .vnc/xstartup file for editing:
gedit ~/.vnc/xstartup

The file will look like:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
#unset SESSION_MANAGER
#exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey
vncconfig -iconic &
xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
twm &

5) Change the .vnc/xstartup file and save it.

Uncomment the lines that start with unset and exec. Comment out the lines that start with xsetroot, vncconfig, xterm and twm.

The final file should look like:
#!/bin/sh
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
#xsetroot -solid grey
#vncconfig -iconic &
#xterm -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" &
#twm &


6) Change the permissions on the /etc/X11/xinit/xinitrc file to make it executable:
sudo chmod 755 /etc/X11/xinit/xinitrc

7) Start the vnc4server:
vnc4server

Again, remember the after the colon (:).

8) Log into your remote desktop to check the configuration:
vncviewer Host-IP:

Mar 4, 2010

Start up & Shut Down Oracle

After Install Oracle, go to $ORACLE_HOME/bin

run :

$ export ORACLE_SID={ORACLE_SID}
$ sqlplus /nolog

SQL*Plus: Release 10.2.0.1.0 - Production on Thu Mar 4 16:21:17 2010

Copyright (c) 1982, 2005, Oracle. All rights reserved.

SQL> connect system/manager as sysdba

**Note: if you prompted this error, means you didn't set the ORACLE_SID :
ORA-12162: TNS:net service name is incorrectly specified

To shutdown database :

SQL> shutdown immediate


To startup database :

SQL> startup

Java Hello Word

1) Download JDK
Just download SUN JDK from http://java.sun.com/javase/downloads/index.jsp
Choose the latest version of JDK, download and install to your PC.

2) Test JDK
You may now test the JDK to make sure you have installed it correctly.
Open your Command Prompt, and type : java -version
This command will show you the java version installed in your PC.

3) Hello World
Yes, hello world again... Open your note pad or other writing software, type in the following :

public class HelloWorld {
public static void main (String[] args) {
System.out.println("Hello, world!\n");
}
}

Save it as HelloWorld.java in a particular folder, let say in C:\Java

4) Compile & Run
Open Command Prompt again, and change directory to C:\Java.
Type : javac HelloWorld.java (To Compile the source)
A HelloWorld.class file will be generated in
C:\Java
Type : java HelloWorld (To Run the class file)

You will see this on the Command Prompt :

Hello, world!






Mar 3, 2010

Oracle to run SQL as script without consider define

To run Oracle sql as script without consider the parameter that starts with "&", just add this before the script :

set def off;

Mar 2, 2010

Oracle 10g SPFILE corrupted

the SPfile is in binary format, if you edit it and save accidentally, your database will not able to startup with the normal startup command.

if you are on unix,

$ cd $ORACLE_HOME/dbs
$ strings spfilename temp_pfile.ora

edit the temp_pfile.ora, clean it up if there is anything "wrong" with it.

then

SQL> startup pfile={FULL-PATH}temp_pfile.ora
SQL> create spfile from pfile;
SQL> shutdown
SQL> startup


Remember to backup your spfile.

Parameter values can only be modified with ALTER SYSTEM that will work after the STARTUP
command
. For example :

SQL> alter system set max_enabled_roles=20 scope=spfile;

Mar 1, 2010

Direct and Asynchronous I/O - Oracle 10g

I/O operations in UNIX and Linux systems typically go through the file system cache. Although this doesn't represent a problem in itself, this extra processing does require resources. Bypassing the file system cache reduces CPU requirements, and frees up the file system cache for other non-database file operations. Operations against raw devices automatically bypass the file system cache.

When a synchronous I/O request is submitted to the operating system, the writing process blocks until the write is complete before continuing processing. With asynchronous I/O, processing continues while the I/O request is submitted and processed. This allows asynchronous I/O to bypass some of the performance bottlenecks associated with I/O operations.

Oracle can take advantage of direct I/O and asynchronous I/O on supported platforms using the FILESYSTEMIO_OPTIONS parameter, whose possible values are listed below.
  • ASYNCH - Enabled asynchronous I/O where possible.
  • DIRECTIO- Enabled direct I/O where possible.
  • SETALL- Enabled both direct I/O and asynchronous I/O where possible.
  • NONE - Disabled both direct I/O and asynchronous I/O.
The following example shows how the parameter is set.

SQL> SHOW PARAMETER FILESYSTEMIO_OPTIONS

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
filesystemio_options string none
SQL> ALTER SYSTEM SET FILESYSTEMIO_OPTIONS=SETALL SCOPE=SPFILE;

System altered.

SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> STARTUP
ORACLE instance started.

Total System Global Area 926941184 bytes
Fixed Size 1222672 bytes
Variable Size 239077360 bytes
Database Buffers 683671552 bytes
Redo Buffers 2969600 bytes
Database mounted.
Database opened.
SQL> SHOW PARAMETER FILESYSTEMIO_OPTIONS

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
filesystemio_options string SETALL
SQL>

also need to alter :

SQL> alter SYSTEM set disk_asynch_io=FALSE SCOPE=SPFILE;

SQL> alter system set dbwr_io_slaves=1 scope=spfile;

Jan 28, 2010

Shrinking the size of the undo tablespace

-- Create a new undo tablespace with smaller size.
SQL> create undo tablespace UNDO_SMALL datafile ''undo-small.dbf' size
100m;
-- Set new tablespace as undo_tablespace.
SQL> alter system set undo_tablespace=UNDO_SMALL;
-- Drop the old tablespace.
SQL> drop tablespace UNDO_LARGE including contents;

The drop command may give ORA-30013 until existing transactions commit
or rollback.

Install Oracle on HPUX 11.11

There is a problem to install Oracle 10g on HP UX that running on command mode, because Oracle 10g installer will need to run on X-Window.

1) Download the XManager : http://www.netsarang.com

2) Install XManager to any PC, this PC has to be accessible by the HPUX.

3) telnet to your HP UX, type the following :

export DISPLAY={IP address of the PC that installed with XManager}:0.0

4) set oracle home and other path, pls follow the Oracle Installation Guide

5) run the installer :
./runInstaller

Jan 12, 2010

Change Screen Resolution For Ubuntu Running On VirtualBox

1) Devices->Install Guest Additions and your virtual Ubuntu should recognize a new CD. Open a terminal and run this command:

sudo /media/cdrom/VBoxLinuxAdditions.run

2)
Open your guest machine’s xorg.conf file:

gksu gedit /etc/X11/xorg.conf

Find the device section, which should look like this:

Section "Device"
Identifier "Configured Video Device"
EndSection

Replace to :

Section "Device"
Identifier "Configured Video Device"
Driver "vboxvideo"
EndSection

3) Find the code like this :

Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
Device "Configured Video Device"
EndSection

replace with :

Section "Screen"
Identifier "Default Screen"
Device "VirtualBox graphics card"
Monitor "Generic Monitor"
DefaultDepth 24
SubSection "Display"
Depth 24
Modes "1024x768"
EndSubSection
EndSection

4) Save the file, and restart your Virtual box.