linux(centOS)下安裝Oracle步驟

來源:互聯網
上載者:User

標籤:

##建立使用者和組:[[email protected] ~]$ su root  #切換到rootPassword:[[email protected] LanRS]# groupadd oinstall  #建立使用者組oinstall[[email protected] LanRS]# groupadd dba  #建立使用者組dba[[email protected] LanRS]# usermod -g oinstall -G dba aofis #建立aofis使用者,並加入到oinstall和dba使用者組[[email protected] LanRS]# passwd aofis  #設定使用者aofis的登陸密碼Changing password for user oracle.New password:   # 密碼BAD PASSWORD: The password is shorter than 8 charactersRetype new password:   # 確認密碼passwd: all authentication tokens updated successfully.[[email protected] LanRS]# id aofis # 查看建立的aofis使用者uid=1001(aofis) gid=1002(dba) groups=1002(dba)[[email protected] LanRS]# ##建立oracle資料庫安裝目錄[[email protected] ~]$ su rootPassword:[[email protected] LanRS]# mkdir -p /data/oracle  #oracle資料庫安裝目錄[[email protected] LanRS]# mkdir -p /data/oraInventory  #oracle資料庫設定檔目錄[[email protected] LanRS]# mkdir -p /data/database  #oracle資料庫軟體包解壓目錄[[email protected] LanRS]# cd /data[[email protected] data]# ls  #建立完畢檢查一下(強迫症)database oracle oraInventory[[email protected] data]# chown -R aofis:oinstall /data/oracle  #設定目錄所有者為oinstall使用者組的oracle使用者[[email protected] data]# chown -R aofis:oinstall /data/oraInventory[[email protected] data]# chown -R aofis:oinstall /data/database[[email protected] data]# chmod -R 775 /data/oracle #為oracle目錄設定許可權為 rwx rwx r-x ##修改OS系統標識---oracle預設不支援CentOS修改檔案 /etc/Redhat-release 為以下內容:# vim /etc/redhat-release# cat /etc/redhat-releaseredhat-7 ##關閉防火牆:# systemctl stop firewalld.service# systemctl disable firewalld.service #禁止使用防火牆(測試機不需要這個東西)##關閉SELINUX# vim /etc/selinux/config用#注釋掉SELINUXTYPE,並修改SELINUX=disabled#SELINUX這個東西太高森,是高手玩的... #配置好外網IP,安裝需要的包檔案:(命令 yum install -y 檔案名稱)#The following packages (or later versions) must be installed:binutils-2.23.52.0.1-12.el7.x86_64compat-libcap1-1.10-3.el7.x86_64compat-libstdc++-33-3.2.3-71.el7.i686(.i686包用 yum install -y)compat-libstdc++-33-3.2.3-71.el7.x86_64gcc-4.8.2-3.el7.x86_64gcc-c++-4.8.2-3.el7.x86_64glibc-2.17-36.el7.i686glibc-2.17-36.el7.x86_64glibc-devel-2.17-36.el7.i686glibc-devel-2.17-36.el7.x86_64libaio-0.3.109-9.el7.i686libaio-0.3.109-9.el7.x86_64libaio-devel-0.3.109-9.el7.i686libaio-devel-0.3.109-9.el7.x86_64libgcc-4.8.2-3.el7.i686libgcc-4.8.2-3.el7.x86_64libstdc++-4.8.2-3.el7.i686libstdc++-4.8.2-3.el7.x86_64libstdc++-devel-4.8.2-3.el7.i686libstdc++-devel-4.8.2-3.el7.x86_64libXi-1.7.2-1.el7.i686libXi-1.7.2-1.el7.x86_64libXtst-1.2.2-1.el7.i686libXtst-1.2.2-1.el7.x86_64make-3.82-19.el7.x86_64sysstat-10.1.5-1.el7.x86_64elfutils-libelf-devel-0.163-3.el7.x86_64unixODBC-devel-2.3.1-11.el7.x86_64unixODBC-devel-2.3.1-11.el7.i686unixODBC-2.3.1-11.el7.x86_64unixODBC-2.3.1-11.el7.i686pdksh(我安裝的時候安裝了pdksh包,安裝過ksh包需要將其卸載)使用 rpm -ivh命令安裝該包(ksh) #修改核心參數vi /etc/sysctl.conffs.file-max = 6815744fs.aio-max-nr = 1048576kernel.shmall = 1572864kernel.shmmax = 6442450943kernel.shmmni = 4096kernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9600 65500net.core.rmem_default = 262144net.core.rmem_max= 4194304net.core.wmem_default= 262144net.core.wmem_max= 1048576 #使核心生效:#sysctl -p##對oracle使用者佈建限制,提高軟體運行效能#vi /etc/security/limits.confaofis soft nproc 2047aofis hard nproc 16384aofis soft nofile 1024aofis hard nofile 65536 #配置環境變數:# vi /home/aofis/.bash_profile 添加一下內容:# export DISPLAY=:0.0export TMP=/tmpexport TMPDIR=$TMPexport ORACLE_BASE=/data/oracleexport ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1export ORACLE_SID=orclexport ORACLE_TERM=xtermexport PATH=$ORACLE_HOME/bin:/usr/sbin:$PATHexport LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/libexport LANG=Cexport NLS_LANG=AMERICAN_AMERICA.ZHS16GBK 使以上配置生效:# source /home/aofis/.bash_profile ##安裝unzip:#yum install -y unzip##上傳安裝檔案到(/home/aofis/Downloads下),解壓解壓:#unzip  安裝包名 -d /data/database(將安裝包解壓到指定檔案夾database下)#進入安裝檔案目錄:cd /data/database/database執行安裝檔案(./ 安裝檔案)中間沒有空格 --PRVF-0002 Could not retrieve local nodename :--找不到主機名稱的對應ip。修改/etc/hosts,添加主機名稱即可(aofis)。 安裝到70%有出現一個錯誤:Error in invoking target ‘agent nmhs‘ of makefile ‘/u01/app/oracle/product/11.2.0/db_1/sysman/lib/ins_emagent.mk‘#用vim 進入錯誤提示上面的路徑名檔案轉到:/$(MK_EMAGENT_NMECTL)保留安裝過程,另外開啟一個終端視窗,將ins_emagent.mk檔案中的$(MK_EMAGENT_NMECTL)更改為$(MK_EMAGENT_NMECTL) -lnnz11,然後在安裝過程中點擊Retry即可  安裝完成後:sys (sys)system(system )(tiger) #########################啟動資料庫#############################更改/etc/oratabORCL:/data/oracle/product/11.2.0/db_1:N --> 改為Y #建立啟動Oracle的Init指令碼:# vi /etc/rc.d/init.d/oracle########################################################################################!/bin/sh## chkconfig: 2345 99 99 #export ORACLE_BASE=/data/oracleexport ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1export ORACLE_HOME_LISTENER=$ORACLE_HOMEexport LD_LIBRARY_PATH=$ORACLE_HOME/lib#export JAVA_HOME=$ORACLE_HOME/jdkexport PATH=$PATH:$ORACLE_HOME/bin:$JAVA_HOME/binexport ORACLE_SID=orcl#export ORACLE_TRACE=Y export PATH=$JAVA_HOME/bin:$ORACLE_HOME/bin:$PATH # Source function library.. /etc/rc.d/init.d/functions # See how we were called.case "$1" instart)echo "1" > /proc/sys/net/ipv4/ip_forward # Route 80 -> 8888 for XDBiptables -t nat -A PREROUTING -m tcp -p tcp --dport 80 -j REDIRECT --to-port 8888iptables -t nat -A PREROUTING -m tcp -p tcp --dport 21 -j REDIRECT --to-port 2121 su aofis -c "$ORACLE_HOME/bin/lsnrctl start"su aofis -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"su aofis -c "echo alter pluggable database all open‘;‘|$ORACLE_HOME/bin/sqlplus / as sysdba"su aofis -c "/home/oracle/bin/ords.sh start /home/oracle/ords/ords.war";;stop)su aofis -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"su aofis -c "$ORACLE_HOME/bin/lsnrctl stop"su aofis -c "/home/oracle/bin/ords.sh stop /home/oracle/ords/ords.war";;restart|reload)su aofis -c "$ORACLE_HOME/bin/dbshut $ORACLE_HOME"su aofis -c "$ORACLE_HOME/bin/lsnrctl stop"su aofis -c "/home/oracle/bin/ords.sh stop /home/oracle/ords/ords.war"su aofis -c "$ORACLE_HOME/bin/lsnrctl start"su aofis -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"su aofis -c "echo alter pluggable database all open‘;‘|$ORACLE_HOME/bin/sqlplus / as sysdba"su aofis -c "/home/oracle/bin/ords.sh start /home/oracle/ords/ords.war";;status)$ORACLE_HOME/bin/lsnrctl status;;*)echo $"Usage: $0 {start|stop|restart|reload}"exit 1esac exit 0####################################################################################### #賦予指令碼許可權:# chmod 755 /etc/rc.d/init.d/oracle#啟動資料庫:service oracle start#關閉資料庫:service oracle stop #設定oracle為開機自啟動:#賦予啟動指令碼執行許可權並連結好:#chmod 755 /etc/init.d/oracle#ln -s /etc/init.d/oracle /etc/rc1.d/K61oracle#ln -s /etc/init.d/oracle /etc/rc3.d/S61oracle把oracle啟動指令碼添加到系統服務裡並設定自啟動:#chkconfig --add oracle#chkconfig --level 2345 oracle on

linux(centOS)下安裝Oracle步驟

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.