Oracle8 Administrator's Guide Release 8.0 A58397-01 |
Library | Product | Contents | Index

# 3
Starting Up and Shutting Down

This chapter describes the procedures for starting and stopping an Oracle database, and includes the following topics:

- Startup Procedures
- Altering Database Availability
- Shutdown Procedures
- Using Parameter Files

See Also: Oracle Enterprise Manager Administrator's Guide and Oracle Server Manager User's Guide, for more information about performing specific tasks using Enterprise Manager/GUI or Server Manager/LineMode.

## Startup Procedures

This section includes the following topics:

- Preparing to Start an Instance
- Starting an Instance: Scenarios

To start up a database or instance, use either the Enterprise Manager Startup Database dialog box or the STARTUP command (after you connect to Oracle with administrator privileges). You can start an instance and database in a variety of ways:

- start the instance without mounting a database
- start the instance and mount the database, but leave it closed
- start the instance, and mount and open the database in:
  - unrestricted mode (accessible to all users)
  - restricted mode (accessible to DBAs only)

    Attention: You cannot start a database instance if you are connected to the database via a multi-threaded server process.

In addition, you can force the instance to start, or start the instance and have complete media recovery begin immediately. If your operating system supports the Oracle Parallel Server, you may start an instance and mount the database in either exclusive or shared mode.

### Preparing to Start an Instance

There are several tasks you need to perform before you attempt to start an instance.

1. Start Enterprise Manager and connect with administrator privileges.

   To start up a database or instance, you must start Enterprise Manager. You must also be connected with administrator privileges.

2. Specify a database name.

   When starting a database instance, specify the name of the database that will be mounted to the instance by either:

   - using the STARTUP command and specifying the database name
   - specifying DB_NAME in the parameter file that starts the instance
3. Specify the parameter filename.

   When starting a database instance, choose a parameter file to initialize the instance's settings:

   - using the Startup Database dialog box and entering a filename in the Parameter File text entry field
   - using the STARTUP command with the PFILE option and a fully specified filename

See Also: The specification of filenames is operating system specific. See your operating system-specific Oracle documentation. If no filename is entered, Oracle uses the default filename.

### Starting an Instance: Scenarios

The following scenarios describe the many ways in which you can start up an instance.

Note: You may 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 the CONTROL_FILES parameter do not exist or cannot be opened when you attempt to mount a database, Oracle returns a warning message and does not mount the database. If one or more of the datafiles or redo log files are not available or cannot be opened when attempting to open a database, Oracle returns a warning message and does not open the database.

#### Starting an Instance Without Mounting a Database

You might want to start an instance without mounting a database; this is usually the case only during database creation. To do this, use one of the following options of Enterprise Manager:

- the Startup Database dialog box, selecting the Startup Nomount radio button
- the STARTUP command with the NOMOUNT option

#### Starting an Instance and Mounting a Database

You might want to start an instance and mount a database, but not open the database because you want to perform specific maintenance operations. For example, the database must be mounted but not open during the following tasks:

- renaming datafiles
- adding, dropping, or renaming redo log files
- enabling and disabling redo log archiving options
- performing full database recovery

Start an instance and mount the database, but leave it closed using one of the following options of Enterprise Manager:

- the Startup database dialog box, selecting the Startup Mount radio button
- the STARTUP command with the MOUNT option

#### 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 allows any valid user to connect to the database and perform typical data access operations.

Start an instance, and mount and open the database, using one of the following options of Enterprise Manager:

- the Startup Database dialog box, selecting the Startup Open radio button
- the STARTUP command with the OPEN option

#### Restricting Access to a Database at Startup

You might want to start an instance and mount and open a database in restricted mode so that the database is available only to administrative personnel (not general database users). Use this mode of database startup when you need to accomplish one of the following tasks:

- perform structure maintenance, such as rebuilding indexes
- perform an export or import of database data
- perform a data load (with SQL*Loader)
- temporarily prevent typical users from using data

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.

Start an instance (and, optionally, mount and open the database) in restricted mode using one of the following options of Enterprise Manager:

- the Startup Database dialog box, selecting the Restrict button
- the STARTUP command with the RESTRICT option

Later, you can make the database accessible to users who do not have the RESTRICTED SESSION system privilege.

#### Forcing an Instance to Start

In unusual circumstances, you might experience problems when attempting to start a database instance. A database instance should not be forced to start unless you are faced with the following:

- The current instance cannot be successfully shut down using either the Normal or Immediate radio buttons of the Shutdown Database dialog box (or an equivalent SHUTDOWN statement).
- 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 either of the following options of Enterprise Manager:

- the Startup Database dialog box with the Force button selected
- the STARTUP command with the FORCE option

#### Starting an Instance, Mounting a Database, and Starting Complete Media Recovery

If 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 the STARTUP command with the RECOVER option.

#### Starting in Exclusive or Parallel Mode

If your Oracle Server allows multiple instances to access a single database concurrently, you must choose whether to mount the database exclusively or in parallel.

#### Starting Up an Instance and Database: Example

