在技术学习之路坚持走下去
分类: Oracle
2015-05-11 22:21:53
安装环境,Windows 7上部署的VMware Workstation 11.0。安装了RHEL server 7.0系统,2G内存,2×2CPU,1块20GB硬盘,1块15GB硬盘(由于安装过程中提示空间不足后增加的),网络设置为主机模式。
安装软件包 Oracle linuxamd64_12102_database。(linuxamd64_12c_database的安装包有大虾提示bug过多)
整个安装过程如下:(1-13为系统配置,可以跳过)
1、 安装系统,选择server with GUI。(具体系统安装网上资料很多,大家自行查找吧)
2、 挂载镜像
[root@redhat ~]# mkdir /media/rhel
[root@redhat ~]# mount -o loop /dev/sr0 /media/rhel
3、 新建一个本地repo文件
[root@rac1 mnt]# more /etc/yum.repos.d/local.repo
[rhel-source]
name=server
baseurl=file:///media/cdrom
enabled=1
gpgchek=0
[root@rac2 cdrom]# rpm --import /media/cdrom/RPM-GPG-KEY-redhat-release
4、 安装vnc
[root@rac2 cdrom]# yum install vnc
5、 安装服务器包
[root@rac2 Packages]# rpm -ivh tigervnc-server-1.2.80-0.30.20130314svn5065.el7.x86_64.rpm
6、 配置启动文件
[root@rac2 system]# cp /lib/systemd/system/vncserver@.service /lib/systemd/system/vncserver@:2.service
[root@rac2 system]# vi
7、 同步配置文件
[root@rac2 system]# systemctl daemon-reload
8、 配置登录密码
[root@rac2 system]# vncpasswd
Password:
Verify:
9、 启动服务
[root@rac2 system]# systemctl start vncserver@:2.service
10、 查看服务状态
[root@rac2 system]# systemctl status vncserver@:2.service -l
vncserver@:2.service - Remote desktop service (VNC)
Loaded: loaded (/usr/lib/systemd/system/vncserver@:2.service; disabled)
Active: active (running) since Mon 2015-05-04 10:42:19 CST; 12s ago
Process: 44624 ExecStart=/sbin/runuser -l root -c /usr/bin/vncserver :2 (code=exited, status=0/SUCCESS)
Process: 44622 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill :2 > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
Main PID: 44677 (Xvnc)
CGroup: /system.slice/system-vncserver.slice/vncserver@:2.service
??44677 /usr/bin/Xvnc :2 -desktop rac2:2 (root) -auth /root/.Xauthority -geometry 1024x768 -rfbwait 30000 -rfbauth /root/.vnc/passwd -rfbport 5902 -fp catalogue:/etc/X11/fontpath.d -pn
May 04 10:42:19 rac2 systemd[1]: Started Remote desktop service (VNC).
11、 开机启动服务
[root@rac2 system]# systemctl enable vncserver@:2.service
ln -s '/usr/lib/systemd/system/vncserver@:2.service' '/etc/systemd/system/multi-user.target.wants/vncserver@:2.service'
12、 关闭防火墙
[root@rac2 system]# systemctl stop firewalld.service
13、 永久关闭防火墙
systemctl disable firewalld.service
Oracle准备工作
14、 安装缺失rpm软件包
(RHEL 7.0默认未安装的,compat-libstdc++-33-3.2.3-68.7.x86_64.rpm在系统盘中没有,需要晚上下载)
rpm -ivh libstdc++-4.8.2-16.el7.x86_64.rpm
rpm -ivh elfutils-libelf-devel-0.158-3.el7.x86_64.rpm
rpm -ivh mpfr-3.1.1-4.el7.x86_64.rpm
rpm -ivh libmpc-1.0.1-3.el7.x86_64.rpm
rpm -ivh kernel-headers-3.10.0-123.el7.x86_64.rpm
rpm -ivh glibc-headers-2.17-55.el7.x86_64.rpm
rpm -ivh glibc-devel-2.17-55.el7.x86_64.rpm
rpm -ivh cpp-4.8.2-16.el7.x86_64.rpm
rpm -ivh gcc-4.8.2-16.el7.x86_64.rpm
rpm -ivh libstdc++-devel-4.8.2-16.el7.x86_64.rpm
rpm -ivh gcc-c++-4.8.2-16.el7.x86_64.rpm
rpm -ivh libaio-devel-0.3.109-12.el7.x86_64.rpm
rpm -ivh ksh-20120801-19.el7.x86_64.rpm
rpm -ivh unixODBC-2.3.1-10.el7.x86_64.rpm
rpm -ivh unixODBC-devel-2.3.1-10.el7.x86_64.rpm
rpm -ivh compat-libcap1-1.10-7.el7.x86_64.rpm
rpm –ivh compat-libstdc++-33-3.2.3-68.7.x86_64.rpm
15、 检查系统环境
[root@rac1 ~]# grep MemTotal /proc/meminfo //查看内存
MemTotal: 1870784 kB
[root@rac1 ~]# grep SwapTotal /proc/meminfo //查看交换区
SwapTotal: 2097148 kB
[root@rac1 ~]# df –h //查看磁盘空间
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 18G 3.1G 15G 18% /
devtmpfs 908M 0 908M 0% /dev
tmpfs 914M 164K 914M 1% /dev/shm
tmpfs 914M 9.0M 905M 1% /run
tmpfs 914M 0 914M 0% /sys/fs/cgroup
/dev/sda1 497M 96M 401M 20% /boot
/dev/sr0 3.5G 3.5G 0 100% /run/media/root/RHEL-7.0 Server.x86_64
[root@rac1 ~]# df -h /tmp //查看tmp区大小
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel-root 18G 3.1G 15G 18% /
[root@rac1 ~]# free
total used free shared buffers cached
Mem: 1870784 989728 881056 9604 928 335796
-/+ buffers/cache: 653004 1217780
Swap: 2097148 0 2097148
[root@rac1 ~]# uname –m //查看系统版本
x86_64
[root@rac1 ~]# uname –a //查看系统内核版本
Linux rac1 3.10.0-123.el7.x86_64 #1 SMP Mon May 5 11:16:57 EDT 2014 x86_64 x86_64 x86_64 GNU/Linux
[root@rac1 ~]# rpm -qa | grep openssh //查看ssh是否安装
openssh-clients-6.4p1-8.el7.x86_64
openssh-6.4p1-8.el7.x86_64
openssh-server-6.4p1-8.el7.x86_64
16、 增加磁盘空间和变更swap大小。
过程见我另一篇博客,建议安装系统时提前规划好大小。
安装前磁盘空间
[oracle@rac1 tmp]$ df -k
df: ?.run/user/0/gvfs?. Permission denied
df: ?.run/media/root/RHEL-7.0 Server.x86_64?. Permission denied
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/rhel-root 23590912 8790792 14800120 38% /
devtmpfs 928976 0 928976 0% /dev
tmpfs 935392 304 935088 1% /dev/shm
tmpfs 935392 9200 926192 1% /run
tmpfs 935392 0 935392 0% /sys/fs/cgroup
/dev/sda1 508588 98296 410292 20% /boot
安装完成后磁盘空间
[root@rac1 tmp]# df -k
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/mapper/rhel-root 23590912 19033240 4557672 81% /
devtmpfs 928976 0 928976 0% /dev
tmpfs 935392 484460 450932 52% /dev/shm
tmpfs 935392 9200 926192 1% /run
tmpfs 935392 0 935392 0% /sys/fs/cgroup
/dev/sda1 508588 98296 410292 20% /boot
/dev/sr0 3654720 3654720 0 100% /run/media/root/RHEL-7.0 Server.x86_64
因此安装前最少要12个G的剩余空间。
17、 配置内核
[root@rac1 etc]# sysctl -a | grep sem
kernel.sem = 250 32000 32 128 250 3200 100 128
[root@rac1 etc]# sysctl -a | grep shm
kernel.shm_rmid_forced = 0
kernel.shmall = 268435456
kernel.shmmax = 4294967295 1024物理内存的一半,单位字节(957841408)
kernel.shmmni = 4096 4096
vm.hugetlb_shm_group = 0
[root@rac1 etc]# sysctl -a | grep file-max
fs.file-max = 184462 6815744
[root@rac1 etc]# sysctl -a | grep ip_local_port_range
net.ipv4.ip_local_port_range = 32768 61000 9000 65500
[root@rac1 etc]# sysctl -a | grep rmem_de
net.core.rmem_default = 212992 262144
[root@rac1 etc]# sysctl -a | grep rmem_max
net.core.rmem_max = 212992 4194304
[root@rac1 etc]# sysctl -a | grep wmem_default
net.core.wmem_default = 212992 262144
[root@rac1 etc]# sysctl -a | grep wmem_max
net.core.wmem_max = 212992 1048576
[oracle@rac1 ~]$ ulimit -Sn
1024
[oracle@rac1 ~]$ ulimit -Hn
4096
[oracle@rac1 ~]$ ulimit -Su
4096
[oracle@rac1 ~]$ ulimit -Hu
14515
[oracle@rac1 ~]$ ulimit -Ss
8192
[oracle@rac1 ~]$ ulimit -Hs
unlimited
更改不符合的参数
[root@rac1 tmp]# vi /etc/sysctl.conf
[root@rac1 tmp]# more /etc/sysctl.conf
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new
settings here, or in an /etc/sysctl.d/
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 957841408
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 = 1048586
[root@rac1 tmp]#
# /sbin/sysctl –p //配置生效
# /sbin/sysctl –a //查看生效配置
18、 配置用户和用户组
/usr/sbin/groupadd -g 200 oinstall
/usr/sbin/groupadd -g 201 dba
/usr/sbin/groupadd -g 202 oper
/usr/sbin/useradd -u 440 -g oinstall -G dba oracle
安装过程见截图
启动安装
配置邮箱,可以跳过
选择安装时创建数据库,还是单纯装软件
数据库级别
数据库类型
典型安装
安装路径
提示安装校验错误,如果没有错误就直接是下图
整体的安装配置
有两个脚本需要root用户手动执行
[root@rac1 app]# cd /ora/app/oraInventory/
[root@rac1 oraInventory]# ./orainstRoot.sh
Changing permissions of /ora/app/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /ora/app/oraInventory to oinstall.
The execution of the script is complete.
[root@rac1 oraInventory]# cd ../oracle/
[root@rac1 oracle]# pwd
/ora/app/oracle
[root@rac1 oracle]# cd product/12.1.0/dbhome_1/
[root@rac1 dbhome_1]# ./root.sh
Performing root user operation.
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /ora/app/oracle/product/12.1.0/dbhome_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.
[root@rac1 dbhome_1]#
You can find the log of this install session at:
/ora/app/oraInventory/logs/installActions2015-05-11_02-57-05PM.log
配置oracle的环境变量
[oracle@rac1 ~]$ vi .bash_profile激动人心的时刻到了,启动和关闭数据库
[oracle@rac1 bin]$ sqlplus /nolog
SQL> startup
ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/ora/app/oracle/product/12.1.0/dbhome_1/dbs/initrac1.ora'
SQL>
[oracle@rac1 dbs]$ cp /ora/app/oracle/admin/orcl/pfile/init.ora.4112015153636 /ora/app/oracle/product/12.1.0/dbhome_1/dbs/initrac1.ora
SQL> startup
ORACLE instance started.
Total System Global Area 767557632 bytes
Fixed Size 2929112 bytes
Variable Size 608177704 bytes
Database Buffers 150994944 bytes
Redo Buffers 5455872 bytes
Database mounted.
Database opened.
SQL>
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.