Starting Up a Database - Oracle 10g

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:

  • Options for Starting Up a Database
  • Preparing to Start an Instance
  • Using SQL*Plus to Start Up a Database

Options for Starting Up a Database

You can start up and administer an instance of your database if several says, as described in the sections that follow.

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.

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.

Starting Up a Database Using Oracle Enterprise Manager

You can use Oracle Enterprise Manager (EM) to administer your database, including starting it up and shutting it down. Enterprise Manager is a separate Oracle product that combines a GUI console, agents, common services, and tools to provide an integrated and comprehensive systems management platform for managing Oracle products. EM enables you to perform the functions using a GUI interface, rather than command line operations.

The remainder of this section describes using SQL*Plus to start up a database instance.

Preparing to Start an Instance

You must perform some preliminary steps before attempting to start an instance of your database using SQL*Plus.

  1. Start SQL*Plus without connecting to the database:
    SQLPLUS /NOLOG
  2. Connect to Oracle Database as SYSDBA:
    CONNECT username/password AS SYSDBA

Now you are connected to the database and ready to start up an instance of your database.

Using SQL*Plus to Start Up a Database

You use the SQL*Plus STARTUP command to start up an Oracle Database instance. To start an instance, the database must read instance configuration parameters (the initialization parameters) from either a server parameter file or a traditional text initialization parameter file. When you issue the STARTUP command, by default, the database reads the initialization parameters from a server parameter file (SPFILE) in a platform-specific default location. If you have not created a server parameter file, or if you wish to use a traditional text parameter file instead, you must specify the PFILE clause of the STARTUP command to identify the initialization parameter file.

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

  1. spfile$ORACLE_SID.ora
  2. spfile.ora
  3. init$ORACLE_SID.ora

You can direct the database to read initialization parameters from a traditional text initialization parameter file, by using the PFILE clause of the STARTUP command. For example:

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

It is not usually necessary to start an instance with a nondefault server parameter file. However, should such a need arise, you can use this PFILE clause to start an instance with a nondefault server parameter file as follows:

  1. 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
  2. Start up the instance pointing to this initialization parameter file.
    STARTUP PFILE = /u01/oracle/dbs/spf_init.ora

The server parameter file must reside on the machine running the database server.Therefore, the preceding method also provides a means for a client machine to start a database that uses a server parameter file. 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 server parameter file is read.

You can start an instance in various modes:

  • 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.
  • 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.
  • 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.

In addition, you can force the instance to start, or start the instance and have complete media recovery begin immediately. The STARTUP command clauses that you specify to achieve these states are illustrated in the following section.

Starting an Instance: Scenarios

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.

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 typical data access operations.

Start an instance, read the initialization parameters from the default server parameter file location, and then mount and open the database by using the STARTUP command by itself (you can, of course, optionally specify the PFILE clause):

STARTUP

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 the STARTUP command with the NOMOUNT clause:

STARTUP NOMOUNT

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:

  • Enabling and disabling redo log archiving options.
  • Performing full database recovery

Start an instance and mount the database, but leave it closed by using the STARTUP command with the MOUNT clause:

STARTUP MOUNT

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 need to accomplish one of the following tasks:

  • Perform an export or import of database data
  • Perform a data load (with SQL*Loader)
  • Temporarily prevent typical users from using data
  • During certain migration and 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.

Start an instance (and, optionally, mount and open the database)in restricted mode by using the STARTUP command with the RESTRICT clause:

STARTUP RESTRICT

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 you need to restrict access, you can use the ALTER SYSTEM statement to do so

Forcing an Instance to Start

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 the STARTUP command with the FORCE clause:

STARTUP FORCE

If an instance is running, STARTUP FORCE shuts it down with mode ABORT before restarting it.

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 clause:

STARTUP OPEN RECOVER

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

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.

Starting Remote Instances

If your local Oracle Database server is part of a distributed database, 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.


All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Oracle 10g Topics