The following statement starts an instance using the parameter file INITSALE.ORA, mounts and opens the database named SALES in exclusive mode, and restricts access to administrative personnel. The DBA is already connected with administrator privileges.

    STARTUP OPEN sales PFILE=INITSALE.ORA EXCLUSIVE RESTRICT;

#### Automatic Database Startup at Operating System Start

Many sites use procedures to enable automatic startup of one or more Oracle instances and databases immediately following a system start. The procedures for doing this are specific to each operating system.

#### Starting Remote Instances

If your local Oracle Server is part of a distributed database, you might need to start a remote instance and database. Procedures for starting and stopping remote instances vary widely depending on communication protocol and operating system.

See Also: For more information about making a database available to non-privileged users, see "Restricting Access to an Open Database".

For more information about recovering control files, database files and redo logs, see Oracle8 Backup and Recovery Guide.

For more information about the side effects of aborting the current instance, see "Aborting an Instance".

For more information about starting up in exclusive or parallel mode, see the Oracle8 Parallel Server Concepts and Administration manual.

For more information about the restrictions that apply when combining options of the STARTUP command, see the Oracle8 SQL Reference.

For more information about automatic startup procedure topics, see your operating system-specific Oracle documentation.

## Altering Database Availability

You can make a database partially available by opening a previously mounted but closed database so that users can connect to and use the database.

The following sections explain how to alter a database's availability:

- Mounting a Database to an Instance
- Opening a Closed Database
- Restricting Access to an Open Database

### Mounting a Database to an Instance

When you need to perform specific administrative operations, the database must be started and mounted to an instance, but closed. This can be accomplished by starting the instance and mounting the database.

When mounting the database, you can indicate whether to mount the database exclusively to this instance or concurrently to other instances.

To mount a database to a previously started instance, use either of the following options:

- the Mount menu item of Enterprise Manager
- the SQL command ALTER DATABASE with the MOUNT option

Use the following statement when you want to mount a database in exclusive mode:

    ALTER DATABASE MOUNT;

See Also: For a list of operations that require the database to be mounted and closed, (and procedures to start an instance and mount a database in one step) see "Starting an Instance and Mounting a Database".

### Opening a Closed Database

You can make a mounted but closed database available for general use by opening the database. To open a mounted database, use either of the following options:

- the Open menu item of Enterprise Manager
- the SQL command ALTER DATABASE with the OPEN option

Use the following statement to open a mounted database:

    ALTER DATABASE OPEN;

After executing this statement, any valid Oracle user with the CREATE SESSION system privilege can connect to the database.

### Restricting Access to an Open Database

Under normal conditions, all users with the CREATE SESSION system privilege can connect to an instance. However, you can take an instance in and out of restricted mode. When an instance is in restricted mode, only users who have both the CREATE SESSION and RESTRICTED SESSION system privileges can connect to it. Typically, only administrators have the RESTRICTED SESSION system privilege.

Restricted mode is useful when you need to perform the following tasks:

- perform structure maintenance, such as rebuilding indexes
- perform an export or import of database data
- perform a data load (with SQL*Loader)
- temporarily prevent non-administrator users from using data

To place an instance in restricted mode, use the Restrict menu item of Enterprise Manager or the SQL command ALTER SYSTEM with the ENABLE RESTRICTED SESSION option. After placing an instance in restricted mode, you might want to kill all current user sessions before performing any administrative tasks.

To lift an instance from restricted mode, use the Allow All menu item of Enterprise Manager or the SQL command ALTER SYSTEM with the DISABLE RESTRICTED SESSION option.

For more information about starting a database instance, and mounting and opening the database in restricted mode, see "Restricting Access to a Database at Startup".

## Shutdown Procedures

The following sections describe shutdown procedures:

- Shutting Down a Database Under Normal Conditions
- Shutting Down a Database Immediately
- Shutdown Transactional

  Note: The SHUTDOWN IMMEDIATE statement disconnects all existing idle connections and shuts down the database. If, however, you've submitted processes (for example, inserts, selects or updates) that are awaiting results, the SHUTDOWN IMMEDIATE statement allows the process to complete before disconnecting you.

To initiate database shutdown, use either the Shutdown Database dialog box of Enterprise Manager or the SQL command SHUTDOWN. Control is not returned to the session that initiates a database shutdown until shutdown is complete. Users who attempt connections while a shutdown is in progress receive a message like the following:

    ORA-01090: shutdown in progress - connection is not permitted

Attention: You cannot shut down a database if you are connected to the database via a multi-threaded server process.

To shut down a database and instance, you must first be connected with administrator privileges. This condition applies whether you are using Enterprise Manager/GUI or SQL commands.

Figure 3-1 shows the sequence of events when the different SHUTDOWN commands are entered during a transfer of funds from one bank account to another.

#### Figure 3-1 Sequence of Events During Different Types of SHUTDOWN.

### Shutting Down a Database Under Normal Conditions

Normal database shutdown proceeds with the following conditions:

- No new connections are allowed after the statement is issued.
- Before the database is shut down, Oracle waits for all currently connected users to disconnect from the database.
- The next startup of the database will not require any instance recovery procedures.

To shut down a database in normal situations, use either of the following options of Enterprise Manager:

- the Normal radio button of the Shutdown Database dialog box
- the SHUTDOWN command with the NORMAL option (`SHUTDOWN NORMAL;)`

### Shutting Down a Database Immediately

Use immediate database shutdown only in the following situations:

- A power shutdown is going to occur soon.
- The database or one of its applications is functioning irregularly.

Immediate database shutdown proceeds with the following conditions:

- Current client SQL statements being processed by Oracle are terminated immediately.
- Any uncommitted transactions are rolled back. (If long uncommitted transactions exist, this method of shutdown might not complete quickly, despite its name.)
- Oracle does not wait for users currently connected to the database to disconnect; Oracle implicitly rolls back active transactions and disconnects all connected users.

To shut down a database immediately, use either of the following options of Enterprise Manager:

- the Immediate radio button of the Shutdown database dialog box
- the SHUTDOWN command with the IMMEDIATE option

  Note: The SHUTDOWN IMMEDIATE statement disconnects all existing idle connections and shuts down the database. If, however, you've submitted processes (for example, inserts, selects or updates) that are awaiting results, the SHUTDOWN IMMEDIATE statement allows the process to complete before disconnecting you.

### Shutdown Transactional

When you wish to perform a planned shutdown of an instance while minimizing interruption to clients, you can use the SHUTDOWN command with the TRANSACTIONAL option:

    SHUTDOWN TRANSACTIONAL;

After submitting this statement, no client can start a new transaction on this particular instance. If a client attempts to start a new transaction, they are disconnected. After all transactions have either committed or aborted, any client still connected to the instance is disconnected. At this point, the instance shuts down just as it would when a SHUTDOWN IMMEDIATE statement is submitted.

A transactional shutdown prevents clients from losing work, and at the same time, does not require all users to log off.

### Aborting an Instance

You can shut down a database instantaneously by aborting the database's instance. If possible, perform this type of shutdown only when in the following situations:

- The database or one of its applications is functioning irregularly and neither of the other types of shutdown work.
- You need to shut down the database instantaneously (for example, if you know a power shutdown is going to occur in one minute).
- You experience problems when starting a database instance.

Aborting an instance shuts down a database and yields the following results:

- Current client SQL statements being processed by Oracle are immediately terminated.
- Uncommitted transactions are not rolled back.
- Oracle does not wait for users currently connected to the database to disconnect; Oracle implicitly disconnects all connected users.

If both the normal and immediate shutdown options do not work, abort the current database instance immediately by using either of the following options of Enterprise Manager:

- the Abort radio button of the Shutdown Database dialog box
- the SHUTDOWN command with the ABORT option

## Using Parameter Files

The following sections include information about how to use parameter files:

- The Sample Parameter File
- The Number of Parameter Files
- The Location of the Parameter File in Distributed Environments

To start an instance, Oracle must read a parameter file, which is a text file containing a list of instance configuration parameters. Often, although not always, this file is named INIT.ORA or INITsid.ORA, where sid is operating system specific.

You can edit parameter values in a parameter file with a basic text editor; however, editing methods are operating system-specific.

Oracle treats string literals defined for National Language Support (NLS) parameters in the file as if they are in the database character set.

See Also: For more information about INITsid.ORA, see your operating system-specific Oracle documentation.

### The Sample Parameter File

A sample parameter file (INIT.ORA or INITsid.ORA) is included in the Oracle distribution set. This sample file's parameters are adequate for initial installations of an Oracle database. After your system is operating and you have some experience with Oracle, you will probably want to change some parameter values.

See Also: For more information about optimizing a database's performance using the parameter file, see the Oracle8 Tuning manual.

### The Number of Parameter Files

Each Oracle database has at least one parameter file that corresponds only to that database. This way, database-specific parameters (such as DB_NAME and CONTROL_FILES) in a given file always pertain to a particular database. It is also possible to have several different parameter files for a single database. For example, you can have several different parameter files for a single database so you can optimize the database's performance in different situations.

### The Location of the Parameter File in Distributed Environments

Enterprise Manager must be able to read a database's parameter file to start a database's instance. Therefore, always store a database's parameter file on the computer executing Enterprise Manager.

For example, in non-distributed processing installations, the same computer executes Oracle and Enterprise Manager. This computer already has the parameter file stored on one of its disk drives.

However, in distributed processing installations, local client workstations can execute Enterprise Manager to administer a database stored on a remote machine. In this type of configuration, the local client machines must each store a copy of the parameter file for the corresponding databases.

See Also: For more information about using administering Oracle in a distributed environment, see Oracle8 Distributed Database Systems.

For information concerning the setup and implementation of Enterprise Manager, see your operating system-specific Oracle documentation.

Prev | Next
| Copyright © 1997 Oracle Corporation. All Rights Reserved. |
Library | Product | Contents | Index