一、啟動監聽與資料庫
1、啟動監聽:
[root@JTWF oracle]# su oraclebash-4.1$ lsnrctl start
結果如下,則啟動成功:
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-APR-2014 16:15:25Copyright (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 - ProductionSystem parameter file is /home/oracle/product/11.2/db_1/network/admin/listener.oraLog messages written to /home/oracle/diag/tnslsnr/JTWF/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=JTWF)(PORT=1521)))Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=JTWF)(PORT=1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionStart Date 04-APR-2014 16:15:25Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /home/oracle/product/11.2/db_1/network/admin/listener.oraListener Log File /home/oracle/diag/tnslsnr/JTWF/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=JTWF)(PORT=1521)))The listener supports no servicesThe command completed successfully
2、啟動資料庫:
串連到sqlplus
su oraclebash-4.1$ sqlplus /nolog
結果如下:
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>
以sysdba登陸,並執行命令startup
SQL> conn /as sysdbaConnected to an idle instance.SQL> startup
結果如下:
ORACLE instance started.Total System Global Area 839282688 bytesFixed Size 2217992 bytesVariable Size 578815992 bytesDatabase Buffers 251658240 bytesRedo Buffers 6590464 bytesDatabase mounted.Database opened.SQL>
二、關閉資料庫、監聽
1、關閉資料庫
su oracle[root@JTWF oracle]# su oraclebash-4.1$ sqlplus /nolog
登陸sqlplus,結果如下:
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>
sysdba登陸:
SQL>conn /as sysdbaConnected.
關閉資料庫:
SQL> shutdown immediateDatabase closed.Database dismounted.ORACLE instance shut down.
關閉資料庫後,若執行查詢命令, 則會報如下錯誤:
SQL> select * from vio_business_request;select * from vio_business_request*ERROR at line 1:ORA-01034: ORACLE not availableProcess ID: 14138Session ID: 75 Serial number: 503SQL>
退出sqlplus:
SQL> exit Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options
2、關閉監聽:
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 successfullybash-4.1$ lsnrctl stopLSNRCTL 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