首页 > Linux操作系统 > Linux操作系统 > 转贴:上周ORACLE RAC培训时的安装RAC的详细步骤(五)

转贴:上周ORACLE RAC培训时的安装RAC的详细步骤(五)

原创 Linux操作系统 作者:orchidllh 时间:2005-03-07 00:00:00 0 删除 编辑

  ****  ORACLE     INTERNAL   ****   ****  ORACLE     INTERNAL   ****
         Copyright (c) 2003-2004 Oracle. All rights reserved.

Create a sample database using DBCA  10g              Last Update: 29NOV04
(Database Configuration Assistant)          Comments:

VMWARE NOTES: o If running on RHEL3 vanilla or Update 1 make sure you
                set LD_ASSUME_KERNEL=2.4.19 in your environment otherwise
                java programs will seem to hang, as documented in bug 3464721
                bugzilla 121500 (workaround: control-Z/bg/fg, or above)
                RHEL3 Update 2 has no issues.

1. We will use netca (Network Configuration Assistant) to configure SQL*Net
   listeners.  The TAF (Transparent Application Failover) portion we'll do
   by hand, according to:

   a. Run netca to create two listeners (on one node) as oracle:

      $ export LD_ASSUME_KERNEL=2.4.19    (Only for RHEL3 vanilla or Update1)
      $ netca

     i. Screen: "Oracle Net Config..."
         Select: "Cluster configuration"
         Click "Next"

     ii. Screen: "TOPSNodes"
         In real life we would select all nodes, here just leave raclinux1
         Select: "raclinux1"
         Click "Next"

    iii. Screen: "Welcome"
         Select: "Listener configuration"
         Click "Next"

     iv. Screen: "Listener Configuration, Listener"
         Select: "Add"
         Click "Next"

      v. Screen: "Listener Configuration, Listener Name"
         Leave: "LISTENER"
         Click "Next"

     vi. Screen: "Listener Configuration, Select Protocols"
         Leave: "TCP"
         Click "Next"

    vii. Screen: "Listener Configuration, TCP/IP Protocol"
         Leave: "1521"
         Click "Next"

   viii. Screen: "Listener Configuration, More Listeners?"
         Select: "Yes"
         Click "Next"

     ix. On REAL hardware (2 nodes or more) above steps already configure
         a listener on each node (both port 1521) this is perfect,
         Skip to step "x", otherwise for "single node RAC" use by training:

         Repeat iv. to vii. with:
             Listener Name = "LISTENER2"

      x. Screen: "Listener Configuration, More Listeners?"
         Select: "No"
         Click "Next"

     xi. Screen: "Listener Configuration, Select Listener"
         Select: "LISTENER2"
         Click "Next"

    xii. Screen: "Listener Configuration Done"
         Click "Finish" (twice).

   b. Startup the primary listener:

      $ srvctl start nodeapps -n raclinux1

   c. Verify the two listeners are running:

      $ ps -efm|grep tnslsnr

      Should see 2 lines: LISTENER_RACLINUX1 & LISTENER2_RACLINUX1
      Starting in each listener has multiple threads so more
      lines will appear.

   d. Obtain tnsnames.ora

      $ cp ~/T3_LinuxDemoFiles-10g/ORACLE_HOME/network/admin/tnsnames.ora

   e. If you create listeners through NETCA, then CRS will start them up
      automatically, OTHERWISE: To enable autostart at boot,
      Add startup lines to:
      REDHAT: /etc/rc.local
      SuSE:   /etc/init.d/boot.local

su - oracle -c "lsnrctl start listener_raclinux1"
su - oracle -c "lsnrctl start listener2_raclinux1"

