본문 바로가기

Database/Oracle

07 - [Oracle 19C] Oracle startup

Database Startup , shutdown and connections

 

Oracle Database 가 시작되는 단계는 아래와 같다.

Shutdown >> NoMount >> Mount >> Open

이 모든 단계를 한번에 처리하는 명령어가 "startup" 이다.

 

No mount - The instance is started but is not yet associated with a database.

Search for Spfile, pfile

Read the parameter file

Allocate the SGA

Start the BG process

Open the alert and trace file

 

Mount - The instance is started and is associated with a database by reading its control file. The database is close to users.

 DB Accessible only to database administrators. The database is not available for normal operations.

 

Open - The instance is started and it's associated with an open database. The data contained in the data files is accessible to authorized user.

Opens the online data files in tablespaces

Acquires an undo tablespace

Opens the online redo log files

 
 
[oracle@test ~]$ sqlplus /nolog

SQL*Plus: Release 19.0.0.0.0 - Production on Mon Nov 13 23:56:10 2023
Version 19.3.0.0.0

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

SQL> conn sys/"xxx@@@XXX" as sysdba
Connected to an idle instance.

SQL> startup;      
ORACLE instance started.

Total System Global Area 1526723608 bytes
Fixed Size		    9135128 bytes
Variable Size		  889192448 bytes
Database Buffers	  620756992 bytes
Redo Buffers		    7639040 bytes
Database mounted.
Database opened.

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
 
 
 
SQL> 
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1526723608 bytes
Fixed Size		    9135128 bytes
Variable Size		  889192448 bytes
Database Buffers	  620756992 bytes
Redo Buffers		    7639040 bytes
SQL> 
SQL> select count(1) from dba_tables;
select count(1) from dba_tables
                     *
ERROR at line 1:
ORA-01219: database or pluggable database not open: queries allowed on fixed
tables or views only


SQL>
SQL> select status from v$instance;

STATUS
------------
STARTED

SQL>

 

 

 

 

SQL> alter database mount;

Database altered.

SQL> 
SQL> select status from v$instance;

STATUS
------------
MOUNTED

SQL>
SQL> select count(1) from dba_tables;
select count(1) from dba_tables
                     *
ERROR at line 1:
ORA-01219: database or pluggable database not open: queries allowed on fixed
tables or views only


SQL>

 

 

 

SQL> alter database open;

Database altered.

SQL> select status from v$instance;

STATUS
------------
OPEN

SQL> select count(1) from dba_tables;

  COUNT(1)
----------
      2178

SQL>

 

 

 

SQL> startup force;
ORACLE instance started.

Total System Global Area 1526723608 bytes
Fixed Size		    9135128 bytes
Variable Size		  889192448 bytes
Database Buffers	  620756992 bytes
Redo Buffers		    7639040 bytes
Database mounted.
Database opened.
SQL>

 

 

 

 

 

 

Syntax ElementDescription
STARTUP If you specify only STARTUP with no other options, then the instance starts the instance with the default server parameter file, mounts the control file, and opens the database.
   DBA Restricts access to users with the RESTRICTED SESSION privilege.
   FORCE If the database is open, then FORCE shuts down the database with a SHUTDOWN ABORT statement before re-opening it. If the database is closed, then FORCE opens the database.
   MOUNT Starts the instance, then mounts the database without opening it
   NOMOUNT Starts the instance without mounting the database. If no parameter file exists, then RMAN starts the instance with a temporary parameter file. You can then run RESTORE SPFILE to restore a backup server parameter file.
   PFILE filename Specifies the file name of the text-based initialization parameter file for the target database. If PFILE is not specified, then the default initialization parameter file name is used.