Centos7下安装oracle11g

主机名设置

[root@localhost ~]# hostname
localhost.localdomain
[root@localhost ~]# vi /etc/hosts
[root@localhost ~]# cat /etc/host
cat: /etc/host: 没有那个文件或目录
[root@localhost ~]# cat /etc/hosts
#127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
#::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
127.0.0.1 localhost
192.168.101.64 localhost.localdomain
[root@localhost ~]# 

防火墙关闭

[root@localhost ~]# firewall-cmd --state
running
[root@localhost ~]# systemctl stop firewalld.service
[root@localhost ~]# firewall-cmd --state
not running
[root@localhost ~]# systemctl disable firewalld.service 
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@localhost ~]# firewall-cmd --state
not running
[root@localhost ~]# 

安装依赖包

yum -y install binutils compat-libcap1 compat-libstdc+±33 compat-libstdc+±33i686 compat-libstdc+±33.devel compat-libstdc+±33 compat-libstdc+±33*.devel gcc gcc-c++ glibc glibc*.i686 glibc-devel glibc-devel*.i686 ksh libaio libaio*.i686 libaio-devel libaio-devel*.devel libgcc libgcc*.i686 libstdc++ libstdc++.i686 libstdc+±devel libstdc+±devel.devel libXi libXi*.i686 libXtst libXtst*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686

检查

rpm -qa binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers glibc-static kernel-headers pdksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel libstdc++-static make numactl-devel sysstat unixODBC unixODBC-devel

创建安装用户、组、目录

[root@localhost ~]# groupadd oinstall
[root@localhost ~]# groupadd dba
[root@localhost ~]# useradd -g oinstall -G dba oracle
[root@localhost ~]# passwd oracle
更改用户 oracle 的密码 。
新的 密码:
无效的密码: 密码少于 8 个字符
重新输入新的 密码:
passwd:所有的身份验证令牌已经成功更新。
[root@localhost ~]# id oracle
uid=1000(oracle) gid=1000(oinstall)=1000(oinstall),1001(dba)
[root@localhost ~]# 
[root@localhost ~]# mkdir -p /opt/oracle
[root@localhost ~]# mkdir -p /opt/oracle/product/112010/db_1
[root@localhost ~]# mkdir /opt/oracle/oradata
[root@localhost ~]# mkdir /opt/oracle/inventory
[root@localhost ~]# mkdir /opt/oracle/flash_recovery_area
[root@localhost ~]# chown -R oracle:oinstall /opt/oracle
[root@localhost ~]# chmod -R 775 /opt/oracle
[root@localhost ~]# 
vi /etc/sudoers

添加如下语句

oracle ALL=(ALL) ALL

在这里插入图片描述

配置系统环境

[root@localhost ~]# vi /etc/sysctl.conf
[root@localhost ~]# cat /etc/sysctl.conf 
# sysctl settings are defined through files in
# /usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.
#
# Vendors settings live in /usr/lib/sysctl.d/.
# To override a whole file, create a new file with the same in
# /etc/sysctl.d/ and put new settings there. To override
# only specific settings, add a file with a lexically later
# name in /etc/sysctl.d/ and put new settings there.
#
# For more information, see sysctl.conf(5) and sysctl.d(5).

kernel.shmall = 2097152
kernel.shmmax = 1073741824
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# sysctl -p
kernel.shmall = 2097152
kernel.shmmax = 1073741824
fs.aio-max-nr = 1048576
fs.file-max = 6815744
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
[root@localhost ~]# 
vi /etc/security/limits.conf

在最后加上

oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
vi /etc/pam.d/login

在最后加上

session required  /lib64/security/pam_limits.so
session required   pam_limits.so
[root@localhost ~]# vi /etc/profile
[root@localhost ~]# source /etc/profile

在里面加上

if [ $USER = "oracle" ]; then
 if [ $SHELL = "/bin/ksh" ]; then
  ulimit -p 16384
  ulimit -n 65536
 else
  ulimit -u 16384 -n 65536
 fi
 umask 022
