1、启动监听

1
2
# su - oracle
$ lsnrctl start

 

结果如下,则启动成功:    
 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
LSNRCTL  for  Linux: Version  11.2 . 0.1 . 0  -  Production on  04 - APR - 2014  16 : 15 : 25
 
Copyright (c)  1991 2009 , Oracle.   All  rights reserved.
 
Starting  / home / oracle / product / 11.2 / db_1 / bin / tnslsnr: please wait...
 
TNSLSNR  for  Linux: Version  11.2 . 0.1 . 0  -  Production
System parameter  file  is  / home / oracle / product / 11.2 / db_1 / network / admin / listener.ora
Log messages written to  / home / oracle / diag / tnslsnr / JTWF / listener / alert / log.xml
Listening on: (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST = JTWF)(PORT = 1521 )))
 
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = JTWF)(PORT = 1521 )))
STATUS of the LISTENER - - - - - - - - - - - - - - - - - - - - - - - - Alias                     LISTENER
Version                   TNSLSNR  for  Linux: Version  11.2 . 0.1 . 0  -  ProductionStart Date                 04 - APR - 2014  16 : 15 : 25Uptime                     0  days  0  hr.  0  min 0  sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter  File    / home / oracle / product / 11.2 / db_1 / network / admin / listener.ora
Listener Log  File          / home / oracle / diag / tnslsnr / JTWF / listener / alert / log.xml
Listening Endpoints Summary...
   (DESCRIPTION = (ADDRESS = (PROTOCOL = tcp)(HOST = JTWF)(PORT = 1521 )))
The listener supports no services
The command completed successfully


 2、连接数据库 

1
2
su  -  oracle
sqlplus  / nolog

 结果如下:  

1
2
3
SQL * Plus: Release  11.2 . 0.1 . 0  Production on Fri Apr  4  16 : 15 : 52  2014Copyright  (c)  1982 2009 , Oracle.   All  rights reserved.
 
SQL>

 

3. 启动数据库


以sysdba登陆,并执行命令startup    

1
2
3
SQL> conn  / as sysdba
Connected to an idle instance.
SQL> startup

 

结果如下:

1
2
3
4
5
6
7
8
ORACLE instance started.
Total System Global Area   839282688  bytes
Fixed Size             2217992  bytes
Variable Size           578815992  bytes
Database Buffers       251658240  bytes
Redo Buffers             6590464  bytes
Database mounted.
Database opened.SQL>

4、关闭数据库  
 

1
2
3
4
5
6
7
8
9
10
#  su - oracle
$ sqlplus  / nolog
SQL * Plus: Release  11.2 . 0.1 . 0  Production on Fri Apr  4  15 : 10 : 59  2014Copyright  (c)  1982 2009 , Oracle.   All  rights reserved.
SQL>
SQL>conn  / as sysdba
Connected.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.

 

 关闭数据库后,若执行查询命令, 则会报如下错误:  
 

1
2
3
4
5
6
SQL> select  *  from  vio_business_request;select  *  from  vio_business_request
*
ERROR at line  1 :
ORA - 01034 : ORACLE  not  available
Process  ID 14138Session  ID 75  Serial number:  503
SQL>

 

退出sqlplus:

1
2
3
SQL> exit  
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


关闭监听

1
2
3
4
5
bash - 4.1 $ lsnrctl stop    / /  oracle用户下执行
 
LSNRCTL  for  Linux: Version  11.2 . 0.1 . 0  -  Production on  04 - APR - 2014  15 : 17 : 00Copyright  (c)  1991 2009 , Oracle.   All  rights reserved.
Connecting to (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = JTWF)(PORT = 1521 )))
The command completed successfully