oracle 11.2.0.1 x64linux
"#" 後跟命令表示以操做系統下root用戶操做;
"$" 後跟命令表示以操做系統下Oracle用戶操做;
下載軟件包
官網下載:http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.htm
linux_11gR2_database_1of2.zip
linux_11gR2_database_2of2.zipc++
vi /etc/sysconfig/seliunx SELINUX=disabled
rpm -qa | grep binutils-2.17.50.0.6 rpm -qa | grep compat-libstdc++-33-3.2.3 rpm -qa | grep compat-libstdc++-33-3.2.3 rpm -qa | grep elfutils-libelf-0.125 rpm -qa | grep elfutils-libelf-devel-0.125 rpm -qa | grep gcc-4.1.2 rpm -qa | grep gcc-c++-4.1.2 rpm -qa | grep glibc-2.5-24 rpm -qa | grep glibc-2.5-24 rpm -qa | grep glibc-common-2.5 rpm -qa | grep glibc-devel-2.5 rpm -qa | grep glibc-devel-2.5 rpm -qa | grep glibc-headers-2.5 rpm -qa | grep pdksh-5.2.14-36.el5 rpm -qa | grep libaio-0.3.106 rpm -qa | grep libaio-0.3.106 rpm -qa | grep libaio-devel-0.3.106 rpm -qa | grep libaio-devel-0.3.106 rpm -qa | grep libgcc-4.1.2 rpm -qa | grep libgcc-4.1.2 rpm -qa | grep libstdc++-4.1.2 rpm -qa | grep libstdc++-4.1.2 rpm -qa | grep libstdc++-devel-4.1.2 rpm -qa | grep make-3.81 rpm -qa | grep sysstat-7.0.2 rpm -qa | grep unixODBC-2.2.11 rpm -qa | grep unixODBC-2.2.11 rpm -qa | grep unixODBC-devel-2.2.11 rpm -qa | grep unixODBC-devel-2.2.11
須要用光盤製做yum源sql
若是有包沒有安裝就必須得先安裝,但安裝前要配置好yum源,用rpm方式安裝太累。
配置yum源參考:按步驟作,也是我寫的啦。
http://blog.csdn.net/jameshadoop/article/details/48054897數據庫
yum -y install make-3.81 compat-db* openmotif* libXp* binutils-2.17.50.0.6 gcc-4.1.2 libaio-0.3.106* glibc-2.5-24* compat-libstdc++-33-3.2.3* elfutils-libelf-0.125 elfutils-libelf-devel-0.125 glibc-common-2.5 glibc-devel-2.5* glibc-headers-2.5 gcc-c++-4.1.2 libaio-devel-0.3.106* libgcc-4.1.2* libstdc++-4.1.2* libstdc++-devel-4.1.2 sysstat-7.0.2 unixODBC-2.2.11* unixODBC-devel-2.2.11* ksh-20060214
安裝完記得用上面的語句再檢查一下啦vim
[root@red5v5 /]# groupadd oinstall [root@red5v5 /]# groupadd dba [root@red5v5 /]# useradd -g oinstall -G dba oracle [root@red5v5 /]# passwd oracle [root@red5v5 /]# id oracle uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba) context=root:system_r:unconfined_t:SystemLow-SystemHigh
不要忘了切換用戶哦,仔細看下面命令bash
[root@red5v5 /]# chmod -R 777 /opt [root@red5v5 /]# su - oracle [oracle@red5v5 ~]$ cd /opt [oracle@red5v5 opt]$ mkdir oracle [oracle@red5v5 opt]$ mkdir oraInventory
[root@red5v5 ~]vim /etc/sysctl.conf fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 //此行默認已有,確認不低於此數便可 kernel.shmmax = 536870912 //此行默認已有,確認不低於此數便可 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 = 1048576
[root@red5v5 ~]# sysctl -p
session
[root@red5v5 ~]# vim /etc/pam.d/login 文件最後添加: session required pam_limits.so
[root@red5v5 ~]# vim /etc/security/limits.conf 文件的最後添加: oracle soft nproc 10000 oracle hard nproc 16384 oracle soft nofile 52768 oracle hard nofile 6553
soft是最小值,hard是最大值,nofile是文件句柄,也就是這個用戶能打開的文件數,nproc是進程數oracle
[root@red5v5 ~]# vim /home/oracle/.bash_profile umask 022 export ORACLE_BASE=/opt/oracle export ORACLE_HOME=/opt/oracle/product/11.2.0/dbhome_1 export ORACLE_SID=orcl export LANG=en_US.UTF-8
[root@red5v5 ~]# vi /etc/profile export PATH=$PATH:/opt/oracle/product/11.2.0/dbhome_1/bin
上傳到/home/oracle/ 解壓Oracle安裝文件oop
# cd /home/oracle/ # unzip linux*_11gR2_database_1of2.zip -d /home/oracle # unzip linux*_11gR2_database_2of2.zip -d /home/oracle # chown -R oracle:oinstall /opt/oracle /home/oracle
到這裏前期的準備工做所有完成啦,建議重啓下系統讓各項配置生效。固然也能夠不重啓測試
此種應答文件是安裝並配置數據庫,直接產生orcl數據庫實例
應答文件模版在解壓後的文件夾中。
/home/oracle/database/response/db_install.rsp
模版中重要的配置項含義以下
ORACLE_HOSTNAME 主機名
ORACLE_BASE oracle的基礎安裝目錄
ORACLE_HOME oracle的安裝目錄
INVENTORY_LOCATION oracle日誌目錄
oracle.install.db.config.starterdb.globalDBName
oracle.install.db.config.starterdb.password.ALL
若是想知道每一個選項的含義,請看:
http://blog.csdn.net/jameshadoop/article/details/48086933
db_install.rsp文件中追加:
oracle.install.option=INSTALL_DB_AND_CONFIG ORACLE_HOSTNAME=red5v5 UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/opt/oraInventory SELECTED_LANGUAGES=en ORACLE_HOME=/opt/oracle/product/11.2.0/dbhome_1 ORACLE_BASE=/opt/oracle oracle.install.db.InstallEdition=EE oracle.install.db.isCustomInstall=false oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oinstall oracle.install.db.CLUSTER_NODES= oracle.install.db.config.starterdb.type=GENERAL_PURPOSE oracle.install.db.config.starterdb.globalDBName=orcl oracle.install.db.config.starterdb.SID=orcl oracle.install.db.config.starterdb.characterSet=AL32UTF8 oracle.install.db.config.starterdb.memoryLimit=503 oracle.install.db.config.starterdb.memoryOption=true oracle.install.db.config.starterdb.installExampleSchemas=true oracle.install.db.config.starterdb.enableSecuritySettings=true oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/opt/oradata oracle.install.db.config.starterdb.password.ALL=Oracle11g oracle.install.db.config.starterdb.password.SYS= oracle.install.db.config.starterdb.password.SYSTEM= oracle.install.db.config.starterdb.password.SYSMAN= oracle.install.db.config.starterdb.password.DBSNMP=
安裝過程當中出現各類警告warning不要去理它,成功後會有:
Successfully Setup Software
./runInstaller -silent -force -responseFile /home/oracle/database/response/db_install.rsp
runInstaller參數說明:
a. 選項-silent表示靜默安裝,免安裝交互,大部分安裝信息也不輸出
b. 選項-responseFile指定應答文件,要求用絕對路徑
c. 執行./runInstaller -help能夠查看安裝幫助
d. 若忽略-silent選項,將會容許交互,對於應答文件中未設置的項能夠再手工指定
e. 若添加-noconfig選項,能夠忽略應答文件中的安裝類型,而僅安裝數據庫軟件
root權限執行安裝後的配置腳本
[oracle@red5v5 /]# su - root [root@red5v5 /]# sh /opt/oraInventory/orainstRoot.sh [root@red5v5 /]# sh /opt/oracle/product/11.2.0/dbhome_1/root.sh
db_install.rsp配置已經產生了數據庫實例orcl,因此不須要再配置數據庫啦
啓動監聽
[oracle@red5v5 /]# lsnrctl start
查看監聽狀態
[oracle@red5v5 /]# lsnrctl status
中止監聽
[oracle@red5v5 /]# lsnrctl stop
此時安裝結束,能夠用scott用戶測試。
因爲系統重啓以後,數據庫服務並非自動啓動,因此要手工啓動,方法:
1.1啓動服務
su - oracle sqlplus /nolog conn /as sysdba startup exit
1.2.啓動監聽
lsnrctl start exit
關閉數據庫服務
su - oracle sqlplus /nolog conn /as sysdba shutdown immediate exit
關閉監聽
lsnrctl stop exit