fi
[root@localhost ~]# vi /home/oracle/.bash_profile
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# source /home/oracle/.bash_profile
[root@localhost ~]# env
XDG_SESSION_ID=2
HOSTNAME=localhost.localdomain
SELINUX_ROLE_REQUESTED=
TERM=xterm
SHELL=/bin/bash
HISTSIZE=1000
SSH_CLIENT=192.168.101.44 52428 22
SELINUX_USE_CURRENT_RANGE=
SSH_TTY=/dev/pts/0
USER=root
LD_LIBRARY_PATH=/opt/oracle/product/112010/db_1/lib:/usr/lib
LS_COLORS=rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=01;05;37;41:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.jpg=01;35:*.jpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;35:*.svgz=01;35:*.mng=01;35:*.pcx=01;35:*.mov=01;35:*.mpg=01;35:*.mpeg=01;35:*.m2v=01;35:*.mkv=01;35:*.webm=01;35:*.ogm=01;35:*.mp4=01;35:*.m4v=01;35:*.mp4v=01;35:*.vob=01;35:*.qt=01;35:*.nuv=01;35:*.wmv=01;35:*.asf=01;35:*.rm=01;35:*.rmvb=01;35:*.flc=01;35:*.avi=01;35:*.fli=01;35:*.flv=01;35:*.gl=01;35:*.dl=01;35:*.xcf=01;35:*.xwd=01;35:*.yuv=01;35:*.cgm=01;35:*.emf=01;35:*.axv=01;35:*.anx=01;35:*.ogv=01;35:*.ogx=01;35:*.aac=01;36:*.au=01;36:*.flac=01;36:*.mid=01;36:*.midi=01;36:*.mka=01;36:*.mp3=01;36:*.mpc=01;36:*.ogg=01;36:*.ra=01;36:*.wav=01;36:*.axa=01;36:*.oga=01;36:*.spx=01;36:*.xspf=01;36:
ORACLE_SID=orcl
ORACLE_BASE=/opt/oracle
MAIL=/var/spool/mail/root
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/root/.local/bin:/root/bin:/root/bin:/opt/oracle/product/112010/db_1/bin
PWD=/root
LANG=zh_CN.UTF-8
SELINUX_LEVEL_REQUESTED=
HISTCONTROL=ignoredups
SHLVL=1
HOME=/root
LOGNAME=root
SSH_CONNECTION=192.168.101.44 52428 192.168.101.64 22
LESSOPEN=||/usr/bin/lesspipe.sh %s
XDG_RUNTIME_DIR=/run/user/0
ORACLE_HOME=/opt/oracle/product/112010/db_1
_=/usr/bin/env
[root@localhost ~]# 
export ORACLE_BASE=/opt/oracle;
export ORACLE_HOME=/opt/oracle/product/112010/db_1;
export ORACLE_SID=orcl;
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin;
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib;
if [ $USER = "oracle" ]; then
 if [ $SHELL = "/bin/ksh" ]; then
  ulimit -p 16384
  ulimit -n 65536
 else
  ulimit -u 16384 -n 65536
 fi
 umask 022
fi

安装

把下载下来的
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
放到 /opt/oracle下,注意是oracle用户

在这里插入图片描述
注意:如果未安装 zip unzip,在上传的时候可以下安装

[root@localhost oracle]# yum install -y unzip zip
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.huaweicloud.com
 * updates: mirrors.aliyun.com
正在解决依赖关系
There are unfinished transactions remaining. You might consider running yum-complete-transaction, or "yum-complete-transaction --cleanup-only" and "yum history redo last", first to finish them. If those don't work you'll have to try removing/installing packages by hand (maybe package-cleanup can help).
The program yum-complete-transaction is found in the yum-utils package.
--> 正在检查事务
---> 软件包 unzip.x86_64.0.6.0-21.el7 将被 安装
---> 软件包 zip.x86_64.0.3.0-11.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

