Rabu, 24 Oktober 2012

Startup dan Shutdown Instance in Oracle

Startup dan Shutdown Instance in Oracle

Administration (activity) that we can do in the instance is startup, shutdown, and alter. In general, the startup process is as follows:

1. Database off (shutdown)
Background process has not gone up. Memory has not been allocated
2.  Nomount
Backgroung process is increased. Memory allocated
3. Mount
Instance reading the control file. Control file contains the configuration database. Instance has not read the data file.
4 Open
Instance already read the data file (header). Database readily accessible




 Command Startup

startup
startup open
startup nomount
startup mount
startup force



Command "startup" without argument, by default is "startup open"
Command "startup force" is just the same with "shutdown abort" and then "startup"


 Command Shutdown

shutdown normal
shutdown transactional
shutdown immediate
shutdown abort


Here is a comparison of the shutdown process normal (N), transactional (T), immediate (I), and abort (A):


Proses Shutdown
AITN
Allowed new connection No No No No
wait until all sessions disconnect No No No Yes
wait until all transactions are complete No No Yes Yes
perform checkpoint and close file No Yes Yes Yes


reference : http://rohmad.net/2008/05/14/startup-dan-shutdown-instance/

Jumat, 12 Oktober 2012

Instalasion Oracle 11g on RHEL 5

Oracle Database DBMS is one of today's popular and widely used by large companies to run their business. This time I try to share how to install Oracle DBMS on RHEL 5 operating system (Redhat Enterprise Linux 5). Well actually the principle of oracle installation on linux and in windows is almost no difference. It's just to install oracle on linux we need to configure some parts manually.

Minimum hardware requirements:

32-bit (x86)
  • x86 CPU
  • 1 GB RAM
  • 10 GB ruang disk (3.5 GB for the Oracle software + 1.5 GB for the database + 3 GB for OEL5 + 2 GB swap)
64-bit (x86_64)
  • x86_64 CPU
  • 1 GB RAM
  • 10.5 GB ruang disk (4 GB for the Oracle software + 1.5 GB for the database + 3 GB for OEL5 + 2 GB swap)
Note: Linux and Oracle must be installed on the same architecture. This means that 32-bit Oracle will only be able to run on Linux 32-bit as well as 64-bit Oracle will only run on 64-bit Linux. Well there is a trick to install Oracle, the calculation of the size of the swap space is usually adjusted to the size of the RAM in order to avoid bottlenecks. Here is a comparison of the size of the swap to the size of RAM.
  • Between 1024 MB and 2048 MB, swap = 2x RAM
  • Between 2049 MB and 8192 MB, swap = 1.5x RAM
  • Above 8192 MB, swap = 0.75x RAM.
 To see the size of the swap, can use the following command:
[root@localhost ~]# grep SwapTotal /proc/meminfo
 SwapTotal:     2096472 kB
The assumption this time is on the computer we have installed RHEL 5 32-bit. So straight to step Oracle installation :)
Well, to check if we are using a Linux 32-bit or 64-bit version of the kernel you can check by using the command

#Output dari Linux 32-bit
[root@localhost ~]# uname -r
2.6.18-128.el5
# Output dari Linux 64-bit
[root@localhost ~]# uname -r
2.6.18-8.el5 x86_64

1. Installing the required packages
To Install Oracle on linux, in requiring the package is not installed by default on linux. There are some differences in the packages that need between 32-bit and 64-bit.

32-bit
The following are thre required packages before installing Oracle on Linux-32bit. Version the package can be more or equal to what written in the following list.
  • compat-libstdc++-33-3.2.3-61
  • elfutils-libelf-0.125-3.el5
  • elfutils-libelf-devel-0.125-3.el5
  • glibc-2.5-12
  • glibc-devel-2.5-12
  • glibc-common-2.5-12
  • gcc-4.1.1-52.el5
  • gcc-c++-4.1.1-52.el5
  • kernel-headers
  • libgcc-4.1.1-52.el5
  • libaio-0.3.106-3.2
  • libaio-devel-0.3.106-3.2
  • libstdc++-4.1.1-52.el5
  • libstdc++-devel-4.1.1-52.el5
  • unixODBC-2.2.11-7.1
  • unixODBC-devel-2.2.11-7.1
  • sysstat-7.0.0-3.el5
  • binutils-2.17.50.0.6-2.el5
  • make-3.81-1.1
