ORACLE在虚拟机RedHat安装说明
1.设置虚拟机内存ORACLE虚拟机的内存最好设置16G以上。2.获取ORACLE安装包使用root用户将包pdksh-5.2.14-30.x86_64.rpmORACLE_11.2.0.30_Linux-x86-64_1of2.zipORACLE_11.2.0.30_Linux-x86-64_2of2.zip 上传到目录/usr/local3.ORACLE
ORACLE虚拟机的内存最好设置16G以上。
2.获取ORACLE安装包
使用root用户将包
pdksh-5.2.14-30.x86_64.rpm
ORACLE_11.2.0.30_Linux-x86-64_1of2.zip
ORACLE_11.2.0.30_Linux-x86-64_2of2.zip
上传到目录/usr/local
3.ORACLE环境配置
在root用户下执行以下步骤
(1)修改用户的SHELL的限制,修改/etc/security/limits.conf文件
输入命令:vi /etc/security/limits.conf,按i键进入编辑模式,将下列内容加入该文件。
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
编辑完成后按Esc键,输入“:wq”存盘退出
(2)修改/etc/pam.d/login 文件,输入命令:vi /etc/pam.d/login,按i键进入编辑模式,将下列内容加入该文件。
session required /lib/security/pam_limits.so
session required pam_limits.so
编辑完成后按Esc键,输入“:wq”存盘退出
(3)修改linux内核,修改/etc/sysctl.conf文件,输入命令: vi /etc/sysctl.conf ,按i键进入编辑模式,将下列内容加入该文件
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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
kernel.shmmax = 107374182400
kernel.shmall = 2097152
fs.aio-max-nr=1048576
编辑完成后按Esc键,输入“:wq”存盘退出
(4)要使 /etc/sysctl.conf 更改立即生效,执行以下命令。输入:sysctl -p
(5)编辑 /etc/profile ,输入命令:vi /etc/profile,按i键进入编辑模式,将下列内容加入该文件。
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536
else
ulimit -u 16384 -n 65536
fi
fi
编辑完成后按Esc键,输入“:wq”存盘退出
[root@RHEL64 ~]# source /etc/profile
(6)创建相关用户和组,作为软件安装和支持组的拥有者。
创建用户,输入命令:
groupadd oinstall
groupadd dba
创建Oracle用户和密码,输入命令:
useradd -g oinstall -g dba -m oracle
passwd oracle
然后会让你输入密码,密码任意输入2次,但必须保持一致,回车确认
(7)创建数据库软件目录和数据文件存放目录,目录的位置,根据自己的情况来定,注意磁盘空间即可,这里我把其放到oracle用户下,例如:
输入命令:
mkdir /home/oracle/app
mkdir /home/oracle/app/oracle
mkdir /home/oracle/app/oradata
mkdir /home/oracle/app/oracle/product
(8)更改目录属主为Oracle用户所有,输入命令:
chown -R oracle:oinstall /home/oracle/app
(9)配置oracle用户的环境变量,首先,切换到新创建的oracle用户下,
输入:su - oracle ,然后直接在输入: vi .bash_profile
按i编辑 .bash_profile,进入编辑模式,增加以下内容:
umask 022
export ORACLE_BASE=/home/oracle/app
export ORACLE_HOME=$ORACLE_BASE/oracle/product/11.2.0/dbhome_1
export ORACLE_SID=ORCL
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
编辑完成后按Esc键,输入“:wq”存盘退出
注意:export ORACLE_SID=ORCL 这里就是数据库实例的SID
(10)修改文件/etc/hosts
进入root账号下,
su – root
输入密码:thinker
修改文件/etc/hosts
vi /etc/hosts
127.0.0.1 localhost
your IP your hostname
比如
127.0.0.1 localhost
192.168.1.2 RHEL64
(11)搭建yum仓库
1)cd /etc/yum.repos.d/
2)touch server.repo
3)vi server.repo
[server]
name=Red Hat Enterprise Linux
baseurl=file:///media
enabled=1
gpgcheck=0
4)把光盘mount到/media下面
[root@RHEL64 yum.repos.d]# mount /dev/cdrom /media
测试yum仓库搭建是否成功命令:yum list all
成功后执行以下rpm包:
yum -y install binutils*
yum -y install compat*
yum -y install control*
yum -y install gcc*
yum -y install glibc*
yum -y install gnome*
yum -y install libstdc*
yum -y install make*
yum -y install ksh*
yum -y install sysstat*
yum -y install libaio-devel*
yum -y install libXp.i686 libXp-devel.i686 libXt.i686 libXt-devel.i686 libXtst.i686 libXtst-devel.i686 make.x86_64 gcc.x86_64 libaio.x86_64 glibc-devel.i686 libgcc.i686 glibc-devel.x86_64 compat-libstdc++-33
yum -y install glibc* gcc* make* compat-db* libstdc* libXp* libXtst* compat-libstdc++*
执行完后再执行:
[root@RHEL64 yum.repos.d]# rpm -ivh /usr/local/pdksh-5.2.14-30.x86_64.rpm --nodeps --force
warning: /usr/local/pdksh-5.2.14-30.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 73307de6: NOKEY
Preparing... ########################################### [100%]
1:pdksh ########################################### [100%]
(12)设置swap内存
[root@RHEL64 ~]# dd if=/dev/zero of=/home/swap bs=1024 count=16400000
16400000+0 records in
16400000+0 records out
16793600000 bytes (17 GB) copied, 40.5422 s, 414 MB/s
[root@RHEL64_190_203_ORACLE ~]# mkswap /home/swap
[root@RHEL64_190_203_ORACLE ~]# swapon /home/swap
[root@RHEL64_190_203_ORACLE ~]# echo "swapon /home/swap" >>/etc/inittab
4.安装ORACLE
(1)上传ORACLE安装包
上传到oracle账号的目录/home/oracle下
/home/oracle/ORACLE_11.2.0.30_Linux-x86-64_1of2.zip
/home/oracle/ORACLE_11.2.0.30_Linux-x86-64_2of2.zip
(2)解压ORACLE安装包
[root@RHEL64 yum.repos.d]# su -oracle
[oracle@RHEL64 ~]$ ll
total 2442056
drwxr-xr-x. 4 oracle oinstall 4096 Oct 10 08:04 app
-rw-r--r--. 1 oracle dba 1358454646 Oct 10 08:29ORACLE_11.2.0.30_Linux-x86-64_1of2.zip
-rw-r--r--. 1 oracle dba 1142195302 Oct 10 08:29ORACLE_11.2.0.30_Linux-x86-64_2of2.zip
[oracle@RHEL64 ~]$ unzipORACLE_11.2.0.30_Linux-x86-64_1of2.zip
[oracle@RHEL64 ~]$ unzipORACLE_11.2.0.30_Linux-x86-64_2of2.zip
(3)使用MobaXtrm软件登陆
MobaXterm_Personal_8.5.exe
进入oracle用户
su – oracle
设置允许图形界面在本地显示,把鼠标放到MobaXtrm界面右上角的按钮X server处,可以看到一行提示:
Stop the X11 server(Current DISPLAY=192.168.1.2:0.0)
执行以下命令,注意这里的DISPLAY=192.168.1.2:0.0与上面的保持一致。
export DISPLAY=192.168.1.2:0.0
Global database name就是SID,可以设置为ORCL
Password:admin
使用root用户,执行上面两个脚本
/home/oracle/oraInventory/orainstRoot.sh
/home/oracle/app/oracle/product/11.2.0/dbhome_1/root.sh
如果遇到Enter the full pathname of the local bin directory: [/usr/local/bin]:
则直接按Enter就可以了
启动实例监听器
[oracle@RHEL64 ~]$ lsnrctl
LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 11-OCT-2016 04:00:39
Copyright (c) 1991, 2011, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> start
Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /home/oracle/app/diag/tnslsnr/RHEL64/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL64)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date 11-OCT-2016 04:00:45
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/app/diag/tnslsnr/RHEL64/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=RHEL64)(PORT=1521)))
The listener supports no services
The command completed successfully
LSNRCTL> exit
zcsh-ora1->oracle$ export | grep SID
declare -x ORACLE_SID="ORCL"
zcsh-ora1->oracle$ export ORACLE_SID="TEST"
zcsh-ora1->oracle$ export | grep SID
declare -x ORACLE_SID="TEST"
zcsh-ora1->oracle$ sqlplus /nolog
[oracle@RHEL64 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.3.0 Production on Tue Oct 11 04:01:48 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> startup
ORACLE instance started.
SQL> create user admin identified by admin;
User created.
SQL> grant dba to admin;
Grant succeeded.
Windows下ORACLE命令行启动命令
C:\Users\test>sqlplus/ as sysdba
使用账号admin/admin
SQL>conn admin/admin
更多推荐
所有评论(0)