=================================================================================================================================================================================================================================================
 Package                                                  架构                                                      版本                                                           源                                                       大小
=================================================================================================================================================================================================================================================
正在安装:
 unzip                                                    x86_64                                                    6.0-21.el7                                                     base                                                    171 k
 zip                                                      x86_64                                                    3.0-11.el7                                                     base                                                    260 k

事务概要
=================================================================================================================================================================================================================================================
安装  2 软件包

总下载量:431 k
安装大小:1.1 M
Downloading packages:
(1/2): unzip-6.0-21.el7.x86_64.rpm                                                                                                                                                                                        | 171 kB  00:00:00     
(2/2): zip-3.0-11.el7.x86_64.rpm                                                                                                                                                                                          | 260 kB  00:00:01     
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                                                                                                             348 kB/s | 431 kB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  正在安装    : zip-3.0-11.el7.x86_64                                                                                                                                                                                                        1/2 
  正在安装    : unzip-6.0-21.el7.x86_64                                                                                                                                                                                                      2/2 
  验证中      : unzip-6.0-21.el7.x86_64                                                                                                                                                                                                      1/2 
  验证中      : zip-3.0-11.el7.x86_64                                                                                                                                                                                                        2/2 

已安装:
  unzip.x86_64 0:6.0-21.el7                                                                                                zip.x86_64 0:3.0-11.el7                                                                                               

完毕!
[root@localhost oracle]# 
[root@localhost oracle]# ll
总用量 2295592
drwxrwxr-x. 2 oracle oinstall          6 521 17:10 flash_recovery_area
drwxrwxr-x. 2 oracle oinstall          6 521 17:10 inventory
-rw-r--r--. 1 root   root     1239269270 521 17:28 linux.x64_11gR2_database_1of2.zip
-rw-r--r--. 1 root   root     1111416131 521 17:28 linux.x64_11gR2_database_2of2.zip
drwxrwxr-x. 2 oracle oinstall          6 521 17:10 oradata
drwxrwxr-x. 3 oracle oinstall         20 521 17:10 product
[root@localhost oracle]# 
[root@localhost oracle]# 
[root@localhost oracle]# chown -R oracle:oinstall linux.x64_11gR2_database_1of2.zip 
[root@localhost oracle]# chown -R oracle:oinstall linux.x64_11gR2_database_2of2.zip 
[root@localhost oracle]# ll
总用量 2295592
drwxrwxr-x. 2 oracle oinstall          6 521 17:10 flash_recovery_area
drwxrwxr-x. 2 oracle oinstall          6 521 17:10 inventory
-rw-r--r--. 1 oracle oinstall 1239269270 521 17:28 linux.x64_11gR2_database_1of2.zip
-rw-r--r--. 1 oracle oinstall 1111416131 521 17:28 linux.x64_11gR2_database_2of2.zip
drwxrwxr-x. 2 oracle oinstall          6 521 17:10 oradata
drwxrwxr-x. 3 oracle oinstall         20 521 17:10 product
[root@localhost oracle]# 
[root@localhost oracle]# su oracle
[oracle@localhost oracle]$ 

[oracle@localhost oracle]$ unzip linux.x64_11gR2_database_1of2.zip
[oracle@localhost oracle]$ unzip linux.x64_11gR2_database_2of2.zip

解压完成后/opt/oracle下会生成database目录

[oracle@localhost oracle]$ cd /opt/oracle/database/response/
[oracle@localhost response]$ ll
总用量 76
-rw-rw-r--. 1 oracle oinstall 44969 214 2009 dbca.rsp
-rw-rw-r--. 1 oracle oinstall 22557 815 2009 db_install.rsp
-rwxrwxr-x. 1 oracle oinstall  5740 226 2009 netca.rsp

