8/1/12

CƠ SỞ DỮ LIỆU ORACLE


1.1.         CƠ SỞ DỮ LIỆU ORACLE

1.1.1.     CÀI ĐẶT ORACLE

[root@db01 ~]#yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel glibc glibc-common glibc-devel gcc gcc-c++ libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

Chỉnh sửa các tham số kernel

[root@db01 ~]#vi /etc/sysctl.conf
# make it comment
#net.bridge.bridge-nf-call-ip6tables = 0
#net.bridge.bridge-nf-call-iptables = 0
#net.bridge.bridge-nf-call-arptables = 0
# add at the last line
net.ipv4.ip_local_port_range = 9000 65500
fs.file-max = 6815744
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=4194304
net.core.wmem_max=1048576
fs.aio-max-nr = 1048576

[root@db01 ~]#sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.ip_local_port_range = 9000 65500
fs.file-max = 65536
kernel.shmall = 10523004
kernel.shmmax = 6465333657
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.core.rmem_default = 262144
net.core.wmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576

Tạo user cho oracle.

[root@db01 ~]#groupadd -g 200 oinstall

[root@db01 ~]#groupadd -g 201 dba

[root@db01 ~]#useradd -u 440 -g oinstall -G dba -d /usr/oracle oracle

[root@db01 ~]#vi /etc/pam.d/login# near line 14: add
session    required     pam_selinux.so open
session    required     pam_namespace.so
session    required     pam_limits.so
session    optional     pam_keyinit.so force revoke
session    include      system-auth
-session   optional     pam_ck_connector.so

[root@db01 ~]#vi /etc/security/limits.conf
# add at the last line
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536

[root@db01 ~]#vi /etc/profile
# add at the last line
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi


[oracle@db01 ~]$chmod 755 /usr/oracle
[oracle@db01 ~]$mkdir /usr/oracle/app
[oracle@db01 ~]$chmod 775 /usr/oracle/app
[oracle@db01 ~]$mkdir /usr/oracle/oradata
[oracle@db01 ~]$chmod 775 /usr/oracle/oradata
[oracle@db01 ~]$vi ~/.bash_profile
# add at the last line
umask 022
export ORACLE_BASE=/usr/oracle/app
[oracle@db01 ~]$ mkdir tmp
# create a temporary dir for installation

Cài đặt oracle 11g R2

[oracle@db01 ~]$cd tmp
[oracle@db01 tmp]$unzip linux.x64_11gR2_database_1of2.zip
[oracle@db01 tmp]$unzip linux.x64_11gR2_database_2of2.zip

Tiến hành cài đặt

[oracle@db01 tmp]$./database/runInstaller
a)   Trình cài đặt Oracle khởi động. Đầu tiên, nhập địa chỉ email và password để nhận thông tin từ Oracle  như security. Nhấn Next để tiếp tục.
b)   Chọn "Install database software only".

c)   Chọn "Single Instance ***".

d)  Chọn ngôn ngữ.

e)    Chọn Enterprise edition.

f)    Chọn thư mục cài đặt Oracle. Trong ví dụ này, giữ default và nhấn Next để tiếp tục

g)   Chọn mặc định và tiếp tục.

h)   Lựa chọn group cơ dữ liệu. Trong ví dụ này chọn default và tiếp tục.

i)     Nhấn Next để tiếp tục

j)     Click "Finish" nếu tất cả OK.

k)   Trình cài đặt bắt đầu, nhấn nút Finish.

l)     Màn hình sau hiển thị, sau đó mở terminal và thực thi các lệnh sau với user root.

[root@db01 ~]# /usr/oracle/oraInventory/orainstRoot.sh
Changing permissions of /usr/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /usr/oracle/oraInventory to oinstall.
The execution of the script is complete.
[root@db01~]#/usr/oracle/app/product/11.2.0/dbhome_1/root.sh
Running Oracle 11g root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /usr/oracle/app/product/11.2.0/dbhome_1
Enter the full pathname of the local bin directory: [/usr/local/bin]: # Enter
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.
m) Cài đặt hoàn thành click nút "Close".

n)   Cấu hình cho user Oracle.
[oracle@db01 ~]$vi ~/.bash_profile
# add at the last lone
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
[oracle@db01 ~]$source ~/.bash_profile
[oracle@db01 ~]$rm -rf tmp
o)  Tạo danh sách Oracle Net Listener
Create a Oracle Net Listener that is a network service on Oracle.


Nhập tên Listner mà bạn thích (tên gì cũng được)




Cấu hình hoàn thành


Bài đăng phổ biến