由于工作需要,需要使用Oracle,记录一下Centos6.5下安装,由于有一次失败的经历,安装成功后关机一直卡在Stoping Oracle Listeners,解决不了,无奈只能快照退回,重新安装。
本文环境
linux版本:Centos6.5
数据库版本:Oracle11.2.0
系统版本:MacOS
使用终端:iTerm
安装必要的RPM包
不管有没有安装过,上来就是执行。
[root@hadoop01 /home/software]# yum -y install binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat
# 过程略
Installed:
compat-libstdc++-33.i686 0:3.2.3-69.el6 compat-libstdc++-33.x86_64 0:3.2.3-69.el6
elfutils-libelf-devel.x86_64 0:0.164-2.el6 glibc.i686 0:2.12-1.212.el6_10.3
glibc-devel.i686 0:2.12-1.212.el6_10.3 ksh.x86_64 0:20120801-38.el6_10
libaio.i686 0:0.3.107-10.el6 libaio-devel.i686 0:0.3.107-10.el6
libaio-devel.x86_64 0:0.3.107-10.el6 libgcc.i686 0:4.4.7-23.el6
libstdc++.i686 0:4.4.7-23.el6
Dependency Installed:
nss-softokn-freebl.i686 0:3.44.0-6.el6_10
Updated:
binutils.x86_64 0:2.20.51.0.2-5.48.el6_10.1 elfutils-libelf.x86_64 0:0.164-2.el6
glibc-common.x86_64 0:2.12-1.212.el6_10.3 glibc-devel.x86_64 0:2.12-1.212.el6_10.3
glibc-headers.x86_64 0:2.12-1.212.el6_10.3 sysstat.x86_64 0:9.0.4-33.el6_9.1
Dependency Updated:
elfutils.x86_64 0:0.164-2.el6 elfutils-libs.x86_64 0:0.164-2.el6 glibc.x86_64 0:2.12-1.212.el6_10.3
tzdata.noarch 0:2019c-1.el6
Complete!
还有如下几个也安装下。
[root@hadoop01 /home/software]# yum install libXp unixODBC unixODBC-devel
# 过程略
Installed:
libXp.x86_64 0:1.0.2-2.1.el6 unixODBC.x86_64 0:2.2.14-14.el6 unixODBC-devel.x86_64 0:2.2.14-14.el6
Dependency Installed:
libtool-ltdl.x86_64 0:2.2.6-15.5.el6
Complete!
建立用户和用户组
# 添加用户组
[root@hadoop01 /home/software]# groupadd oinstall
[root@hadoop01 /home/software]# groupadd dba
[root@hadoop01 /home/software]# groupadd oper
# 创建用户oracle,指定主组oinstall,附加组dba,oper
[root@hadoop01 /home/software]# useradd -g oinstall -G dba,oper oracle
# 修改用户密码
[root@hadoop01 /home/software]# echo "123456" | passwd --stdin oracle
Changing password for user oracle.
passwd: all authentication tokens updated successfully.
# 查看用户oracle
[root@hadoop01 /home/software]# id oracle
uid=502(oracle) gid=1002(oinstall) groups=1002(oinstall),1003(dba),1004(oper)
建立安装目录
# 创建目录
[root@hadoop01 /home/software]# mkdir -p /clyang/app/oracle/product/11.2.0/db_1
[root@hadoop01 /home/software]# mkdir -p /clyang/app/oralnventory
# 进入安装目录
[root@hadoop01 /clyang/app]# ll
total 8
drwxr-xr-x. 3 root root 4096 Apr 12 09:16 oracle
drwxr-xr-x. 2 root root 4096 Apr 12 09:21 oralnventory
# 修改oracle目录的用户:用户组以及读写操作权限
[root@hadoop01 /clyang/app]# chown -R oracle:oinstall oracle/
[root@hadoop01 /clyang/app]# chmod -R 755 oracle
[root@hadoop01 /clyang/app]# ll
total 8
drwxr-xr-x. 3 oracle oinstall 4096 Apr 12 09:16 oracle
drwxr-xr-x. 2 root root 4096 Apr 12 09:21 oralnventory
[root@hadoop01 /clyang/app]# chown -R oracle:oinstall oralnventory/
# 修改oralnventory目录的用户:用户组以及读写操作权限
[root@hadoop01 /clyang/app]# chmod -R 755 oralnventory/
[root@hadoop01 /clyang/app]# ll
total 8
drwxr-xr-x. 3 oracle oinstall 4096 Apr 12 09:16 oracle
drwxr-xr-x. 2 oracle oinstall 4096 Apr 12 09:21 oralnventory
修改内核参数
# 查看页大小,计算shmall用
[root@hadoop01 /clyang/app]# getconf PAGESIZE
4096
[root@hadoop01 /clyang/app]# vim /etc/sysctl.conf
编辑sysctl.conf文件,添加以下内容到末尾,并保存。
# 安装oracle需要添加修改的内存参数
# 同时可以拥有的异步IO请求数目
fs.aio-max-nr = 1048576
# 表示一个进程可以打开的文件句柄的最大数量
fs.file-max = 6815744
# 控制内存共享页数=内存大小/PAGESIZE 2G内存的配置
kernel.shmall = 524288
# 设置单个共享内存段的最大尺寸,为物理内存的一半,1G
kernel.shmmax = 1073741824
# 设置共享内存段总数
kernel.shmmni = 4096
# 设置信号量,一般为固定内容大小
# SEMMSL:每个用户拥有信号量最大数
# SEMMNS:系统信号量最大数
# SEMOPM:每次semopm系统调用操作数
# SEMMNI:系统辛苦量集数最大数。
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 = 1048576
sysctl -p使得立即生效。
[root@hadoop01 /clyang/app]# 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
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 524288
kernel.shmmax = 1073741824
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 = 1048576
设置oracle用户的shell limit
修改/etc/security/limits.conf文件,添加如下内容到末尾保存退出。
# 安装oracle add
# soft 指的是当前系统生效的设置值,hard 表明系统中所能设定的最大值
# nproc 进程的最大数目
oracle soft nproc 2047
oracle hard nproc 16384
# 打开文件的最大数目
oracle soft nofile 1024
oracle hard nofile 65536
# 最大栈大小
orcle soft stack 10240
oracle hard stack 32768
要使 limits.conf 文件配置生效,必须要确保 pam_limits.so 文件被加入到启动文件中,添加下面的内容到/etc/pam.d/login,保存退出。
[root@hadoop01 /etc/pam.d]# cat /etc/pam.d/login
# 文件末尾添加
# oracle add
session required pam_limits.so
确认Java环境变量和oracle用户环境变量
确认一下java的环境变量。
# jdk解压后的目录
JAVA_HOME=/home/software/jdk1.8.0_181
# 添加环境变量
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
修改oracle用户环境变量,需要在oracle用户下操作。
# 切换到oracle用户
[root@hadoop01 /etc/pam.d]# su - oracle
# 查看隐藏文件,需要修改.bash_profile
[oracle@hadoop01 ~]$ ll -la
total 24
drwx------. 2 oracle oinstall 4096 Apr 12 09:11 .
drwxr-xr-x. 14 root root 4096 Apr 12 09:11 ..
-rw-r--r--. 1 oracle oinstall 18 Jul 18 2013 .bash_logout
-rw-r--r--. 1 oracle oinstall 176 Jul 18 2013 .bash_profile
-rw-r--r--. 1 oracle oinstall 124 Jul 18 2013 .bashrc
-rw-r--r--. 1 oracle oinstall 171 Feb 18 01:20 .kshrc
# 编辑
[oracle@hadoop01 ~]$ vim .bash_profile
# 需要添加的内容,保存后退出
ORACLE_BASE=/clyang/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1
ORACLE_SID=ORADB
PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_BASE ORACLE_HOME ORACLE_SID
export PATH
# 生效
[oracle@hadoop01 ~]$ source .bash_profile
安装图形界面需要的包
安装oracle需要借助图形界面安装,因此还需要先保证自己的linux能按init 5后能进入图形界面。第一次安装这里卡了很久,安装Oracle时没有反应,就是需要切换到图形界面才可以。
# centos安装图形界面
[root@hadoop01 /home/oracle]# yum groupinstall "X Window System" "Desktop Platform" Desktop -y
安装完后init 5尝试是否可以切换到图形界面,这里不是在xshell或者item来操作,我这里切换到了图形界面。
安装Oracle
iTerm或Xshell中
(1)先准备安装包上传到linux中。
[root@hadoop01 /oraclefile]# ll
total 2442052
-rw-r--r--. 1 root root 1358454646 Apr 12 11:17 p10404530_112030_Linux-x86-64_1of7.zip
-rw-r--r--. 1 root root 1142195302 Apr 12 11:18 p10404530_112030_Linux-x86-64_2of7.zip
(2)解压执行,先执行xhost +命令,很愉快的报错 unable to open display ""。
[root@hadoop01 /oraclefile]# xhost +
xhost: unable to open display ""
参考博文,先安装tigervnc-server,安装后重新执行ok。
[root@hadoop01 /oraclefile]# yum install tigervnc-server
# 过程略
Installed:
tigervnc-server.x86_64 0:1.1.0-24.el6
Dependency Installed:
xorg-x11-fonts-misc.noarch 0:7.2-11.el6
Complete!
# 启动vnc
[root@hadoop01 /oraclefile]# vncserver
You will require a password to access your desktops.
# 输入密码
Password:
# 确认密码
Verify:
xauth: file /root/.Xauthority does not exist
New 'hadoop01:1 (root)' desktop is hadoop01:1
Creating default startup script /root/.vnc/xstartup
Starting applications specified in /root/.vnc/xstartup
Log file is /root/.vnc/hadoop01:1.log
# 根据上面的端口提示,这里也这么写
[root@hadoop01 /oraclefile]# export DISPLAY=hadoop01:1
# 再次执行xhost +,提示正常
[root@hadoop01 /oraclefile]# xhost +
access control disabled, clients can connect from any host
(3)解压两个压缩包,并修改database的用户和用户组。
[root@hadoop01 /oraclefile]# unzip p10404530_112030_Linux-x86-64_1of7.zip
[root@hadoop01 /oraclefile]# unzip p10404530_112030_Linux-x86-64_2of7.zip
# 解决中文乱码
[root@hadoop01 /oraclefile]# unset LANG LANGUAGE
# 解压后会进入一个目录 database
[root@hadoop01 /oraclefile]# ll
total 2442056
drwxr-xr-x. 8 root root 4096 Sep 22 2011 database
# 修改用户和组
[root@hadoop01 /oraclefile]# chown -R oracle:oinstall database/
[root@hadoop01 /oraclefile]# ll
total 2442056
drwxr-xr-x. 8 oracle oinstall 4096 Sep 22 2011 database
图形界面安装
使用oracle登录,继续后面的可视化安装。
(1)运行安装脚本。
(2)安全更新,跳过,不选。
(3)软件更新,跳过。
(4)创建并配置数据库。
(5)选择服务器类型。
(6)选择安装单实例数据库。
(7)选择高级安装。
(8)选择简体中文,也可以不选使用英文。
(9)选择企业版本。
(10)确认安装路径,就是前面先创建的安装目录,包括oracle base、software location和inventory directory。
个人这里先切换到item,把关键目录赋予了oracle可写的权限。
[root@hadoop01 /clyang/app]# chmod -R 775 oracle/
[root@hadoop01 /clyang/app]# chmod -R 775 oralnventory/
(11)修改database name,按照建议修改,并且sid需要跟前面环境变量中的配置一样,这里为ORADB。
(12)确认内存,这里忘记改虚拟机内存了,关闭了虚拟机,修改成3G内存后,继续设置。
(13)字符需要改成AL32UTF8。
(14)指定数据文件存放的位置。
(15)不自动备份。
(16)设置管理员密码。
(17)操作组,选择dba,就是前面创建的用户组。
(18)最后安装前确认一下是否有未提前安装的包,发现没有设置的swap交换分区有点小,下次还需要设置更大一些,参考文末博文即可。
点击忽略全部继续。
(19)查看确认安装清单。
(20)点击安装后,会弹出最后还需要执行2个脚本的提示,注意一定要执行,在终端下以root用户执行。
配置助手提示。
确认后按照提示来操作,需要新开一个终端操作。
[root@hadoop01 ~]# cd /clyang/app/oralnventory
[root@hadoop01 /clyang/app/oralnventory]# ll
total 20
drwxrwx---. 2 oracle oinstall 4096 Apr 12 12:32 ContentsXML
drwxrwx---. 2 oracle oinstall 4096 Apr 12 12:30 logs
-rw-rw----. 1 oracle oinstall 59 Apr 12 12:32 oraInst.loc
-rwxrwx---. 1 oracle oinstall 1647 Apr 12 12:32 orainstRoot.sh
drwxrwx---. 2 oracle oinstall 4096 Apr 12 12:30 oui
# 执行
[root@hadoop01 /clyang/app/oralnventory]# ./orainstRoot.sh
Changing permissions of /clyang/app/oralnventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /clyang/app/oralnventory to oinstall.
# 提示脚本执行完成
The execution of the script is complete.
[root@hadoop01 /clyang/app/oralnventory]# cd /clyang/app/oracle/product/11.2.0/db_1/
[root@hadoop01 /clyang/app/oracle/product/11.2.0/db_1]# ls
apex css EMStage javavm mgw ord root.sh uix
assistants ctx hadoop01_ORADB jdbc network oui scheduler usm
bin cv hadoop01_orcl jdev nls owb slax utl
ccr dbs has jdk oc4j owm sqldeveloper wwg
cdata dc_ocm hs jlib odbc perl sqlj xdk
cfgtoollogs deinstall ide ldap olap plsql sqlplus
clone demo install lib OPatch precomp srvm
config diagnostics instantclient log opmn racg sysman
crs dv inventory md oracore rdbms timingframework
csmig emcli j2ee mesg oraInst.loc relnotes ucp
# 执行
[root@hadoop01 /clyang/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= /clyang/app/oracle/product/11.2.0/db_1
Enter the full pathname of the local bin directory: [/usr/local/bin]: /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.
完成后,点击ok,完成安装。
提示安装成功,关闭窗口即可。
到了这里就完成了oracle的安装,为了保险起见,这里完成后快照一下,上次就是没快照导致后面脚本挖坑导致无法出来了。
后续配置
安装完成之后还有一些后续配置要处理。
init.ora
确认以下内容。
修改安装目录下的init.ora。
[root@hadoop01 /clyang/app/oracle/product/11.2.0/db_1/dbs]# ll
total 20
-rw-rw----. 1 oracle oinstall 1544 Apr 12 12:35 hc_ORADB.dat
-rw-r--r--. 1 oracle oinstall 2986 Apr 12 13:12 init.ora
-rw-r-----. 1 oracle oinstall 24 Apr 12 12:33 lkORCL
-rw-r-----. 1 oracle oinstall 1536 Apr 12 12:35 orapwORADB
-rw-r-----. 1 oracle oinstall 2560 Apr 12 12:38 spfileORADB.ora
vim确认如下的内容后保存退出。
# 数据库名
db_name='ORCL'
memory_target=1G
processes = 150
# <ORACLE_BASE>全部修改为自己配置的位置
audit_file_dest='/clyang/app/oracle/admin/orcl/adump'
audit_trail ='db'
db_block_size=8192
db_domain=''
db_recovery_file_dest='clyang/app/oracle/flash_recovery_area'
db_recovery_file_dest_size=2G
diagnostic_dest='/clyang/app/oracle'
dispatchers='(PROTOCOL=TCP) (SERVICE=ORCLXDB)'
open_cursors=300
remote_login_passwordfile='EXCLUSIVE'
undo_tablespace='UNDOTBS1'
# 修改control_files的路径
control_files = (/clyang/app/oracle/oradata/orcl/control01.ctl)
compatible ='11.2.0'
做一次复制。
[root@hadoop01 /clyang/app/oracle/product/11.2.0/db_1/dbs]# cp init.ora initORADB.ora
oratab
修改了oracle系统配置文件,oracle自带的dbstart和dbshut才能发挥作用。
[root@hadoop01 /etc]# vim oratab
# N改成Y
ORADB:/clyang/app/oracle/product/11.2.0/db_1:Y
启动/停止脚本
(1)在/etc/init.d中创建一个文件oracle,并编辑脚本内容,参考博文修改如下。
#! /bin/sh
# chkconfig: 35 80 10
# description: Oracle auto start-stop script.
#
# Set ORA_HOME to be equivalent to the $ORACLE_HOME
# from which you wish to execute dbstart and dbshut;
#
# Set ORA_OWNER to the user id of the owner of the
# Oracle database in ORA_HOME.
ORA_HOME=/clyang/app/oracle/product/11.2.0/db_1
ORA_OWNER=oracle
if [ ! -f $ORA_HOME/bin/dbstart ]
then
echo "Oracle startup: cannot start"
exit
fi
case "$1" in
'start')
# Start the Oracle databases:
echo "Starting Oracle Databases ... "
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Starting Oracle Databases as part of system up." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/dbstart" >>/var/log/oracle
echo "Done"
# Start the Listener:
echo "Starting Oracle Listeners ... "
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Starting Oracle Listeners as part of system up." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl start" >>/var/log/oracle
echo "Done."
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Finished." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
touch /var/lock/subsys/oracle
;;
'stop')
# Stop the Oracle Listener:
echo "Stoping Oracle Listeners ... "
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Stoping Oracle Listener as part of system down." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/lsnrctl stop" >>/var/log/oracle
echo "Done."
rm -f /var/lock/subsys/oracle
# Stop the Oracle Database:
echo "Stoping Oracle Databases ... "
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Stoping Oracle Databases as part of system down." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
su - $ORA_OWNER -c "$ORA_HOME/bin/dbshut" >>/var/log/oracle
echo "Done."
echo ""
echo "-------------------------------------------------" >> /var/log/oracle
date +" %T %a %D : Finished." >> /var/log/oracle
echo "-------------------------------------------------" >> /var/log/oracle
;;
'restart')
$0 stop
$0 start
;;
esac
(2)修改文件为可执行权限。
[root@hadoop01 /etc/init.d]# chmod 755 oracle
(3)添加服务
[root@hadoop01 /etc/init.d]# chkconfig --level 35 oracle on
(4)关机或重启之前停止数据库,创建软链接。
# rc0 代表关机
[root@hadoop01 /etc/init.d]# ln -s /etc/init.d/oracle /etc/rc0.d/K01oracle
# rc6 代表重启
[root@hadoop01 /etc/init.d]# ln -s /etc/init.d/oracle /etc/rc6.d/K01oracle
使用初体验
(1)开启自启动ok。
# 切换到oracle用户
[root@hadoop01 ~]# su - oracle
[oracle@hadoop01 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Sun Apr 12 13:53:48 2020
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> set linesize 100
SQL> set pagesize 30
# 查询ok
SQL> select * from scott.emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
(2)关闭服务成功,注意在root用户停止。
# 关闭成功
[root@hadoop01 /home/oracle]# service oracle stop
Stoping Oracle Listeners ...
Done.
Stoping Oracle Databases ...
Done.
[root@hadoop01 /home/oracle]# su - oracle
[oracle@hadoop01 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Sun Apr 12 13:59:26 2020
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
# sql查询失败,提示服务不可用
SQL> select * from scott.emp;
select * from scott.emp
*
ERROR at line 1:
ORA-01034: ORACLE not available
Process ID: 0
Session ID: 0 Serial number: 0
(3)启动服务成功。
# 启动成功
[root@hadoop01 /home/oracle]# service oracle start
Starting Oracle Databases ...
Done
Starting Oracle Listeners ...
Done.
[root@hadoop01 /home/oracle]# su - oracle
[oracle@hadoop01 ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.3.0 Production on Sun Apr 12 14:02:03 2020
Copyright (c) 1982, 2011, Oracle. All rights reserved.
# 提示连接成功
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
# 又能查询到了
SQL> set linesize 100
SQL> set pagesize 30
SQL> select * from scott.emp;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
---------- ---------- --------- ---------- --------- ---------- ---------- ----------
7369 SMITH CLERK 7902 17-DEC-80 800 20
7499 ALLEN SALESMAN 7698 20-FEB-81 1600 300 30
7521 WARD SALESMAN 7698 22-FEB-81 1250 500 30
7566 JONES MANAGER 7839 02-APR-81 2975 20
7654 MARTIN SALESMAN 7698 28-SEP-81 1250 1400 30
7698 BLAKE MANAGER 7839 01-MAY-81 2850 30
7782 CLARK MANAGER 7839 09-JUN-81 2450 10
7788 SCOTT ANALYST 7566 19-APR-87 3000 20
7839 KING PRESIDENT 17-NOV-81 5000 10
7844 TURNER SALESMAN 7698 08-SEP-81 1500 0 30
7876 ADAMS CLERK 7788 23-MAY-87 1100 20
7900 JAMES CLERK 7698 03-DEC-81 950 30
7902 FORD ANALYST 7566 03-DEC-81 3000 20
7934 MILLER CLERK 7782 23-JAN-82 1300 10
14 rows selected.
(4)重启成功。
[root@hadoop01 /home/oracle]# service oracle restart
Stoping Oracle Listeners ...
Done.
Stoping Oracle Databases ...
Done.
Starting Oracle Databases ...
Done
Starting Oracle Listeners ...
Done.
启动后,查看内存使用情况。
[root@hadoop01 /home/oracle]# free -m
total used free shared buffers cached
Mem: 2817 1667 1149 0 20 992
-/+ buffers/cache: 653 2163
Swap: 2047 0 2047
使用DBeaver连接
使用它连接,需要提前准备好驱动,网址https://www.oracle.com/database/technologies/jdbcdriver-ucp-downloads.html,下载ojdbc6.jar、orai18n.jar、odb6.jar,并添加到oracle驱动中。
连接上,使用查询测试,ok。
以上,主要是为自己使用写的,内容仅供参考。
参考博文:
(1)https://www.cnblogs.com/youngchaolin/p/11680157.html 用户和用户组
(2)https://blog.csdn.net/cymm_liu/article/details/22797089 oralnventory的作用
(3)https://www.cnblogs.com/jianglaoda/p/8983264.html Centos6.5下安装oracle11
(4)https://www.cnblogs.com/keystone/p/10945677.html 安装图形界面
(5)https://blog.csdn.net/qq_26963433/article/details/79468308 xhost + 报错
(6)https://blog.csdn.net/minchao1122/article/details/86417522 增加swap交换分区
(7)https://www.cnblogs.com/mchina/archive/2012/11/27/2782993.html 脚本启动相关