3.1 Starting Up a Database

«« Previous
Next »»

When you start up a database, you create an instance of that database and you determine the state of the database. Normally, you start up an instance by mounting and opening the database. Doing so makes the database available for any valid user to connect to and perform typical data access operations.
  • About Database Startup Options
When Oracle Restart is not in use, you can start up a database instance with SQL*Plus, Recovery Manager, or Oracle Enterprise Manager Cloud Control (Cloud Control). If your database is being managed by Oracle Restart, the recommended way to start the database is with SRVCTL.

1. Starting Up a Database Using SQL*Plus

You can start a SQL*Plus session, connect to Oracle Database with administrator privileges, and then issue the STARTUP command. Using SQL*Plus in this way is the only method described in detail in this book.

→ Run the SQL*Plus STARTUP command.

2. Starting Up a Database Using Recovery Manager

You can also use Recovery Manager (RMAN) to execute STARTUP and SHUTDOWN commands. You may prefer to do this if your are within the RMAN environment and do not want to invoke SQL*Plus.

→ Run an RMAN STARTUP command.

3. Starting Up a Database Using Cloud Control

You can use Cloud Control to administer your database, including starting it up and shutting it down. Cloud Control combines a GUI console, agents, common services, and tools to provide an integrated and comprehensive systems management platform for managing Oracle products. Cloud Control enables you to perform the functions discussed in this book using a GUI interface, rather than command line operations.

→ In Cloud Control, start the database instance.

4. Starting Up a Database Using SRVCTL

When Oracle Restart is installed and configured for your database, Oracle recommends that you use SRVCTL to start the database.

Starting the database instance with SRVCTL ensures that:
  1. Any components on which the database depends (such as Oracle Automatic Storage Management and the Oracle Net listener) are automatically started first, and in the proper order.
  2. The database is started according to the settings in its Oracle Restart configuration. An example of such a setting is the server parameter file location.
  3. Environment variables stored in the Oracle Restart configuration for the database are set before starting the instance.
To start a database instance with SRVCTL:

→ Run the srvctl start database command.
  • Specifying Initialization Parameters at Startup
To start an instance, the database must read instance configuration parameters (the initialization parameters) from either a server parameter file (SPFILE) or a text initialization parameter file (PFILE). The database looks for these files in a default location. You can specify nondefault locations for these files, and the method for doing so depends on whether you start the database with SQL*Plus (when Oracle Restart is not in use) or with SRVCTL (when the database is being managed with Oracle Restart).

1. About Initialization Parameter Files and Startup

When you start the database instance, it attempts to read the initialization parameters from an SPFILE in a platform-specific default location. If it finds no SPFILE, then it searches for a text initialization parameter file.

Table 2-3 lists PFILE and SPFILE default names and locations.

In the platform-specific default location, Oracle Database locates your initialization parameter file by examining file names in the following order:

The location specified by the -spfile option in the SRVCTL commands srvctl add database or srvctl modify database
  1. You can check the current setting with the srvctl config database command.
  2. spfileORACLE_SID.ora
  3. spfile.ora
  4. initORACLE_SID.ora
The first three files are SPFILEs and the fourth is a text initialization parameter file. If DBCA created the SPFILE in an Oracle Automatic Storage Management disk group, then the database searches for the SPFILE in the disk group.

If you specify both the spfile_name and the FROM PFILE clause in a CREATE SPFILE statement, and the database is defined as a resource in Oracle Clusterware, then this statement automatically updates the SPFILE name and location in the database resource.

Note: The spfile.ora file is included in this search path because in an Oracle Real Application Clusters environment one server parameter file is used to store the initialization parameter settings for all instances. There is no instance-specific location for storing a server parameter file.

If you (or the Database Configuration Assistant) created a server parameter file, but you want to override it with a text initialization parameter file, then you can do so with SQL*Plus, specifying the PFILE clause of the STARTUP command to identify the initialization parameter file:

STARTUP PFILE = /u01/oracle/dbs/init.ora

Nondefault Server Parameter Files

A nondefault server parameter file (SPFILE) is an SPFILE that is in a location other than the default location. It is not usually necessary to start an instance with a nondefault SPFILE. However, should such a need arise, both SRVCTL (with Oracle Restart) and SQL*Plus provide ways to do so. These are described later in this section.

Initialization Files and Oracle Automatic Storage Management

A database that uses Oracle Automatic Storage Management (Oracle ASM) usually has a nondefault SPFILE. If you use the Database Configuration Assistant (DBCA) to configure a database to use Oracle ASM, DBCA creates an SPFILE for the database instance in an Oracle ASM disk group, and then causes a text initialization parameter file (PFILE) to be created in the default location in the local file system to point to the SPFILE, as explained in the next section.

