一、啟動監聽與資料庫

 

1、啟動監聽:
1.[root@JTWF oracle]# su oracle
2.bash-4.1$ lsnrctl start
結果如下,則啟動成功:
01.LSNRCTL for Linux : Version 11.2.0.1.0 - Production on 04-APR-2014 16:15:25
02. 
03.Copyright (c) 19912009, Oracle.  All rights reserved.
04. 
05.Starting /home/oracle/product/11.2/db_1/bin/tnslsnr: please wait...
06. 
07.TNSLSNR for Linux: Version 11.2.0.1.0 - Production
08.System parameter file is /home/oracle/product/11.2/db_1/network/admin/listener.ora
09.Log messages written to /home/oracle/diag/tnslsnr/JTWF/listener/alert/log.xml
10.Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=JTWF)(PORT=1521)))
11. 
12.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=JTWF)(PORT=1521)))
13.STATUS of the LISTENER
14.------------------------
15.Alias                     LISTENER
16.Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
17.Start Date                04-APR-2014 16:15:25
18.Uptime                    0 days 0 hr. 0 min. 0 sec
19.Trace Level               off
20.Security                  ON: Local OS Authentication
21.SNMP                      OFF
22.Listener Parameter File   /home/oracle/product/11.2/db_1/network/admin/listener.ora
23.Listener Log File         /home/oracle/diag/tnslsnr/JTWF/listener/alert/log.xml
24.Listening Endpoints Summary...
25.(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=JTWF)(PORT=1521)))
26.The listener supports no services
27.The command completed successfully

 

2、啟動資料庫:
連接到sqlplus
1.su oracle
2.bash-4.1$ sqlplus /nolog
結果如下:
1.SQL*Plus: Release 11.2.0.1.0 Production on Fri Apr 4 16:15:52 2014
2. 
3.Copyright (c) 19822009, Oracle.  All rights reserved.
4. 
5.SQL>
以sysdba登陸,並執行命令startup
1.SQL> conn /as sysdba
2.Connected to an idle instance.
3.SQL> startup   
結果如下:

01.ORACLE instance started.

02.Total System Global Area  839282688 bytes
03.Fixed Size            2217992 bytes
04.Variable Size          578815992 bytes
05.Database Buffers      251658240 bytes
06.Redo Buffers            6590464 bytes
07.Database mounted.
08.Database opened.
09.SQL>
二、關閉資料庫、監聽
1、關閉資料庫
1.su oracle
2.[root@JTWF oracle]# su oracle
3.bash-4.1$ sqlplus /nolog
登陸sqlplus,結果如下:

1.SQL*Plus: Release 11.2.0.1.0 Production on Fri Apr 4 15:10:59 2014

2. 
3.Copyright (c) 19822009, Oracle.  All rights reserved.
4. 
5.SQL>
sysdba登陸:
1.SQL>conn /as sysdba
2.Connected.

 

關閉資料庫:
1.SQL> shutdown immediate
2.Database closed.
3.Database dismounted.
4.ORACLE instance shut down.
關閉資料庫後,若執行查詢命令, 則會報如下錯誤:
1.SQL> select * from vio_business_request;
2.select * from vio_business_request
3.*
4.ERROR at line 1:
5.ORA-01034: ORACLE not available
6.Process ID: 14138
7.Session ID: 75 Serial number: 503
8.SQL>



退出sqlplus:
1.SQL> exit  
2.Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
3.With the Partitioning, OLAP, Data Mining and Real Application Testing options
2、關閉監聽:
bash-4.1$ lsnrctl stop   // oracle用户下执行
02. 
03.LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-APR-2014 15:17:00
04. 
05.Copyright (c) 19912009, Oracle.  All rights reserved.
06. 
07.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=JTWF)(PORT=1521)))
08.The command completed successfullybash-4.1$ lsnrctl stop
09. 
10.LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-APR-2014 15:17:00
11. 
12.Copyright (c) 19912009, Oracle.  All rights reserved.
13. 
14.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=JTWF)(PORT=1521)))
15.The command completed successfully

 

創作者介紹
創作者 shadow 的頭像
shadow

資訊園

shadow 發表在 痞客邦 留言(0) 人氣()