Oracle9i Real Application Clusters Administration
Release 1 (9.0.1)

Part Number A89869-02
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback

Go to previous page Go to next page

4
Administering Real Application Clusters Databases with Server Control, SQL, and SQL*Plus

This chapter explains how to administer instances and databases in Real Application Clusters environments using Server Control (SRVCTL), SQL, and SQL*Plus. The topics in this chapter include:

Using SRVCTL to Administer Real Application Clusters Instances

Oracle Corporation recommends that you use SRVCTL to administer your Real Application Clusters database environment. SRVCTL manages configuration information that is used by several Oracle tools. For example, Oracle Enterprise Manager and the Intelligent Agent use the configuration information that SRVCTL generates to discover and monitor nodes in your cluster.

Before using SRVCTL, ensure that your Global Services Daemon (GSD) is running after you configure your database as described in Oracle9i Real Application Clusters Installation and Configuration. Do this by executing the appropriate command to run the GSD based on your platform. Oracle should respond with a message stating that the GSD is already running.

For more information on using the Global Services Daemon, refer to "Global Services Daemon (GSD)".

Note:

To use SRVCTL, you must have already created the configuration information for the database that you want to administer. You must have done this either by using the Oracle Database Configuration Assistant (DBCA), or by using the srvctl add command as described in the chapter on manually configuring your database in Oracle9i Real Application Clusters Installation and Configuration.  

Administrative Tasks That You Can Accomplish with SRVCTL

This section describes how to use the SRVCTL utility to administer instances in Real Application Clusters. You can use SRVCTL to perform two types of administrative tasks as listed under the following sub-headings:

SRVCTL Cluster Database Tasks

SRCVTL Cluster Database Configuration Tasks

SRVCTL Command Syntax

To see the online command syntax and options for each SRVCTL command, enter:

srvctl command option -h

Where command option is one of the valid options such as start, stop, or status. To see a list of available command options, enter:

srvctl

The remainder of this section describes the SRVCTL commands.

srvctl start

Use the srvctl start command to start all instances or a subset of instances in your Real Application Clusters database. For example, to start all the instances use the syntax:

srvctl start -p db_name

Or you can start specific instances using the syntax:

srvctl start -p db_name -i instance_name

This syntax starts the specific instance that you name. Using srvctl start also starts all listeners associated with an instance.

Use the -s option (lower-case s) as in the following syntax where stage is either inst or lsnr:

srvctl start -p db_name -s stage

Use this syntax to separately start instances and listeners.

srvctl stop

Use the srvctl stop command to stop all instances or a subset of instances in your Real Application Clusters database. For example, to stop all instances use the syntax:

srvctl stop -p db_name 

Or you can stop specific instances using:

srvctl stop -p db_name -i instance_name

Using srvctl stop also stops all listeners associated with an instance.

Use the -s option (lower-case s) as in the following syntax where stage is either inst or lsnr:

srvctl stop -p db_name -s stage

Use this syntax to separately stop instances and listeners.

srvctl status

Use the srvctl status command to determine what instances are running. For example, use the output from the following syntax to identify which instances are running:

srvctl status -p db_name

Use the -s option (lower-case s) as in the following syntax where stage is either inst or lsnr:

srvctl status -p db_name -s stage

Use this syntax to obtain the status of an instance or a listener.

srvctl config

Use the srvctl config command to identify the existing Real Application Clusters databases. You can use two syntaxes for srvctl config. For example, the following syntax lists all the Real Application Clusters databases in your environment:

srvctl config 

The following syntax lists the instances for the Real Application Clusters database name that you provide:

srvctl config -p db_name

The Oracle Enterprise Manager auto-discovery process also uses output from this command to discover the configurations for databases in your Real Application Clusters.

srvctl get env

Use the srvctl get env command to obtain environment information for either a specific instance or for an entire Real Application Clusters database. For example, the output from the following syntax displays environment information for the entire Real Application Clusters database identified by the name you provide:

srvctl get env -p db_name

The following syntax displays environment information for a specific instance:

srvctl get env -p db_name -i instance_name

Updating Your Configuration Information with SRVCTL

The remaining SRVCTL commands update your configuration information. If you use these commands, you must also use SQL to add or remove database objects as needed so that your instance or database can operate. For example, you must add redo log groups and thread IDs for instances if you use the srvctl add instance command.


Note:

Oracle Corporation recommends that you use the Instance Management feature of the Oracle Database Configuration Assistant to add and delete instances.  


srvctl add db

The srvctl add db command creates the configuration for the Real Application Clusters database. For example, the following syntax adds the configuration information for a Real Application Clusters database to the configuration repository.

srvctl add db -p db_name -o oracle_home

This database is identified by the name that you provide in the command syntax. You must then execute the srvctl add instance command to add instance configurations to the database.

srvctl add instance

Use the srvctl add instance command to add static configuration information for an instance. For example, the following syntax adds an instance using the instance name that you provide:

srvctl add instance -p db_name -i instance_name -n node_name

As mentioned, this command only updates the configuration; it does not create the database. Execute the srvctl add db command before using the srvctl add instance command.

srvctl delete instance

Use the srvctl delete instance command to delete static configuration information for a Real Application Clusters instance. For example, the following syntax deletes the configuration for the instance identified by the database name that you provide:

srvctl delete instance -p db_name -i instance_name

srvctl delete db

Use the srvctl delete db command to delete the static configuration for a Real Application Clusters database. For example, the following syntax deletes the Real Application Clusters database identified by the name that you provide:

srvctl delete db -p db_name 

srvctl rename instance

Use the srvctl rename instance command to rename a Real Application Clusters database instance. For example, the following syntax renames the Real Application Clusters instance identified by the name that you provide:

srvctl rename instance -p db_name -i old_name -e new_name

srvctl move instance

Use the srvctl move instance command to move a Real Application Clusters instance from one node to another in the static configuration. For example, the following syntax moves the Real Application Clusters instance to the node identified by the node name that you provide:

srvctl move instance -p db_name -i instance_name -n new_node

srvctl set env

Use the srvctl set env command to set the environment that Oracle uses when you start instances in a Real Application Clusters database that you name. For example, the following syntax sets the environment for an entire Real Application Clusters database:

srvctl set env -p db_name -t name=value 

You can also set the environment for specific instances. For example, the following syntax sets the environment variable for the Real Application Clusters database instance that you name:

srvctl set env -p db_name -t name=value -i instance_name

An example of this command is:

srvctl set env -p proddb -t LANG=en

srvctl unset env

Use the srvctl unset env command to unset the environment that Oracle uses when you start instances in the Real Application Clusters database that you name. For example, the following syntax unsets the environment variable for an entire Real Application Clusters database:

srvctl unset env -p db_name -t environment_variable 

An example of this command is:

srvctl unset env -p proddb -t LANG

You can also unset the environment for specific instances. For example, the following syntax unsets the environment variable for the Real Application Clusters database instance that you name:

srvctl unset env -p db_name -t environment_variable -i instance_name

An example of this command is:

srvctl unset env -p proddb -t LANG -i proddb1

Importing and Exporting Raw Device Configuration with SRVCONFIG

Use SRVCONFIG to import and export raw device configuration information. For example, the following syntax exports the contents of the configuration information to the text file that you name:

srvconfig -exp file name

While the following example imports configuration information from the text file you name to the configuration repository for the Real Application Clusters environment in which you execute the command:

srvconfig -imp file name

Migrating Oracle8i Configurations to Oracle9i

If you are upgrading from Oracle8i to Oracle9i, migrate your configuration information using the following post-installation procedure. Do this for each Real Application Clusters database:

  1. Stop all Global Services Daemons (GSD).

  2. Execute the following command from the node in a UNIX cluster where the
    db_name.conf file is located:

    srvconfig -conv $Oracle_Home/ops/db_name.conf
    
    