[oracle@localhost response]$ vi db_install.rsp
29 oracle.install.option=INSTALL_DB_SWONLY
37 ORACLE_HOSTNAME=localhost.localdomain
42 UNIX_GROUP_NAME=oinstall
47 INVENTORY_LOCATION=/opt/oracle/inventory
78 SELECTED_LANGUAGES=en
83 ORACLE_HOME=/opt/oracle/product/112010/db_1
88 ORACLE_BASE=/opt/oracle
99 oracle.install.db.InstallEdition=EE
142 oracle.install.db.DBA_GROUP=dba
147 oracle.install.db.OPER_GROUP=oinstall
160 oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
165 oracle.install.db.config.starterdb.globalDBName=orcl
170 oracle.install.db.config.starterdb.SID=orcl
200 oracle.install.db.config.starterdb.memoryLimit=800
233 oracle.install.db.config.starterdb.password.ALL=oracle
385 DECLINE_SECURITY_UPDATES=true
[oracle@localhost response]$ cd /opt/oracle/database/
[oracle@localhost database]$ 
[oracle@localhost database]$ ./runInstaller -silent -responseFile /opt/oracle/database/response/db_install.rsp -ignorePrereq
正在启动 Oracle Universal Installer...

检查临时空间: 必须大于 120 MB。   实际为 11293 MB    通过
检查交换空间: 必须大于 150 MB。   实际为 2047 MB    通过
准备从以下地址启动 Oracle Universal Installer /tmp/OraInstall2020-05-21_05-41-49PM. 请稍候...[oracle@localhost database]$ [WARNING] [INS-32055] 主产品清单位于 Oracle 基目录中。
   原因: 主产品清单位于 Oracle 基目录中。
   操作: Oracle 建议将此主产品清单放置在 Oracle 基目录之外的位置中。
[WARNING] [INS-32055] 主产品清单位于 Oracle 基目录中。
   原因: 主产品清单位于 Oracle 基目录中。
   操作: Oracle 建议将此主产品清单放置在 Oracle 基目录之外的位置中。
可以在以下位置找到本次安装会话的日志:
 /opt/oracle/inventory/logs/installActions2020-05-21_05-41-49PM.log
以下配置脚本需要以 "root" 用户的身份执行。
 #!/bin/sh 
 #要运行的 Root 脚本

/opt/oracle/inventory/orainstRoot.sh
/opt/oracle/product/112010/db_1/root.sh
要执行配置脚本, 请执行以下操作:
	 1. 打开一个终端窗口
	 2."root" 身份登录
	 3. 运行脚本
	 4. 返回此窗口并按 "Enter" 键继续

Successfully Setup Software.

在这里插入图片描述

一直等待。。。。。。。。。。直到成功

打开新的终端,以root身份登录

[root@localhost ~]# /opt/oracle/inventory/orainstRoot.sh
更改权限/opt/oracle/inventory.
添加组的读取和写入权限。
删除全局的读取, 写入和执行权限。

更改组名/opt/oracle/inventory 到 oinstall.
脚本的执行已完成。
[root@localhost ~]# /opt/oracle/product/112010/db_1/root.sh
Check /opt/oracle/product/112010/db_1/install/root_localhost.localdomain_2020-05-21_17-50-05.log for the output of root script
[root@localhost ~]# 

配置监听

[root@localhost ~]# 
[root@localhost ~]# vi /opt/oracle/database/response/netca.rsp
[root@localhost ~]# 

主要查看以下几个参数,一般不要改

33 CREATE_TYPE="CUSTOM"
76 LISTENER_NUMBER=1
82 LISTENER_NAMES={"LISTENER"}
88 LISTENER_PROTOCOLS={"TCP;1521"}
91 LISTENER_START=""LISTENER""
[oracle@localhost database]$ 
[oracle@localhost database]$ netca /silent /responseFile /opt/oracle/database/response/netca.rsp

正在对命令行参数进行语法分析:
参数"silent" = true
参数"responsefile" = /opt/oracle/database/response/netca.rsp
完成对命令行参数进行语法分析。
Oracle Net Services 配置:
完成概要文件配置。
Oracle Net 监听程序启动:
    正在运行监听程序控制: 
      /opt/oracle/product/112010/db_1/bin/lsnrctl start LISTENER
    监听程序控制完成。
    监听程序已成功启动。
