Linux系统下Oracle数据库静默安装配置

Linux系统下oracle数据库静默安装配置

1、系统环境

  • 系统平台:CentOS Linux release 7.2.1511 (Core)

  • 内存/SWAP:4G/16G

RAM与交换分区之间的要求
RAM 需要交换空间的大小
1GB和2GB之间 RAM大小的1.5倍
2GB和16GB之间 等于RAM的大小
超过16GB 16GB
  • 硬盘:500G(至少10G以上)

  • 防火墙状态:

    [root@oracle_bak ~]# firewall-cmd --state
    not running
    [root@oracle_bak ~]# setenforce 0
    [root@oracle_bak ~]# getenforce 
    Permissive
    
  • oracle数据库所需的软件列表

    linux.x64_11gR2_database_1of2.zip
    linux.x64_11gR2_database_2of2.zip

  • oracle数据库所在目录:/oracle/app

2、oracle安装前准备

2-1 操作系统hosts修改

[root@oracle_bak ~]# vi /etc/hosts
10.0.7.168 oracle_bak

2-2 安装依赖包

官方文档中对于RHEL5及以上版本的Linux发行版,要求需要以下的软件包(更高版本也行):

shell
binutils-2.17.50.0.6
compat-libstdc++-33-3.2.3
elfutils-libelf-0.125
elfutils-libelf-devel-0.125
elfutils-libelf-devel-static-0.125
gcc-4.1.2
gcc-c++-4.1.2
glibc-2.5-24
glibc-common-2.5
glibc-devel-2.5
glibc-headers-2.5
kernel-headers-2.6.18
ksh-20060214
libaio-0.3.106
libaio-devel-0.3.106
libgcc-4.1.2
libgomp-4.1.2
libstdc++-4.1.2
libstdc++-devel-4.1.2
make-3.81
sysstat-7.0.2
unixODBC-2.2.11
unixODBC-devel-2.2.11

使用以下命令查看上面这些软件包的版本是否大于等于上面的要求:

[root@oracle_bak ~]#rpm -q binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

如果有未安装的软件包使用yum更新:

yum install binutils compat-libstdc++ elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel glibc-headers kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel

2-3 修改配置内核参数

修改、添加以下内容:

如果安装oracle用于生产的话,内核参数是一个很重要的优化系统性能的配置项,比如配置信号量,I/O,共享内存等参数配置,这个建议参考官方文档进行详细配置,官方文档对这方面有很详细的说明。如果你和我一样只是安装个Oracle用来学习那只需要使用官方文档中建议的最低配置就行

[root@oracle_bak oracle]#vim /etc/sysctl.conf 
# System default settings live in /usr/lib/sysctl.d/00-system.conf.
# To override those settings, enter new settings here, or in an /etc/sysctl.d/<name>.conf file
#
# For more information, see sysctl.conf(5) and sysctl.d(5).
# Auto-enabled by xs-tools:install.sh
===============添加以下内容=================
net.ipv4.conf.all.arp_notify = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 1048586

配置生效而不重启系统:

[root@oracle_bak oracle]# /sbin/sysctl -p
net.ipv4.conf.all.arp_notify = 1
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 536870912
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 = 1048586

2-4 为oracle用户添加shell配置

末行添加:

[root@oracle_bak oracle]# vim /etc/security/limits.conf
# /etc/security/limits.conf
#
#This file sets the resource limits for the users logged in via PAM.
#It does not affect resource limits of the system services.
===========================================
#*               soft    core            0
#*               hard    rss             10000
#@student        hard    nproc           20
#@faculty        soft    nproc           20
#@faculty        hard    nproc           50
#ftp             hard    nproc           0
#@student        -       maxlogins       4
===============添加以下内容=================
oracle           soft    nproc   2047
oracle           hard    nproc   16384
oracle           soft    nofile  1024
oracle           hard    nofile  65536
oracle           soft    stack   10240
# End of file

末行添加:

[root@oracle_bak oracle]# vi /etc/pam.d/login
#%PAM-1.0
auth [user_unknown=ignore success=ok ignore=ignore default=bad] pam_securetty.so
auth       substack     system-auth
auth       include      postlogin
account    required     pam_nologin.so
account    include      system-auth
password   include      system-auth
# pam_selinux.so close should be the first session rule
session    required     pam_selinux.so close
session    required     pam_loginuid.so
session    optional     pam_console.so
# pam_selinux.so open should only be followed by sessions to be executed in the user context
session    required     pam_selinux.so open
session    required     pam_namespace.so
session    optional     pam_keyinit.so force revoke
session    include      system-auth
session    include      postlogin
session    optional     pam_ck_connector.so
===============添加以下内容=================
session    required     pam_limits.so

修改/etc/profile:

[root@oracle_bak oracle]# vim /etc/profile
# /etc/profile
# System wide environment and startup programs, for login setup
# Functions and aliases go in /etc/bashrc
# It's NOT a good idea to change this file unless you know what you
# are doing. It's much better to create a custom.sh shell script in
# /etc/profile.d/ to make custom changes to your environment, as this
# will prevent the need for merging in future updates.
================添加以下内容======================
if [ $USER = "oracle" ]; then
      if [ $SHELL = "/bin/ksh" ]; then
            ulimit -p 16384
            ulimit -n 65536
      else
            ulimit -u 16384 -n 65536
      fi
fi
[root@oracle_bak oracle]#source /etc/profile    //source profile使环境变量生效

2-5 创建安装用户、组、目录

  1. 创建安装用户和组

    [root@oracle_bak oracle]#groupadd oinstall                  //创建oinstall组(安装数据库使用)
    [root@oracle_bak oracle]#groupadd dba                       //创建dba(其他组)
    [root@oracle_bak oracle]#useradd -g oinstall -G dba oracle  //创建oracle用户并加入到2个组中
    [root@oracle_bak oracle]#passwd oracle                      //修改oracle用户密码
    [root@oracle_bak oracle]#id oracle                          //查看群组情况
    uid=1000(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba)
    
  2. 创建软件安装目录

    [root@oracle_bak oracle]#mkdir -p /oracle/app                          //$ORACLE_BASE
    [root@oracle_bak oracle]#mkdir -p /oracle/app/product/112010/db_1      //$ORACLE_HOME
    [root@oracle_bak oracle]#mkdir -p /oracle/app/oradata                  //存放数据库目录
    [root@oracle_bak oracle]#mkdir -p /oracle/app/inventory                //oracle软件安装的目录信息(管理升级)
    [root@oracle_bak oracle]#mkdir -p /oracle/app/flash_recovery_area      //回闪恢复区
    [root@oracle_bak oracle]#chown -R oracle:oinstall /oracle              //  /oracle安装权限
    [root@oracle_bak oracle]#chmod -R 775 /oracle                          //  /oracle 775权限
    
  3. 修改用户环境变量

    [root@oracle_bak oracle]# vim /home/oracle/.bash_profile   //编辑用户环境变量(在最底下加入以下内容)
    # .bash_profile
    # Get the aliases and functions
    if [ -f ~/.bashrc ]; then
            . ~/.bashrc
    fi
    ==================添加以下内容====================
    # For Oracle
    export  ORACLE_BASE=/oracle/app
    export  ORACLE_HOME=/oracle/app/product/112010/db_1
    export  ORACLE_SID=oratest
    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
    [root@oracle_bak oracle]#source /home/oracle/.bash_profile          //环境变量立即生效
    