2. Use dbca to create a Database, some options will look strange it's
   because we're trying to create a small enough database that will fit
   in laptop/limited space:

   a. Invoke dbca, as oracle user:

      $ export LD_ASSUME_KERNEL=2.4.19    (Only for RHEL3 vanilla or Update1)
      $ dbca

      i. Screen: "Welcome..."
         Select: "Oracle Real Application Clusters database"
         Click "Next"

     ii. Screen: "Step 1 of 17: Operations"
         Select: "Create a database"
         Click "Next"

    iii. Screen: "Step 2 of 17: Node Selection"
         In real life we would select all nodes, here just leave raclinux1
         If you Don't see this, check that VIP/GSD/ONS are UP
         Click "Next"

     iv. Screen: "Step 3 of 17: Database Templates"
         Select: "Custom Database"
         Click "Next"

      v. Screen: "Step 4 of 17: Database Identification"
         Enter "O10G" in both fields
         Click "Next"

     vi. Screen: "Step 5 of 16: Management Options"
         Leave: "Configure the Database with Enterprise Manager"
         Click "Next"

    vii. Screen: "Step 6 of 16: Database Credentials"
         Enter: "oracle"  as password for all accounts
         Click "Next"

   viii. Screen: "Step 7 of 14: Storage Options"
         Leave: "Cluster File System"
         Click "Next"

     ix. Screen: "Step 8 of 14: Database File Locations"
         Select: "Use Common Location for All Database Files"
         Enter: "/ocfs"
         Click "Next"

      x. Screen: "Step 9 of 14: Recovery Configuration"
         Enter location as "/ocfs/flash_recovery_area"
         Reduce: "Flash Recovery Area Size"  to 500MB
         Click "Next"

     xi. Screen: "Step 10 of 14: Database Content"
         Unselect all options except "Enterprise Manager Repository"
         Click: "Standard Database Components"
         Unselect: "Oracle Intermedia"  & "Oracle XML DB"
         Click "OK"
         Click "Next"
         NOTE: You may choose to leave XML DB on if you need it as it will
               help if you plan on doing Stage9 (HTML DB)

    xii. Screen: "Step 11 of 14: Database Services"
         Click "Next"

   xiii. Screen: "Step 12 of 14: Initialization Parameters"
         In "Sizing" tab, change:
           Block Size: 2KB
           Processes: 100
         In SGA memory is calculated based on percentage of physical
         memory, disable by selecting:
           "Custom", "Manual"
            Shared Pool = 140M
            Buffer Cache = 40M
            Java Pool = 50M
            PGA Size = 16M
            This is to ensure successful DB creation even with low memory
            in a VMware environment.
         Click "Next"
    xiv. Screen: "Step 13 of 14: Database Storage"
         Select "Controlfile" on left side
         In "General" tab delete
            control03.ctl, highlight and hit backspace
         In "Options" tab change
            Maximum no. of instances to: 8
            Maximum no. of log history: 100

         Expand "Tablespaces" on left side and select "SYSAUX"
         In "General" tab change size to 100MB

         select "SYSTEM" tablespace
         In "General" tab change size to 250MB
         Click "OK"
         In "Storage" tab change to "Managed in the dictionary"
            Initial: 32KB
            Next: 128KB
            Increment Size by: 0   (PCTINCREASE, set to Zero!)

         Select "TEMP" on the left and change its size to 10MB
         Select "UNDOTBS1" on the left and change its size to 65MB

         Expand "Redo Log Groups" on the left side
         Select "3"
           Delete group by pressing the Delete button on bottom left, confirm.

         Click "Next"

     xv. Screen: "Step 14 of 14: Creation Options"
         Select "Generate Database Creation Scripts"

         To run the database creation MANUALLY (step 3 below)
         Deselect "Create Database"     (not recommended, bug 3463569)
         (Preferred) To let dbca create database AUTOMATICALLY now:
         Select "Create Database" (and SKIP step 3 below)
         Either way check "Generate Database Creation Scripts"
         Click "Finish"
         Review summary and Click "OK", Click "OK" for script creation.
         About 50-120 minutes (if creating now) depending on laptop speed
         You will get a success message.
         Click Exit.

         "Do you want to perform another operation?"
         Click "no"

         NOTE:  If you see an error message:
                ORA-2142: missing or invalid ALTER TABLESPACE option

                Just click Ignore, lookup bug 3445044 for more details.

