Start/shutdown oracle

## set the database to logon
export ORACLE_SID=mydb
## conect sqlplus to the target database
sqlplus / as sysdba

## make sure connected to the correct database
SQL>show user;
user is "SYS"
SQL>select name from v$database;
name
--------
mydb

## start oracle goes through 3 stages: no mount, mount, open
1. startup; - this will go through all the stages and is the normal cmd

2. startup nomount; - only control files are loaded
alter database mount;
alter database open;

3. startup mount; - control file/data files are loaded but not open yet
alter database open;

## shutdown database
1. shutdown; - the normal cmd. Would hang if there're still users logged on, or active transactions not yet committed or rolled back.

2. shutdown immediate; - would shut down the database, logged in users kicked out, any active transactions would be rolled back.

3. shutdown transactional; - would hang if there're active transactions not yet committed or rolled back.

4. shutdown abort; - would shut down db immediately, without commit or rollback. On next startup, it would go through a recovery process and thus takes longer time.

------------------ a start example -----------------
[oracle@mob1db1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Fri Nov 2 10:00:11 2012

Copyright (c) 1982, 2007, Oracle. All rights reserved.

[b]Connected to an idle instance.[/b]

SQL> select name from v$database;
select name from v$database
*
ERROR at line 1:
[b]ORA-01034: ORACLE not available[/b]
Process ID: 0
Session ID: 0 Serial number: 0


SQL> [b]startup;[/b]
[b]ORACLE instance started.

Total System Global Area 1603411968 bytes
Fixed Size 2144824 bytes
Variable Size 872416712 bytes
Database Buffers 721420288 bytes
Redo Buffers 7430144 bytes
Database mounted.
Database opened.[/b]

SQL> select name from v$database;

NAME
---------
AWCC

SQL> quit;
Disconnected from Oracle Database 11g Release 11.1.0.6.0 - 64bit Production
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值