To install the package, insert the DVD from RHEL5 installer then navigate our working directory on the DVD in the Server folder.


[root@localhost ~]# cd /media/RHEL_5.3\ i386\ DVD/

[root@localhost RHEL_5.3 i386 DVD]# cd Server/

[root@localhost Server]# rpm -ivh elfutils-libelf-devel* glibc-devel-2* glibc-headers-2* gcc-4* libgomp-4* gcc-c++-4* libstdc++-devel-4* compat-libstdc++-33* libaio-devel* sysstat* unixODBC*

Or you can also use the command yum. Installing packages using yum will be easier, because all the package dependencies automatically be directly installed.

[root@localhost ~]# yum install elfutils-libelf-devel* glibc-devel-2* glibc-headers-2* gcc-4* libgomp-4* gcc-c++-4* libstdc++-devel-4* compat-libstdc++-33* libaio-devel* sysstat* unixODBC*  

64-bit
The following are the required packages before installing Oracle on Linux 32-bit. In general almost the same, but there are some differences. For how to install the package can follow with an additional 32-bit package is needed. List packages that are required are as follows:  

  • binutils-2.17.50.0.6
  • compat-libstdc++-33-3.2.3
  • compat-libstdc++-33-3.2.3 (32 bit)
  • elfutils-libelf-0.125
  • elfutils-libelf-devel-0.125
  • gcc-4.1.1
  • gcc-c++-4.1.1
  • glibc-2.5-12
  • glibc-2.5-12 (32 bit)
  • glibc-common-2.5
  • glibc-devel-2.5
  • glibc-devel-2.5-12 (32 bit)
  • libaio-0.3.106
  • libaio-0.3.106 (32 bit)
  • libaio-devel-0.3.106
  • libgcc-4.1.1
  • libgcc-4.1.1 (32 bit)
  • libstdc++-4.1.1
  • libstdc++-4.1.1 (32 bit)
  • libstdc++-devel 4.1.1
  • make-3.81
  • sysstat-7.0.0

Configuration Linux for Oracle
Once all the required packages installed, it is now time to configure Linux to be installed oracle 

Make direktori
Create a directory in which the location of the Oracle DBMS will be placed. For example we will place the directory oracle / oracle / oracle11g
[root@localhost ~]# mkdir -p /app
[root@localhost ~]# mkdir -p /app/oracle11g
[root@localhost ~]# chown -R oracle:oinstall /app/oracle11g
[root@localhost ~]# chmod -R 775 /app

Configure the Linux kernel parameters
Oracle Database 11g requires minimum kernel parameter settings as below. But if the setting previously possessed greater value then do not need to be changed. Usually RHEL 5 is defining kernel.shmall and kernel.shmmax. No need to restart the computer after you change the kernel parameter values​​.
kernel.shmall = 2097152
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
net.core.rmem_default=4194304
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=262144

Use the following command to change the parameters of the Linux kernel
vi /etc/sysctl.conf <<EOF

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default=262144

kernel.shmmni = 4096

kernel.sem = 250 32000 100 128

fs.file-max = 65536

net.ipv4.ip_local_port_range = 1024 65000

net.core.rmem_default=4194304

net.core.wmem_default=262144
net.core.rmem_max=4194304

net.core.wmem_max=262144

EOF

In order for these settings can be used, just use the command sysctl-p
Setting shell limits for user oracle 
Change the file /etc/security/limits.conf and add the following line:

oracle    soft  nproc  2047
oracle    hard  nproc  16384
oracle    soft  nofile  1024
oracle    hard  nofile  65536

