安裝前準(zhǔn)備:
Oracle11gR2安裝介質(zhì)蒂誉;
最小化安裝Redhat6
linux系統(tǒng)足夠的磁盤空間和內(nèi)存;
linux系統(tǒng)需要有固定ip镰吆;
Xmanager5(圖形化安裝需要)涂佃;
依賴包可通過yum方式安裝(需要聯(lián)網(wǎng)環(huán)境);
zip包的解壓工具可通過yum方式安裝(需要聯(lián)網(wǎng)環(huán)境)缚去;
root用戶權(quán)限
1:前期環(huán)境準(zhǔn)備
設(shè)置固定IP、修改主機(jī)名并添加主機(jī)與IP的對應(yīng)關(guān)系
修改網(wǎng)絡(luò)IP(根據(jù)自己的環(huán)境設(shè)置)
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
重啟網(wǎng)絡(luò)
# service network restart
修改主機(jī)名
# vi /etc/sysconfig/network
替換CentOS yum源
參照http://www.reibang.com/p/8af5521104ae修改yum源
安裝軟件
yum -y install lrzsz vim zip unzip wget
修改hosts
# vim /etc/hosts
ping oracle 查看是否正常
# ping oracle
設(shè)置內(nèi)核參數(shù)琼开、修改系統(tǒng)資源限制
vim /etc/sysctl.conf
在最下方添加
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 100128
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ǒng)資源限制
# vim /etc/security/limits.conf
在最下方添加
oracle soft nproc 2047
oracle? hard? nproc? 16384
oracle? soft? nofile? 1024
oracle? hard? nofile? 65536
#vim /etc/pam.d/login
在session required pam_namespace.so #下面添加一條
使內(nèi)核參數(shù)實(shí)時(shí)生效
# sysctl -p
安裝依賴包
yum -y install binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-common glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat compat-libstdc++-296 compat-libstdc++-33 pdksh unixODBC unixODBC-devel unixODBC xdpyinfo
2配置用戶和組
[root@localhost yum.repos.d]# groupadd dba
[root@localhost yum.repos.d]# groupadd oinstall
[root@localhost yum.repos.d]# useradd -g oinstall -G dba oracle
[root@localhost yum.repos.d]# passwd oracle
設(shè)置oracle用戶的環(huán)境變量
# su - oracle
$ vim .bash_profile?
在最下方添加
export ORACLE_BASE=/home/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_SID=orcl
讓環(huán)境變量立即生效
$ source .bash_profile
關(guān)閉Selinux
# vim /etc/selinux/config
SELINUX=disabled
# setenforce 0
重啟點(diǎn)
# reboot
創(chuàng)建文件夾和權(quán)限
[root@localhost mnt]# mkdir -p /home/app/oracle
[root@localhost mnt]# mkdir -p /home/app/oraInventory
[root@localhost mnt]# chown -R oracle:oinstall /home/app/oracle
[root@localhost mnt]# chown -R oracle:oinstall /home/app/oraInventory
[root@localhost mnt]#? chmod -R 775 /home/app
2安裝軟件
下載軟件包到rracle文件夾里
軟件包的下載地址
https://www.oracle.com/technetwork/database/enterprise-edition/downloads/index-092322.html
# cd /home/oracle
解壓軟件包
# unzip linux.x64_11gR2_database_1of2.zip && unzip linux.x64_11gR2_database_2of2.zip 病游、
# xhost +
切換用戶
# su oracle
export DISPLAY=windows本地ip:0.0
進(jìn)入database目錄
#cd /home/oracle/database
安裝oracle
$ ./runInstaller
在命令行輸入
# /home/app/oraInventory/orainstRoot.sh
# /home/app/oracle/product/11.2.0/dbhome_1/root.sh
?????????????????????????? Enter the full pathname of the local bin directory: [/usr/local/bin]: /usr/local/bin
然后回到執(zhí)行腳本窗口點(diǎn)確認(rèn)
創(chuàng)建數(shù)據(jù)庫
$ dbca
創(chuàng)建監(jiān)聽
$ netca
常用的啟動(dòng)和關(guān)閉命令
如果監(jiān)聽不能識別到數(shù)據(jù)庫解決方法 進(jìn)入sqlplus
$ sqlplus / as sysdba
SQL>alter system register;
關(guān)閉和啟動(dòng)數(shù)據(jù)庫順序
關(guān)閉順序 EM和isqlplus --監(jiān)聽 --數(shù)據(jù)庫
啟動(dòng)順序 監(jiān)聽 --數(shù)據(jù)庫 --EM和isqlplus
查看端口是否打開
$ netstat -tulnp|grep 5560(isqlplus端口)
關(guān)閉和啟動(dòng)isqlplus
$ isqlplusctl stop 關(guān)閉
$ isqlplusctl start 啟動(dòng)
關(guān)閉和啟動(dòng)EM
$ emctl stop dbconsole 關(guān)閉
$ emctl start dbconsole 啟動(dòng)
$ emctl status dbconsole 查看EM狀態(tài)或用netstat 查看1158端口
關(guān)閉和啟動(dòng)監(jiān)聽(1521端口)
$ lsnrctl stop 關(guān)閉
$ lsnrctl start 啟動(dòng)
啟動(dòng)Orcale
$ sqlplus / as sysdba
SQL>startup
關(guān)閉和啟動(dòng)Orcale
$ sqlplus / as sysdba
SQL>shutdown immediate; 安全關(guān)閉
SQL>startup 啟動(dòng)
SQL>startup nomount; 啟動(dòng)數(shù)據(jù)庫 只啟動(dòng)實(shí)例
SQL>alter database mount;
SQL>alter database open;
測試連接
$ sqlplus"/as sysdba"
startup
啟動(dòng)OEM客戶端
$ emctl start dbconsole
瀏覽器打開,并輸入OEM的URL:https://oracle:1158/em稠通,輸入sys用戶和密碼衬衬,以SYSDBA身份登錄:
?
END