2. Starting Up with SQL*Plus with a Nondefault Server Parameter File

With SQL*Plus, you can use the PFILE clause to start an instance with a nondefault server parameter file.

To start up with SQL*Plus with a nondefault server parameter file:

⇛ Create a one-line text initialization parameter file that contains only the SPFILE parameter. The value of the parameter is the nondefault server parameter file location.
For example, create a text initialization parameter file /u01/oracle/dbs/spf_init.ora that contains only the following parameter:

SPFILE = /u01/oracle/dbs/test_spfile.ora

Note: You cannot use the IFILE initialization parameter within a text initialization parameter file to point to a server parameter file. In this context, you must use the SPFILE initialization parameter.

⇛ Start up the instance pointing to this initialization parameter file.

STARTUP PFILE = /u01/oracle/dbs/spf_init.ora

The SPFILE must reside on the database host computer. Therefore, the preceding method also provides a means for a client system to start a database that uses an SPFILE. It also eliminates the need for a client system to maintain a client-side initialization parameter file. When the client system reads the initialization parameter file containing the SPFILE parameter, it passes the value to the server where the specified SPFILE is read.

3. Starting Up with SRVCTL with a Nondefault Server Parameter File

If your database is being managed by Oracle Restart, then you can specify the location of a nondefault SPFILE by setting or modifying the SPFILE location option in the Oracle Restart configuration for the database.

To start up with SRVCTL with a nondefault server parameter file:

1. Prepare to run SRVCTL as described in "Preparing to Run SRVCTL".
2. Enter the following command:
srvctl modify database -db db_unique_name -spfile spfile_path
where db_unique_name must match the DB_UNIQUE_NAME initialization parameter setting for the database.
3. Enter the following command:
srvctl start database -db db_unique_name [options]
  • About Automatic Startup of Database Services
When your database is managed by Oracle Restart, you can configure startup options for each individual database service (service).

If you set the management policy for a service to AUTOMATIC (the default), the service starts automatically when you start the database with SRVCTL. If you set the management policy to MANUAL, the service does not automatically start, and you must manually start it with SRVCTL. A MANUAL setting does not prevent Oracle Restart from monitoring the service when it is running and restarting it if a failure occurs.

In an Oracle Data Guard (Data Guard) environment in which databases are managed by Oracle Restart, you can additionally control automatic startup of services by assigning Data Guard roles to the services in their Oracle Restart configurations. A service automatically starts upon manual database startup only if the management policy of the service is AUTOMATIC and if one of its assigned roles matches the current role of the database.
  • Preparing to Start Up an Instance
You must perform some preliminary steps before attempting to start an instance of your database using SQL*Plus.

To prepare for starting an instance:

1. Ensure that any Oracle components on which the database depends are started.
For example, if the database stores data in Oracle Automatic Storage Management (Oracle ASM) disk groups, ensure that the Oracle ASM instance is running and the required disk groups are mounted. Also, it is preferable to start the Oracle Net listener before starting the database.

2. If you intend to use operating system authentication, log in to the database host computer as a member of the OSDBA group.

3. Ensure that environment variables are set so that you connect to the desired Oracle instance. 

4. Start SQL*Plus without connecting to the database:


5. Connect to Oracle Database as SYSOPER, SYSDBA, SYSBACKUP, or SYSDG. For example:


Now you are connected to the database and ready to start up an instance of your database.
  • Starting Up an Instance
You can start up an instance using SQL*Plus or Oracle Restart.

1. About Starting Up an Instance

When Oracle Restart is not in use, you use the SQL*Plus STARTUP command to start up an Oracle Database instance. If your database is being managed by Oracle Restart, Oracle recommends that you use the srvctl start database command.

With SQL*Plus and Oracle Restart, you can start an instance in various modes:
  • NOMOUNT—Start the instance without mounting a database. This does not allow access to the database and usually would be done only for database creation or the re-creation of control files.
  • MOUNT—Start the instance and mount the database, but leave it closed. This state allows for certain DBA activities, but does not allow general access to the database.
  • OPEN—Start the instance, and mount and open the database. This can be done in unrestricted mode, allowing access to all users, or in restricted mode, allowing access for database administrators only.
  • FORCE—Force the instance to start after a startup or shutdown problem.
  • OPEN RECOVER—Start the instance and have complete media recovery begin immediately.
Note: You cannot start a database instance if you are connected to the database through a shared server process.

The following scenarios describe and illustrate the various states in which you can start up an instance. Some restrictions apply when combining clauses of the STARTUP command or combining startup options for the srvctl start database command.

Note: It is possible to encounter problems starting up an instance if control files, database files, or online redo logs are not available. If one or more of the files specified by the CONTROL_FILES initialization parameter does not exist or cannot be opened when you attempt to mount a database, Oracle Database returns a warning message and does not mount the database. If one or more of the data files or online redo logs is not available or cannot be opened when attempting to open a database, the database returns a warning message and does not open the database.

