ORACLE安装(12c-Redhat6.5)
Posted The Scented Path
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ORACLE安装(12c-Redhat6.5)相关的知识,希望对你有一定的参考价值。
Oracle安装(12c-Redhat6.5)
Redhat6.5系统准备
/ |
10G |
SWAP |
4G |
/boot |
200M |
/HOME |
4G |
/usr |
8G |
/var |
4G |
/u01 |
|
一:Linux挂载:VMware tools for Linux安装
# mkdir /mnt/cdrom
# mount /dev/cdrom /mnt/cdrom/
# cp VMwareTools-9.0.0-782409.tar.gz /opt/
# tar -zxvpf VMwareTools-9.0.0-782409.tar.gz
# cd vmware-tools-distrib
# ./vmware-install.pl
# /etc/init.d/vmware-tools status #查看是否有在執行
二、设置ip地址:Linux网络配置:设置IP地址、网关DNS、主机名
/etc/sysconfig/network-scripts/ifcfg-ethN 文件
/etc/hosts文件
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.66
NETMASK=255.255.255.0
GATEWAY=192.168.0.65
配置OK后使用service network restart重启网络服务
三、设置防火墙
设置 vim /etc/selinux/config
SELINUX=disabled
关闭防火墙
chkconfig ip6tables off
chkconfig iptables off
service iptables stop
service ip6tables stop
查看防火墻狀態:service iptables status
啟動防火墻:service iptables start
禁用防火墻:service iptables stop
四、建立oracle账户和群组
建立dba群组:groupadd dba
创建oracle用户并授权到dba群组:useradd -g dba oracle
设定oracle用户密码:passwd oracle
五、创建oracle工作目录
Oracle基础目录:mkdir -p /u01/app/oracle
Oracle软件存放目录:mkdir -p /u01/app/oracle/product
Oracle库存目录:mkdir -p /u01/app/oraInventory
Oracle数据库文件目录:mkdir -p /u01/app/oracle/oradata
六、授权Oracle工作目录
chown -R oracle.dba /u01
七、Yum源配置 ,安装Packages
挂载Redhat5.8ISO文件
mount /dev/cdrom /mnt/cdrom
注:虚拟机-〉setting->cd/dvd-〉device status-.connected前面的勾打上
备份Yum的配置文件
1. #cd /etc/yum.repos.d/
2. #cp rhel-debuginfo.repo rhel-debuginfo.repo.bak
配置文件进行编辑
vi rhel-debuginfo.repo |
[rhel-debuginfo] name=Red Hat Enterprise Linux $releasever – $basearch – Debug baseurl=file:///mnt/cdrom/Server enabled=1 gpgcheck=1 gpgkey=file:///mnt//cdrom/pki/rpm-gpg/RPM-GRG-KEY-redhat-release |
vim rhel-source.repo |
[oel6] name=oel6 baseurl=file:///mnt/cdrom enabled=1 gpgcheck=0 |
验证可以安装的组件
#yum grouplist
安装组件
#yum groupinstall “KDE (K Desktop Environment)”
# yum -y install glibc-devel-2.5*
Packages:Red Hat Enterprise Linux 4.0:
binutils-2.15.92.0.2-10.EL4
compat-db-4.1.25-9
control-center-2.8.0-12
gcc-3.4.3-9.EL4
gcc-c++-3.4.3-9.EL4
glibc-2.3.4-2
glibc-common-2.3.4-2
gnome-libs-1.4.1.2.90-44.1
libstdc++-3.4.3-9.EL4
libstdc++-devel-3.4.3-9.EL4
make-3.80-5
pdksh-5.2.14-30
sysstat-5.0.5-1
xscreensaver-4.18-5.rhel4.2
八、Configuring Kernel Parameters
kernel parameter settings /etc/sysctl.conf /sbin/sysctl -p /etc/sysctl.conf |
kernel.shmmni = 4096
kernel.sem = 250 32000 100 142
fs.aio-max-nr = 1048576
fs.file-max = 6815744
net.ipv4.ip_local_port_range = 9000 65000
net.core.rmem_default = 262144
net.core.rmem_max = 4194304
net.core.wmem_default =262144
net.core.wmem_max = 1048576
|
Setting Shell Limits for the oracle User |
1、Add the following lines to the /etc/security/limits.conf file: oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 2、Add or edit the following line in the /etc/pam.d/login file, if it does not already exist: session required pam_limits.so 3、Depending on the oracle user\'s default shell, make the following changes to the default shell start-up file: For the Bourne, Bash, or Korn shell, add the following lines to the /etc/profile file (or the /etc/profile.local file on SUSE systems): if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi For the C shell (csh or tcsh), add the following lines to the /etc/csh.login file (or the file on SUSE systems)/etc/csh.login.local: if ( $USER == "oracle" ) then limit maxproc 16384 limit descriptors 65536 endif |
Configuring the oracle User\'s Environment
/home/oracle/.bash_profile
Source /home/oracle/.bash_profile |
#Enter commands similar to the following to set the TEMP and TMPDIR environment variables: TMP=/tmp; export TMP TMPDIR=$TMP; export TMPDIR #Enter commands similar to the following to set the ORACLE_BASE and ORACLE_SID environment variables: ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE ORACLE_HOME=$ORACLE_BASE/product/12.2.0/dbhome_1; export ORACLE_HOME ORACLE_SID=ora01; export ORACLE_SID ORACLE_UNQNAME=ora01; export ORACLE_UNQNAME PATH=/usr/sbin:$PATH; export PATH PATH=$ORACLE_HOME/bin:$PATH; export PATH LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64:/usr/lib64:/usr/local/lib64:/usr/X11R6/lib64; export LD_LIBRARY_PATH CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH TNS_ADMIN=$ORACLE_HOME/network/admin NLS_LANG=AMERICAN_AMERICA.AL32UTF8; export NLS_LANG umask 022 if [ $USER = "oracle" ]; then if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fi fi |
九、解压缩安装文档:Linux压缩解压缩(unzip,tar)
十、安装ORACLE软件
以root账户权限运行
/u01/app/oraInventory/orainstRoot.sh
/u01/app/oracle/product/12.2.0/dbhome_1/root.sh
十一、安装数据
十二:安装LISTENER
Oracle 监听器启动与关闭
启动:lsnrctl start
关闭:lsnrctl stop
使用srvctl 命令
Oracle环境变量、监听listener.ora、tnsnames.ora、sqlnet.ora配置
/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora配置
在这个目录下有个listener.ora文件,内容如下:
LISTENER = (DESCRIPTION_LIST = (DESCRIPTION = (ADDRESS = (PROTOCOL = IPC)(KEY = ora01)) (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.111)(PORT = 1521)) (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ) )
ADR_BASE_LISTENER = /u01/app/oracle
|
十三:连接oracle
PLSQL Developer在未安装Oracle Client情况下连接Oracle
若遇到如上错误,下载instantclient_12.2
/u01/app/oracle/product/11.2.0.4.0/dbhome_1/network/admin/tnsnames.ora配置
安装完Oracle Client以后,发现相应目录中没有tnsnames.ora文件,其实只要手动建立一个就可以了。
在 oracle安装位置product11.2.0client_1networkadmin 目录下,建立一个tnsnames.ora,内容如下
ora01= (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(host = 192.168.0.111)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID=ora01) ) ) |
D:\\PLSQL\\instantclient_11_2\\tnsnames.ora
sqlplus常用命令
在sqlplus中调用本机操作系统命令,只需要在相关命令前加上HOST指令即可。
设置每行显示的记录长度 | SET LINESIZE 300; |
设置每页显示的记录长度 | SET PAGESIZE 30; |
调用本机记事本程序 | 使用ed命令 |
用户连接数据库 | CONN 用户名/密码 [AS SYSDBA] |
取得当前用户的全部数据对象 | SELECT * FROM tab |
查看表结构 | DESC 表名称 |
使用本机的操作系统命令 | HOST 命令 |
查看当前连接用户 | SHOW USER命令 |
查看现在的容器名称 | show con_name; CON_NAME ------------------------------ CDB$ROOT
|
改变容器为PDB | ALTER SESSION SET CONTAINER=ora01pdb01 ALTER DATABASE ora01pdb01 OPEN; ALTER PLUGGABLEDATABASE ORA01PDB01 OPEN; |
查看用户 | SELECT username FROM dba_users WHERE username=\'SCOOT\' OR username=\'SH\'; |
以上是关于ORACLE安装(12c-Redhat6.5)的主要内容,如果未能解决你的问题,请参考以下文章
sentos 6.5 安装 oracle11g R2 RAC遇到的问题处理
Oracle菜鸟学习之在RedHat 6.5上安装Oracle
[Oracle] - Install Oracle12cR1 on Oracle Linux 6.5 in VirtualBox