Starting and stopping your Oracle database 12C is a task that you’ll perform frequently. To start/stop your database, connect with a SYSDBA or SYSOPER privileged user account, and issue the STARTUP and SHUTDOWN statements. The following example uses OS authentication to connect to the database:
$ sqlplus / as sysdba
After you’re connected as a privileged account, you can start your database, as follows:
SQL> startup;
Note For the prior command to work, you need either an spfile or init.ora file in the ORACLE_HOME/dbs directory.
When your instance starts successfully, you should see messages from Oracle indicating that the system global area (SGA) has been allocated. The database is mounted and then opened:
ORACLE instance started.
Total System Global Area 2137886720 bytes
Fixed Size 2290416 bytes
Variable Size 1207962896 bytes
Database Buffers 922746880 bytes
Redo Buffers 4886528 bytes
Database mounted.
Database opened.
From the prior output the database startup operation goes through three distinct phases in opening an Oracle database:
- Starting the instance
- Mounting the database
- Opening the database
You can step through these one at a time when you start your database. First, start the Oracle instance (background processes and memory structures):
SQL> startup nomount;
Next, mount the database. At this point, Oracle reads the control files:
SQL> alter database mount;
Finally, open the data files and online redo log files:
SQL> alter database open;
Tip It’s especially important to understand these startup phases when performing RMAN backup and recovery tasks. For example, in some scenarios you may need your database to be in mount mode. In that mode, it’s important to understand that the control file is open but the data files and online redo logs have not been opened yet.
This startup process is depicted graphically in Figure 1.
Figure 1. Phases of Oracle startup
When you issue a STARTUP statement without any parameters, Oracle automatically steps through the three startup phases (nomount, mount, open). In most cases, you will issue a STARTUP statement with no parameters to start your database. In many RMAN backup and recovery scenarios, you’ll issue a STARTUP MOUNT to place your database in mount mode (instance started and control files opened). Table 2 describes the meanings of parameters that you can use with the database STARTUP statement.
Table 2. Parameters Available with the STARTUP Command
Parameter | Meaning |
---|---|
| Shuts down the instance with ABORT before restarting it; useful for troubleshooting startup issues |
| Only allows users with the RESTRICTED SESSION privilege to connect to the database |
| Specifies the client parameter file to be used when starting the instance |
| Suppresses the display of SGA information when starting the instance |
| Starts background processes and allocates memory; doesn’t read control files |
| Starts background processes, allocates memory, and reads control files |
| Starts background processes, allocates memory, reads control files, and opens online redo logs and data files |
| Attempts media recovery before opening the database |
| Opens the database in read-only mode |
| Used when upgrading a database |
| Used when downgrading a database |