2. Starting an Instance, and Mounting and Opening a Database

Normal database operation means that an instance is started and the database is mounted and open. This mode allows any valid user to connect to the database and perform data access operations.

The following command starts an instance, reads the initialization parameters from the default location, and then mounts and opens the database.

SQL*Plus SRVCTL (When Oracle Restart Is In Use)
STARTUP srvctl start database -db db_unique_name

where db_unique_name matches the DB_UNIQUE_NAME initialization parameter.

3. Starting an Instance Without Mounting a Database

You can start an instance without mounting a database. Typically, you do so only during database creation.

Use one of the following commands:

SQL*PlusSRVCTL (When Oracle Restart Is In Use)
STARTUP NOMOUNTsrvctl start database -db db_unique_name -startoption nomount

4. Starting an Instance and Mounting a Database

You can start an instance and mount a database without opening it, allowing you to perform specific maintenance operations.

For example, the database must be mounted but not open during the following tasks:
  1. Starting with Oracle Database 12c Release 1 (, putting a database instance in force full database caching mode.
  2. Enabling and disabling redo log archiving options. 
  3. Performing full database recovery.
The following command starts an instance and mounts the database, but leaves the database closed:

SQL*PlusSRVCTL (When Oracle Restart Is In Use)
STARTUP MOUNTsrvctl start database -db db_unique_name -startoption mount

5. Restricting Access to an Instance at Startup

You can start an instance, and optionally mount and open a database, in restricted mode so that the instance is available only to administrative personnel (not general database users).

Use this mode of instance startup when you must accomplish one of the following tasks:
  • Perform an export or import of data
  • Perform a data load (with SQL*Loader)
  • Temporarily prevent typical users from using data
  • Perform certain migration or upgrade operations
Typically, all users with the CREATE SESSION system privilege can connect to an open database. Opening a database in restricted mode allows database access only to users with both the CREATE SESSION and RESTRICTED SESSION system privilege. Only database administrators should have the RESTRICTED SESSION system privilege. Further, when the instance is in restricted mode, a database administrator cannot access the instance remotely through an Oracle Net listener, but can only access the instance locally from the system that the instance is running on.

The following command starts an instance (and mounts and opens the database) in restricted mode:

SQL*PlusSRVCTL (When Oracle Restart Is In Use)
STARTUP RESTRICTsrvctl start database -db db_unique_name -startoption restrict

You can use the restrict mode in combination with the mount, nomount, and open modes.

Later, use the ALTER SYSTEM statement to disable the RESTRICTED SESSION feature:


If you open the database in nonrestricted mode and later find that you must restrict access, you can use the ALTER SYSTEM statement to do so, as described in "Restricting Access to an Open Database".

6. Forcing an Instance to Start

In unusual circumstances, you might experience problems when attempting to start a database instance, and you can force a database instance to start.

You should not force a database to start unless you are faced with the following:
  • You cannot shut down the current instance with the SHUTDOWN NORMAL, SHUTDOWN IMMEDIATE, or SHUTDOWN TRANSACTIONAL commands.
  • You experience problems when starting an instance.
If one of these situations arises, you can usually solve the problem by starting a new instance (and optionally mounting and opening the database) using one of these commands:

SQL*PlusSRVCTL (When Oracle Restart Is In Use)
STARTUP FORCEsrvctl start database -db db_unique_name -startoption force

If an instance is running, the force mode shuts it down with mode ABORT before restarting it. In this case, the alert log shows the message "Shutting down instance (abort)" followed by "Starting ORACLE instance (normal)."

7. Starting an Instance, Mounting a Database, and Starting Complete Media Recovery

If you know that media recovery is required, then you can start an instance, mount a database to the instance, and have the recovery process automatically start.

To do so, use one of these commands:

SQL*PlusSRVCTL (When Oracle Restart Is In Use)
STARTUP OPEN RECOVERsrvctl start database -db db_unique_name -startoption "open,recover"

If you attempt to perform recovery when no recovery is required, Oracle Database issues an error message.

8. Automatic Database Startup at Operating System Start

Many sites use procedures to enable automatic startup of one or more Oracle Database instances and databases immediately following a system start.

The procedures for performing this task are specific to each operating system. For information about automatic startup, see your operating system specific Oracle documentation.

The preferred (and platform-independent) method of configuring automatic startup of a database is Oracle Restart.

9. Starting Remote Instances

If your local Oracle Database server is part of a distributed database, then you might want to start a remote instance and database.

Procedures for starting and stopping remote instances vary widely depending on communication protocol and operating system.

«« Previous
Next »»