Skip Headers

Oracle9i Real Application Clusters Setup and Configuration
Release 2 (9.2)

Part Number A96600-01
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

5
Manually Creating Real Application Clusters Databases

This chapter discusses considerations and procedures for manually creating Real Application Clusters databases. The topics in this chapter are:

Setting CREATE DATABASE Options for Cluster-Enabled Environments

This section describes the following CREATE DATABASE options specific to Real Application Clusters.

Use this information when writing database creation scripts. A sample database creation script for Real Application Clusters databases appears in the script clustdb.sql that resides in the $ORACLE_HOME/srvm/admin directory on UNIX or in the %ORACLE_HOME%\srvm\admin directory on Windows NT and Windows 2000 platforms.

Setting MAXINSTANCES

The MAXINSTANCES option of CREATE DATABASE limits the number of instances that can access a database concurrently. MAXINSTANCES defaults to the maximum value specific to your operating system.

For Real Application Clusters, set MAXINSTANCES to a value greater than the maximum number of instances you expect to run concurrently. For example, assume you have three instances, A, B, and C. If instance A fails and instance B recovers it, you can start instance C before instance A is fully recovered. In this case, set MAXINSTANCES to 4 or more.

Setting MAXLOGFILES and MAXLOGMEMBERS

The MAXLOGFILES option of CREATE DATABASE specifies the maximum number of redo log groups that can be created for the database. The MAXLOGMEMBERS option specifies the maximum number of members or copies for each group. Set MAXLOGFILES to the maximum number of threads possible, multiplied by the maximum anticipated number of groups for each thread.

Setting MAXLOGHISTORY

The MAXLOGHISTORY clause of the CREATE DATABASE statement specifies the maximum number of archived redo log files that can be recorded in the log history of the control file. The log history is used for automatic media recovery of Real Application Clusters databases.

For Real Application Clusters, set MAXLOGHISTORY to a large value, such as 1000. The control files can then only store information about this number of redo log files. When the log history exceeds this limit, Oracle overwrites the oldest entries. The default for MAXLOGHISTORY is 0 (zero), which disables log history.

This parameter is useful only if you are using Oracle in ARCHIVELOG mode with Real Application Clusters. Specify the maximum number of archived redo log files for automatic media recovery. Oracle uses this value to determine how much space in the control file to allocate for the names of archived redo log files. The minimum value is 0. The default value is a multiple of the MAXINSTANCES value and depends on your operating system. The maximum value is limited only by the maximum size of the control file.

Setting MAXDATAFILES

The MAXDATAFILES option is generic, but Real Application Clusters databases tend to have more datafiles and log files than single-instance Oracle databases.

See Also:

Setting ARCHIVELOG Mode

Create your database using the default of NOARCHIVE log mode. This reduces system overhead while you create your database. You can later implement archive logging using the ALTER DATABASE statement with the ARCHIVELOG option. Refer to "Setting the Log Mode" for information on setting the log mode.

Note:

You cannot use the STARTUP command to change the database archiving mode.

See Also:

Oracle9i Database Administrator's Guide for more information about archive logging

Changing Values for CREATE DATABASE Options

You can use the CREATE CONTROLFILE statement to change the value of the following database parameters for a database:

Database Objects to Support Clusters

To prepare a new database for Real Application Clusters, create and configure the additional database objects as described under the following headings:

Creating Additional Undo Tablespaces

Oracle strongly recommends that you use automatic undo management. This feature automatically manages undo space. To use automatic undo management, use the CREATE DATABASE statement with the UNDO TABLESPACE clause to create an undo tablespace. You can also use the CREATE UNDO TABLESPACE statement to create additional undo tablespaces for additional instances.

When you use the CREATE DATABASE statement and you have enabled automatic undo management, if you do not specify the UNDO TABLESPACE clause, Oracle creates an undo tablespace by default. The name and size of the default file varies depending on your operating system. However, if you are using raw devices, this automatically created file will be on your file system where it cannot be shared. In this case, you must specify a name for the undo tablespace.