监听程序配置完成。
成功完成 Oracle Net Services 配置。退出代码是0
[oracle@localhost database]$ 

[oracle@localhost admin]$ cd /opt/oracle/product/112010/db_1/network/admin
[oracle@localhost admin]$ 
[oracle@localhost admin]$ ll
总用量 12
-rw-r--r--. 1 oracle oinstall 374 521 17:54 listener.ora
drwxr-xr-x. 2 oracle oinstall  64 521 17:42 samples
-rw-r--r--. 1 oracle oinstall 187 57 2007 shrept.lst
-rw-r--r--. 1 oracle oinstall 211 521 17:54 sqlnet.ora
[oracle@localhost admin]$ 

重新开一个窗口

[root@localhost ~]# netstat -tnulp | grep 1521
tcp6       0      0 :::1521                 :::*                    LISTEN      26751/tnslsnr       
[root@localhost ~]# 
[root@localhost ~]# vi /etc/sysconfig/network
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# 
[root@localhost ~]# cat /etc/sysconfig/network
# Created by anaconda
NETWORKING=yes
HOSTNAME=localhost.localdomain
[root@localhost ~]# 

[oracle@localhost admin]$ pwd
/opt/oracle/product/112010/db_1/network/admin
[oracle@localhost admin]$ 
[oracle@localhost admin]$ ll
总用量 12
-rw-r--r--. 1 oracle oinstall 374 521 17:54 listener.ora
drwxr-xr-x. 2 oracle oinstall  64 521 17:42 samples
-rw-r--r--. 1 oracle oinstall 187 57 2007 shrept.lst
-rw-r--r--. 1 oracle oinstall 211 521 17:54 sqlnet.ora
[oracle@localhost admin]$ 
[oracle@localhost admin]$ vi listener.ora 
[oracle@localhost admin]$ 
[oracle@localhost admin]$ cat listener.ora 
# listener.ora Network Configuration File: /opt/oracle/product/112010/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.101.64)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /opt/oracle

[oracle@localhost admin]$ 

[oracle@localhost admin]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-MAY-2020 18:01:16

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
[oracle@localhost admin]$ 
[oracle@localhost admin]$ 
[oracle@localhost admin]$ 
[oracle@localhost admin]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-MAY-2020 18:01:23

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /opt/oracle/product/112010/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /opt/oracle/product/112010/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.101.64)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                21-MAY-2020 18:01:23
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/112010/db_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.101.64)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@localhost admin]$ 

添加数据库实例

[oracle@localhost admin]$ cd /opt/oracle/database/response
[oracle@localhost response]$ 
[oracle@localhost response]$ vi dbca.rsp 

50 RESPONSEFILE_VERSION = "11.2.0"
60 OPERATION_TYPE = "createDatabase"
78 GDBNAME = "orcl"
149 SID = "orcl"
169 TEMPLATENAME = "General_Purpose.dbc"
190 SYSPASSWORD = "oracle"
200 SYSTEMPASSWORD = "oracle"
231 SYSMANPASSWORD = "oracle"
241 DBSNMPPASSWORD = "oracle"
357 DATAFILEDESTINATION =/opt/oracle/oradata
367 RECOVERYAREADESTINATION=/opt/oracle/flash_recovery_area
415 CHARACTERSET = "ZHS16GBK"
540 TOTALMEMORY = "800"
[oracle@localhost response]$ dbca -silent -responseFile /opt/oracle/database/response/dbca.rsp
复制数据库文件
1% 已完成
3% 已完成
11% 已完成
18% 已完成
26% 已完成
37% 已完成
正在创建并启动 Oracle 实例
40% 已完成
45% 已完成
50% 已完成
55% 已完成
56% 已完成
60% 已完成
62% 已完成
正在进行数据库创建
66% 已完成
70% 已完成
73% 已完成
85% 已完成
96% 已完成
100% 已完成
有关详细信息, 请参阅日志文件 "/opt/oracle/cfgtoollogs/dbca/orcl/orcl.log"[oracle@localhost response]$ 