3. Run database creation scripts manually
   (If you let dbca create database above then SKIP this step, go to 4)

   a. Register the database with CRS:

      $ srvctl add database -d O10G -o $ORACLE_HOME
      $ srvctl add instance -d O10G -i O10G1 -n raclinux1
      $ $ORA_CRS_HOME/bin/crs_stat -t


      $ srvctl add database -d O10G -o $ORACLE_HOME

      PRKP-1037 : Failed to create cluster database O10G.
      BUG# 3238000

   b. Create the database using manual scripts:

      $ cd /opt/oracle/admin/O10G/scripts
      $ time ./                 (About 50 minutes)

      Enter:  oracle      for all passwords

   c. Start up database using srvctl so it registers with CRS
      $ sqlplus "/ as sysdba"      
      SQL> shutdown immediate;   
      $ srvctl start instance -d O10G -i O10G1

   d. To enable autostart at boot, NOT needed for 10g if registered w/CRS:

      United Linux:
        Change in /etc/sysconfig/oracle (included with orarun package)

        Add startup line to /etc/rc.local
        su - oracle -c "dbstart"

4. Enable auto-start of database, reduce SGA size:

   a. edit /etc/oratab:

      If created DB manually, add the following line to /etc/oratab:

      If dbca created DB automatically just change the "N" to "Y" on
      that line inside /etc/oratab.  Ignore lines starting as "*:/opt..."

      For RAC, use DB Name, NOT SID like oratab says.  (Bug# 3445115)
      Does it really matter what's in oratab in 10g? not really, CRS is
      used, see bug text for more details.

    b. Reduce SGA size of instance to conserve memory.  This is typically
       very useful for vmware users. We will also fix some other
       init.ora parameters and move away from spfile for easier future
       init.ora modifications:
       i. Disable spfile usage:
          $ srvctl modify database -d O10G -p ""
          to verify issue:
          $ srvctl config database -d O10G -a

      ii. Put in place pre-edited init.ora:
          $ cd $ORACLE_HOME/dbs
          $ cp ~/T3_LinuxDemoFiles-10g/ORACLE_HOME/dbs/initO10G1.ora  .

     iii. (Optional) You may skip the "cp" above and manually edit the
          initO10G1.ora as follows (if you did the cp above skip this step):
          $ cd $ORACLE_HOME/dbs
          $ sqlplus "/ as sysdba"
          SQL> create pfile from spfile;
          SQL> exit
          Now edit the newly created initO10G1.ora and make following changes:




      iv. Restart instance to make sure changes took effect:

          $ srvctl stop  instance -d O10G -i O10G1      
          $ srvctl start instance -d O10G -i O10G1
          ipcs should show a segment of size: 138412032  (132MB)

5. Add second instance to database, TWO options of doing it, choose ONE:

   a. (Preferred) OPTION 1: Add instance using DBCA

      i. Create second instance
         $ dbca

         If "Instance Management" is greyed out see bug 3445115
         Choose: RAC, Instance Management, Add instance
                 user: sys , passwd: oracle,  next , next, next, finish.
                 Instance Summary: OK
         Installer asks "Do you want perform another operation?"
         Click "NO"
        If auto start fails you can startup by using:
        $ srvctl start instance -d O10G -i O10G2
      ii. Make both instances use same init.ora:
          $ cd $ORACLE_HOME/dbs
          $ mv initO10G2.ora initO10G2.ora.orig
          $ ln -s initO10G1.ora initO10G2.ora
    b. OPTION 2: Manually add second instance:

       i. Setup second init.ora file:
          $ cd $ORACLE_HOME/dbs
          $ ln -s initO10G1.ora initO10G2.ora

       ii. Add the second instance.  Obtain the script

  $ cp ~/T3_LinuxDemoFiles-10g/ORACLE_BASE/admin/O10G/scripts/

           As oracle user, run:
           $ srvctl add instance -d O10G -i O10G2 -n raclinux1
           $ $ORA_CRS_HOME/bin/crs_stat -t
           $ cd /opt/oracle/admin/O10G/scripts
           $ ./
           $ srvctl start instance -d O10G -i O10G2

6. You now have TWO instances on the SAME node, to verify:

    a. On Linux level:
       ipcs             (should see two large segments)
       ps -ef|grep dbw  (should see two dbwr's)

    b. On Oracle level:
       sqlplus "
sys/oracle@O10G1 as sysdba"
       sqlplus "
sys/oracle@O10G2 as sysdba"
       sqlplus "
sys/oracle@O10G-TAF as sysdba"
       sqlplus "
sys/oracle@O10G-NOTAF as sysdba"

       All above should connect to database, to verify which instance you
       connected to issue:
       SQL> select host_name,instance_name from v$instance;

    c. You also have Enterprise Manager configured, just add:

       su - oracle -c "emctl start agent"
       su - oracle -c "emctl start dbconsole"

       To /etc/rc.local to start it up automatically at next boot.
       To manage & monitor connect to:
       user: sys  pass: oracle
       Fix Bug 3760143 by replacing /opt/oracle/DB10g/bin/ with
       fixed file from ess30 or supplied in LinuxDemoFiles.

7. (Optional) Install Sample Schemas and Demos. 
   Because we didn't use the pre-created database (wanted custom:
   learn how to, and get DB small enough for laptop) there's no option
   to install the sample schemas see bug 3522385.  We need to install it
   from the Companion CD:
   a. Put the Oracle10g Companion CD in CD tray, Linux will
      automount it and add a "CDROM" icon to the desktop.
      If not, as root issue:  # mount /mnt/cdrom

   b. Run the installer, as the oracle user:

      $ cd                                 (Do NOT cd into /mnt/cdrom)
      $ /mnt/cdrom/runInstaller                         
      i. Screen: "Welcome"
         Click "Next"
     ii. Screen: "Specify File Locations"
         Change Name to: DB10g
         Verify Path is: /opt/oracle/DB10g
         Click "Next"

    iii. Screen: "Select Nodes"
         In real life we would select all nodes, here just leave raclinux1
         Click "Next"
     iv. Screen: "Select a Product to Install"
         Select: "Oracle Database 10g Products" (TOP option)
         Includes Oracle JDBC, SQLJ, Examples, etc.
         Click "Next"
      v. Screen: Summary
         Click "Install"   (About 5 minutes)

     vi. PopUP: As root run /opt/oracle/DB10g/

         # /opt/oracle/DB10g/

         Probably choose option 3 which is not to install any of the
         Legato software, go back to installer and Click OK to finish.
         "Do you want to perform another operation?"
         Click "no"
         If you want to save 40M delete $ORACLE_HOME/stage_tmp  (Legato stuff)

   c. Now that we have scripts that build the sample schmea, to load,
      use (it will also recompile all invaild objects)
      $ cd ~oracle/T3_LinuxDemoFiles-10g/ORACLE_HOME/demo/schema
      $ sh      (About 40minutes)

      It is normal for some objects to fail to build due to lack of
      database support, like for example spatial.

8. General notes:

   a. To startup/stop database
      (this will be done automatically at boot time by CRS):
      $ srvctl stop  database -d O10G
      $ srvctl start database -d O10G
      PRKP-1001 : Error starting instance O10G1 on node raclinux1
      CRS-1005: Failed to get required resources
      CRS-0223: Resource ora.O10G.O10G1.inst has placement error.
      See bug# 3465118 for details, possible workaround:
      $ srvctl start instance -d O10G -i O10G1
      $ sleep 10
      $ srvctl start instance -d O10G -i O10G2
      There are several start/stop scripts in the ~oracle/bin directory to help
      you control the environment.
   b. Check how DB is configured:
      srvctl config database -d O10G -a
      Sample output:
      raclinux1 O10G1 /opt/oracle/DB10g
      raclinux1 O10G2 /opt/oracle/DB10g
      DB_NAME: O10G
      ORACLE_HOME: /opt/oracle/DB10g
      SPFILE: null
      DOMAIN: null
      DB_ROLE: null
      START_OPTIONS: null
   c. To Turn tracing ON in srvctl:
      $ export SRVM_TRACE=true

   d. To add another NODE to RAC:  From an *existing* RAC member/node run:

      $ cd $ORA_CRS_HOME/oui/bin/                       (As oracle user)

      Follow the prompts, oui will copy the software to the remote node
      Later you can use dbca to add an instance on that new node.  No need
      to use the CDs/ISO to reinstall the software.  OUI will mirror the
      existing ORACLE_HOME onto the new hosts.

-- DONE Database creation --

        Copyright (c) 2003-2004 Oracle. All rights reserved.
 ****  ORACLE     INTERNAL   ****   ****  ORACLE     INTERNAL   ****

来自 “ ITPUB博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录


  • 博文量
  • 访问量