3、正式安装

  1. 将安装包上传至服务器/oracle/app下面(进入oracle用户)

    [root@oracle_bak oracle]#su – oracle
    [oracle@oracle_bak ~]$cd /oracle/app
    [oracle@oracle_bak ~]$rz linux.x64_11gR2_database_*    //或用其他工具尽量使用oracle用户上传到对应文件路径下
    
  2. 解压oracle安装文件

    [oracle@oracle_bak app]$unzip linux.x64_11gR2_database_1of2.zip
    [oracle@oracle_bak app]$unzip linux.x64_11gR2_database_2of2.zip
    //解压完成后/oracle/app下会生成database目录
    [oracle@oracle_bak app]$ ls
    database  flash_recovery_area  inventory  linux.x64_11gR2_database_1of2.zip  linux.x64_11gR2_database_2of2.zip  oradata  product
    
  3. 编辑oracle数据库安装应答文件

    (进入解压后的文件中)下有db_install.rsp、dbca.rsp和netca.rsp三个应答文件,分别数据库安装文件、建立数据库实例和监听配置安装文件

    [oracle@oracle_bak oracle]$ cd /oracle/app/database/response
    [oracle@oracle_bak response]$ ls
    dbca.rsp  db_install.rsp  netca.rsp
    

    编辑db_install.rsp文件修改以下内容

    [oracle@oracle_bak response]$vim db_install.rsp
    racle.install.option=INSTALL_DB_SWONLY          //29行 安装类型
    ORACLE_HOSTNAME=oratest                         //37行 主机名称
    UNIX_GROUP_NAME=oinstall                        //42行 安装组
    INVENTORY_LOCATION=/oracle/app/inventory        //47行 INVENTORY目录
    SELECTED_LANGUAGES=zh_CN,en                     //78行 选择语言
    ORACLE_HOME=/oracle/app/product/112010/db_1     //83行 oracle_home
    ORACLE_BASE=/oracle/app                         //88行 oracle_base
    oracle.install.db.InstallEdition=EE             //99行 oracle版本
    oracle.install.db.DBA_GROUP=dba                 //142行 dba用户组
    oracle.install.db.OPER_GROUP=oinstall           //147行 oper用户组
    oracle.install.db.config.starterdb.type=GENERAL_PURPOSE //160行 数据库类型
    oracle.install.db.config.starterdb.globalDBName=oratest //165行 globalDBName
    oracle.install.db.config.starterdb.SID=oratest          //170行 SID
    oracle.install.db.config.starterdb.memoryLimit=800      //200行 自动管理内存的最小内存(M)
    oracle.install.db.config.starterdb.password.ALL=oracle  //233行 设定所有数据库用户使用同一个密码
    DECLINE_SECURITY_UPDATES=true                           //385行 设置安全更新
    
  4. 开始安装oracle

    [oracle@oracle_bak response]$ cd /oracle/app/database    //进入刚才解压的database目录
    [oracle@oracle_bak database]$ ./runInstaller -silent -responseFile /oracle/app/database/response/db_install.rsp -ignorePrereq                                       //静默运行安装
    安装过程中,如果提示[WARNING]不必理会,此时安装程序仍在后台进行,如果出现[FATAL],则安装程序已经停止了。
    可以在以下位置找到本次安装会话的日志:
    /oracle/app/inventory/logs/installActions2020-05-14_08-11-45PM.log
    可以使用命令查看日志:后面的地址应该以安装过程中的提示为准
    #tail -100f /oracle/app/inventory/logs/installActions2020-05-14_08-11-45PM.log
    安装过程是没有任何进度提示的,最多只能通过日志文件查看!
    
    报错一般看报错信息或者提示的日志文件解决,大多数是由配置文件编写不正确引起,仔细检查并重新运行脚本
    
    [oracle@oracle_bak database]$ ./runInstaller -silent -responseFile /oracle/app/database/response/db_install.rsp -ignorePrereq
    Starting Oracle Universal Installer...
    
    Checking Temp space: must be greater than 120 MB.   Actual 12771 MB    Passed
    Checking swap space: must be greater than 150 MB.   Actual 16382 MB    Passed
    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-05-14_08-11-45PM. Please wait ...[oracle@ortest database]$ You can find the log of this install session at:
    /oracle/app/inventory/logs/installActions2020-05-14_08-11-45PM.log
    
    安装好或者是失败会有提示;如下所示,是安装成功的信息提示:
    Starting Oracle Universal Installer...
    Checking Temp space: must be greater than 120 MB.   Actual 12771 MB    Passed
    Checking swap space: must be greater than 150 MB.   Actual 16382 MB    Passed
    Preparing to launch Oracle Universal Installer from /tmp/OraInstall2020-05-14_08-11-45PM. Please wait ...[oracle@ortest database]$ You can find the log of this install session at:
    /oracle/app/inventory/logs/installActions2020-05-14_08-11-45PM.log
    The following configuration scripts need to be executed as the "root" user.
    #!/bin/sh
    #Root scripts to run
    /oracle/app/inventory/orainstRoot.sh
    /oracle/app/product/112010/db_1/root.sh
    To execute the configuration scripts:
            1. Open a terminal window 
            2. Log in as "root" 
            3. Run the scripts 
            4. Return to this window and hit "Enter" key to continue 
    Successfully Setup Software.
    
  5. 安装后操作

    按照上面的要求执行脚本命令:

  • 打开新的终端,以root身份登录,执行以下两个脚本

    [root@ortest ~]# /oracle/inventory/orainstRoot.sh
    Changing permissions of /oracle/inventory.
    Adding read,write permissions for group.
    Removing read,write,execute permissions for world.
    Changing groupname of /oracle/inventory to oinstall.
    The execution of the script is complete.
    
    [root@ortest ~]# /oracle/app/product/112010/db_1/root.sh
    Check /oracle/app/product/112010/db_1/install/root_ortest_2020-05-14_20-27-46.log for the output of root script
    
  • 完成后,返回原来的终端按下回车键

  1. oracle11g的安装就到此结束

