Oracle8 Concepts Release 8.0 A58227-01 |
Library | Product | Contents | Index

# 5
Database and Instance Startup and Shutdown

Greetings, Prophet; The Great Work begins: The Messenger has arrived.

Tony Kushner: Angels in America, Part I

This chapter explains the procedures involved in starting and stopping an Oracle instance and database. It includes:

- Overview of an Oracle Instance
  - Connecting with Administrator Privileges
  - Parameter Files
- Instance and Database Startup
- Database and Instance Shutdown

  Additional Information: If you are using Trusted Oracle, refer to your Trusted Oracle documentation for information about starting up and shutting down in that environment.

## Overview of an Oracle Instance

Every running Oracle database is associated with an Oracle instance. When a database is started on a database server (regardless of the type of computer), Oracle allocates a memory area called the System Global Area (SGA) and starts one or more Oracle processes. This combination of the SGA and the Oracle processes is called an Oracle instance. The memory and processes of an instance manage the associated database's data efficiently and serve the one or multiple users of the database.

Figure 5-1 shows an Oracle instance. Also see Chapter 6, "Memory Structures" and Chapter 7, "Process Structure" for details about the SGA and Oracle processes.

#### Figure 5-1 An Oracle Instance

### The Instance and the Database

After starting an instance, Oracle associates the instance with the specified database. This is called mounting the database. The database is then ready to be opened, which makes it accessible to authorized users.

Multiple instances can execute concurrently on the same computer, each accessing its own physical database. In clustered and massively parallel systems (MPP), the Oracle Parallel Server allows multiple instances to mount a single database.

Additional Information: See Oracle8 Parallel Server Concepts and Administration for information about the Oracle Parallel Server. If you are using Trusted Oracle, see your Trusted Oracle documentation for information about instances in that environment.

Only the database administrator can start up an instance and open the database. If a database is open, the database administrator can shut down the database so that it is closed. When a database is closed, users cannot access the information that it contains.

Security for database startup and shutdown is controlled via connections to Oracle with administrator privileges. Normal users do not have control over the current status of an Oracle database.

### Connecting with Administrator Privileges

Database startup and shutdown are powerful administrative options and are restricted to users who connect to Oracle with administrator privileges. Depending on the operating system, one of the following conditions establishes administrator privileges for a user:

- The user's operating system privileges allow him or her to connect using administrator privileges.
- The user is granted the SYSDBA or SYSOPER privileges and the database uses password files to authenticate database administrators.
- The database has a password for the INTERNAL login, and the user knows the password.

For additional security, users who connect with administrator privileges can only connect to dedicated servers (not shared servers).

When you connect with administrator privileges, you are placed in the schema owned by SYS. This gives you access to all the objects in the SYS schema.

For more information about password files and authentication schemes for database administrators, see Chapter 25, "Controlling Database Access".

Additional Information: For information on how administrator privileges work on your operating system, see your operating system-specific Oracle documentation.

### Parameter Files

To start an instance, Oracle must read a parameter file - a text file containing a list of configuration parameters (initialization parameters) for that instance and database. You set these parameters to particular values to initialize many of the memory and process settings of an Oracle instance. Most initialization parameters belong to one of the following groups:

- parameters that name things (such as files)
- parameters that set limits (such as maximums)
- parameters that affect capacity (such as the size of the SGA), which are called variable parameters

Among other things, the initialization parameters tell Oracle:

- the name of the database for which to start up an instance
- how much memory to use for memory structures in the SGA
- what to do with filled online redo log files
- the names and locations of the database's control files
- the names of private rollback segments in the database

#### An Example of a Parameter File

The following is an example of a typical parameter file:

    db_block_buffers = 550
    db_name = ORA8PROD
    db_domain = US.ACME.COM
    #
    license_max_users = 64
    #
    control_files = filename1, filename2
    #
    log_archive_dest = c:\logarch
    log_archive_format = arch%S.ora
    log_archive_start = TRUE
    log_buffer = 64512
    log_checkpoint_interval = 256000
    # rollback_segments = rs_one, rs_two

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

#### Changing Parameter Values

The database administrator can adjust variable parameters to improve the performance of a database system. Exactly which parameters most affect a system is a function of numerous database characteristics and variables.

Modified parameter values take effect only when the instance starts up and reads the parameter file. Some parameters can also be changed dynamically by using the ALTER SESSION or ALTER SYSTEM command while the instance is running.

Additional Information: For descriptions of all initialization parameters, see Oracle8 Reference. For information about parameters that affect the SGA, see "Size of the SGA" on page 6-11.

## Instance and Database Startup

The three steps to starting a Oracle database and making it available for systemwide use are:

1. Start an instance.
2. Mount the database.
3. Open the database.

A database administrator can perform these steps using Oracle Enterprise Manager.

Additional Information: See Oracle Enterprise Manager Administrator's Guide.

### Starting an Instance

When Oracle starts an instance, first it reads a parameter file to determine the values of initialization parameters and then it allocates an SGA - a shared area of memory used for database information - and creates background processes. At this point, no database is associated with these memory structures and processes.

See Chapter 6, "Memory Structures", for information about the SGA and Chapter 7, "Process Structure", for information about background processes.

#### Restricted Mode of Instance Startup

You can start an instance in restricted mode (or later alter an existing instance to be in restricted mode). This restricts connections to only those users who have been granted the RESTRICTED SESSION system privilege.

