1. 在oratab中查看SID的ORACLE_HOME目录
[oracle@localhost ~]$ cat /etc/oratab
#
# This file is used by ORACLE utilities. It is created by root.sh
# and updated by either Database Configuration Assistant while creating
# a database or ASM Configuration Assistant while creating ASM instance.
# 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:
#
# 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.
#
#
PROD:/u01/app/oracle/product/11.2.0/dbhome_1:N (ORACLE_HOME目录)
2. 查看监听状态
[oracle@localhost ~]$ lsnrctl status (监听状态)
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 29-NOV-2018 03:49:27
Copyright © 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 29-NOV-2018 00:14:46
Uptime 0 days 3 hr. 34 min. 41 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter
File /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log
File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary…
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary…
Service “PROD” has 1 instance(s).
Instance “PROD”, status READY, has 1 handler(s) for this service…
Service “PRODXDB” has 1 instance(s).
Instance “PROD”, status READY, has 1 handler(s) for this service…
The command completed successfully
3. sqlplus登录
[oracle@localhost ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Nov 29 03:49:46 2018
Copyright © 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
4. 查看INSTANCE_NAME和STATUS
SYS@PROD>select instance_name,status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
PROD OPEN
SYS@PROD>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 -
64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
5. 在bash_profile中查看ORACLE_BASE , ORACLE_HOME , ORACLE_SID
[oracle@localhost ~]$ cat .bash_profile (第一次登录先查看ORACLE_BASE
, ORACLE_HOME , ORACLE_SID)
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
PATH=$PATH:$HOME/bin
export PATH
unset TNS_ADMIN
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export ORACLE_SID=PROD
export PATH=$ORACLE_HOME/bin:$PATH
[oracle@localhost ~]$
[oracle@localhost ~]$
[oracle@localhost ~]$
[oracle@localhost ~]$ echo $ORACLE_BASE
/u01/app/oracle
[oracle@localhost ~]$
6. echo搜索ORACLE相关目录
[oracle@localhost ~]$ echo $ORACLE_BASE
/u01/app/oracle
[oracle@localhost ~]$ echo $ORACLE_HOME
/u01/app/oracle/product/11.2.0/dbhome_1
[oracle@localhost ~]$ echo $ORACLE_SID
PROD
[oracle@localhost ~]$