1.oracle安装
1.前言
Centos7下安装oracle11g r2
2.具体操作
参考:
https://www.cnblogs.com/muhehe/p/7816808.html
https://blog.csdn.net/qq_21153619/article/details/81771791
软件安装
配置YUM(主备全操作):
[root@www ~]# vi /etc/yum.repos.d/redhat.repo
[server]
name=server
baseurl=file:///mnt/Server
enabled=1
gpgcheck=0
挂载光盘到MNT目录下(主备全操作):
[root@www ~]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
清除YUM缓存(主备全操作):
[root@www ~]# yum clean all
Loaded plugins: rhnplugin, security
Cleaning up Everything
[root@www ~]# yum repolist
Loaded plugins: rhnplugin, security
This system is not registered with RHN.
RHN support will be disabled.
server | 1.3 kB 00:00
server/primary | 845 kB 00:00
server 3040/3040
repo id repo name status
server server enabled: 3,040
repolist: 3,040
检查安装ORACLE所需要的依赖包(主备全操作):
[root@www ~]# unset uninstall_rpm;for i in binutils compat-libstdc++-33 \
elfutils-libelf elfutils-libelf-devel \
gcc gcc-c++ glibc glibc-devel glibc-headers kernel-headers \
libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel \
make sysstat unixODBC unixODBC-devel;do rpm -q $i &>/dev/null || uninstall_rpm="$uninstall_rpm $i";\
done;[[ -z "$uninstall_rpm" ]] && echo -e "\nuninstall_rpm:\n\tOK.OK.OK"|| \
echo -e "\nuninstall_rpm:\n\t$uninstall_rpm"
uninstall_rpm:
elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers kernel-headers libaio-devel libgomp libstdc++-devel sysstat unixODBC unixODBC-devel
安装缺少软件包(主备全操作):
[root@www ~]# yum install -y elfutils-libelf-devel gcc gcc-c++ glibc-devel glibc-headers kernel-headers libaio-devel libgomp libstdc++-devel sysstat unixODBC unixODBC-devel
Installed:
elfutils-libelf-devel.i386 0:0.137-3.el5 elfutils-libelf-devel.x86_64 0:0.137-3.el5
gcc.x86_64 0:4.1.2-46.el5 gcc-c++.x86_64 0:4.1.2-46.el5
glibc-devel.i386 0:2.5-42 glibc-devel.x86_64 0:2.5-42
glibc-headers.x86_64 0:2.5-42 kernel-headers.x86_64 0:2.6.18-164.el5
libaio-devel.i386 0:0.3.106-3.2 libaio-devel.x86_64 0:0.3.106-3.2
libgomp.i386 0:4.4.0-6.el5 libgomp.x86_64 0:4.4.0-6.el5
libstdc++-devel.i386 0:4.1.2-46.el5 libstdc++-devel.x86_64 0:4.1.2-46.el5
sysstat.x86_64 0:7.0.2-3.el5 unixODBC.i386 0:2.2.11-7.1
unixODBC.x86_64 0:2.2.11-7.1 unixODBC-devel.i386 0:2.2.11-7.1
unixODBC-devel.x86_64 0:2.2.11-7.1
Dependency Installed:
elfutils-libelf.i386 0:0.137-3.el5 elfutils-libelf-devel-static.i386 0:0.137-3.el5
elfutils-libelf-devel-static.x86_64 0:0.137-3.el5
Complete!
添加Oracle用户和组(主备全操作):
[root@www ~]# groupadd oinstall
[root@www ~]# groupadd dba
[root@www ~]# useradd -g oinstall -G dba oracle
[root@www ~]# passwd oracle
Changing password for user oracle.
New UNIX password:
BAD PASSWORD: it does not contain enough DIFFERENT characters
Retype new UNIX password:
passwd: all authentication tokens updated successfully.
修改系统对ORACLE限制(主备全操作):
[root@www ~]# vi /etc/sysctl.conf
kernel.shmall = 2097152
kernel.shmmax = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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 = 1048586
使内核参数生效(主备全操作):
[root@www ~]# sysctl -p
net.ipv4.ip_forward = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.accept_source_route = 0
kernel.sysrq = 0
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
kernel.shmall = 2097152
kernel.shmmax = 4294967296
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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 = 1048586
修改ORACLE用户文件限制(主备全操作):
[root@www ~]# vi /etc/security/limits.conf
oracle soft nofile 65536
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
建立相关目录(主备全操作):
[root@www ~]# mkdir -p /home/oracle/u01/app/oracle
[root@www ~]# chown -R oracle:oinstall /home/oracle/u01/app/
[root@www ~]# chmod -R 775 /home/oracle/u01/app
[root@www ~]# chown -R oracle.oinstall /home/oracle/u01
修改ORACLE用户环境变量(主备全操作):
[root@www home]# su - oracle
[oracle@www ~]$ vi .bashrc
export ORACLE_BASE=/home/oracle/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
export ORACLE_SID=pri(主库为pri,备库为std)
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LANG=AMERICAN_AMERICA.ZHS16CGB231280
安装ORACLE软件(主备全操作):机器很慢
执行最后弹出的脚本:
[oracle@www ~]$ exit
[root@www ~]# /home/oracle/u01/app/ora
oracle/ oraInventory/
[root@www ~]# /home/oracle/u01/app/oraInventory/orainstRoot.sh
Changing permissions of /home/oracle/u01/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /home/oracle/u01/app/oraInventory to oinstall.
The execution of the script is complete.
[root@www ~]# /home/oracle/u01/app/oracle/product/11.2.0/db_1/root.sh
Performing root user operation for Oracle 11g
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /home/oracle/u01/app/oracle/product/11.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]:
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Finished product-specific root actions.
建立数据库(只在主库操作,备库用RMAN进行恢复)