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.

Connected to an idle instance.

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


SQL> startup;
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.


SQL> select name from v$database;

NAME
---------
AWCC

SQL> quit;
Disconnected from Oracle Database 11g Release 11.1.0.6.0 - 64bit Production

你可能感兴趣的:(oracle,shutdown,startup)