#### Forcing an Instance to Startup in Abnormal Situations

In unusual circumstances, a previous instance might not have been shut down "cleanly", for example, one of the instance's processes might not have terminated properly. In such situations, the database might return an error during normal instance startup. To resolve this problem, you must terminate all remnant Oracle processes of the previous instance before starting the new instance.

### Mounting a Database

The instance mounts a database to associate the database with that instance. After mounting the database, the instance finds the database control files and opens them. (Control files are specified in the CONTROL_FILES initialization parameter in the parameter file used to start the instance.) Oracle then reads the control files to get the names of the database's datafiles and redo log files.

At this point, the database is still closed and is accessible only to the database administrator. The database administrator can keep the database closed while completing specific maintenance operations. However, the database is not yet available for normal operations.

#### Modes of Mounting a Database with the Parallel Server

Attention: The features described in this chapter are available only if you have purchased Oracle8 Enterprise Edition with the Parallel Server Option. See Getting to Know Oracle8 and the Oracle8 Enterprise Edition for more information.

If Oracle allows multiple instances to mount the same database concurrently, the database administrator can choose whether to run the database in exclusive or shared mode.

##### Exclusive Mode

If the first instance that mounts a database does so in exclusive mode, only that instance can mount the database. Versions of Oracle that do not support the Parallel Server option allow an instance to mount a database only in exclusive mode.

##### Shared Mode

If the first instance that mounts a database is started in shared mode (also called "parallel" mode), other instances that are started in shared mode can also mount the database.

The number of instances that can mount the database is subject to a predetermined maximum, which you can specify when creating the database.

Additional Information: See Oracle8 Parallel Server Concepts and Administration for more information about the use of multiple instances with a single database.

### Opening a Database

Opening a mounted database makes it available for normal database operations. Any valid user can connect to an open database and access its information. Usually a database administrator opens the database to make it available for general use.

When you open the database, Oracle opens the online datafiles and online redo log files. If a tablespace was offline when the database was previously shut down, the tablespace and its corresponding datafiles will still be offline when you reopen the database. See "Bringing Tablespaces Online and Offline" on page 3-7.

If any of the datafiles or redo log files are not present when you attempt to open the database, Oracle returns an error. You must perform recovery on a backup of any damaged or missing database files before you can open the database.

#### Instance Recovery

If the database was last closed abnormally, either because the database administrator aborted its instance or because of a power failure, Oracle automatically performs instance recovery when the database is reopened. See "Database Instance Failure" on page 28-4.

#### Rollback Segment Acquisition

When you open the database, the instance attempts to acquire one or more rollback segments. See "The Rollback Segment SYSTEM" and "Oracle Instances and Types of Rollback Segments" on page 2-23.

#### Resolution of In-Doubt Distributed Transaction

Occasionally a database may close abnormally with one or more distributed transactions in doubt (neither committed nor rolled back). When you reopen the database and instance recovery is complete, the RECO background process automatically, immediately, and consistently resolves any in-doubt distributed transactions. For more information, see Chapter 30, "Distributed Databases".

Additional Information: See Oracle8 Distributed Database Systems for information on recovery from distributed transaction failures.

## Database and Instance Shutdown

The three steps to shutting down a database and its associated instance are:

1. Close the database.
2. Dismount the database.
3. Shut down the instance.

A database administrator can perform these steps using Oracle Enterprise Manager. Oracle automatically performs all three steps whenever an instance is shut down.

Additional Information: See Oracle Enterprise Manager Administrator's Guide.

### Closing a Database

When you close a database, Oracle writes all database data and recovery data in the SGA to the datafiles and redo log files, respectively. Next, Oracle closes all online datafiles and online redo log files. (Any offline datafiles of any offline tablespaces will have been closed already. If you subsequently reopen the database, any tablespace that was offline and its datafiles remain offline and closed, respectively.) At this point, the database is closed and inaccessible for normal operations. The control files remain open after a database is closed but still mounted.

#### Closing the Database by Aborting the Instance

In rare emergency situations, you can abort the instance of an open database to close and completely shut down the database instantaneously. This process is fast, because the operation of writing all data in the buffers of the SGA to the datafiles and redo log files is skipped. The subsequent reopening of the database requires instance recovery, which Oracle performs automatically.

Note: If a system crash or power failure occurs while the database is open, the instance is, in effect, "aborted", and instance recovery is performed when the database is reopened.

### Dismounting a Database

Once the database is closed, Oracle dismounts the database to disassociate it from the instance. At this point, the instance remains in the memory of your computer.

After a database is dismounted, Oracle closes the control files of the database.

### Shutting Down an Instance

The final step in database shutdown is shutting down the instance. When you shut down an instance, the SGA is removed from memory and the background processes are terminated.

#### Abnormal Instance Shutdown

In unusual circumstances, shutdown of an instance might not occur cleanly; all memory structures might not be removed from memory or one of the background processes might not be terminated. When remnants of a previous instance exist, subsequent instance startup most likely will fail. In such situations, the database administrator can force the new instance to start up by first removing the remnants of the previous instance and then starting a new instance, or by issuing a SHUTDOWN ABORT command in Oracle Enterprise Manager.

Additional Information: For more detailed information on instance and database startup and shutdown, see Oracle8 Administrator's Guide.

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