Oracle Real Application Clusters
| < Day Day Up > |
|
Database creation can be done in one of two ways, either by using the GUI-based interface provided with the product, as stated in the previous section, or using a script file, which contains all the steps required to create a database. In the case of a RAC database, creation of the database is different from the regular stand-alone configuration because in the case of RAC, we have one database and two or more instances.
An advantage of using the GUI interface over script file method is that there are fewer steps to be remembered. This is because using the configuration assistant the steps are already predefined, and based on the selected template the type of database is automatically created, sized, and configured. However, the script file approach has an advantage over the GUI interface approach in the sense that the creator is able to see what is happening during the creation process and can physically monitor the process. Another advantage of this option is that the script can be done based on the needs of the enterprise.
8.4.1 Database Configuration Assistant
The Oracle Database Configuration Assistant (DBCA) helps in the creation of the database. It follows the standard naming and placement convention as defined in the OFA standards. DBCA provides three primary processing phases:
-
Verification of the shared disk configuration
-
Creation of the database
-
Configuration of the Oracle network services
To create the database, the following steps have to be completed via the DBCA:
-
As mentioned earlier in Figure 8.8, the DBCA could be launched automatically as part of the installation process or manually by directly executing the dbca command from the $ORACLE_HOME/ bin directory in the case of a Unix platform. On a Windows platform, from the start menu select Programs, Oracle, and then configuration and migration tools. From this option, the DBCA option can be selected. Figure 8.10 is the DBCA selection screen; from this screen, the type of database to be installed is selected. The screen provides two choices, Oracle clustered database or single instance Oracle database. Select the Oracle cluster database option and click ''next.''
Figure 8.10: Database Configuration Assistant data base selection screen. -
The next screen is the operations window (Figure 8.11), which provides the options to either create a new database or to manage database creation templates provided by Oracle. From this screen, select ''create a database option'' and click ''next.''
Figure 8.11: Database Configuration Assistant opera tion selection. Oracle 9i New Feature: With Version 9i, Oracle has introduced templates that could be used to create databases. For example, there is a template for setting up a database that is more suited for an OLTP type of environment.
-
The next screen is the node selection window. The appropriate node where RAC needs to be configured is selected. After making the appropriate selection, click ''next.''
-
Following the node selection screen is the template selection screen. Figure 8.12 shows the Oracle templates that can be selected according to the functionality that the database will support. Oracle provides various predefined templates as part of the database configuration assistant that make it easy for the user to create predefined standard configurations depending on the type of application that the database will be used for.
Figure 8.12: Selecting the template. -
Based on the template selected, the template with the predefined configuration is displayed for validation. At this point the user could either cancel certain selections that he or she feels are not required or select the ''back'' option to make a different choice.
-
The next screen is the database identification window. In the screen the global database name and Oracle system identifier prefix (SID) are entered in the appropriate fields. The global data base name is typically of the form name.domain, for example, proddb.summerskyus.com, and the SID is used to uniquely identify the instance. In the case of RAC the specified SID is used as a prefix to the instance number. For example, PRODDB would become PRODDB1 and PRODDB2 for instance 1 and instance 2, respectively. These values could also be overridden, for example with RAC1 and RAC2, respectively.
The next few screens take the user through the process of creating the database and configuring the additional features such as Java Virtual Machine (JVM) and intermedia.
-
The next window (Figure 8.13) is the client connection selection screen, which displays the option to select the type of connection that is intended. This allows the installation and configuration of either of the two connection options (shared server or dedicated server). If the database were to run from multiple clustered nodes, then the shared server mode would be ideal. However if only one node is available, dedicated server would be the choice. After selecting the connection mode click ''next.''
Figure 8.13: Client connec tion selection. -
The next few screens displayed by the DBCA are for configuration of the initialization parameters such as the shared pool, buffer pool, file locations for the system parameter file, the user trace, system trace files, etc.
-
After selecting the appropriate values for the initialization parameters, click ''next'' on the last parameter screen. A summary screen containing the initialization parameters will be displayed and after the initial review of the parameters, click ''next.''
-
DBCA now displays the database storage window. This window allows entering a filename for each type of file, for example the storage definition for the control file, for the various tablespaces, rollback segments, etc. Once all the storage for the various files has been defined, click ''next.''
-
The next screen shows the database creation options. Ensure that the ''create database'' check box is selected and click ''finish.''
-
Figure 8.14 is the final screen where the actual ''create database'' option is selected. On selection of the ''finish'' option, the DBCA begins creating the database according to the values specified. Once the process has finished, a new database is created which can be accessed using SQL*Plus or other applications designed to work with a RAC database.
Figure 8.14: Database creation screen.
8.4.2 Manual database configuration
In the previous section we looked at how, using the DBCA, the RAC database and the required instances could be created from a GUI interface. Another method, which is a more traditional way of creating databases and the corresponding instances is through the script file method with certain manual steps. Apart from executing a script file that contains the definitions required for creating the instance and the database, there are other steps that would require manual intervention and control. When installing and configuring the database manually the following would be the sequence of steps and tasks:
-
Determine sizes of the initial tablespaces. Table 8.3 provides the recommended sizes for the various tablespaces.
-
Create crdbRAC1.sql script and initPRODDB.ora files to install the new RAC instance.
Note CrdbRAC1.sql, CrdbRAC2.sql, and initPRODDB.ora source files have been provided in Appendix 2.
-
Create a RAC1 instance and PRODDB database.
-
Create all directories based on OFA standards for the new instance.
-
Create a crdbRAC1.sql script to create the subdirectory and initPRODDB.ora file to the $ORACLE_BASE/admin/RAC1/ pfile directory.
-
Ensure that the following parameters in initPRODDB.ora have the following values:
RAC1.instance_number = 1 RAC1.thread = 1 RAC1.instance_name = RAC1 RAC1.service_names = RAC1. SUMMERSKYUS.COM RAC1.undo_tablespace = UNDO_RAC1
Table 8.3: Recommended Sizes for the Initial Tablespaces Tablespace
Size (MB)
SYSTEM
1000
UNDO_RAC1
5000
UNDO_RAC2
5000
TEMP
2000
TOOLS
2000
USERS
1000
INDX
200
DRSYS
200
CONTROL FILE 1
300
CONTROL FILE 2
300
CONTROL FILE 3
300
Server parameter file
5
EXAMPLE
160
CWMLITE
100
XML
50
ODM
250
INDX
70
Srvcfg for the SRVM configuration repository
100
-
Ensure that the following parameters for the RAC2 instance have the following values:
RAC2.instance_number = 2 RAC2.instance_name = RAC2 RAC2.thread = 2 RAC2.service_names = RAC2.SUMMERSKYUS.COM RAC2.undo_tablespace = UNDO_RAC2
-
Set ORACLE_SID to the new SID, and ORACLE_HOME.
-
Create the password file for remote admin:
orapwd file =$ORACLE_HOME/dbs/orapwRAC1 entries =32 password =oracle orapwd file =$ORACLE_HOME/dbs/orapwRAC2 entries =32 password =oracle
-
Invoke SQL*Plus, and execute crdbRAC1.sql after logging in
as oracle on ORA-DB1. oracle$ sqlplus /nolog SQL>@crdbRAC1.sql
-
Convert the pfile into an spfile (binary) and move it to a shared raw device partition:
oracle$ sqlplus /nolog SQL> CREATE SPFILE ='/dev/vx/rdsk/oraracdg/ partition200m_1' from pfile;
-
Create a symbolic link for this new shared spfile:
ln --s /dev/vx/rdsk/oraracdg/paritition200m_1 $ORACLE_HOME/dbs/ spfilePRODDB.ora
-
Invoke SQL*Plus and start the instance:
SQL> startup ORACLE instance started. Total System Global Area 450937896 bytes Fixed Size 730152 bytes Variable Size 285212672 bytes Database Buffers 163840000 bytes Redo Buffers 1155072 bytes Database mounted. Database opened. SQL>
-
Verify the parameter definitions:
SQL>select sid, name, value from v$spparameter;
-
Check spool file for errors and resolve.
-
-
Create RAC2 instance:
-
Invoke SQL_Plus; and execute crdbRAC2.sql after logging in as oracle on ORA-DB1:
oracle$ sqlplus /nolog SQL>@crdbRAC2.sql
-
Issue the following command to enable the second thread on ORA-DB1:
SQL>ALTER DATABASE ENABLE THREAD 2;
-
Shut down the instance:
oracle$ sqlplus /nolog SQL>shutdown immediate
-
Create a symbolic link from $ORACLE_HOME/dbs to $ORACLE_BASE/admin/PRODDB/pfile for the initPRODDB.ora file:
ln -s $ORACLE_BASE/admin/PRODDB/pfile/initPRODDB.ora $ORACLE_HOME/ dbs/initRAC1.ora
-
Create a symbolic link from $ORACLE_HOME/dbs to $ORACLE_BASE/admin/PRODDB/pfile for the initPRODDB.ora file:
ln -s $ORACLE_BASE/admin/PRODDB/pfile/initPRODDB.ora $ORACLE_HOME/ dbs/initRA2.ora
-
From ORA-DB2 connect to RAC1 via SQL*Plus and restart RAC1:
oracle$sqlplus /nolog SQL>connect as sys@RAC1 /as sysdba SQL>shutdown immediate SQL> startup ORACLE instance started. Total System Global Area 450937896 bytes Fixed Size 730152 bytes Variable Size 285212672 bytes Database Buffers 163840000 bytes Redo Buffers 1155072 bytes Database mounted. Database opened. SQL>
-
By default, the ORA-DB1/RAC1 instance threads are created with mode PUBLIC. To change the mode to PRIVATE (disabling and enabling the threads will change them to PRIVATE):
oracle$ sqlplus /nolog SQL> SQL>ALTER DATABASE DISABLE THREAD 1; SQL>ALTER DATABASE ENABLE THREAD 1;
-
From ORA-DB1 connect to RAC1 via SQL*Plus and restart the instance:
oracle$ sqlplus /nolog SQL>connect as sys@RAC1 /as sysdba SQL>shutdown immediate SQL> startup ORACLE instance started. Total System Global Area 450937896 bytes Fixed Size 730152 bytes Variable Size 285212672 bytes Database Buffers 163840000 bytes Redo Buffers 1155072 bytes Database mounted. Database opened. SQL>
-
-
Full export of the database.
-
Invoke SQL_Plus and connect as SYS/<password> as sysdba.
-
Create user FULLEXPORT identified by <password> default tablespaces users temporary tablespace temp:
exp userid =fullexport/<password> file =fullexportRAC.dmp log =fullexportRAC.log
-
-
Bounce both the instances, RAC1 and RAC2.
-
Instance RAC1:
oracle$sqlplus /nolog SQL>connect as sys@RAC1 /as sysdba SQL>shutdown immediate SQL> startup ORACLE instance started. Total System Global Area 450937896 bytes Fixed Size 730152 bytes Variable Size 285212672 bytes Database Buffers 163840000 bytes Redo Buffers 1155072 bytes Database mounted. Database opened. SQL>
-
Instance RAC2:
oracle$ sqlplus SQL*Plus: Release 9.2.0.1.0 - Production on Wed Oct 9 18:07:16 2002 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved. SQL>connect as sys@RAC2 /as sysdba SQL>shutdown immediate SQL> startup ORACLE instance started. Total System Global Area 450937896 bytes Fixed Size 730152 bytes Variable Size 285212672 bytes Database Buffers 163840000 bytes Redo Buffers 1155072 bytes Database mounted. Database opened. SQL>
-
-
Database verification.
-
RAC1 and RAC2 instances:
oracle$sqlplus /nolog SQL>connect as sys@RAC1 /as sysdba SQL>select * from v$active_instances; oracle$sqlplus /nolog SQL>connect as sys@RAC2 /as sysdba SQL>select * from v$active_instances;
-
Verify if the database files have been created:
oracle$sqlplus /nolog SQL>connect as sys@RAC1 /as sysdba SQL>select file_id, status, file_name from dba_data_files;
-
Verify tablespaces:
oracle$sqlplus /nolog SQL>connect as sys@RAC1 /as sysdba SQL>select tablespace_name, status, contents from dba_tablespaces;
-
This completes the creation of the basic database. As part of the database configuration the next step is selecting the appropriate database options to ensure that it has been created based on requirements.
| < Day Day Up > |
|