Oracle® Database Administrator's Guide 11g Release 2 (11.2) Part Number E10595-04 |
|
|
View PDF |
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. Other options exist, and these are also discussed in this section.
This section contains the following topics relating to starting up an instance of a database:
When Oracle Restart is not in use, you can start up a database instance with SQL*Plus, Recovery Manager, or Enterprise Manager. If your database is being managed by Oracle Restart, the recommended way to start the database is with SRVCTL.
See Chapter 4, "Configuring Automatic Restart of an Oracle Database" for information about Oracle Restart.
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.
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.
See Also:
Oracle Database Backup and Recovery Reference for information about the RMANSTARTUP
commandYou can use Oracle Enterprise Manager (EM) to administer your database, including starting it up and shutting it down. EM combines a GUI console, agents, common services, and tools to provide an integrated and comprehensive systems management platform for managing Oracle products. EM Database Control, which is the portion of EM that is dedicated to administering an Oracle database, enables you to perform the functions discussed in this book using a GUI interface, rather than command line operations.
The remainder of this section describes using SQL*Plus to start up a database instance.
When Oracle Restart is installed and configured for your database, Oracle recommends that you use SRVCTL to start the database. This ensures that:
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.
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.
Environment variables stored in the Oracle Restart configuration for the database are set before starting the instance.
See "srvctl start database" and "Starting and Stopping Components Managed by Oracle Restart" for details.
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 non-default 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).
The following sections provide details:
Starting Up with SQL*Plus with a Non-Default Server Parameter File
Starting Up with SRVCTL with a Non-Default Server Parameter File
See Also:
Chapter 2, "Creating and Configuring an Oracle Database", for more information about initialization parameters, initialization parameter files, and server parameter filesWhen 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
, it searches for a text initialization parameter file.
Table 2-4 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:
spfile
ORACLE_SID
.ora
spfile.ora
init
ORACLE_SID
.ora
The first two files are SPFILE
s and the third is a text initialization parameter file. If DBCA created the SPFILE in an Oracle Automatic Storage Management disk group, the database searches for the SPFILE in the disk group.
Note:
Thespfile.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.
For more information about the server parameter file for an Oracle Real Application Clusters environment, see Oracle Real Application Clusters Administration and Deployment Guide.
If you (or the Database Configuration Assistant) created a server parameter file, but you want to override it with a text initialization parameter file, 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
Non-Default Server Parameter Files A non-default 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 non-default 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 non-default 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.
With SQL*Plus you can use the PFILE
clause to start an instance with a non-default server parameter file.
To start up with SQL*Plus with a non-default server parameter file:
Create a one-line text initialization parameter file that contains only the SPFILE
parameter. The value of the parameter is the non-default 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 theIFILE
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 machine to start a database that uses an SPFILE
. It also eliminates the need for a client machine to maintain a client-side initialization parameter file. When the client machine reads the initialization parameter file containing the SPFILE
parameter, it passes the value to the server where the specified SPFILE
is read.
If your database is being managed by Oracle Restart, you can specify the location of a non-default SPFILE by setting or modifying the SPFILE location option in the Oracle Restart configuration for the database.
To start up with SRVCTL with a non-default server parameter file:
Prepare to run SRVCTL as described in "Preparing to Run SRVCTL".
Enter the following command:
srvctl modify database -d db_unique_name -p spfile_path
where db_unique_name
must match the DB_UNIQUE_NAME
initialization parameter setting for the database.
Enter the following command:
srvctl start database -d db_unique_name [options]
See "SRVCTL Command Reference" for more information.
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.
See "srvctl add service" and "srvctl modify service" for the syntax for setting the management policy of and Data Guard roles for a service.
Note:
When using Oracle Restart, Oracle strongly recommends that you use SRVCTL to create database services.Note:
The following instructions are for installations where Oracle Restart is not in use. If your database is being managed by Oracle Restart, follow the instructions in "Starting and Stopping Components Managed by Oracle Restart".You must perform some preliminary steps before attempting to start an instance of your database using SQL*Plus.
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.
If you intend to use operating system authentication, log in to the database host computer as a member of the OSDBA group.
See "Using Operating System Authentication" for more information.
Ensure that environment variables are set so that you connect to the desired Oracle instance. For details, see "Submitting Commands and SQL to the Database".
Start SQL*Plus without connecting to the database:
SQLPLUS /NOLOG
Connect to Oracle Database as SYSDBA
:
CONNECT username AS SYSDBA
—or—
CONNECT / AS SYSDBA
Now you are connected to the database and ready to start up an instance of your database.
See Also:
SQL*Plus User's Guide and Reference for descriptions and syntax for theCONNECT
, STARTUP
, and SHUTDOWN
commands.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.
In either case, 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 redo log files are not available. If one or more of the files specified by theCONTROL_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 datafiles or redo log files 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.See Also:
SQL*Plus User's Guide and Reference for information about the restrictions that apply when combining clauses of the STARTUP
command
"Starting and Stopping Components Managed by Oracle Restart" for instructions for starting a database that is managed by Oracle Restart.
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 -d db_unique_name
|
where db_unique_name
matches the DB_UNIQUE_NAME
initialization parameter.
You can start an instance without mounting a database. Typically, you do so only during database creation. Use one of the following commands:
SQL*Plus | SRVCTL (When Oracle Restart Is In Use) |
---|---|
STARTUP NOMOUNT |
srvctl start database -d db_unique_name -o nomount
|
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:
Enabling and disabling redo log archiving options. For more information, please refer to Chapter 12, "Managing Archived Redo Logs".
Performing full database recovery. For more information, please refer to Oracle Database Backup and Recovery User's Guide
The following command starts an instance and mounts the database, but leaves the database closed:
SQL*Plus | SRVCTL (When Oracle Restart Is In Use) |
---|---|
STARTUP MOUNT |
srvctl start database -d db_unique_name -o mount
|
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 need to 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 machine that the instance is running on.
The following command starts an instance (and mounts and opens the database) in restricted mode:
SQL*Plus | SRVCTL (When Oracle Restart Is In Use) |
---|---|
STARTUP RESTRICT |
srvctl start database -d db_unique_name -o 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:
ALTER SYSTEM DISABLE RESTRICTED SESSION;
If you open the database in nonrestricted mode and later find that you need to restrict access, you can use the ALTER SYSTEM
statement to do so, as described in "Restricting Access to an Open Database".
In unusual circumstances, you might experience problems when attempting to start a database instance. 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*Plus | SRVCTL (When Oracle Restart Is In Use) |
---|---|
STARTUP FORCE |
srvctl start database -d db_unique_name -o 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)
."
See Also:
"Shutting Down with the Abort Mode" to understand the side effects of aborting the current instanceIf you know that media recovery is required, you can start an instance, mount a database to the instance, and have the recovery process automatically start by using one of these commands:
SQL*Plus | SRVCTL (When Oracle Restart Is In Use) |
---|---|
STARTUP OPEN RECOVER |
srvctl start database -d db_unique_name -o "open,recover"
|
If you attempt to perform recovery when no recovery is required, Oracle Database issues an error message.
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.
Beginning with Oracle Database 11g Release 2, the preferred (and platform-independent) method of configuring automatic startup of a database is Oracle Restart. See Chapter 4, "Configuring Automatic Restart of an Oracle Database" for details.