Change the file /etc/pam.d/login and add the following line:
session required pam_limits.so
Change /etc/profile and add the following line:

if [ \$USER = "oracle" ]; then
 if [ \$SHELL = "/bin/ksh" ]; then
 ulimit -p 16384
 ulimit -n 65536
 else
 ulimit -u 16384 -n 65536
 fi
 umask 022
fi
Change the file /etc/csh.login and add the following line:
if ( \$USER == "oracle" ) then
 limit maxproc 16384
 limit descriptors 65536
 umask 022
endif
Create user dan group Oracle
The next stage is to create a group on Linux and the user that will be used to install and maintain Oracle database. Users will be created is a group oracle oinstall and dba
#groupadd oinstall -g 200
#groupadd dba -g 201
#useradd -u 200 -g dba -G oinstall -s /bin/bash oracle
#passwd oracle
Changing password for user oracle.
New UNIX password: *****
BAD PASSWORD: it is based on a dictionary word
Retype new UNIX password: *****
passwd: all authentication tokens updated successfully.

Configuring Oracle environment 
The last and not least no setting oracle environment, so that the oracle user can easily use the features in oracle. The trick is to add the following script into the file / home / oracle / .bash_profile 
login with TUI, 
su - oracle

vi .bash_profile
export EDITOR=vi
export ORACLE_SID=orcl
export ORACLE_BASE=/app/oracle11g
export ORACLE_HOME=/app/oracle11g/product/11.2.0/db
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PAT=$PATH:$ORACLE_HOME/bin:usr/bin:/usr/sbin:/usr/local/bin
:/usr/X1146/bin
unmask 022
set -o vi 
Download dan Ekstrak Oracle Installer 
Oracle can be downloaded for free on the Oracle Web site development and testing license. However, Oracle does not provide support for this linsensi. For more details about the license can be viewed on OTN. 

[root@localhost ~]# mkdir OraInstaller
[root@localhost ~]# cd OraInstaller
[root@localhost OraInstaller]# cd unzip linux_11R2_database_1of2.zip
[root@localhost OraInstaller]# cd unzip linux_11R2_database_2of2.zip
[root@localhost OraInstaller]# chown -R oracle database/
[root@localhost OraInstaller]# chmod 777 -R database



Instalasi Oracle
Well, it's time to install the oracle. Do not forget to use the GUI in this session, as required for installation. To install Oracle, log in as oracle and go to the directory where the installer is the location and run the installer.
[oracle@localhost ~]$ cd /root/OraInstaller/database


[oracle@localhost database]$ ./runInstaller
 
Step 1 installation Oracle
 Step 2 installation Oracle
Step 3 installation Oracle 


 Step 4 installation Oracle 
Step 5 installation Oracle 

 Step 6 installation Oracle  
 
 Step 7 installation Oracle  

 Step 8 installation Oracle  

 Step 9 installation Oracle  

 Step 10 installation Oracle  

 Step 11 installation Oracle  
  
Don't Klik OK 
At the last stage, run the script that must run as root. Then think about the result will be like below:

[oracle@localhost database]$ su - root
Password:
[root@localhost ~]# cd /app/oraInventory
[root@localhost oraInventory]# ./orainstRoot.sh
Changing permissions of /home/oracle/app/oraInventorya.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.

Changing groupname of /app/oraInventory to oinstall.
The execution of the script is complete.
[root@localhost oraInventory]# cd /app/oracle/product/11.2.0/dbhome_1/
[root@localhost dbhome_2]# ./root.sh
Running Oracle 11g root.sh script...

The following environment variables are set as:
             ORACLE_OWNER= oracle
             ORACLE_HOME=  /app/oracle/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...

Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
          
After run the above script, then klik ok

Now Oracle have been configuration and ready to use
good luck guys :-)

reference : 
http://www.oracle.com/technetwork/articles/smiley-11gr1-install-092791.html