赞
踩
启动监听服务:============================================================
方法1:
用root以ssh登录到linux,打开终端输入以下命令:
cd $ORACLE_HOME #进入到oracle的安装目录
dbstart #重启服务器
lsnrctl start #重启监听器
cd $ORACLE_HOME #进入到oracle的安装目录
dbstart #重启服务器
lsnrctl start #重启监听器
-----------------------------------
方法2:
Sql代码
cd $ORACLE_HOME/bin #进入到oracle的安装目录
./dbstart #重启服务器
./lsnrctl start #重启监听器
-----------------------------------
方法3:
(1) 以oracle身份登录数据库,命令:su -oracle
(2) 进入Sqlplus控制台,命令:sqlplus /nolog
(3) 以系统管理员登录,命令:connect / as sysdba
(4) 启动数据库,命令:startup
(5) 如果是关闭数据库,命令:shutdown immediate
(6) 退出sqlplus控制台,命令:exit
(7) 进入监听器控制台,命令:lsnrctl
(8) 启动监听器,命令:start
(9) 退出监听器控制台,命令:exit
二、重启实例:
(1) 切换需要启动的数据库实例:export ORACLE_SID=C1
(2) 进入Sqlplus控制台,命令:sqlplus /nolog
(3) 以系统管理员登录,命令:connect / as sysdba
(4) 如果是关闭数据库,命令:shutdown abort
(5) 启动数据库,命令:startup
(6) 退出sqlplus控制台,命令:exit
====================================================================================
[oracle@localhost ~]$ env | grep ORA
ORACLE_SID=orcl
ORACLE_BASE=/data/oracle
ORACLE_TERM=xterm
ORACLE_HOME=/data/oracle/product/11.2.0/db_1
[oracle@localhost ~]$ cd $oracle_home
[oracle@localhost ~]$ cd $ORACLE_HOME
[oracle@localhost db_1]$ cd bin
[oracle@localhost bin]$ ./sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Sat Sep 30 09:38:07 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 759943168 bytes
Fixed Size 2217224 bytes
Variable Size 457181944 bytes
Database Buffers 293601280 bytes
Redo Buffers 6942720 bytes
Database mounted.
Database opened.
SQL> select count(0) from user_tables;
COUNT(0)
----------
956
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
[oracle@localhost bin]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 30-SEP-2017 09:48:07
Copyright (c) 1991, 2009, Oracle. All rights reserved.
Starting /data/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.1.0 - Production
System parameter file is /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /data/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 30-SEP-2017 09:48:07
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /data/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /data/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
The listener supports no services
The command completed successfully
查看实例名
select name from v$database;
select instance_name from v$instance;
show parameter instance;
切换实例==========================================================
export ORACLE_SID=test
export ORACLE_SID=orcl
sqlplus sys/system as sysdba
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。