If you create your database in manual undo management mode, you must first create and bring online one additional rollback segment in the SYSTEM tablespace before creating rollback segments in other tablespaces. The instance that creates the database can create this additional rollback segment and new tablespaces, but it cannot create database objects in non-SYSTEM tablespaces until you bring the additional rollback segment online.

Then you must create at least two rollback segments for each instance of Real Application Clusters. To avoid performance issues, create these rollback segments in a tablespace other than the SYSTEM tablespace, for example, the RBS tablespace.


Note:

Do not store these rollback segments in the SYSTEM tablespace.


See Also:

Oracle9i Real Application Clusters Administration for more information about automatic undo management

Manually Creating Rollback Segments

If you cannot use automatic undo management, then you can manually create rollback segments. Real Application Clusters databases need at least as many rollback segments as the maximum number of concurrent instances plus one; the extra rollback segment is for the SYSTEM rollback segment. An instance cannot start up shared without exclusive access to at least one rollback segment, whether it is public or private.

You can create new rollback segments in any tablespace except for the temporary tablespace. To reduce performance issues between rollback data and table data, partition your rollback segments in a separate tablespace. This facilitates taking tablespaces offline because a tablespace cannot be taken offline if it contains active rollback segments.

In general, make each rollback segment extent the same size by specifying identical values for the storage parameters INITIAL and NEXT. To ensure you have correctly created the rollback segments, examine the data dictionary view DBA_ROLLBACK_SEGS. This view shows each rollback segment's name, segment ID number, and owner (PUBLIC or other).

See Also:

The Oracle9i Database Administrator's Guide for information about rollback segment performance and for information on the implications of adding rollback segments

Using Private Rollback Segments

If you use manual undo management and manually manage rollback segments, Oracle Corporation recommends that you make the rollback segments private. This enables you to closely control which instances use which rollback segments. To do this follow these steps:

  1. Create a rollback segment with the SQL statement using the syntax:
    CREATE ROLLBACK SEGMENT ... TABLESPACE tablespace_name;
    
    
    
  2. Use the ROLLBACK_SEGMENTS parameter to specify the rollback segment in the initialization parameter file by naming it as a value for the parameter. For example, SID.ROLLBACK_SEGMENTS=[RBS1, RBS2]. This reserves these two rollback segments for that instance.
  3. Use ALTER ROLLBACK SEGMENT to bring the rollback segment online. You can also restart the instance to use the reserved rollback segment.

You should specify a particular private rollback segment in either the server parameter file with the appropriate instance identifier, or in only one instance-specific initialization parameter file so that the segment is associated with only one instance. If an instance attempts to acquire a public rollback segment that another instance has already acquired, then Oracle generates an error message and prevents the instance from starting up. Private rollback segments stay offline until brought online or until the owning instance restarts and acquires it.

Using Public Rollback Segments

Any instance can create public rollback segments. Once created, public rollback segments are available for any instance. When an instance uses a rollback segment, the instance uses the rollback segment exclusively until the instance shuts down. When the instance shuts down, the instance releases the rollback segment for use by other instances.

Use the SQL statement CREATE PUBLIC ROLLBACK SEGMENT to create public rollback segments. Public rollback segments are owned as PUBLIC in the data dictionary view DBA_ROLLBACK_SEGS. If you do not assign a rollback segment to an instance by setting a value for the ROLLBACK_SEGMENTS parameter, the instance uses public rollback segments. The procedures you use to create and manage rollback segments are the same regardless of whether you have enabled or disabled Real Application Clusters.

Typically, the parameter file does not specify public rollback segments because they are by default available to any instance needing them. However, if another instance is not already using a particular public rollback segment, you can assign the rollback segment to the instance by declaring a value in the ROLLBACK_SEGMENTS parameter for that instance.

An instance brings a public rollback segment online when the instance acquires the rollback segment at startup. However, starting an instance that uses public rollback segments does not ensure that the instance uses a particular public rollback segment. The exception to this is when the instance acquires all available public rollback segments.

If you need to keep a public rollback segment offline and do not want to drop it and re-create it, you must prevent other instances that require public rollback segments from starting up.

