轉載自:https://www.cnblogs.com/startnow/p/7580865.html
1. 系統準備
1.1. 安裝基礎工具
- yum install wget unzip net-tools -y
- 首先下載oracle的 repo文件
wget http://public-yum.oracle.com/public-yum-ol7.repo -O /etc/yum.repos.d/public-yum-ol7.repo
wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol7 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
- oracle-rdbms-server-11gR2-preinstall安裝
基於Oracle Linux,Oracle僅僅需要通過安裝oracle-rdbms-server-11gR2-preinstall RPM包即可全部搞定其餘未安裝的RPM包,解決之間的依賴關係,配置內核參數。
yum install oracle-rdbms-server-11gR2-preinstall -y
1.2. 環境參數修改
- 備份/var/log/oracle-rdbms-server-11gR2-preinstall文件到其他目錄
- 加載內核參數:sysctl -f
- 配置oracle系統配置文件及授權
|
- 創建oracle安裝的目錄&授權
mkdir -p /u01/app/
mkdir /u01/tmp
chown -R oracle:oinstall /u01/app/
chmod -R 775 /u01/app/
chmod a+wr /u01/tmp
- 設置oracle用戶密碼:passwd oracle
- 爲oracle用戶添加一些必要的環境
cat >> /home/oracle/.bash_profile <<EOF
TMP=/u01/tmp
TMPDIR=/u01/tmp
export TMP TMPDIR
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_SID=orcl
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE ORACLE_SID ORACLE_HOME PATH
EOF
source .bash_profile
- 配置用戶環境及上傳安裝文件
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
解壓後文件會在/home/oracle/database/
運行命令: -R oracle:oinstall /home/oracle/database
2. 配置db_install.rsp
備份到/home/oracle/rsp/:cp -r /home/oracle/database/response /home/oracle/rsp
配置安裝響應文件db_install.rsp文件 這裏配置參數先下載到本地 用記事本根據自己情況修改 在上傳
配置參照:https://blog.csdn.net/java3344520/article/details/8063785
3. 靜默安裝數據庫
會出現密碼不規範的警告,忽略:
/home/oracle/database/runInstaller -silent -ignorePrereq -responseFile
/home/oracle/rsp/db_install.rsp
查看安裝過程 另開一個shell 稍等
tail -f 上圖中紅框所示
最後會提示安裝完成 !【切換root執行】
【切換到oracle】
sqlplus登錄
sqlplus / as sysdba
查看狀態:
select status from v$instance;
4. 配置防火牆
查看1521端口:netstat -an|grep 1521
防火牆 放行1521端口
firewall-cmd --zone=public --add-port=1521/tcp –permanent
重新加載防火牆規則
firewall-cmd –reload
5. 數據庫的啓動&關閉
修改oracle服務啓動配置
vi /etc/oratab
:wq保存
[oracle]
#啓動oracle
#因爲修改了/etc/oratab N->y 所以啓動服務也會同時啓動實例
##N的情況不會同時啓動實例 sqlplus登錄會提示 an idle instance
##用sqlplus 然後---> startup啓動實例
#重啓系統後用這個命令啓動
dbstart $ORACLE_HOME
#關閉
dbshut $ORACLE_HOME
#遠程連接oracle
sqlplus sys/[email protected]:1521/ORCL.LAN as sysdba
conn sys/[email protected]:1521/ORCL.LAN as sysdba
ORCL.LAN是服務名 不是sid
6.Oacle安裝報錯
- Checking swap space: 0 MB available, 150 MB required. Failed:
https://blog.csdn.net/qq_35893120/article/details/80655645
- 靜默安裝Oracle 11G過程中提示:Exception in thread "main" java.lang.NoClassDefFoundError:
https://blog.csdn.net/u011451049/article/details/9411341