工具:xshell,VMware workstation12
os:Centos6.5 磁盤40G內存2G,swap分4G,剩餘給/
關於如何安裝Centos6.5:http://blog.csdn.net/ssrmygod/article/details/70037780
意外情況:centos安裝完成後右鍵桌面沒有open in terminal
於是xshell連接進去
[root@mygod ~]# mkdir -p /media/cdrom
[root@mygod ~]# mount /dev/cdrom/media/cdrom
mount: block device /dev/sr0 iswrite-protected, mounting read-only
[root@mygod ~]# cd /etc/yum.repos.d/
[root@mygod yum.repos.d]# ls
CentOS-Base.repo CentOS-Debuginfo.repo CentOS-Media.repo CentOS-Vault.repo
[[email protected]]# rm -rf C*
[root@mygod yum.repos.d]# ls
[root@mygod yum.repos.d]# vi mygod.repo
[root@mygod yum.repos.d]# cat mygod.repo
[mygod]
name=mygod
baseurl=file:///media/cdrom
enabled=1
gpgcheck=0
[root@mygod yum.repos.d]#
[root@mygod yum.repos.d]# yum clean all
Loaded plugins: fastestmirror,refresh-packagekit, security
Cleaning repos: mygod
Cleaning up Everything
[root@mygod yum.repos.d]# yum repolist
Loaded plugins: fastestmirror,refresh-packagekit, security
Determining fastest mirrors
mygod | 4.0 kB 00:00 ...
mygod/primary_db | 4.4 MB 00:00 ...
repo id reponame status
mygod mygod 6,367
repolist: 6,367
[root@mygod yum.repos.d]# yum -y installnautilus-open-terminal
Loaded plugins: fastestmirror,refresh-packagekit, security
Loading mirror speeds from cached hostfile
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Packagenautilus-open-terminal.x86_64 0:0.17-4.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
===================================================================================================
Package Arch Version Repository Size
===================================================================================================
Installing:
nautilus-open-terminal x86_64 0.17-4.el6 mygod 63 k
Transaction Summary
===================================================================================================
Install 1 Package(s)
Total download size: 63 k
Installed size: 202 k
Downloading Packages:
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : nautilus-open-terminal-0.17-4.el6.x86_64 1/1
Verifying :nautilus-open-terminal-0.17-4.el6.x86_64 1/1
Installed:
nautilus-open-terminal.x86_64 0:0.17-4.el6
Complete!
[root@mygod yum.repos.d]#
然後圖像化界面logout一下
然後正常了。
檢查是否缺少rpm包
[root@mygod ~]# rpm -q binutilscompat-libstdc++-33 elfutils-libelf elfutils-libelf-devel expat gcc gcc-c++glibc glibc-common glibc-devel glibc-headers libaio libaio-devel libgcc libstdc++libstdc++-devel make pdksh sysstat unixODBC unixODBC-devel | grep "notinstalled"
package pdksh is not installed
[root@mygod ~]#
pdksh 這個包不重要,可以忽略
修改hosts
[root@mygod yum.repos.d]# cat/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=mygod
GATEWAY=192.168.158.1
[root@mygod yum.repos.d]# vi /etc/hosts
[root@mygod yum.repos.d]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.158.10 mygod
[root@mygod yum.repos.d]# ifconfig
eth0 Link encap:Ethernet HWaddr00:0C:29:A9:DA:9A
inet addr:192.168.158.10 Bcast:192.168.158.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fea9:da9a/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1255 errors:0 dropped:0 overruns:0 frame:0
TX packets:776 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:116943 (114.2 KiB) TXbytes:111461 (108.8 KiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:112 errors:0 dropped:0 overruns:0 frame:0
TX packets:112 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:8372 (8.1 KiB) TXbytes:8372 (8.1 KiB)
[root@mygod yum.repos.d]#
若要修改網絡配置,加亮的是重點
[root@mygod ~]# cat/etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=bfb136a7-c026-4e49-a00a-d104d1cf7a3b
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static
HWADDR=00:0C:29:A9:DA:9A
IPADDR=192.168.158.10
PREFIX=24
GATEWAY=192.168.158.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
[root@mygod ~]#
[root@mygod ~]# service network restart
關閉防火牆和selinux
[root@mygod ~]# service iptables stop
iptables: Setting chains to policy ACCEPT:filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@mygod ~]# chkconfig iptables off
[root@mygod ~]# vi /etc/selinux/config
[root@mygod ~]# cat /etc/selinux/config
# This file controls the state of SELinuxon the system.
# SELINUX= can take one of these threevalues:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these twovalues:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
修改/etc/sysctl.conf
[root@mygod ~]# cp /etc/sysctl.conf/etc/sys1
[root@mygod ~]# cat /etc/sys1 |grep -v^#|grep -v ^$ >/etc/sysctl.conf 這裏是多餘的直接在/etc/sysctl.conf改就行
[root@mygod ~]# vi /etc/sysctl.conf
[root@mygod ~]# cat /etc/sysctl.conf
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.bridge.bridge-nf-call-ip6tables = 0
net.bridge.bridge-nf-call-iptables = 0
net.bridge.bridge-nf-call-arptables = 0
kernel.msgmnb = 65536
kernel.msgmax = 65536
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
[root@mygod ~]# rm -f /etc/sys1
[root@mygod ~]#
[root@mygod ~]# 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
error:"net.bridge.bridge-nf-call-ip6tables" is an unknown key 不知名error,講道理不應該出現,但是我還是刪除了,目測不影響安裝oracle
error:"net.bridge.bridge-nf-call-iptables" is an unknown key
error: "net.bridge.bridge-nf-call-arptables"is an unknown key
kernel.msgmnb = 65536
kernel.msgmax = 65536
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
[root@mygod ~]#
[root@mygod ~]# cat /etc/sysctl.conf
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
kernel.msgmnb = 65536
kernel.msgmax = 65536
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
[root@mygod ~]#
[root@mygod ~]# 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
kernel.msgmnb = 65536
kernel.msgmax = 65536
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048586
[root@mygod ~]#
創建相關用戶和組,文件夾
[root@mygod ~]# groupadd dba
[root@mygod ~]# groupadd oinstall
[root@mygod ~]# useradd -g oinstall -G dbaoracle
[root@mygod~]# echo "redhat"|passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updatedsuccessfully.
[root@mygod ~]#
[root@mygod ~]# mkdir -p /u01/oracle
[root@mygod ~]# chown -R oracle:oinstall/u01
[root@mygod ~]# su - oracle
[oracle@mygod ~]$ cd /u01/
[oracle@mygod u01]$ ls -lrt
total 4
drwxr-xr-x 2 oracle oinstall 4096 Apr 1006:30 oracle
[oracle@mygod u01]$
添加環境變量
[oracle@mygod u01]$ cd
[oracle@mygod ~]$ vi .bash_profile
[oracle@mygod ~]$ cat .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
.~/.bashrc
fi
# User specific environment and startupprograms
PATH=$PATH:$HOME/bin
export PATH
export ORACLE_BASE=/u01/oracle
exportORACLE_HOME=$ORACLE_BASE/product/11.2.0
export ORACLE_SID=ora11g
exportPATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
[oracle@mygod ~]$
[oracle@mygod ~]$ source .bash_profile
修改/etc/security/limits.conf
[root@mygod ~]# tail -6/etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
# End of file
[root@mygod ~]#
解壓p13390677_112040_Linux-x86-64_1of7.zip和p13390677_112040_Linux-x86-64_2of7.zip
[oracle@mygod ~]$ cd /u01/
[oracle@mygod u01]$ ls
oracle p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@mygod u01]$ unzip p13390677_112040_Linux-x86-64_1of7.zip
[oracle@mygod u01]$ unzip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@mygod u01]$ ls
database oracle p13390677_112040_Linux-x86-64_1of7.zip p13390677_112040_Linux-x86-64_2of7.zip
[oracle@mygod u01]$ chown -R oracle:oinstall database
[oracle@mygod u01]$
開始安裝
先root下xhost +
su - oracle
cd /u01/database
./runInstaller
wish to receive security updates via MyOracle Support 前面的對勾,點擊 Next
在彈出對話框中點擊 yes
選擇 Skip software update,點擊 Next
選擇 Install database software only,點擊 Next
選擇 Single instance database installation,點擊 Next
語言選擇,保持默認,點擊 Next
選擇 Enterprise Edition,點擊 Next
產品安裝目錄選擇,保持默認即可,點擊 Next
產品目錄及用戶組設置,保持默認,點擊 Next
數據庫管理組選擇,保持默認,點擊 Next
安裝前檢查頁面
檢查完畢,發現缺失了一個 pdksh 的 rpm
點擊右上角的 Ignore All,然後點擊 Next。並在彈出框中點擊 yes。
進入如下界面,點擊 install
安裝進度到 94%的時候,彈出如下對話框,需要在root下執行兩個腳本。
在桌面上新開一個窗口,根據提示運行如下命令:
sh /u01/oraInventory/orainstRoot.sh
sh /u01/oracle/product/11.2.0/root.sh
注:這兩條命令的執行順序不能顛倒。命令執行過程中若有提示輸入,直接回車即可
運行完成後,點擊 OK,則進入如下界面,點擊 close
su – oracle
netca
一路回車,完成監聽,至此完成數據庫軟件的安裝
接着使用dbca建立一個數據庫
完成後
[oracle@mygod ~]$ ps -ef |grep pmon
oracle 51406 1 0 08:09 ? 00:00:00 ora_pmon_oracle11g
oracle 54640 54599 0 08:14 pts/3 00:00:00 grep pmon
[oracle@mygod ~]$
[oracle@mygod ~]$ echo $ORACLE_SID
ora11g
[oracle@mygod ~]$
[oracle@mygod ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Apr 10 08:14:39 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/oracle/product/11.2.0/dbs/initora11g.ora'
SQL> exit
.bash_profile裏的sid和建庫的sid不一致導致數據庫無法啓動!
只好重新建立數據庫
[oracle@mygod ~]$ kill -9 51406
[oracle@mygod ~]$
dbca
然後建立數據庫時候注意SID就行了
再次規範建庫後,若成功的話數據庫在open階段