See Also:

Oracle9i Database Administrator's Guide for more information about rollback segments

Configuring the Online Redo Log for Real Application Clusters

When running Real Application Clusters, two or more instances concurrently access a single database and each instance must have its own thread of redo. This section explains how to configure these online redo threads for clusters.

Each database instance has its own thread of online redo, consisting of its own online redo log groups. Oracle Corporation recommends that you create at least two members for each redo log group to prevent data loss. Create each thread with at least two redo log groups and enable each thread so the instance can use it.

For improved performance and to minimize the overhead of software mirroring, or multiplexing, put the members of each redo log group on separate physical disks or on separate disk arrays. The CREATE DATABASE statement creates thread number 1 as a public thread and enables it automatically. Use the ALTER DATABASE statement to create and enable subsequent threads.

Creating Threads

Threads can be either public or private. The THREAD initialization parameter assigns a unique thread number to an instance. If you set THREAD to zero, which is the default, the instance acquires a public thread.

The CREATE DATABASE statement creates thread number 1 as a public thread and enables it automatically. Subsequent threads must be created and enabled with the ALTER DATABASE statement. For example, the following statements create and enable thread 2 with two groups of three members each.

   ALTER DATABASE ADD LOGFILE THREAD 2 
   GROUP 3 (disk1_file4, disk2_file4, disk3_file4) SIZE 100M REUSE, 
   GROUP 4 (disk1_file5, disk2_file5, disk3_file5) SIZE 100M REUSE; 
   ALTER DATABASE ENABLE PUBLIC THREAD 2; 

If you do not specify the THREAD parameter in your initialization file, you must specify the THREAD clause when creating new redo log groups. If you specify the THREAD parameter, you can omit the THREAD clause when creating new redo log groups and the newly created redo log groups will be assigned to the thread of the instance that you used to create them.

See Also:

Oracle9i Real Application Clusters Administration for more information about threads of redo

Disabling Threads

Disable a public or private thread with the ALTER DATABASE DISABLE THREAD statement. You cannot disable a thread if an instance using the thread has the database mounted. To change a thread from public to private, or vice versa, disable the thread and then enable it again. An instance cannot disable its own thread. The database must be open when you disable or enable a thread.

When you disable a thread with the database in ARCHIVELOG mode, Oracle marks its current redo log file as needing to be archived. If you want to drop that file, you might need to first archive it manually.

An error or failure while a thread is being enabled can result in a thread that has a current set of log files but is not enabled. You cannot drop or archive these log files. In this case, disable the thread, even though it is already disabled, then re-enable it.

Setting the Log Mode

You typically set the redo log mode, ARCHIVELOG or NOARCHIVELOG, when you create your database. You can later change the archive mode using the ALTER DATABASE statement. When archiving is enabled, online redo log files cannot be reused until they are archived.

The redo log mode is associated with the database rather than with individual instances. If the redo log is being used in ARCHIVELOG mode, for most purposes all instances should use the same archiving method, either automatic or manual.

To switch archiving modes:

  1. Set the CLUSTER_DATABASE parameter to false in the parameter file.
  2. Mount the database in exclusive mode.
  3. Set the LOG_ARCHIVE_START parameter to true.
  4. Set the LOG_ARCHIVE_FORMAT and LOG_ARCHIVE_DEST_n parameters as needed.
  5. Execute the ALTER DATABASE statement with either the ARCHIVELOG or the NOARCHIVELOG clause.
  6. Shutdown the database and then restart it with the CLUSTER_DATABASE parameter set to true.

Changing the Redo Log

You can change the configuration of the redo log, such as adding, dropping, or renaming a log file or log file member, while the database is mounted with Real Application Clusters either enabled or disabled. The only restriction is that you cannot drop or rename a log file or log file member currently in use by any thread. Moreover, you cannot drop a log file if that would reduce the number of log groups to less than two for the thread it is in.

Any instance can add or rename redo log files, or members, of any group for any other instance. As long as there are more than two groups for an instance, a redo log group can be dropped from that instance by any other instance. Changes to redo log files and log members take effect on the next log switch.