Global Services Daemon (GSD)

Clients of the Global Services Daemon (GSD), such as SRVCTL, the DBCA, and Oracle Enterprise Manager, interact with the GSD to perform various manageability operations on the nodes in your cluster. You must start the GSD on all the nodes in your Real Applications Clusters database so that the manageability features and tools operate properly.

For example, if you start an instance using Oracle Enterprise Manager, the Intelligent Agent launches a script that contains SRVCTL commands. The GSD executes these commands which correspond to the requested operation.


Note:

Only run one GSD service on each node regardless of how many Real Application Clusters database installations you have.  


UNIX GSD Implementations

The name of the Global Services Daemon on UNIX platforms is gsd. The GSD is located in the $ORACLE_HOME/bin directory. The GSD records information such as connection requests from SRVCTL and stores these records the gsdaemon.log file in the $ORACLE_HOME/srvm/log directory.

Windows GSD Implementations

The name of the GSD service on Windows NT and Windows 2000 platforms is OracleGSD. The GSD service is located in the %ORACLE_HOME%\bin directory. The GSD service records information such as connection requests from SRVCTL and stores these records in the gsdservice.log file in the %ORACLE_HOME%\srvm\log directory.

Administering the GSD on Windows Platforms

You can use gsdservice commands to install the GSD service in the Windows Services panel. You can also use this command to start and stop the GSD service. The options for gsdservice are:

Administering Real Application Clusters Databases Using SQL and SQL*Plus

Although Oracle Corporation recommends that you use SRVCTL to administer your Real Application Clusters database environment, you can also use SQL and SQL*Plus. Prior to performing the tasks with SQL and SQL*Plus as described in this section, ensure your Cluster Manager (CM) component is started on each node.

The SQL and SQL*Plus procedures you use to start your cluster database depends on your platform as explained under the following sub-headings:

Starting Databases in Cluster Mode on UNIX

To start a Real Application Clusters database in cluster mode:

  1. Ensure your Cluster Manager software is running. Instructions on Cluster Manager software administration appear in your operating-system specific documentation. If the Cluster Manager is not available or if Oracle cannot communicate with this component, Oracle displays the error ORA-29701: "Unable to connect to Cluster Manager".

  2. Start any required operating system specific processes. For more information about these processes, see your operating system-specific documentation.

  3. If the listener is not started, start it on each of the nodes. Enter:

    LSNRCTL
    LSNRCTL> start [listener_name]
    
    

    Where listener_name is the name of the listener defined in the listener.ora file. It is not necessary to identify the listener if you are using the default listener named LISTENER.

    LSNRCTL displays a status message indicating that the listener started successfully. You can check that all expected services for that listener are listed in the services summary in the status message. You can also check the status of the listener with the LSNRCTL STATUS command.

  4. Start the database on one of the nodes by starting SQL*Plus. Then enter:

    CONNECT SYS/password as SYSDBA
    
        STARTUP PFILE=init$ORACLE_sid.ora
    
    

    The first instance to start in cluster mode determines the values of any global parameters for the other instances. When another instance attempts to start in cluster mode, the Real Application Clusters database compares the values of any global parameters in its parameter file with those already in use and issues messages if any values are incompatible. An instance cannot mount the database unless it has the correct values for its global parameters.

  5. On the remaining nodes, start the database:

    CONNECT SYS/password as SYSDBA
    
        STARTUP PFILE=$ORACLE_sid.ora; 
    

Starting Databases in Cluster Mode on Windows NT and Windows 2000