检查

[oracle@localhost response]$ ps -ef | grep ora_ | grep -v grep
oracle    27415      1  0 18:15 ?        00:00:00 ora_pmon_orcl
oracle    27417      1  0 18:15 ?        00:00:00 ora_vktm_orcl
oracle    27421      1  0 18:15 ?        00:00:00 ora_gen0_orcl
oracle    27423      1  0 18:15 ?        00:00:00 ora_diag_orcl
oracle    27425      1  0 18:15 ?        00:00:00 ora_dbrm_orcl
oracle    27427      1  0 18:15 ?        00:00:00 ora_psp0_orcl
oracle    27429      1  0 18:15 ?        00:00:00 ora_dia0_orcl
oracle    27431      1  0 18:15 ?        00:00:00 ora_mman_orcl
oracle    27433      1  0 18:15 ?        00:00:00 ora_dbw0_orcl
oracle    27435      1  0 18:15 ?        00:00:00 ora_lgwr_orcl
oracle    27437      1  0 18:15 ?        00:00:00 ora_ckpt_orcl
oracle    27439      1  0 18:15 ?        00:00:00 ora_smon_orcl
oracle    27441      1  0 18:15 ?        00:00:00 ora_reco_orcl
oracle    27443      1  0 18:15 ?        00:00:00 ora_mmon_orcl
oracle    27445      1  0 18:15 ?        00:00:00 ora_mmnl_orcl
oracle    27447      1  0 18:15 ?        00:00:00 ora_d000_orcl
oracle    27449      1  0 18:15 ?        00:00:00 ora_s000_orcl
oracle    27536      1  0 18:15 ?        00:00:00 ora_qmnc_orcl
oracle    27551      1  0 18:15 ?        00:00:00 ora_cjq0_orcl
oracle    27553      1  0 18:15 ?        00:00:00 ora_q000_orcl
oracle    27555      1  0 18:15 ?        00:00:00 ora_q001_orcl
[oracle@localhost response]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-MAY-2020 18:16:32

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                21-MAY-2020 18:01:23
Uptime                    0 days 0 hr. 15 min. 9 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/112010/db_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.101.64)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@localhost response]$ 


[oracle@localhost response]$ vi /opt/oracle/product/112010/db_1/bin/dbstart
[oracle@localhost response]$ 
[oracle@localhost response]$ vi /opt/oracle/product/112010/db_1/bin/dbshut
[oracle@localhost response]$ 


把上面两个文件中的

ORACLE_HOME_LISTNER=$1

改为

ORACLE_HOME_LISTNER=$ORACLE_HOME

[oracle@localhost response]$ vi /etc/oratab
[oracle@localhost response]$ cat /etc/oratab 
#



# This file is used by ORACLE utilities.  It is created by root.sh
# and updated by the Database Configuration Assistant when creating
# a database.

# A colon, ':', is used as the field terminator.  A new line terminates
# the entry.  Lines beginning with a pound sign, '#', are comments.
#
# Entries are of the form:
#   $ORACLE_SID:$ORACLE_HOME:<N|Y>:
#
# The first and second fields are the system identifier and home
# directory of the database respectively.  The third filed indicates
# to the dbstart utility that the database should , "Y", or should not,
# "N", be brought up at system boot time.
#
# Multiple entries with the same $ORACLE_SID are not allowed.
#
#
orcl:/opt/oracle/product/112010/db_1:Y
[oracle@localhost response]$ 


[oracle@localhost response]$ dbshut
Processing Database instance "orcl": log file /opt/oracle/product/112010/db_1/shutdown.log
[oracle@localhost response]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-MAY-2020 18:20:35

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.64)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
[oracle@localhost response]$ ps -ef |grep ora_ |grep -v grep
[oracle@localhost response]$ 