4、配置监听

  1. 新开窗口使用root用户编辑

    [oracle@oracle_bak ~]# vim /oracle/app/database/response/netca.rsp
    //编辑oracle安装目录下的netca.rsp应答文件
    INSTALL_TYPE=""custom""安装的类型                       //72行
    LISTENER_NUMBER=1监听器数量                             //76行
    LISTENER_NAMES={"LISTENER"}监听器的名称列表             //82行
    LISTENER_PROTOCOLS={"TCP;1521"}监听器使用的通讯协议列表  //88行
    LISTENER_START=""LISTENER""监听器启动的名称             //91行
    
  2. 返回oracle用户窗口执行监听安装

    [oracle@oracle_bak response]$ netca /silent /responseFile /oracle/app/database/response/netca.rsp
    Parsing command line arguments:
        Parameter "silent" = true
        Parameter "responsefile" = /oracle/app/database/response/netca.rsp
    Done parsing command line arguments.
    Oracle Net Services Configuration:
    Configuring Listener:LISTENER
    Listener configuration complete.
    Oracle Net Listener Startup:
        Running Listener Control: 
        /oracle/app/product/112010/db_1/bin/lsnrctl start LISTENER
        Listener Control complete.
        Listener started successfully.
    Profile configuration complete.
    Oracle Net Services configuration successful. The exit code is 0
    
  3. 监听安装完毕检查

    /检查完毕后执行成功运行后,在/oracle/product/112010/db_1/network/admin中生成listener.ora和sqlnet.ora
    [oracle@oracle_bak ~]$ ls /oracle/app/product/112010/db_1/network/admin
    listener.ora  samples  shrept.lst  sqlnet.ora  tnsnames1804107下午3532.bak  tnsnames.ora
    
    [oracle@oracle_bak response]$ ls /oracle/app/product/112010/db_1/network/admin
    listener.ora  samples  shrept.lst  sqlnet.ora
    
    [oracle@oracle_bak ~]$ lsnrctl start  //开启监听
    

5、添加数据库实例

