8.4 Database creation

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

  1. 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.''

    click to expand
    Figure 8.10: Database Configuration Assistant data base selection screen.

  2. 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.''

    click to expand
    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.

  3. 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.''

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

    click to expand
    Figure 8.12: Selecting the template.

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

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

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

    click to expand
    Figure 8.13: Client connec tion selection.

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

  9. 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.''

  10. 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.''

  11. The next screen shows the database creation options. Ensure that the ''create database'' check box is selected and click ''finish.''

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

    click to expand
    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:

  1. Determine sizes of the initial tablespaces. Table 8.3 provides the recommended sizes for the various tablespaces.

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

  3. Create a RAC1 instance and PRODDB database.

    1. Create all directories based on OFA standards for the new instance.

    2. Create a crdbRAC1.sql script to create the subdirectory and initPRODDB.ora file to the $ORACLE_BASE/admin/RAC1/ pfile directory.

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

    4. 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
    5. Set ORACLE_SID to the new SID, and ORACLE_HOME.

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

    7. Invoke SQL*Plus, and execute crdbRAC1.sql after logging in

      as oracle on ORA-DB1. oracle$ sqlplus /nolog SQL>@crdbRAC1.sql
    8. 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;

    9. Create a symbolic link for this new shared spfile:

      ln --s /dev/vx/rdsk/oraracdg/paritition200m_1  $ORACLE_HOME/dbs/ spfilePRODDB.ora

    10. 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>
    11. Verify the parameter definitions:

      SQL>select sid, name, value from v$spparameter;
    12. Check spool file for errors and resolve.

  4. Create RAC2 instance:

    1. Invoke SQL_Plus; and execute crdbRAC2.sql after logging in as oracle on ORA-DB1:

      oracle$ sqlplus /nolog SQL>@crdbRAC2.sql
    2. Issue the following command to enable the second thread on ORA-DB1:

      SQL>ALTER DATABASE ENABLE THREAD 2;
    3. Shut down the instance:

      oracle$ sqlplus /nolog SQL>shutdown immediate 
    4. 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

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

    6. 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>
    7. 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;
    8. 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> 
  5. Full export of the database.

    1. Invoke SQL_Plus and connect as SYS/<password> as sysdba.

    2. Create user FULLEXPORT identified by <password> default tablespaces users temporary tablespace temp:

      exp userid =fullexport/<password> file =fullexportRAC.dmp  log =fullexportRAC.log
  6. Bounce both the instances, RAC1 and RAC2.

    1. 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>
    2. 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> 
  7. Database verification.

    1. 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;

    2. 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;
    3. 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 > 



Oracle Real Application Clusters
Oracle Real Application Clusters
ISBN: 1555582885
EAN: 2147483647
Year: 2004
Pages: 174

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