To start the Real Application Clusters database in cluster mode on Windows platforms:

  1. Start OracleServicesid instance on each node.

    • From the MS-DOS command line enter:

      C:\> net start OracleServicesid
      
      
    • From the Control Panel's Services window, select OracleServicesid, then click Start.

  2. If the listener is not started, start it on each of the nodes. Enter:

    LSNRCTL
    LSNRCTL> start [listener_name]
    
    

    Where listener_name is the name of the listener defined in the listener.ora file. You do not have to identify the listener if you are using the default listener named LISTENER.

    LSNRCTL displays a status message indicating that the listener started successfully. You can check that all expected services for that listener appear in the services summary in the status message. You can also check the status of the listener with the LSNRCTL STATUS command.

  3. Start the database on one of the nodes by starting SQL*Plus. Then enter:

    CONNECT SYS\password
    
        STARTUP PFILE=%ORACLE_HOME%\database\initsid.ora; 
    
    

    The first instance to start in cluster mode determines the values of any global parameters for the other instances. When another instance attempts to start in cluster mode, the Real Application Clusters database compares the values of any global parameters in its parameter file with those already in use and issues messages if any values are incompatible. The instance cannot mount the database unless it has the correct values for its global parameters.

  4. On the remaining nodes, start the database:

    CONNECT SYS\password
    
        STARTUP PFILE=%ORACLE_HOME%\database\initsid.ora; 
    

Using RETRY to Mount a Database in Cluster Mode

If you attempt to start an instance and mount a database in cluster mode while another instance is recovering the same database, your current instance cannot mount the database until the recovery is complete. Rather than repeatedly attempting to start the instance, use the STARTUP RETRY statement. This causes the new instance to retry mounting the database every five seconds until it succeeds or has reached the retry limit. Use the syntax:

STARTUP OPEN database_name RETRY

To set the maximum number of times the instance attempts to mount the database, use the SQL*Plus SET command with the RETRY option. You can specify either an integer such as 10, or the keyword INFINITE.

If the database can only be opened by being recovered by another instance, then using the RETRY does not repeat connection attempts. For example, if the database was mounted in exclusive mode by one instance, then trying the STARTUP RETRY command in cluster mode does not work for another instance.


Note:

Because an instance startup does not affect the data files, you can start an instance without mounting the data files.  


Setting and Connecting to Instances

Before setting instances and connecting to them, you must install and configure Oracle Net for the Real Application Clusters nodes and any clients that access these nodes. This establishes remote connections from the clients to the nodes.

See Also:

 

SQL*Plus commands operate on the current instance with some exceptions as noted under the next heading, "The SET INSTANCE and SHOW INSTANCE Commands".

The current instance can be either the local default instance on which you initiated your SQL*Plus session, or it can be a remote instance. Because the SQL*Plus prompt does not show which instance is the current instance, be sure you direct your commands to the correct instance.

Starting a SQL*Plus session and connecting to the database without specifying an instance directs all SQL*Plus commands to the local instance. In this case, the default instance is also the current instance.

To switch the current instance from the local instance to a remote instance, do one of the following:

Issue another CONNECT command with only your user ID and password. Specifying a remote instance with the CONNECT command while connected to the database by way of an instance enables you to switch from one instance to another without disconnecting.

See Also:

  • The Oracle9i Net Services Administrator's Guide for information on configuring net service names

  • Your operating system-specific Oracle documentation for more information about the exact format required for the connect string used in the SET INSTANCE and CONNECT commands

 

The SET INSTANCE and SHOW INSTANCE Commands

When using SET INSTANCE to specify an instance on a remote node for the STARTUP command, the parameter file for the remote instance must be accessible by the local node.

The SHOW INSTANCE command displays the net service name for the current instance. SHOW INSTANCE returns the value local if you have not used SET INSTANCE during the SQL*Plus session.

To reset to the default instance, use SET INSTANCE without specifying a net service name or specify local. Do not follow the SET INSTANCE command with the word default; this syntax specifies a connect string for an instance named default.

The CONNECT Command

Connecting as SYSOPER or SYSDBA enables you to perform privileged operations, such as instance startup and shutdown. Multiple SQL*Plus sessions can connect to the same instance at the same time. SQL*Plus automatically disconnects you from the first instance whenever you connect to another one.