5-1 修改配置

  1. 返回root窗口使用root用户编辑

    [oracle@oracle_bak ~]# vim /oracle/app/database/response/dbca.rsp
    //一下内容根据db_install.rsp下配置的内容参考修改
    RESPONSEFILE_VERSION ="11.2.0"                //50行 不能更改
    OPERATION_TYPE ="createDatabase"              //60行 一般不用更改
    GDBNAME ="oratest"                            //60行 更改成自己数据库的名字
    SID =" oratest"                               //149行 对应的实例名字
    TEMPLATENAME ="General_Purpose.dbc"           //169行 建库用的模板文件(一般不用修改)
    SYSPASSWORD ="sys123"                         //190行 SYS管理员密码
    SYSTEMPASSWORD ="oracle"                      //200行 SYSTEM管理员密码
    //其他的系统用户根据自己需求更改对应密码
    DATAFILEDESTINATION =/oracle/app/oradata      //357行 数据文件存放目录
    RECOVERYAREADESTINATION=/oracle/app/flash_recovery_area  //367行 恢复数据存放目录
    CHARACTERSET ="ZHS16GBK"                      //415行
    NATIONALCHARACTERSET= "AL16UTF16"             //425行
    //字符集,重要!!!!!建库后一般不能更改,所以建库前要和数据库具体使用业务人员确定清楚。
    TOTALMEMORY ="2400"                           //540行物理内存4G*60%(2400M)
    

5-2 安装实例

进入oracle安装目录的bin下,执行dbca命令

[oracle@oracle_bak ~]$cd /oracle/app/product/112010/db_1/bin
[oracle@oracle_bak bin] $dbca -silent -responseFile /oracle/app/database/response/dbca.rsp
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/oracle/app/cfgtoollogs/dbca/oratest/oratest.log" for further details.

查看安装日志

[root@oracle_bak ~]# tail -50f /oracle/app/cfgtoollogs/dbca/oratest/oratest.log
Copying database files
DBCA_PROGRESS : 1%
DBCA_PROGRESS : 3%
DBCA_PROGRESS : 11%
DBCA_PROGRESS : 18%
DBCA_PROGRESS : 26%
DBCA_PROGRESS : 37%
Creating and starting Oracle instance
DBCA_PROGRESS : 40%
DBCA_PROGRESS : 45%
DBCA_PROGRESS : 50%
DBCA_PROGRESS : 55%
DBCA_PROGRESS : 56%
DBCA_PROGRESS : 60%
DBCA_PROGRESS : 62%
Completing Database Creation
DBCA_PROGRESS : 66%
DBCA_PROGRESS : 70%
DBCA_PROGRESS : 73%
DBCA_PROGRESS : 85%
DBCA_PROGRESS : 96%
DBCA_PROGRESS : 100%
Database creation complete. For details check the logfiles at:
 /oracle/app/cfgtoollogs/dbca/oratest.
Database Information:
Global Database Name:oratest
System Identifier(SID):oratest

建库后进行实例进程检查

[oracle@oracle_bak bin]$ ps -ef | grep ora_ | grep -v grep
oracle   23431     1  0 09:52 ?        00:00:00 ora_pmon_oratest
oracle   23433     1  0 09:52 ?        00:00:00 ora_vktm_oratest
oracle   23437     1  0 09:52 ?        00:00:00 ora_gen0_oratest
oracle   23439     1  0 09:52 ?        00:00:00 ora_diag_oratest
oracle   23441     1  0 09:52 ?        00:00:00 ora_dbrm_oratest
oracle   23443     1  0 09:52 ?        00:00:00 ora_psp0_oratest
oracle   23445     1  0 09:52 ?        00:00:00 ora_dia0_oratest
oracle   23447     1  0 09:52 ?        00:00:00 ora_mman_oratest
oracle   23449     1  0 09:52 ?        00:00:00 ora_dbw0_oratest
oracle   23451     1  0 09:52 ?        00:00:00 ora_lgwr_oratest
oracle   23453     1  0 09:52 ?        00:00:00 ora_ckpt_oratest
oracle   23455     1  0 09:52 ?        00:00:00 ora_smon_oratest
oracle   23457     1  0 09:52 ?        00:00:00 ora_reco_oratest
oracle   23459     1  0 09:52 ?        00:00:00 ora_mmon_oratest
oracle   23461     1  0 09:52 ?        00:00:00 ora_mmnl_oratest
oracle   23463     1  0 09:52 ?        00:00:00 ora_d000_oratest
oracle   23465     1  0 09:52 ?        00:00:00 ora_s000_oratest
oracle   23475     1  0 09:52 ?        00:00:00 ora_qmnc_oratest
oracle   23490     1  0 09:52 ?        00:00:00 ora_cjq0_oratest
oracle   23493     1  0 09:53 ?        00:00:00 ora_q000_oratest
oracle   23495     1  0 09:53 ?        00:00:00 ora_q001_oratest

