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/.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 创建安装用户、组、目录
-
创建安装用户和组
[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)
-
创建软件安装目录
[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权限
-
修改用户环境变量
[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、正式安装
-
将安装包上传至服务器/oracle/app下面(进入oracle用户)
[root@oracle_bak oracle]#su – oracle [oracle@oracle_bak ~]$cd /oracle/app [oracle@oracle_bak ~]$rz linux.x64_11gR2_database_* //或用其他工具尽量使用oracle用户上传到对应文件路径下
-
解压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
-
编辑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行 设置安全更新
-
开始安装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.
-
安装后操作
按照上面的要求执行脚本命令:
-
打开新的终端,以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
完成后,返回原来的终端按下回车键
- oracle11g的安装就到此结束
4、配置监听
-
新开窗口使用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行
-
返回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
-
监听安装完毕检查
/检查完毕后执行成功运行后,在/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 修改配置
-
返回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