See Also:

Oracle9i Real Application Clusters Administration for more information about archiving redo log files

Creating a Database Manually

Create your database manually if you already have scripts, or if you have database requirements that differ greatly from the types of databases that the DBCA creates as described in Chapter 4. The two major steps you must perform to manually create a database are:

Install Oracle Products

Perform the following tasks before manually creating a Real Application Clusters database:

  1. Run the Oracle Universal Installer (OUI) as specified in your platform-specific documentation.
  2. At the Installation Types screen select Software Only and click Continue. Your installation should proceed automatically without installing a Real Application Clusters database.

Refer to the following section for procedures on manual database creation.

Manually Create the Database

Perform the following tasks to manually create a new database:

Task 1: Back Up Existing Databases

Task 2: Specify the Database and Instance Parameter Settings

Task 3: Create the Real Application Clusters Configuration with SRVCTL

Task 4: Configure the oratab File on UNIX

Task 5: Set ORACLE_SID for Each Node

Task 6: Create the Server Parameter File

Task 7: Create the Password Files

Task 8: Prepare a CREATE DATABASE Script for the Cluster Database

Task 9: Create the Database

Task 10: Back Up the Database

Task 11: Configure Oracle Net on All Nodes

Review all the steps in this chapter before performing them.

Task 1: Back Up Existing Databases

Oracle strongly recommends that you make complete backups of all existing databases before creating a new database in case database creation accidentally affects existing files. Backups should include parameter files, database files, redo log files, control files, and network configuration files.

See Also:

The Oracle9i User-Managed Backup and Recovery Guide

Task 2: Specify the Database and Instance Parameter Settings

In Real Application Clusters, each node typically has one instance. The instances collectively form a Real Application Clusters database. Being aware of database- and instance-level information enables you to more easily complete Tasks 2 through 12.


Note:

You can configure multiple instances on one node, but this may reduce scalability.


To determine database- and instance-level information:

  1. Determine the settings for your database for the items in the left-hand column of Table 5-1:
    Table 5-1  Component Settings for Manual Database Creation
    Component Description

    Database Name

    The name of your database.

    Database Domain

    The domain name of your database.

    Global Database Name

    A name that comprises the database name and database domain.

    SID Prefix

    A prefix for the Oracle system identifier (sid). The instance's thread number, or number of the redo thread assigned to the instance, is appended to the SID prefix to create the SID for the node's instance.

  2. Determine the settings for the items in Table 5-2. For example, Table 5-2 shows the settings for a database named db:
    Table 5-2   Database Name, Domain, Global Name, and SID Prefix Example Settings
    Database Name Database Domain Global Database Name SID Prefix

    db

    us.acme.com

    db.us.acme.com

    db

  3. Determine the settings for the items in the left-hand column of Table 5-3 for each node:
    Table 5-3   Component Settings for Node and Host Name and Thread ID
    Component Description

    Node name

    The node name defined by the Cluster Manager (CM) software

    Use the command lsnodes -l -n to obtain the computer's node name.

    lsnodes is located in the $ORACLE_HOME/bin directory on UNIX and %ORACLE_HOME%\bin directory on Windows NT and Windows 2000.

    Host name

    The host name of the computer. The host name may be the same name as the node name.

    On UNIX and Windows NT and Windows 2000, use the command hostname to obtain the host name for the computer.

    Thread ID

    Each instance requires a unique thread number. The thread ID is appended to the SID prefix to create the SID for the instance on the node. Threads are usually numbered sequentially beginning with 1.

  4. Determine the settings for the items in the column headers in Table 5-4, which for example, shows the nodes named node1 and node2:
    Table 5-4   Host and Node Name, Thread ID and SID
    Node Name Host Name Thread ID SID

    node1

    node1

    1

    db1

    node2

    node2

    2

    db2

Task 3: Create the Real Application Clusters Configuration with SRVCTL

If this is the first Oracle9i database created on this cluster database, then you must initialize the clusterwide SRVM configuration. Do this by executing the following command:

srvconfig -init