See Also:

 

Verifying That Instances are Running

To verify that instances are running:

  1. On any node, enter:

    CONNECT SYS/password
    SELECT * FROM V$ACTIVE_INSTANCES;
    
    

    Oracle returns output similar to the following:

    INST_NUMBER INST_NAME          
    -----------  ----------------- 
               1 db1-sun:db1  
               2 db2-sun:db2  
               3 db3-sun:db3  
    
    

Where the output columns from this SELECT statement are as described in Table 4-1:

Table 4-1 Descriptions of V$ACTIVE_INSTANCES Columns
Column  Description 

INSTANCE_NUMBER 

Identifies the instance number. 

INST_NAME 

Identifies the host name and instance name. 

Shutting Down Real Application Clusters Instances

Shutting down Real Application Clusters instances is procedurally identical to shutting down instances in single instance environments with these exceptions:

Quiescing A Real Application Clusters Database

Quiescing a Real Application Clusters database is procedurally identical to quiescing a single-instance database except as described in this section. For example, you cannot open the database on one instance if the database is being quiesced. In other words, if you issued the ALTER SYSTEM QUIESCE RESTRICTED statement but Oracle has not finished processing it, you cannot open the database. Nor can you open the database if it is already in a quiesced state. In addition, the ALTER SYSTEM QUIESCE RESTRICTED and ALTER SYSTEM UNQUIESCE statements affect all instances in a Real Application Clusters environment, not just the instance that issues the command.

See Also:

The Oracle9i Database Administrator's Guide for details on the quiesce database feature and the Oracle9i SQL Reference for more information about the ALTER SYSTEM QUIESCE RESTRICTED syntax  

How SQL and SQL*Plus Commands Affect Instances

Most SQL statements apply to the current instance. For example, the statement ALTER SYSTEM SET CHECKPOINT LOCAL only applies to the instance to which you are currently connected, rather than the default instance or all instances.

ALTER SYSTEM CHECKPOINT LOCAL also applies to the current instance. By contrast, ALTER SYSTEM CHECKPOINT or ALTER SYSTEM CHECKPOINT GLOBAL applies to all instances.

ALTER SYSTEM SWITCH LOGFILE applies only to the current instance. To force a global log switch, use the ALTER SYSTEM ARCHIVE LOG CURRENT statement. The THREAD option of ALTER SYSTEM ARCHIVE LOG enables you to archive online redo log files for a specific instance.

Table 4-2 describes how common SQL*Plus commands affect instances.

Table 4-2 How SQL*Plus Commands Apply to Instances
SQL*Plus Command  Associated Instance 

ARCHIVE LOG 

Always applies to the current instance. 

CONNECT 

Applies the default instance if no instance is specified in the CONNECT command. 

HOST 

Applies to the node running the SQL*Plus session, regardless of the location of the current and default instances. 

RECOVER 

Does not apply to any particular instance, but rather to the database. 

SHOW INSTANCE 

Displays information about the current instance, which can be different from the default local instance if you have redirected your commands to a remote instance.  

SHOW PARAMETER and SHOW SGA 

Display parameter and SGA information from the current instance. 

STARTUP and SHUTDOWN 

Always apply to the current instance. These are privileged SQL*Plus commands.  


Note:

The security mechanism that Oracle uses when you execute privileged SQL*Plus commands depends on your operating system. Most operating systems have a secure authentication mechanism when logging onto the operating system. On these systems, your default operating system privileges usually determine whether you can use STARTUP and SHUTDOWN. For more information, refer to your operating system-specific documentation.  



Go to previous page Go to next page
Oracle
Copyright © 1996-2001, Oracle Corporation.

All Rights Reserved.
Go To Documentation Library
Home
Go To Product List
Book List
Go To Table Of Contents
Contents
Go To Index
Index

Master Index

Feedback