環(huán)境準(zhǔn)備
Linux版本:
CentOS Linux release 7.8.2003 (Core)
Oracle版本:
11gR2 64位
Oracle包:
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
地址鏈接:
鏈接:https://pan.baidu.com/s/15ejYe3h7VkMNjkfH3oiQGw 提取碼:yju6
一爵嗅、系統(tǒng)初始化
01.關(guān)閉防火墻iptables毫缆、Network泳唠、selinux
# 關(guān)閉firewalld和NetworkManager
systemctl stop firewalld NetworkManager
systemctl disable firewalld NetworkManager
# 關(guān)閉selinux
setenforce 0
sed -i s#SELINUX=enforcing#SELINUX=disabled#g /etc/sysconfig/selinux
02.swap交換分區(qū)調(diào)整
物理內(nèi)存應(yīng)不少于1GB,對(duì)于VMWARE虛擬機(jī)建議不少于1200MB拱礁。
對(duì)于系統(tǒng)中的交換分區(qū)設(shè)置恩闻,應(yīng)參以下約定:
物理內(nèi)存為1GB~2GB時(shí)塌衰,交換分區(qū)為物理內(nèi)存的1.5~2倍豌注;
物理內(nèi)存為2GB~16GB時(shí),交換分區(qū)與物理內(nèi)存大小相同揉忘;
物理內(nèi)存超過16GB時(shí)跳座,交換分區(qū)使用16GB就可以了。
# 6.添加swap分區(qū)
dd if=/dev/zero of=/root/swapfile bs=4M count=1024
cd
mkswap swapfile
swapon swapfile
cat >> /etc/fstab <<EOF
/root/swapfile swap swap defaults 0 0
EOF
03.配置主機(jī)名hostname
hostname
hostnamectl set-hostname oracledb
su -
04.SSH連接優(yōu)化
cat >>/etc/hosts <<EOF
127.0.0.1 oracledb
EOF
sed -i '/^#UseDNS/a UseDNS no' /etc/ssh/sshd_config
systemctl restart sshd.service
二泣矛、軟硬件需求檢查
01.軟件包檢查
版本號(hào)只能大于規(guī)定的版本疲眷,不能小于
官網(wǎng)地址:
https://docs.oracle.com/cd/E11882_01/install.112/e47689/pre_install.htm#LADBI1111
軟件列表_(官方提供):
binutils-2.23.52.0.1-12.el7.x86_64
compat-libcap1-1.10-3.el7.x86_64
compat-libstdc++-33-3.2.3-71.el7.i686
compat-libstdc++-33-3.2.3-71.el7.x86_64
gcc-4.8.2-3.el7.x86_64
gcc-c++-4.8.2-3.el7.x86_64
glibc-2.17-36.el7.i686
glibc-2.17-36.el7.x86_64
glibc-devel-2.17-36.el7.i686
glibc-devel-2.17-36.el7.x86_64
ksh
libaio-0.3.109-9.el7.i686
libaio-0.3.109-9.el7.x86_64
libaio-devel-0.3.109-9.el7.i686
libaio-devel-0.3.109-9.el7.x86_64
libgcc-4.8.2-3.el7.i686
libgcc-4.8.2-3.el7.x86_64
libstdc++-4.8.2-3.el7.i686
libstdc++-4.8.2-3.el7.x86_64
libstdc++-devel-4.8.2-3.el7.i686
libstdc++-devel-4.8.2-3.el7.x86_64
libXi-1.7.2-1.el7.i686
libXi-1.7.2-1.el7.x86_64
libXtst-1.2.2-1.el7.i686
libXtst-1.2.2-1.el7.x86_64
make-3.82-19.el7.x86_64
sysstat-10.1.5-1.el7.x86_64
unixODBC-2.3.1-6.el7.i686
unixODBC-2.3.1-6.el7.x86_64
unixODBC-devel-2.3.1-6.el7.i686
unixODBC-devel-2.3.1-6.el7.x86_64
02.安裝必須依賴包
前提:需要連接外網(wǎng)
yum -y install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel
可以多執(zhí)行一遍,確認(rèn)包名沒有拼錯(cuò)
檢查依賴是否安裝
rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel | grep "not installed"
03.修改資源限制
修改操作系統(tǒng)對(duì)oracle用戶資源的限制乳蓄。
為oracle用戶設(shè)置Shell限制:
為了優(yōu)化性能咪橙,需要添加oracle用戶的限制參數(shù)。
cat >> /etc/security/limits.conf <<EOF
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
EOF
第1行是設(shè)置進(jìn)程數(shù)軟限制虚倒;
第2行是設(shè)置進(jìn)程數(shù)硬限制美侦;
第3行是設(shè)置文件數(shù)軟限制;
第4行是設(shè)置文件數(shù)硬限制
04.修改內(nèi)核參數(shù)(參考多個(gè)資料)
cat >> /etc/sysctl.conf <<EOF
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
EOF
要使/etc/sysctl.conf更改立即生效魂奥,執(zhí)行以下命令
# 立即生效
sysctl -p
05.修改進(jìn)程會(huì)話限制
進(jìn)程會(huì)話限制可以采用pam_limits認(rèn)證模塊來實(shí)現(xiàn)菠剩,通過修改登錄程序login的PAM設(shè)置以啟用該認(rèn)證。
cat >>/etc/pam.d/login<<EOF
session required /lib64/security/pam_limits.so
session required pam_limits.so
EOF
最后一行插入環(huán)境變量耻煤,立即生效
vim /etc/profile
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
source /etc/profile
06.禁用大內(nèi)存頁
禁用使用Transparent HugePages(啟用Transparent HugePages,可能會(huì)導(dǎo)致造成內(nèi)存在運(yùn)行時(shí)的延遲分配具壮,Oracle官方建議使用標(biāo)準(zhǔn)的HugePages)
- 查看是否啟用 如果顯示
[always]
說明啟用了
cat /sys/kernel/mm/transparent_hugepage/enabled
- 禁用Transparent HugePages,在/etc/grub.conf添加如下內(nèi)容
echo never > /sys/kernel/mm/transparent_hugepage/enabled
重新啟動(dòng)系統(tǒng)以使更改成為永久更改
==========================================
三准颓、軟件安裝之前環(huán)境準(zhǔn)備
01.創(chuàng)建用戶和用戶組
在安裝oracle時(shí),需要單獨(dú)的用戶去安裝棺妓,
假設(shè)使用名為oracle用戶安裝oracle數(shù)據(jù)庫(kù)攘已,需要建立oracle用戶和dba、oper用戶組
# 添加用戶組
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba oracle
# 修改oracle用戶密碼
passwd oracle
02.創(chuàng)建oracle安裝目錄
創(chuàng)建Oracle得數(shù)據(jù)目錄怜跑,可以直接使用Oracle用戶登錄样勃,避免權(quán)限出錯(cuò)
# root身份
su -
mkdir -p /u01/app/
# 存放壓縮包
mkdir -p /u01/src
chown -R oracle:oinstall /u01/
chmod -R 775 /u01/
03.配置oracle用戶環(huán)境變量
環(huán)境變量的值可以根據(jù)需要適當(dāng)修改,在文件最后一行插入
vim /home/oracle/.bash_profile
umask 022
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/
# Oracle實(shí)例名
export ORACLE_SID=ORCL
export PATH=.:$ORACLE_HOME/bin:$ORACLE_HOME/OPatch:$ORACLE_HOME/jdk/bin:$PATH
export LC_ALL="en_US"
export LANG="en_US"
export NLS_LANG="AMERICAN_AMERICA.ZHS16GBK"
export NLS_DATE_FORMAT="YYYY-MM-DD HH24:MI:SS"
04.解壓下載好的兩個(gè)Oracle數(shù)據(jù)庫(kù)文件
建議先將壓縮包上傳到空間足夠大的目錄性芬,進(jìn)行解壓縮峡眶,使用oracle用戶進(jìn)行。
解壓后生成database目錄植锉,兩個(gè)壓縮包都會(huì)解壓到這里辫樱。
unzip -q linux.x64_11gR2_database_1of2.zip -d /u01/src/
unzip -q linux.x64_11gR2_database_2of2.zip -d /u01/src/
# 存放oracle的配置文件信息和自動(dòng)應(yīng)答文件信息
mkdir -p /u01/etc
cp /u01/src/database/response/* /u01/etc/
[root@oracle response]# ls /u01/src/database/response
dbca.rsp db_install.rsp netca.rsp
可以看見/u01/src/database/response文件夾下有三個(gè)模板
其中dbca.rsp是用來創(chuàng)建數(shù)據(jù)庫(kù)的。db_install.rsp是用來安裝Oracle軟件的俊庇。netca.rsp是用來創(chuàng)建監(jiān)聽器的狮暑。
05.重啟系統(tǒng)
reboot
四、ORACLE軟件安裝(Oracle用戶操作)
01.編寫安裝應(yīng)答文件
為了避免交互辉饱,可以先將我們的“答案”寫在自動(dòng)應(yīng)答文件里心例,可以根據(jù)需要自動(dòng)修改
在/u01/etc/db_install.rsp
修改以下變量的值
su - oracle
vim /u01/etc/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
DECLINE_SECURITY_UPDATES=true
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOSTNAME=oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.config.starterdb.characterSet=ZHS16GBK
oracle.install.db.isCustomInstall=true
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
02.開始安裝
在安裝之前確保是使用Oracle用戶操作,
在/u01/src/database目錄下有runInstaller可執(zhí)行文件
su - oracle
cd /u01/src/database
./runInstaller -silent -responseFile /u01/etc/db_install.rsp -ignorePrereq
安裝期間可以再開一個(gè)會(huì)話窗口使用tail命令監(jiān)看oracle的安裝日志
#日志文件名稱根據(jù)自己的實(shí)際執(zhí)行時(shí)間變更
tail -f /u01/app/oracle/inventory/logs/installActions2021-09-06_04-56-22PM.log
如果在安裝過程沒有錯(cuò)誤鞋囊,并顯示以下信息提示,說明安裝完成
注意先不要回車瞎惫,注意看提示信息
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/u01/app/oracle/inventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.
提示信息的大致意思為:
新開一個(gè)會(huì)話窗口溜腐,使用root用戶登錄
然后執(zhí)行兩個(gè)腳本文件
再執(zhí)行完之后,回到這個(gè)安裝界面的窗口瓜喇,輸入"Enter"命令繼續(xù)
注意:腳本文件根據(jù)自己的路徑修改挺益,確保自己的腳本在該目錄下
03.使用root
用戶執(zhí)行腳本
su - root
/u01/app/oracle/inventory/orainstRoot.sh
/u01/app/oracle/product/11.2.0/root.sh
如果在安裝過程中出現(xiàn)報(bào)錯(cuò),無法安裝乘寒,可以把 /u01/app/oracle/目錄下的所有文件目錄刪除望众,
然后重新檢查、安裝
04.配置監(jiān)聽程序
直接在命令行輸入netca命令伞辛,如果沒有此命令烂翰,說明前面的環(huán)境變量有問題。
確認(rèn)有netca命令之后蚤氏,輸入以下命令
su - oracle
netca /silent /responsefile /u01/etc/netca.rsp
#輸出結(jié)果
[oracle@oracle database]$ netca /silent /responsefile /u01/etc/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /u01/etc/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/11.2.0/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
查看監(jiān)聽端口
netstat -tlunp|grep 1521
05.創(chuàng)建數(shù)據(jù)庫(kù)實(shí)例
編寫數(shù)據(jù)庫(kù)實(shí)例自動(dòng)應(yīng)答文件甘耿,該文件可以設(shè)置數(shù)據(jù)庫(kù)也就是實(shí)例的實(shí)例名和賬號(hào)密碼等信息。
vim /u01/etc/dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION =/u01/app/oracle/oradata
RECOVERYAREADESTINATION=/u01/app/oracle/fast_recovery_area
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "1638"
執(zhí)行靜默建數(shù)據(jù)庫(kù)實(shí)例
su - oracle
dbca -silent -responseFile /u01/etc/dbca.rsp
執(zhí)行過程如下
[oracle@oracledb ~]$ dbca -silent -responseFile /u01/etc/dbca.rsp
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
查看數(shù)據(jù)庫(kù)進(jìn)程
ps -ef | grep ora_ | grep -v grep
# 執(zhí)行結(jié)果
[oracle@oracledb ~]$ ps -ef | grep ora_ | grep -v grep
oracle 19304 1 0 18:33 ? 00:00:00 ora_pmon_orcl
oracle 19306 1 0 18:33 ? 00:00:00 ora_vktm_orcl
oracle 19310 1 0 18:33 ? 00:00:00 ora_gen0_orcl
oracle 19312 1 0 18:33 ? 00:00:00 ora_diag_orcl
oracle 19314 1 0 18:33 ? 00:00:00 ora_dbrm_orcl
oracle 19316 1 0 18:33 ? 00:00:00 ora_psp0_orcl
oracle 19318 1 0 18:33 ? 00:00:00 ora_dia0_orcl
oracle 19320 1 0 18:33 ? 00:00:00 ora_mman_orcl
oracle 19322 1 0 18:33 ? 00:00:00 ora_dbw0_orcl
oracle 19324 1 0 18:33 ? 00:00:00 ora_lgwr_orcl
oracle 19326 1 0 18:33 ? 00:00:00 ora_ckpt_orcl
oracle 19328 1 0 18:33 ? 00:00:00 ora_smon_orcl
oracle 19330 1 0 18:33 ? 00:00:00 ora_reco_orcl
oracle 19332 1 0 18:33 ? 00:00:00 ora_mmon_orcl
oracle 19334 1 0 18:33 ? 00:00:00 ora_mmnl_orcl
oracle 19336 1 0 18:33 ? 00:00:00 ora_d000_orcl
oracle 19338 1 0 18:33 ? 00:00:00 ora_s000_orcl
oracle 19361 1 0 18:34 ? 00:00:00 ora_qmnc_orcl
oracle 19376 1 0 18:34 ? 00:00:00 ora_cjq0_orcl
oracle 19396 1 0 18:34 ? 00:00:00 ora_q000_orcl
oracle 19398 1 0 18:34 ? 00:00:00 ora_q001_orcl
06.啟動(dòng)監(jiān)聽
先查看是否啟動(dòng)監(jiān)聽程序竿滨,一般在安裝好實(shí)例之后自動(dòng)啟動(dòng)佳恬,
但是下一重啟的時(shí)候就需要手動(dòng)啟動(dòng)監(jiān)聽程序捏境。
查看監(jiān)聽狀態(tài)
$ lsnrctl status
#結(jié)果
[oracle@oracle database]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 31-AUG-2022 17:46:10
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 31-AUG-2022 17:35:19
Uptime 0 days 0 hr. 10 min. 50 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
如果監(jiān)聽程序沒有啟動(dòng),可以使用start命令啟動(dòng)
lsnrctl start
07.連接數(shù)據(jù)庫(kù)
如果沒有設(shè)置數(shù)據(jù)庫(kù)開機(jī)自動(dòng)啟動(dòng)的話毁葱,每次開機(jī)都需要手動(dòng)啟動(dòng)數(shù)據(jù)庫(kù)垫言,先使用sysdba登錄到數(shù)據(jù)庫(kù),然后輸入startup
即可倾剿,
關(guān)閉數(shù)據(jù)庫(kù)輸入shu
命令
至此數(shù)據(jù)庫(kù)就安裝成功了筷频,下面我們登錄下數(shù)據(jù)庫(kù)
su - oracle
sqlplus / as sysdba
select status from v$instance;
執(zhí)行select時(shí),全出現(xiàn)以下情況
SQL> select status from v$instance;
select status from v$instance
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
解決方式:
- 輸入
startup
,
#startup的輸出提示:
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/dbs/initORCL.ora'
SQL>
根據(jù)提示柱告,將ORACLEBASE/admin/數(shù)據(jù)庫(kù)名稱/pfile目錄下的init.ora.xxx形式的文件copy
到ORACLE_BASE/admin/數(shù)據(jù)庫(kù)名稱/pfile目錄下的init.ora.xxx形式的文件copy到ORACLE_HOME/dbs目錄下initOracle.ora(根據(jù)startup提示)即可
[oracle@oracle ~]$ cd $ORACLE_BASE/
[oracle@oracle oracle]$ ls
admin cfgtoollogs checkpoints diag flash_recovery_area inventory oradata product
[oracle@oracle oracle]$ cd admin/orcl/pfile/
[oracle@oracle pfile]$ ls
init.ora.731202217454
[oracle@oracle pfile]$ cp init.ora.731202217454 /u01/app/oracle/product/11.2.0/dbs/initORCL.ora
[oracle@oracle pfile]$
查看數(shù)據(jù)庫(kù)編碼
select userenv('language') from dual;
# 輸出結(jié)果:
SQL> select userenv('language') from dual;
USERENV('LANGUAGE')
--------------------------------------------------------------------------------
AMERICAN_AMERICA.AL32UTF8
SQL>
查看數(shù)據(jù)庫(kù)版本
select * from v$version;
#結(jié)果
SQL> select * from v$version;
BANNER
--------------------------------------------------------------------------------
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
PL/SQL Release 11.2.0.1.0 - Production
CORE 11.2.0.1.0 Production
TNS for Linux: Version 11.2.0.1.0 - Production
NLSRTL Version 11.2.0.1.0 - Production
激活scott用戶
alter user scott account unlock;
alter user scott identified by tiger;
select username,account_status from dba_users;
08.設(shè)置Oracle開機(jī)啟動(dòng)
修改/u01/app/oracle/product/11.2.0/bin/dbstart
ORACLE_HOME_LISTNER=$ORACLE_HOME
修改/u01/app/oracle/product/11.2.0/bin/dbshut
ORACLE_HOME_LISTNER=$ORACLE_HOME
修改vi /etc/oratab
orcl:/u01/app/oracle/product/11.2.0:Y
新建文件/etc/rc.d/init.d/oracle
#! /bin/bash
# oracle: Start/Stop Oracle Database 11g R2
#
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
#
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0
ORACLE_USER=oracle
case "$1" in
'start')
if [ -f $LOCKFILE ]; then
echo $0 already running.
exit 1
fi
echo -n $"Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $LOCKFILE
;;
'stop')
if [ ! -f $LOCKFILE ]; then
echo $0 already stopping.
exit 1
fi
echo -n $"Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $LOCKFILE
;;
'restart')
$0 stop
$0 start
;;
'status')
if [ -f $LOCKFILE ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0
給/etc/init.d/oracle
添加執(zhí)行權(quán)限
chmod +x /etc/init.d/oracle
開機(jī)啟動(dòng)oracle
systemctl enable oracle
或
chkconfig oracle on
給啟動(dòng)文件加權(quán)限
cd /u01/app/oracle/product/11.2.0/bin/
chmod 6751 oracle
cd /var/tmp
chown -R oracle:oinstall .oracle
SYS@qq> startup nomount;
ORA-00845: MEMORY_TARGET not supported on this system
找到錯(cuò)誤原因是MEMORY_MAX_TARGET 的設(shè)置不能超過 /dev/shm 的大小截驮,我們來看一下解決步驟:
[oracle@ocp dbs]$ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 95G 21G 70G 23% /
tmpfs 932M 265M 667M 29% /dev/shm
/dev/sda1 194M 34M 151M 19% /boot
/dev/sr0 3.6G 3.6G 0 100% /media/RHEL_6.5 x86_64 Disc 1
[oracle@ocp dbs]$ cat /etc/fstab | grep tmpfs
tmpfs /dev/shm tmpfs defaults 0 0
可以看出/dev/shm分區(qū)確實(shí)有點(diǎn)小,我們給它加大就可以了际度,現(xiàn)在可以通過重啟使這個(gè)配置生效葵袭,也可以通過重新掛載來修改其大小:
[root@oracle ~]# mount -o remount,size=3G /dev/shm/
[root@oracle ~]# df -h | grep shm
tmpfs 3.0G 1.9G 1.2G 64% /dev/shm
注意:要用root用戶才能有權(quán)限掛載分區(qū)乖菱。
再次啟動(dòng)數(shù)據(jù)庫(kù)就沒有報(bào)錯(cuò)了坡锡。
SQL> startup nomount;
ORACLE instance started.
Total System Global Area 1068937216 bytes
Fixed Size 2260088 bytes
Variable Size 671089544 bytes
Database Buffers 390070272 bytes
Redo Buffers 5517312
bytes
參考文章:
https://blog.csdn.net/qq_20143059/article/details/107227679