1、停用IPV6(不是必须可以略过)
shell>sysctl net.ipv6.conf.all.disable_ipv6=1
shell>vim /etc/sysctl.conf
#修改配置如下
net.ipv6.conf.all.disable_ipv6=1
net.ipv6.conf.default.disable_ipv6=1
net.ipv6.conf.lo.disable_ipv6=1
2、配置主机名及域名解析
shell>hostnamectl set-hostname oracle-12c
shell>echo ‘192.168.0.50 oracle-12c’ >> /etc/hosts
shell>ping oracle-12c
3、设置支持中文
#查看默认语系
[root@oracle-12c ~]# locale
LANG=en_US.UTF-8
LC_CTYPE=“en_US.UTF-8”
LC_NUMERIC=“en_US.UTF-8”
LC_TIME=“en_US.UTF-8”
LC_COLLATE=“en_US.UTF-8”
LC_MONETARY=“en_US.UTF-8”
LC_MESSAGES=“en_US.UTF-8”
LC_PAPER=“en_US.UTF-8”
LC_NAME=“en_US.UTF-8”
LC_ADDRESS=“en_US.UTF-8”
LC_TELEPHONE=“en_US.UTF-8”
LC_MEASUREMENT=“en_US.UTF-8”
LC_IDENTIFICATION=“en_US.UTF-8”
LC_ALL=
#查看支持的语系
[root@oracle-12c ~]# locale -a
…
zh_CN
zh_CN.gb18030
zh_CN.gb2312
zh_CN.gbk
zh_CN.utf8
…
修改配置文件永久生效
[root@oracle-12c ~]# vim /etc/locale.conf
LANG=“zh_CN.UTF-8”
[root@oracle-12c ~]#reboot
#查看语言默认为中文了
[root@oracle-12c ~]# echo $LANG
zh_CN.UTF-8
4、安装CNOME桌面
[root@oracle-12c ~]# yum -y groupinstall “GNOME Desktop”
5、创建Oracle数据库所需的用户和组
[root@oracle-12c ~]# groupadd dba
[root@oracle-12c ~]# groupadd oinstall
[root@oracle-12c ~]# useradd -g oinstall -G dba oracle
[root@oracle-12c ~]# passwd oracle
[root@oracle-12c ~]# id oracle
uid=1001(oracle) gid=1002(oinstall) 组=1002(oinstall),1001(dba)
#配置oracle使用资源情况
[root@oracle-12c ~]# vim /etc/security/limits.conf
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240
6、创建安装oracle数据库所需目录
[root@oracle-12c ~]# mkdir -p /u01/app/oracle
[root@oracle-12c ~]# chown -R oracle.oinstall /u01/
[root@oracle-12c ~]# chmod -R 755 /u01/
7、安装和配置VNC
[root@oracle-12c ~]# yum -y install tigervnc-server
复制vnc的启动操作脚本, vncserver@:1.service中的:1表示"桌面号",
启动的端口号就是5900+桌面号,即是5901,如果再有一个就是2啦,
端口号加1就是5902,以此类推:
[root@oracle-12c ~]# cp /lib/systemd/system/[email protected] /etc/systemd/system/vncserver@:1.service
[root@oracle-12c ~]# vim /etc/systemd/system/vncserver@:1.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target
[Service]
Type=simple
# Clean any existing files in /tmp/.X11-unix environment**
ExecStartPre=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’
#仅仅修改这里的用户名为oralce即可
ExecStart=/usr/bin/vncserver_wrapper oracle %i
ExecStop=/bin/sh -c ‘/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :’
[Install]
WantedBy=multi-user.target
#切换到oracle用户 设置vnc远程桌面密码
[root@oracle-12c ~]# su - oracle
[oracle@oracle-12c ~]$ vncpasswd
Password: -->qwert@12345 远程桌面的密码
Verify:
Would you like to enter a view-only password (y/n)? n
A view-only password is not used
#oracle用户启动vnc
[oracle@oracle-12c ~]$ vncserver
#或者由root用户启动vnc服务
[root@oracle-12c ~]# systemctl start vncserver@:1.service
[root@oracle-12c system]# netstat -tulnp | grep vnc
tcp 0 0 0.0.0.0:5901 0.0.0.0:* LISTEN 53249/Xvnc
tcp 0 0 0.0.0.0:6001 0.0.0.0:* LISTEN 53249/Xvnc
tcp6 0 0 :::5901 :: LISTEN 53249/Xvnc
tcp6 0 0 :::6001 :: LISTEN 53249/Xvnc
8、windows上安装VNC-Viewer连接linux 端口5901
9、上传oracle安装文件到centos的/tmp目录
10、通过vnc连接到centos桌面
11、解压oracle12c安装包
[root@oracle-12c ~] unzip linuxx64_12201_database.zip -d /tmp
12、安装oracle所需依赖包
[root@oracle-12c ~]# yum -y install compat-libcap1 compat-libstdc+±33 libstdc+±devel gcc gcc-c++ ksh libaio-devel
#完整全部依赖
yum -y install binutils compat-libcap1 libgcc libstdc++ libstdc+±devel sysstat gcc-c++ ksh make glibc glibc-devel libaio libaio-devel smartmontools net-tools
到远程桌面操作
[root@oracle-12c tmp]# cd /tmp/database/
[oracle@oracle-12c database]$ ls
install response rpm runInstaller sshsetup stage welcome.html
[oracle@oracle-12c database]$ ./runInstaller
根据oracle安装提示root执行以下脚本
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/12.2.0/dbhome_1/root.sh
13安装完后配置
1)检查listener.ora 和 tnsnames.ora
第一个文件
[root@oracle-12c ~]# find /u01 -name listener.ora
[root@oracle-12c ~]# cat /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle-12c)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
第二个文件
[root@oracle-12c ~]# find /u01 -name tnsnames.ora
/u01/app/oracle/product/12.2.0/dbhome_1/network/admin/samples/tnsnames.ora
/u01/app/oracle/product/12.2.0/dbhome_1/network/admin/tnsnames.ora
[root@oracle-12c ~]# cat /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/12.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle-12c)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracle-12c)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
[root@oracle-12c ~]# netstat -tulnp | grep 1521
tcp6 0 0 :::1521 :: LISTEN 10824/tnslsnr
2)配置/etc/oratab
vim /etc/oratab
orcl:/u01/app/oracle/product/12.2.0/dbhome_1:N ==> N修改为Y
3)配置/etc/rc/local随系统启动oracle及tnslsnr
vim /etc/rc/local --> vim /etc/rc.local(该文件centos7默认没有执行权限,需要赋予执行权限)
TMP=/tmp
TMPDIR= T M P O R A C L E B A S E = / u 01 / a p p / o r a c l e O R A C L E H O M E = / u 01 / a p p / o r a c l e / p r o d u c t / 12.2.0 / d b h o m e 1 O R A C L E S I D = o r c l O R A C L E T E R M = x t e r m P A T H = / u s r / s b i n : TMP ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 ORACLE_SID=orcl ORACLE_TERM=xterm PATH=/usr/sbin: TMPORACLEBASE=/u01/app/oracleORACLEHOME=/u01/app/oracle/product/12.2.0/dbhome1ORACLESID=orclORACLETERM=xtermPATH=/usr/sbin:PATH
PATH= O R A C L E H O M E / b i n : ORACLE_HOME/bin: ORACLEHOME/bin:PATH
LD_LIBRARY_PATH= O R A C L E H O M E / l i b : / l i b : / u s r / l i b C L A S S P A T H = ORACLE_HOME/lib:/lib:/usr/lib CLASSPATH= ORACLEHOME/lib:/lib:/usr/libCLASSPATH=ORACLE_HOME/jdk/jre: O R A C L E H O M E / j l i b : ORACLE_HOME/jlib: ORACLEHOME/jlib:ORACLE_HOME:/rdbms/jlib
export CLASSPATH LD_LIBRARY_PATH ORACLE_TERM ORACLE_SID ORACLE_HOME ORACLE_BASE TMPDIR TMP
su - oracle -c “lsnrctl start”
su - oracle -c “dbstart”
4)配置/etc/profile环境变量(不配置如下使用不了oracle的客户端)
备注:如果不希望所有用户都可以使用sqlplus,可以仅配置oracle用户的~/.bash_profile文件
配置到文件最后
vim etc/profile
TMP=/tmp
TMPDIR= T M P O R A C L E B A S E = / u 01 / a p p / o r a c l e O R A C L E H O M E = / u 01 / a p p / o r a c l e / p r o d u c t / 12.2.0 / d b h o m e 1 O R A C L E S I D = o r c l O R A C L E T E R M = x t e r m P A T H = / u s r / s b i n : TMP ORACLE_BASE=/u01/app/oracle ORACLE_HOME=/u01/app/oracle/product/12.2.0/dbhome_1 ORACLE_SID=orcl ORACLE_TERM=xterm PATH=/usr/sbin: TMPORACLEBASE=/u01/app/oracleORACLEHOME=/u01/app/oracle/product/12.2.0/dbhome1ORACLESID=orclORACLETERM=xtermPATH=/usr/sbin:PATH
PATH= O R A C L E H O M E / b i n : ORACLE_HOME/bin: ORACLEHOME/bin:PATH
LD_LIBRARY_PATH= O R A C L E H O M E / l i b : / l i b : / u s r / l i b C L A S S P A T H = ORACLE_HOME/lib:/lib:/usr/lib CLASSPATH= ORACLEHOME/lib:/lib:/usr/libCLASSPATH=ORACLE_HOME/jdk/jre: O R A C L E H O M E / j l i b : ORACLE_HOME/jlib: ORACLEHOME/jlib:ORACLE_HOME:/rdbms/jlib
export CLASSPATH LD_LIBRARY_PATH ORACLE_TERM ORACLE_SID ORACLE_HOME ORACLE_BASE TMPDIR TMP
if [ $USER = “oracle” ];then
if [ $SHELL = “/bin/ksh” ];then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi