Centos7_Minimal 靜默安裝 Oracle 12c版本

來源:互聯網
上載者:User

標籤:centos7   oracle   

Centos7_Minimal 靜默安裝 Oracle 12c版本


1.檢查系統版本

[[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core)


2.關閉selinux

[[email protected] ~]# sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config[[email protected] ~]# getenforce Disabled


3.關閉防火牆

[[email protected] ~]# systemctl stop firewalld


4.修改主機名稱和hosts檔案

[[email protected] ~]# cat /etc/hostname oracle[[email protected] ~]# cat /etc/hostsoracle 172.18.135.72


5.升級系統

[[email protected] ~]# yum update -y


6.安裝依賴包和java環境

[[email protected] ~]#yum -y install binutils compat-libstdc++ compat-libstdc++-33 elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers ksh libaio-devel libstdc++-devel make sysstat unixODBC-devel binutils-* compat-libstdc++* elfutils-libelf* glibc* gcc-* libaio* libgcc* libstdc++* make* sysstat* unixODBC* wget unzip[[email protected] ~]# yum -y install java-1.8.0-openjdk*


7.建立使用者,組

[[email protected] ~]# groupadd oinstall[[email protected] ~]# groupadd dba[[email protected] ~]# useradd -g oinstall -G dba oracle[[email protected] ~]# passwd oracleChanging 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] ~]# id oracleuid=1004(oracle) gid=1005(oinstall) groups=1005(oinstall),1006(dba)


8.建立軟體安裝目錄,並賦許可權

[[email protected] ~]# mkdir -p /opt/oracle$ORACLE_BASE[[email protected] ~]# mkdir -p /opt/oracle/12c$ORACLE_HOME[[email protected] ~]# mkdir /opt/oracle/oradata資料存放目錄[[email protected] ~]# mkdir /opt/oracle/inventory清單目錄[[email protected] ~]# mkdir /opt/oracle/flash_recovery_area資料恢複目錄[[email protected] ~]# chown -R oracle:oinstall /opt/oracle[[email protected] ~]# chmod -R 775 /opt/oracle


9.修改系統參數

[[email protected] ~]# vim /etc/sysctl.conf 

fs.file-max = 6815744kernel.sem = 250 32000 100 128kernel.shmmni = 4096kernel.shmall = 1073741824kernel.shmmax = 4398046511104net.core.rmem_default = 262144net.core.rmem_max = 4194304net.core.wmem_default = 262144net.core.wmem_max = 1048576fs.aio-max-nr = 1048576net.ipv4.ip_local_port_range = 9000 65500

[[email protected] ~]# sysctl -p (啟動生效)


10. 修改使用者限制檔案

[[email protected] ~]# vim /etc/security/limits.conf

oracle   soft   nofile   1024oracle   hard   nofile   65536oracle   soft   nproc    2047oracle   hard   nproc    16384oracle   soft   stack    10240oracle   hard   stack    32768


11.關聯設定

[[email protected] ~]# vi /etc/pam.d/login

session    required    /lib64/security/pam_limits.sosession    required    pam_limits.so


12.設定環境變數

[[email protected] ~]# vim /etc/profile

if [ $USER = "oracle" ]; then        if [ $SHELL = "/bin/ksh" ]; then                ulimit -p 16384                ulimit -n 65536        else                ulimit -u 16384 -n 65536        fifi

[[email protected] ~]# source /etc/profile  (執行)


13.配置oracle使用者環境變數(切換oracle使用者)

[[email protected] ~]$ vim .bash_profile 

# For Oracleexport ORACLE_BASE=/opt/oracleexport ORACLE_HOME=/opt/oracle/12cexport ORACLE_SID=orclexport PATH=$PATH:$HOME/bin:$ORACLE_HOME/binexport LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/libif [ $USER = "oracle" ]; then        if [ $SHELL = "/bin/ksh" ]; then                ulimit -p 16384                ulimit -n 65536        else                ulimit -u 16384 -n 65536        fi                umask 022fi

[[email protected] ~]$ source .bash_profile 


14.官網下載oracle 12c版本安裝包,上傳至/opt/oracle 目錄

[[email protected] oracle]$ pwd/opt/oracle[[email protected] oracle]$ ls12c   flash_recovery_area  inventory  linuxamd64_12102_database_1of2.zip  linuxamd64_12102_database_2of2.zip  oradata


15.接下來用oracle使用者解壓

[[email protected] oracle]$ unzip linuxamd64_12102_database_1of2.zip [[email protected] oracle]$ unzip linuxamd64_12102_database_2of2.zip


16.解壓完成可以看到目錄/opt/oracle/database/response有3個應答檔案,

分別資料庫安裝檔案、建立資料庫執行個體和監聽配置安裝檔案

[[email protected] oracle]$ ll /opt/oracle/database/response/total 112-rwxrwxr-x 1 oracle oinstall 74822 Apr  4  2014 dbca.rsp-rw-rw-r-- 1 oracle oinstall 25036 Jul  7  2014 db_install.rsp-rwxrwxr-x 1 oracle oinstall  6038 Jan 24  2014 netca.rsp[[email protected] oracle]$


17.修改資料庫安裝檔案db_install.rsp

[[email protected] oracle]$ vim /opt/oracle/database/response/db_install.rsp 

oracle.install.option=INSTALL_DB_SWONLY   #安裝類型ORACLE_HOSTNAME=oracle #主機名稱UNIX_GROUP_NAME=oinstall #安裝組INVENTORY_LOCATION=/opt/oracle/inventory #清單目錄SELECTED_LANGUAGES=en,zh_CN #選擇語言ORACLE_HOME=/opt/oracle/12c/  # oracle_homeORACLE_BASE=/opt/oracle  #oracle_baseoracle.install.db.InstallEdition=EE  #oracle版本oracle.install.db.DBA_GROUP=dba  #dba使用者組oracle.install.db.OPER_GROUP=oinstall  #oper使用者組oracle.install.db.BACKUPDBA_GROUP=dbaoracle.install.db.DGDBA_GROUP=dbaoracle.install.db.KMDBA_GROUP=dbaoracle.install.db.config.starterdb.type=GENERAL_PURPOSE  #資料庫類型oracle.install.db.config.starterdb.globalDBName=orcl #globalDBNameoracle.install.db.config.starterdb.SID=orcl #SIDoracle.install.db.config.starterdb.memoryLimit=81920   #自動管理記憶體的最小記憶體(M)oracle.install.db.config.starterdb.password.ALL=oracle  #設定所有資料庫使用者使用同一個密碼DECLINE_SECURITY_UPDATES=true  #設定安全更新


18.開始安裝,等的時間有點長,可以通過查看後台日誌安裝進程,tail -f log ,安裝過程有警告可忽略,如即為安裝成功,根據圖示操作

[[email protected] ~]$ cd /opt/oracle/database/[[email protected] database]$ ./runInstaller -silent -responseFile /opt/oracle/database/response/db_install.rsp -ignorePrereq


19.切換root使用者執行指令碼,然後回到oracle使用者按enter就可以


20.查看預設的監聽檔案,並安裝監聽應答檔案

[[email protected] ~]$ vim /opt/oracle/database/response/netca.rsp 

INSTALL_TYPE=""custom""安裝的類型LISTENER_NUMBER=1監聽器數量LISTENER_NAMES={"LISTENER"}監聽器的名稱列表LISTENER_PROTOCOLS={"TCP;1521"}監聽器使用的通訊協議列表LISTENER_START=""LISTENER""監聽器啟動的名稱

[[email protected] ~]$ netca /silent /responseFile /opt/oracle/database/response/netca.rsp


21.上述命令執行成功後,會在/opt/oracle/12c/network/admin中產生listener.ora和sqlnet.ora檔案

[[email protected] ~]$ ls /opt/oracle/12c/network/admin/

listener.ora  samples  shrept.lst  sqlnet.ora


22.安裝完成後可以查看連接埠1521是否起來

[[email protected] ~]$ netstat -tulnp |grep 1521


23.添加資料庫執行個體,修改dbca.rsp檔案

[[email protected] ~]$ vim /opt/oracle/database/response/dbca.rsp 

RESPONSEFILE_VERSION = "12.1.0"   #預設OPERATION_TYPE = "createDatabase" #預設GDBNAME = "orcl"  #資料庫名字SID = "orcl"   #對應的執行個體名TEMPLATENAME = "General_Purpose.dbc"   #預設SYSPASSWORD = "oracle"  #sys密碼SYSTEMPASSWORD = "oracle"  #system密碼DBSNMPPASSWORD = "oracle"   #dbs密碼DATAFILEDESTINATION =/opt/oracle/oradata  #清單目錄RECOVERYAREADESTINATION=/opt/oracle/flash_recovery_area  #恢複資料目錄CHARACTERSET = "AL32UTF8"   #字元集,重要!!!建庫後一般不能更改


24.執行資料庫執行個體安裝

[[email protected] ~]$ cd /opt/oracle/12c/bin/

[[email protected] bin]$ dbca -silent -responseFile /opt/oracle/database/response/dbca.rsp


25.查看執行個體進程,監聽狀態

[[email protected] bin]$ ps -ef |grep ora_ |grep -v grep




26.查看執行個體狀態

[[email protected] ~]$ sqlplus / as sysdba



27.oracle的一些命令

開啟racle服務:

$dbstart

$lsnrctl start

$sqlplus / as sysdba

SQL>startup

 

關閉oracle服務:

$dbshut

$lsnrctl stop

$sqlplus / as sysdba

SQL>shutdown /shutdown immediate




Centos7_Minimal 靜默安裝 Oracle 12c版本

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.