oracle:11.2.0.4 linux:紅帽6.5 依賴包,是全部都寫上來了,按照需求選擇,也可以全部都安裝一遍 yum install -y binutils-* compat-libstdc++-33-* elfutils-libelf-* elfutils-libelf-devel-* g ...
oracle:11.2.0.4
linux:紅帽6.5
依賴包,是全部都寫上來了,按照需求選擇,也可以全部都安裝一遍
yum install -y binutils-* compat-libstdc++-33-* elfutils-libelf-* elfutils-libelf-devel-* gcc-* gcc-c++-* glibc-* glibc-common-* glibc-devel-* glibc-headers-* ksh-* libaio-* libgcc-* libstdc++-* make-* sysstat-* unixODBC-* unixODBC-devel-* ld-linux.so.2 libXp.so.6 libXt.so.6 libXtst.so.6 glibc.i686 libgcc.i686 glibc-devel.i686
yum install -y binutils compat-libcap1 compat-libstdc++-33 e2fsprogs e2fsprogs-libs glibc glibc-devel ksh libaio-devel libaio libgcc libstdc++ libstdc++-devel libxcb libX11 libXau libXi libXtst make net-tools nfs-utils smartmontools sysstat gcc-c++-4.* gcc-4.*
yum install binutils-2.* compat-libstdc++-33* elfutils-libelf-0.* elfutils-libelf-devel-* gcc-4.* gcc-c++-4.* glibc-2.* glibc-common-2.* glibc-devel-2.* glibc-headers-2.* libaio-0.* libaio-devel-0.* libgcc-4.* libstdc++-4.* libstdc++-devel-4.* make-3.* sysstat-7.* unixODBC-2.* unixODBC-devel-2.*
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*i686 compat-libstdc++-33*.devel compat-libstdc++-33 compat-libstdc++-33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686
創建oracle用戶和屬組,grid用戶,這裡是嫌麻煩,所以就直接創建了oracle和grid用戶
groupadd oinstall
groupadd dba
useradd -m -g oinstall -G dba oracle
passwd oracle
useradd -m -g oinstall -G dba grid
passwd grid
vim /etc/hosts
--------------------------
192.168.100.100 oracle
--------------------------
vim /etc/selinux/config
----------------------
SELINUX=disabled
---------------------
修改oracle用戶限制
vi /etc/security/limits.conf
----------------------------------------
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
----------------------------------------
修改系統參數
vi /etc/sysctl.conf
----------------------------------------
kernel.shmmax = 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
net.ipv4.ip_local_port_range = 9000 65500
net.core.rmem_default = 4194304
net.core.rmem_max = 4194304
net.core.wmem_default = 262144
net.core.wmem_max = 1048576
fs.aio-max-nr = 1048576
fs.file-max = 6815744
----------------------------------------
sysctl -p
最全創建目錄,按照需求創建目錄,給予許可權,為了方便,我把grid目錄也創建了:
mkdir -p /u01/app
chown -R grid:oinstall /u01/app/
chmod -R 775 /u01/app/
mkdir -p /u01/app/grid
mkdir -p /u01/app/oracle
chown -R grid:oinstall /u01/app/grid/
chown -R oracle:oinstall /u01/app/oracle/
chmod -R 775 /u01/app/grid/
chmod -R 775 /u01/app/oracle/
mkdir -p /u01/app/11.2.0/grid
chown -R grid:oinstall /u01/app/11.2.0/grid
chmod -R 775 /u01/app/11.2.0/grid
mkdir -p /u01/app/oracle/oradata
chown -R oracle:oinstall /u01/app/oracle/oradata
chmod -R 775 /u01/app/oracle/oradata
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app/oraInventory
chmod -R 775 /u01/app/oraInventory
mkdir -p /u01/app/oracle/product/11.2.0/db_1
chown -R oracle:oinstall /u01/app/oracle/product/11.2.0/db_1
chmod -R 775 /u01/app/oracle/product/11.2.0/db_1
設置 oracle 帳號登錄時環境
(以下以 oracle 身份登錄): 編輯文件
su - oracle
vim .bash_profile
添加如下行:
-----------------------------
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID=ora11g
LD_LIBRARY_PATH=$ORACLE_HOME/lib
PATH=$PATH:$ORACLE_HOME/bin:$HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID LD_LIBRARY_PATH PATH
-----------------------------
保存退出後執行如下命令使以上設置立即生效:
source .bash_profile
好了,前期安裝準備,都是一樣的,接下來是靜默安裝的
響應文件所在的目錄:
vim /u01/database/response/db_install.rsp
--------------------------------------------------------
oracle.install.option=INSTALL_DB_SWONLY // 安裝類型
ORACLE_HOSTNAME=docker // 主機名稱(hostname查詢)
UNIX_GROUP_NAME=oinstall // 安裝組
INVENTORY_LOCATION=/u01/app/oraInventory //INVENTORY目錄(不填就是預設值)
SELECTED_LANGUAGES=en,zh_CN,zh_TW // 選擇語言
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1 //oracle_home
ORACLE_BASE=/u01/app/oracle //oracle_base
oracle.install.db.InstallEdition=EE // oracle版本
oracle.install.db.isCustomInstall=false //自定義安裝,否,使用預設組件
oracle.install.db.DBA_GROUP=dba / / dba用戶組
oracle.install.db.OPER_GROUP=oinstall // oper用戶組
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //資料庫類型
oracle.install.db.config.starterdb.globalDBName=orcl //globalDBName
oracle.install.db.config.starterdb.SID=dbsrv2 //SID
oracle.install.db.config.starterdb.memoryLimit=81920 //自動管理記憶體的記憶體(M)
oracle.install.db.config.starterdb.password.ALL=oracle //設定所有資料庫用戶使用同一個密碼
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false //(手動寫了false)
DECLINE_SECURITY_UPDATES=true //設置安全更新(貌似是有bug,這個一定要選true,否則會無限提醒郵件地址有問題,終止安裝。PS:不管地址對不對)
-------------------------------------------------------------------------------------------------------------------------
運行靜默安裝
su -oracle
./runInstaller -silent -ignoreSysPrereqs -showProgress -responseFile /u01/database/response/db_install.rsp
其中-silent指的是靜默安裝,-ignorePrereq忽略prerequisite的檢查結果,showProgress顯示進度,responseFile是種子文件。
查看安裝日誌
tail -f /u01/app/oraInventory/logs/installActions2018-11-27_06-56-29PM.log
運行完成後,會讓執行兩個腳本
root用戶執行以下兩個腳本
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0.4/db_1/root.sh
運行靜默安裝監聽
netca.rsp在 /u01/app/database/response中
我因為是預設的,所以就沒改
netca -silent -responseFile /u01/app/database/response/netca.rsp
靜默安裝庫,需要修改項
vim /u01/database/response/dbca.rsp
-------------------------------------------------------
RESPONSEFILE_VERSION = "10.0.0"
OPERATION_TYPE = "createDatabase"
GDBNAME = "ora11g" //資料庫全局名稱
SID = "ora11g" //這個sid 必須要和前面的/home/oracle/.bash_profile文件中的sid相同
TEMPLATENAME = "New_Database.dbt"
SYSPASSWORD = "oracle" //SYS 用戶的初始密碼
SYSTEMPASSWORD = "oracle" //SYSTEM 用戶的初始密碼
DATAFILEDESTINATION ="/u01/app/oracle/oradata/"
RECOVERYAREADESTINATION="/u01/app/oracle/flash_recovery_area"
STORAGETYPE=FS
CHARACTERSET = "ZHS16GBK" //資料庫字元集(中文為
ZHS16GBK )
MEMORYPERCENTAGE = "40"
SCRIPTDESTINATION ="/u01/app/oracle/admin/ora10g/scripts"
EMCONFIGURATION=”LOCAL”
SYSMANPASSWORD = "system"
DBSNMPPASSWORD = "system"
其中最後1項不是必須的,這個的目的是在建立資料庫的同時生成腳本。
下麵就可以開始SILENT模式的資料庫創建了。
----------------------------------------------------------------
dbca -silent -responseFile /u01/database/response/dbca.rsp
執行後,如果出現清屏,請一定要檢查,實例名、sys密碼、system密碼的正確性
如果出現錯誤:
SQL> startup
ORA-01081: cannot start already-running ORACLE - shut it down first
解決方法:
shutdown abort;
startup;
即可
shutdown abort;
startup;