0438-0440

Previous Table of Contents Next

Page 438

NOTE
In the MOUNT or NOMOUNT state, the database can be used only by the DBA.

In some cases, such as when recovery is to be initiated, the database might not have gone through all three stages. It might be at stage 2, for example, which means that only the control file can be accessed. The actual database files are closed, so no operations on database objects are possible.

The tool used to perform the startup and shutdown is the Oracle Instance Manager, which is part of the Enterprise Manager.

Before you can issue a startup or shutdown from the Instance Manager tool, you must be connected as the INTERNAL user by means of a dedicated server connection:

 CONNECT INTERNAL 

In other words, the multithreaded server configuration cannot be used. This feature is a check to see whether you have operating system privileges and can perform these operations. Operating system_specific privileges, such as UNIX groups or VAX VMS process rights, determine who has access to perform these operations.

After you are connected as the INTERNAL user, you can use the STARTUP command to initiate the instance startup in whatever mode you want. During the first stage of startup, the instance parameter file must be provided. In its simplest form, the STARTUP command brings the instance through all three stages and makes the database available for all Oracle users to access:

 STARTUP 

Note that the parameter file the instance will use has not been specified. On most platforms, you can set an operating system environment variable. The default location for the parameter file on a UNIX platform is the /dbs directory below the home directory of the Oracle software.

The name of the database is assumed to have been specified in the INIT.ORA parameter file with the DB_NAME parameter. The name of the database specified is checked against the name of the database stored in the control file. If a mismatch occurs, the instance fails to start up and an error message is generated.

If you do not use this syntax, you must name the parameter file explicitly in the STARTUP command. In the following command, the DB_NAME parameter has not been specified in the INIT.ORA file:

 STARTUP PFILE =`/disk04/initmydb.ora' db_mydbname 

Therefore, you must specify the DB_NAME explicitly as part of the STARTUP command.

Page 439

You also can use this syntax when you want to start up the instance with a set of parameters different from the default values. You might want to use parameters that have been tuned to optimize batch jobs, for example.

If you use the Parallel Server option, you can specify additional parameters as part of the STARTUP command. The PARALLEL and EXCLUSIVE parameters control whether other instances can access the database after the instance starts up. If you use the EXCLUSIVE parameter, any attempt to start up the instance on another processor fails.

In many cases, you might not want to take the instance through all three stages. You might need to perform maintenance and recovery operations, for example. If this is the case, specify additional parameters, depending on what stage you want.

If you use the NOMOUNT parameter, only the Oracle background processes start, and the SGA area in memory is allocated:

 STARTUP PFILE =`/disk04/initmydb.ora' NOMOUNT 

You typically use NOMOUNT only when the database is created.

The MOUNT option takes the instance up to the point when the control file is opened:

 STARTUP PFILE =`/disk04/initmydb.ora' MOUNT mydbname 

You use MOUNT, for example, when you want to recover the database and the database files, or the redo logs are not present. You need to have the control file open, which is the case if the database is mounted, because it contains information that helps ensure that the files that make up the database remain in a synchronized state.

CAUTION
The word after MOUNT or OPEN in the STARTUP command is assumed to be the name of the database. If the name of the database already is specified in the INIT.ORA file, move the MOUNT or OPEN keyword to the end of the command.
Another option is to bring the database through all three stages but to limit access to the tables to the DBA. This method is useful for performing a full export of the database, because the data will not change during the export. You can use this code, for example:
 STARTUP PFILE =`/disk04/initmydb.ora' RESTRICT OPEN 

Only Oracle accounts that have been given the RESTRICTED SESSION system privilege can connect to the database after the instance is brought up with the RESTRICT keyword.

On some operating systems, a special facility is provided to databases to be started automatically when the machine is booted up. Refer to the User's Guide for your platform to see how to implement this facility if it is available on your platform.

Page 440

Shutdown Stages

A database is brought down in three stages:

  1. Closing the database files and the redo log files
  2. Dismounting the database
  3. Shutting down the Oracle background processes and releasing the memory occupied for the SGA

In the first stage, the database files and the redo log files are closed. Before this happens, information in the SGA is flushed down to the database files for system and user data. Entries from the redo buffer cache in the SGA also are flushed down to the active redo log file, and a marker is created in the redo log to indicate that a shutdown has occurred.

In the second stage, the database is dismounted. This means that the control file is updated with synchronization information and is closed.

In the third stage, the Oracle background processes are shut down, and the memory occupied for the SGA is released.

The Instance Manager tool is used to perform the shutdown, and the user must be connected to the database as INTERNAL, as shown in this code:

 CONNECT INTERNAL 

The SHUTDOWN command takes the instance through all three shutdown stages:

 SHUTDOWN 

If the database is not fully open, informational messages indicate which shutdown stage is not necessary, and the other stages are performed.

NOTE
If users are connected to the database, the SHUTDOWN command without any parameters waits indefinitely for the users to disconnect from the database. You can disconnect users manually by using the ALTER SYSTEM KILL SESSION command or by using the Instance Manager menu options.

You can shut down the instance so that connected users are disconnected immediately, and work in their current transactions is rolled back. Use the IMMEDIATE keyword after the SHUTDOWN command:

 SHUTDOWN IMMEDIATE 
Previous Table of Contents Next


Oracle Unleashed
Oracle Development Unleashed (3rd Edition)
ISBN: 0672315750
EAN: 2147483647
Year: 1997
Pages: 391

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net