将jdk-linux-x64.tar.gz上传至/usr/local目录下,下载链接:链接:https://pan.baidu.com/s/16DIADy_NA35NExs-cx_q9Q
提取码:QGS1
可通过Xshell6和MobaXterm或者其他工具上传
cd /usr/local
ll
tar -zxvf jdk-linux-x64.tar.gz #解压安装包
mv jdk1.8.0_131 java #更改文件夹目录名称
vi /etc/profile #更改环境变量,在最后添加如下内容
export JAVA_HOME=/usr/local/java
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
java -version #如截图,完成成功
安装相关依赖包
yum -y install kernel-headers* gcc-c++* numactl-devel* glibc-headers* glibc-common* binutils* unixODBC-devel* libaio* make* elfutils-libelf* elfutils-libelf-devel* sysstat* glibc-static* glibc-devel* glibc* elfutils-libelf-devel-static* libaio* gcc* libgcc* libstdc++-static* libaio-devel* libstdc++* libaio-devel* unixODBC* libstdc++-devel* compat-libstdc++* libgcc* libgomp*
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
yum -y install dnf #安装dnf
#升级python并安装软件
yum update python*
yum install dnf-data dnf-plugins-core libdnf-devel libdnf python2-dnf-plugin-migrate dnf-automatic
dnf install tzdata*
dnf install libX*
groupadd oinstall #创建组
groupadd dba
useradd -m -d /home/oracle -g oinstall -G dba oracle #创建oracle用户并分配组
passwd oracle #设置oracle用户密码
配置文件
vi /etc/sysctl.conf #修改内核,在最尾部添加如下内容
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 1200000000
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
/sbin/sysctl -p
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/pam.d/login #修改login文件,在尾部添加如下内容
session required /lib64/security/pam_limits.so
session required pam_limits.so
vi /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
#创建安装目录、修改文件权限
mkdir -p /opt/oracle/product/11.2.0
mkdir /opt/oracle/oradata
mkdir /opt/oracle/inventory
mkdir /opt/oracle/fast_recovery_area
chown -R oracle:oinstall /opt/oracle
chmod -R 775 /opt/oracle
vi /home/oracle/.bashrc #设置环境oracle变量,在尾部添加如下内容
ORACLE_BASE=/opt/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0
ORACLE_SID=orcl
PATH=$PATH:$ORACLE_HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
cd /opt/oracle #上传oracle两个压缩包,可通过Xshell6和MobaXterm或者其他工具上传
yum -y install unzip #安装解压命令
#解压
unzip linux.x64_11gR2_database_1of2.zip
unzip linux.x64_11gR2_database_2of2.zip
#为了方便更改主机名,我对主机名进行了修改
hostnamectl set-hostname c1
su
vi /opt/oracle/database/response/db_install.rsp #配置静默安装文件,配置内容如下,耐心配置,一 一对应
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=c1
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/opt/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/opt/oracle/product/11.2.0
ORACLE_BASE=/opt/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
su - oracle #切换到 oracle用户,进行下一步安装
cd /opt/oracle/database/
#安装,耐心等待即可
./runInstaller -silent -ignorePrereq -ignoreSysPrereqs -responseFile /opt/oracle/database/response/db_install.rsp
cd /opt/oracle/inventory/ #切换到目录,查看是否有./orainstRoot.sh文件
ll
./orainstRoot.sh #执行./orainstRoot.sh文件
此脚本必须以根用户身份执行
su #切换root用户,输入密码(由于之前切换到了oracle用户,所以要切换回root用户才能执行sh脚本)
cd /opt/oracle/product/11.2.0/
ll
./root.sh #执行./root.sh脚本
su - oracle #切换到oracle用户,配置监听
export DISPLAY=IP:0.0 #IP为本机地址,export DISPLAY=本机地址:0.0
netca -silent -responseFile /opt/oracle/database/response/netca.rsp
dbca -silent -responseFile /opt/oracle/database/response/dbca.rsp #建立新库,页面不动之后回车后并输入oracle密码,等待初始化
sqlplus / as sysdba #验证是否成功
sqlplus / as sysdba
startup
ORA-00845: MEMORY_TARGET not supported on this system
ORA-00845:此系统不支持目标内存
解决方法如下
方法1.简单粗暴
重启机子/虚拟机
方法2如下
cd /opt/oracle/product/11.2.0/dbs/
ll
cd /opt/oracle/admin/orcl11g/pfile
ll
cp init.ora.2220211118 /opt/oracle/product/11.2.0/dbs/ #根据实际来操作
cd /opt/oracle/product/11.2.0/dbs/
mv init.ora.2220211118 initorcl.ora
su #切回root
chown oracle:oinstall initorcl.ora
df -h
mount -o remount,size=8.5G /dev/shm/
还不行就在重启一下