ORACLE服务实例切换命令

启动服务器的其他实例 
export ORACLE_SID=其它实例名 
sqlplus /nolog 
conn /as sysdba 
select name from v$database; 
$:lsnrctl status;查看实例监听器 
>startup 
 
Oracle操作指令 
 
#sqlplus /nolog 
>connect system/system as sysdba 
>startup open app(实例名) 
 
stop 
>connect system/system as sysdba 
>shutdown immediate 
  www.2cto.com  
启动oracle监听 
su - oracle 
>lsnrctl status   查看状态 
>lsnrctl start    启动 
 
连接oracle数据库 
#sqlplus user/pasword@//ip:端口/实例名 
例: 
#sqlplus system/[email protected]:1521/app 
 
// 查看实例状态 
>select instance_name, status from v$instance 
 
重启服务器后,让数据库实例自动启动: 
 
1、用oracle用户> vi /etc/oratab 
2、修改这些句话的最后的字母N为Y。 
app:/opt/oracle/app/oracle/product/11.2.0/app:N 
3、切换到root。 
vi /etc/rc.d/after.local 
 
4、添加: 
su - oracle -c '$ORACLE_HOME/bin/lsnrctl start' 
sleep 2s 
su - oracle -c '$ORACLE_HOME/bin/dbstart' 
5、加执行权限 
chmod +x /etc/rc.d/after.local   
  www.2cto.com   
做完这些操作,以后重启服务器,oracle监听和实例就可以自动起来了! 
 
#sqlplus /nolog 
>connect system/system as sysdba 
>startup open app(实例名) 
 
stop 
 
>connect system/system as sysdba 
>shutdown immediate 
 
启动oracle监听 
su - oracle 
>lsnrctl status   查看状态 
>lsnrctl start    启动

猜你喜欢

转载自muziliuxiang.iteye.com/blog/1883732
今日推荐