监听状态

查看监听
[oracle@oracle_bak bin]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-MAY-2020 09:57:04

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle_bak)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                14-MAY-2020 21:22:08
Uptime                    0 days 12 hr. 34 min. 56 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/product/112010/db_1/network/admin/listener.ora
Listener Log File         /oracle/app/diag/tnslsnr/oracle_bak/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle_bak)(PORT=1521)))
Services Summary...
Service "oratest" has 1 instance(s).
  Instance "oratest", status READY, has 1 handler(s) for this service...
Service "oratestXDB" has 1 instance(s).
  Instance "oratest", status READY, has 1 handler(s) for this service...
The command completed successfully

关闭监听
[oracle@oracle_bak app]$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-MAY-2020 12:09:33

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle_bak)(PORT=1521)))
The command completed successfully

启动监听
[oracle@oracle_bak app]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 15-MAY-2020 12:10:14

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

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

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle_bak)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                15-MAY-2020 12:10:14
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/app/product/112010/db_1/network/admin/listener.ora
Listener Log File         /oracle/app/diag/tnslsnr/oracle_bak/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle_bak)(PORT=1521)))
The listener supports no services
The command completed successfully

修改启动配置:

[oracle@oracle_bak ~]$ vim /oracle/app/product/112010/db_1/bin/dbstart
将ORACLE_HOME_LISTNER=$1修改为ORACLE_HOME_LISTNER=$ORACLE_HOME     //80行
[oracle@oracle_bak ~]$ vim /oracle/app/product/112010/db_1/bin/dbshut
将ORACLE_HOME_LISTNER=$1修改为ORACLE_HOME_LISTNER=$ORACLE_HOME     //50行
[oracle@oracle_bak ~]$vi /etc/oratab
将oratest:/oracle/app/product/112010/db_1:N中最后的N改为Y,成为oratest:/oracle/app/product/112010/db_1:Y
关闭数据库
[oracle@oracle_bak bin]$ dbshut
Processing Database instance "oratest": log file /oracle/app/product/112010/db_1/shutdown.log

开启数据库
[oracle@oracle_bak app]$ dbstart
Processing Database instance "oratest": log file /oracle/app/product/112010/db_1/startup.log

登录查看实例状态

  • 使用sysdba登录

    [oracle@oracle_bak bin]$ sqlplus "/as sysdba"
    
    SQL*Plus: Release 11.2.0.1.0 Production on Fri May 15 10:01:28 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 name from v$database;
    
    NAME
    ---------
    ORATEST
    
  • 使用sys用户登录

    [oracle@oracle_bak app]$ sqlplus
    
    SQL*Plus: Release 11.2.0.1.0 Production on Fri May 15 11:49:03 2020
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    Enter user-name: sys
    Enter password:sys123 as sysdba
    注:
    1. sys123为密码,密码可随意输入,不输也可,所以忘记密码也没关系
    2. as sysdba表示以sysdba的角色登录,必须要输入
    3. oracle为了提高安全性,输入的密码是不可见的
    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 name from v$database;
    
    NAME
    ---------
    ORATEST
    
  • 使用system用户登录

    [oracle@oracle_bak app]$ sqlplus
    
    SQL*Plus: Release 11.2.0.1.0 Production on Fri May 15 12:03:36 2020
    
    Copyright (c) 1982, 2009, Oracle.  All rights reserved.
    
    Enter user-name: system
    Enter password:
    
    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 instance_name,status from v$instance; 
    
    INSTANCE_NAME    STATUS
    ---------------- ------------
    oratest          OPEN
    
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 203,547评论 6 477
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 85,399评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 150,428评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,599评论 1 274
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,612评论 5 365
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,577评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,941评论 3 395
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,603评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,852评论 1 297
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,605评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,693评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,375评论 4 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,955评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,936评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,172评论 1 259
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 43,970评论 2 349
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,414评论 2 342