The first time you use the SRVCTL Utility to create the configuration, start the Global Services Daemon (GSD) on each node with the gsdctl start command so that SRVCTL can access your cluster's configuration information. Then execute the srvctl add command so that Real Application Clusters knows what instances belong to your cluster using the following syntax.

If you are using the server parameter file, then execute the following command:

srvctl add db -d db_name -m db_domain -o oracle_home -s spfile_name

If your database does not have a domain name, then do not specify the -m option. If you do not use the server parameter file, then do not specify the -s option. Then for each instance enter the command:

srvctl add instance -d db_name -i sid -n node

Task 4: Configure the oratab File on UNIX

To use Oracle Enterprise Manager, manually create an entry in the oratab file on each node. This entry identifies the database. Oracle Enterprise Manager uses the information in this file during service discovery to determine the database name and the ORACLE_HOME from which the database runs.

The oratab file is stored in /etc/oratab or /var/opt/oracle/oratab, depending on your operating system. The syntax for this entry is as follows where db_name is the database name given to your database, $ORACLE_HOME is the directory path to the database, and N indicates that the database should not be started at restart time:

db_name:$ORACLE_HOME:N

Use the database name and Oracle home you specified in "Task 2: Specify the Database and Instance Parameter Settings".

A sample entry follows for a database named db:

db:/private/oracle/db:N

Task 5: Set ORACLE_SID for Each Node

The SID must be defined for each node's instance in the cluster database, and the value you set for ORACLE_SID must be unique for each instance. To simplify administration, Oracle Corporation recommends that you use SIDs that consist of the database name as the common base and the number of the thread assigned to the instance that you specified in "Task 2: Specify the Database and Instance Parameter Settings". For example, if db is the database name, then the first instance in the cluster has a SID of db1 and the second instance has a SID of db2. The SID specification is operating system-specific as described under the following headings:

UNIX

On UNIX, set the ORACLE_SID environment variable.

See Also:

Oracle9i Administrator's Reference for your UNIX operating system for further information about setting this environment variable

Windows NT and Windows 2000

On Windows NT and Windows 2000, create an ORACLE_SID Registry key under the following Registry key. Then set the value of your instance SID in the ORACLE_SID registry key:

HKEY_LOCAL_MACHINE\SOFTWARE\ORACLE\[HOMEID]

See Also:

Oracle9i Database Getting Started for Windows for further information about this Registry value

After creating the SIDs, create an OracleServicesid service. You can use this service to start or stop an instance from the Control Panel. To create OracleServicesid:

  1. On each node, use the CRTSRV batch file to create a unique service corresponding to the instance of the node.
    C:\%ORACLE_HOME%\bin\ crtsrv.bat sid
    
    

    For example, to create a service for a SID of db1, OracleServicedb1, enter the following:

    C:\%ORACLE_HOME%\bin\ crtsrv.bat db1
    
    
  2. Verify OracleServicesid exists by entering:
    C:\net start
    
    

    Note:

    The Service must already have a status of Started to appear in the list that Oracle displays in response to this command.


Task 6: Create the Server Parameter File

When an Oracle instance starts, it refers to the parameter file for configuration information. Oracle Corporation recommends that you use a single server parameter file to designate both global and instance-specific settings. Using this type of parameter file greatly simplifies parameter administration.

Name the server parameter file initdbname.ora. To designate instance-specific settings in this file, use the SID prefix and place these entries after the generic, global entries. Specify instance-specific settings using the instance_name.parameter_name=value syntax.

You can also make parameter files for the database you are about to create by copying the initialization parameter file located in the $ORACLE_HOME/srvm/admin directory on UNIX or by using the file in the %ORACLE_HOME%\srvm\admin directory on Windows NT and Windows 2000. Rename this file and edit and customize it for your database.

Edit the following parameters in the new initdb_name.ora parameter file:

Edit the following instance-specific parameters in the file:

Examples of instance-specific settings in the server parameter file are:

db1.instance_name=db1
db1.instance_number=1
db2.instance_name=db2
db2.instance_number=2


Go to previous page Go to next page
Oracle
Copyright © 1998, 2002 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