[oracle@localhost response]$ dbstart
Processing Database instance "orcl": log file /opt/oracle/product/112010/db_1/startup.log
[oracle@localhost response]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-MAY-2020 18:21:18

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                21-MAY-2020 18:21:10
Uptime                    0 days 0 hr. 0 min. 8 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/112010/db_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.101.64)(PORT=1521)))
Services Summary...
Service "orcl" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
Service "orclXDB" has 1 instance(s).
  Instance "orcl", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@localhost response]$ ps -ef |grep ora_ |grep -v grep
oracle    27830      1  0 18:21 ?        00:00:00 ora_pmon_orcl
oracle    27832      1  0 18:21 ?        00:00:00 ora_vktm_orcl
oracle    27836      1  0 18:21 ?        00:00:00 ora_gen0_orcl
oracle    27838      1  0 18:21 ?        00:00:00 ora_diag_orcl
oracle    27840      1  0 18:21 ?        00:00:00 ora_dbrm_orcl
oracle    27842      1  0 18:21 ?        00:00:00 ora_psp0_orcl
oracle    27844      1  0 18:21 ?        00:00:00 ora_dia0_orcl
oracle    27846      1  1 18:21 ?        00:00:00 ora_mman_orcl
oracle    27848      1  0 18:21 ?        00:00:00 ora_dbw0_orcl
oracle    27850      1  0 18:21 ?        00:00:00 ora_lgwr_orcl
oracle    27852      1  0 18:21 ?        00:00:00 ora_ckpt_orcl
oracle    27854      1  0 18:21 ?        00:00:00 ora_smon_orcl
oracle    27856      1  0 18:21 ?        00:00:00 ora_reco_orcl
oracle    27858      1  1 18:21 ?        00:00:00 ora_mmon_orcl
oracle    27860      1  0 18:21 ?        00:00:00 ora_mmnl_orcl
oracle    27862      1  0 18:21 ?        00:00:00 ora_d000_orcl
oracle    27864      1  0 18:21 ?        00:00:00 ora_s000_orcl
oracle    27951      1  0 18:21 ?        00:00:00 ora_qmnc_orcl
oracle    27953      1  0 18:21 ?        00:00:00 ora_q000_orcl
oracle    27955      1  0 18:21 ?        00:00:00 ora_q001_orcl
oracle    28003      1  0 18:21 ?        00:00:00 ora_cjq0_orcl
[oracle@localhost response]$ 


[oracle@localhost response]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu May 21 18:21:54 2020

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> 

到此已经结束

收尾

数据库监听关闭


[oracle@localhost response]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu May 21 18:21:54 2020

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> shotdown
SP2-0042: unknown command "shotdown" - rest of line ignored.
SQL> shutdown
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> quit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost response]$ 
[oracle@localhost response]$ 
[oracle@localhost response]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-MAY-2020 18:24:11

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
The command completed successfully
[oracle@localhost response]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-MAY-2020 18:24:23

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 2: No such file or directory
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.101.64)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
[oracle@localhost response]$ 

数据库监听启动


[oracle@localhost response]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Thu May 21 18:25:09 2020

Copyright (c) 1982, 2009, Oracle.  All rights reserved.

Connected to an idle instance.

SQL> startup
ORACLE instance started.

Total System Global Area  835104768 bytes
Fixed Size		    2217952 bytes
Variable Size		  490735648 bytes
Database Buffers	  339738624 bytes
Redo Buffers		    2412544 bytes
Database mounted.
Database opened.
SQL> quit;
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@localhost response]$ 
[oracle@localhost response]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 21-MAY-2020 18:25:31

Copyright (c) 1991, 2009, Oracle.  All rights reserved.

Starting /opt/oracle/product/112010/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /opt/oracle/product/112010/db_1/network/admin/listener.ora
Log messages written to /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.101.64)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                21-MAY-2020 18:25:31
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /opt/oracle/product/112010/db_1/network/admin/listener.ora
Listener Log File         /opt/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.101.64)(PORT=1521)))
The listener supports no services
The command completed successfully
[oracle@localhost response]$ 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值