installing grid infrastructure for a standalone server

Upload: vinnu-kumar

Post on 16-Oct-2015

64 views

Category:

Documents


0 download

DESCRIPTION

GRID INSTALLATION

TRANSCRIPT

Installing Grid Infrastructure for a Standalone ServerPurposeThis tutorial shows you how to install the Grid Infrastructure for a standalone server, configure Oracle Restart, move the SPFILE for an ASM instance into an ASM diskgroup.Time to CompleteApproximately 1 hourTopicsThis tutorial covers the following topics:Overview

Scenario

Prerequisites

Preparing to Install Grid Infrastructure

Installing Grid Infrastructure for a Standalone Server

Enabling Grid Infrastructure Features

Cleanup

Summary

Related information

Viewing ScreenshotsPlace the cursor over this icon to load and view all the screenshots for this tutorial. (Caution: This action loads all screenshots simultaneously, so response time may be slow depending on your Internet connection.)Note:Alternatively, you can place the cursor over each individual icon in the following steps to load and view only the screenshot associated with that step.OverviewThis tutorial covers how to install the Oracle Grid Infrastructure for a standalone server. In the Oracle 11g Release 2, the Grid Infrastructure is required to use Automatic Storage Management (ASM), and Oracle RestartThis tutorial includes:The required pre-installation tasks,The installation using the Oracle Universal Installer (OUI),The post-installation tasks to integrate the Grid infrastructure with a pre-existing database installationImplementing Oracle RestartMoving the SPFILE for the ASM instance into an ASM diskgroup.Note:Best practice is to install the Grid Infrastructure before installing the database. The registration of the database and listeners with Oracle restart is automatic when they are created after Grid Infrastructure is installed.Back to Topic ListScenarioThis tutorial has been written to operate in a VM environment, therefore the Oracle Database 11g Release 2 has already been installed. In order to take advantage of ASM, the ASM Clustered file system (ACFS) and Oracle Restart for standalone server, you must install the Grid infrastructure. You can create ASM on unformatted disk partitions. You can use ACFS as a general file system either on a single server or in a cluster. Oracle Restart manages dependencies between the database, ASM and the listener to restart these resources when they fail; it also starts them on reboot.Back to Topic ListPrerequisitesBefore starting this tutorial, you should understand the following:1.An OS user, oracle, is the user that installed the Oracle database software, and the oracle user has a primary group of oinstall and secondary group of dba.

2.If you are using theOracle VM template for Oracle Database 11gR2 OBEs, the software is staged at /stage/clusterware/. You will use the Oracle Universal Installer at /stage/clusterware/Disk1/runInstaller.Notethe name of the clusterware directory will change to grid with the production version of 11gR2.If you are not using theOracle VM template for Oracle Database 11gR2 OBEs, you need to access the runInstaller from your software directory.

3.There are unformatted disk partitions available to mark as ASM disks and form into an ASM diskgroup.This tutorial uses 4 drives of 500 MB each. ( this size limits the number of files that can be placed on ASM, For example the size prevents migrating the database to ASM.) These drives are named /dev/sdc, /dev/sdd, dev/sde, and /dev/sdf in this tutorial.

4.The asmlib rpms for your version of linux have already been installed. See the instructions on the Oracle Technical Network athttp://www.oracle.com/technology/tech/linux/asmlib/index.html.for downloading and installing the proper version of the rpms for your Linux version.

5.Download and unzip thegi_inst.zipfile into your working directory which contains the files needed to perform this tutorial.

Back to Topic ListPreparing to Install Grid InfrastructureOracle Database 11g Release 2 introduces the new Grid Infrastructure Oracle Home which includes Oracle Restart and Oracle Automatic Storage Management(ASM). To implement ASM, you must install Grid Infrastructure. ASM requires unformatted partitions to use as ASM disks and group into ASM diskgroups..In this topic, you partition the disk to be used by ASM, then use oracleasm to label the the disks for discovery by ASM.Partitioning the disks

Using oracleasm to label ASM disks

Back to Topic ListTo partition the disks, perform the following steps:1.Open a terminal window, and become the root OS user. Use thesu - rootcommand

2.As the root user, determine the partitions available. the following command shows all the partitions known to the OS.cat /proc/partitions

3.Determine which devices will be partitioned. Use thefdisk command for each disk/dev/sdc, /dev/sdd, /dev/sde, /dev/sdfand specify the values as shown in the screenshots

4.Checkthat the expected partitions exist. Partitions named /dev/sdc1, /dev/sdd1, /dev/sde1, and /dev/sdf1should exist. Check by usingcat /proc/partitions

Back to TopicTo label the disks for use by ASM, perform the following steps:1.As the root user, configure oracleasm by using the commandoracleasm configure -iand answer the prompts as shown in the screenshot.

2.Initialize the asmlib with theoracleasm initcommand. This command loads the oracleasm module and mounts the oracleasm filesystem.

3.Use theoracleasm createdisk command to create the ASM disk label for each disk.In this tutorial name the disks DATA1, DATA2, DATA3, and DATA4 as shown in the screenshot.

4.Check that the disk are visible using theoracleasm listdiskscommand.

5.Check the the disks are mounted in the oracleasm filesystem with the commandls -l /dev/oracleasm/disks

Back to TopicBack to Topic ListInstalling Grid Infrastructure for a Standalone ServerIn this topic you install the grid Infrastructure is a separate home directory. This separate home directory is a requirement for the Grid Infrastructure. You will use the Oracle Universal installer from the directory where the clusterware software is staged.Use OUI to Install the Grid Infrastructure

Configure EM Database control to manage ASM

Back to Topic ListTo install Grid Infrastructure for single Server, perform the following steps:1.Open a terminal window as the OS user named oracle. This is the user that will own the Grid Infrastructure Installation. Change directories to the location that the clusterware software is staged.cd /stage/clusterware/Disk1

2.Start the installer with the command./runInstaller

3.On the first screen of the installer, selectInstall and Configure Grid Infrastructure for a Standalone Server.ClickNext.

4.On the Select Product Languages screen, select the languages that should be supported in this installation. For this tutorial click theMove All button to select all the available languages. ClickNext.

5.On the CreateASMDiskGroup screen, Set Redundancy toExternal Select the disks:ORCL:DATA1,ORCL:DATA2, andORCL:DATA3. ClickNext

6.On the Specify ASM Password page, Select 'Use same passwords for these accounts' Enter your password Confirm the password ClickNext

7.On the Privileged Operating System Groups page,set each group todba.

Note: these groups do not allow for job role separation. For this tutorial the database DBA and ASM administrator are assumed to be the same person, or have all the same privileges. A warning will appear. ClickYes.

8.On the Specify Installation Location page, the location of the database home will be shown Set the Software Location to/u01/app/grid/product/11.2.0/grid. Set the Oracle Base to/u01/app/grid ClickNextNote: the Grid infrastructure must be installed in a separate home directory from the database

9.The Perform Prerequisite Check page appears and completes the checks.

You may receive a failed RunLevel. This is ok. Select theIgnore Allcheck box and clickNext.

On the Summary page, the installation settings are shown. ClickFinishto complete the installation.

10.The setup page shows the install progress.

The Execute Configuration Scripts page asks you to execute a configuration script as the root user.

Open a terminal window. connect as the root user. Use thesu - rootcommand to become the root user as shown in the screenshot.

Copy the script name,/u01/app/grid/product/11.2.0/grid/root.sh, from the Execute Configuration Scripts page into to the terminal window and execute.

When the script has completed, ClickOKin the Execute Configuration Scripts page.

11.When the Finish page appears, with the message "The installation of Oracle Grid Infrastructure for single Server was successful", clickClose

Back to TopicTo Configure EM Database Control to manage ASM, perform the following steps:1.To manage the ASM instance in Enterprise Manager Database Control. you must configure the ASM Instance as a target. When you configure the ASM target, you must provide the port for the ASM listener. The Grid Infrastructure installs a listener by default on port 1521, and configures the ASM instance to use this listener. In this tutorial the database is already installed and has a listener configured on port 1521, the Grid Infrastructure places a listener on port 1522 and the ASM instance is registered with the grid listener.In a terminal window as the oracle OS user, start EM database control with the command. If the console is already running the command will return "An instance of Oracle Enterprise Manager 11g Database Control is already running."emctl start dbconsole

2.View the EM database control home page. Invoke the browser and enter the URLhttps://host01.example.com:1158/emWhen the login page appears enter: User:SYS Password: Connect as:SYSDBA

The database instance home page appears: notice that the ASM target is absent from the expected position below Listener in the leftmost column.

3..Configure the ASM Target in EM database control.1. Click theServertab.2. On the Server page, clickMigrate to ASM.

4On the Migrate Database to ASM : ASM Instance page, configure the ASM instance as a target. Change the Target name to+ASM.example.com Change Database Home to the ASM Home:/u01/app/grid/product/11.2.0/grid Enter the SYS password Change Port to:1522 In Host Credentials section enter Username:oracle,and the Password ClickContinue

5.On the Migrate Database To ASM: Migration Options page clickCancel.

6.Create a tablespace named test with datafile named test01.dbf in the DATA diskgroup of the ASM instance1. On the Server page, in the Storage section, clickTablespaces

2. On the Tablespaces page, clickCreate.

3. On the Create Tablespace page, enter Name:TEST ClickAdd

4. On the Add Datafile page Enter File Name:test01.dbf Enter File Directory:+DATA ClickContinue

5. On the Create Tablespace page, clickOK.

6. On the Tablespaces page confirm that the TEST tablespace has been created. EnterTESTin the search field and clickGo.

7. The tablespace was created and is in the list.

7.In a terminal window as the oracle OS user stop, and restart EM database control with the commands.emctl stop dbconsoleemctl start dbconsole

8.View the EM database instance home page, use the URLhttps: host01.example.com:1158/emConfirm that the ASM instance is now listed as a target.

Close your browser.

Back to TopicBack to Topic ListEnabling Grid Infrastructure FeaturesIn this topic you enable some of the grid infrastructure features. Perform the following tasks:Enabling Oracle Restart

Move ASM spfile to ASM storage

Back to Topic ListTo Enable Oracle Restart, perform the following steps:1.Stop EM database control withemctl stop dbconsole

2.Determine which components are running. The pgrep -lf command work well for this. Usepgrep -lf orclto see the orcl instance processes

Usepgrep -lf ASMto see the +ASM instance processes

Usepgrep -lf tnsto see the listeners

3.Shutdown the database instance withsqlplus / as sysdbaSQL>shutdown immediateSQL>exit

4.Stop the listener with the commandlsnrctl stop

5.In a terminal window as the oracle user, set the environment to user the ASM home with. oraenvand enter the ORACLE_SID+ASMwhen prompted.

6.In the same terminal window, shutdown the ASM instancesqlplus / as sysasmSQL>shutdown immediateSQL>exit

7.In the same terminal window, stop the listener that was configured for the ASM instance with the command:lsnrctl stop

8.The standard OBE environment automatically starts the database with the dbora service. The dbora service may not exist if you downloaded this OBE and configured your own environment. As the root user, remove the dbora service with the command:su - rootchkconfig --del dboraUse the --list option to determine if the dbora service is configuredchkconfig --list dbora

9.Now that all the Oracle related processes are stopped reboot the machineIn a terminal window as the root use the reboot commandreboot

10.Connect to the machine and LoginAs the oracle user are any of the Oracle related processes running. Use the pgrep -lf command to check. The listener started from the database home directory is the only Oracle related process runningpgrep -lf orclpgrep -lf ASMpgrep -lf tns

11.Enable Oracle restart to automatically start the registered components with the crsctl command This command must be run from the grid ORACLE_HOME directory (this is the same directory as the ASM home). You can set this by running oraenv as shown below and setting the ORACLE_SID to +ASM.. oraenvcrsctl enable has

12.Attempt to start Oracle Restart with the crsctl utility. This fails because the ohasd process is already running. It was configured to restart automatically at boot time during the grid Infrastructure installation.crsctl start has

13.Remove the grid infrastructure listener from the Oracle Restart configuration with the following command:srvctl remove listener -l LISTENER

14.Change the name of the grid infrastructure listener. The default name LISTENER cannot be the same as the database listener if both listeners will be registered with Oracle Restart.Edit the grid infrastructure listener.ora file at /u01/app/grid/product/11.2.0/grid/network/admin/listener.oravi /u01/app/grid/product/11.2.0/grid/network/admin/listener.ora

Change the name LISTENER toLISTENERASM.Save the file

15.Add the grid infrastructure listener to the Oracle Restart configuration with the following command:srvctl add listener -l LISTENERASM -p "TCP:1522" -o $ORACLE_HOME

16.Reconfigure the asm database in Oracle Restart to have a dependencies on the LISTENERASM. Use the commands listed below. Check the current configuration then modify it using the values shown in the configuration. Be sure to use your spfilename.srvctl config asm

srvctl remove asmsrvctl add asm -l LISTENERASM -p +data/spfile.orasrvctl config asm

17.Start the oracle grid components: listener, and asm, and then check that the +ASM instance and the LISTENERASM are running. Since they are configured in Oracle Restart, use the single commandsrvctl start asmpgrep -lf ASMpgrep -lf tns

18.Start the oracle database components: listener, database instance and EM database control.Change the environment to use the orcl instance ORACLE_HOME with. oraenv

Start the listener withlsnrctl start LISTENER

Start the database withsqlplus / as sysdbaSQL>startupSQL>exit

Start EM database control withemctl start dbconsole

19.Enable Oracle Restart for the orcl database instanceStart EM database control at URL https://host01.example.com:1158/emNavigate to the database home page.In the High Availability section click theDisabledlink for Oracle Restart

On the Specify Host Credentials page enter Username:oracleand Password:oracle

On the Confirmation: Register Database page, observe the command that will be executed, and then clickContinue.

On the Database Home page, Oracle Restart now shows Enabled.

20.Register the database listener with Oracle Restart.On the Database Home page, in the General section click the Listener name.

On the Listener: Listener_host01.example.com page, click theDisabledlink for Oracle Restart.

On the Confirmation: Register Listener page observe the command to be executed.srvctl add listener -l LISTENER -p TCP:1521 -o /u01/app/oracle/product/11.2.0/dbhome_1ClickContinue.

The Processing page appears, then the Listener Home page. The listener is now Enabled for Oracle Restart.

21.In a terminal window as the oracle OS user, start the database with the commandsrvctl start database -d orcl

22.As the root user reboot the machine with the commandsu - rootreboot

23.Observe the oracle components that are started automatically with the pgrep commands:pgrep -lf tns

pgrep -lf ASM

pgrep -lf orcl

Check the EM database control status with the commandemctl status dbconsole

Because the EM database is not included in Oracle Restart, it must be started manually.

Back to TopicTo Move the SPFILE for the ASM instance , perform the following steps:1.The SPFILE for an ASM instance is in use anytime the ASM instance is active. The SPFILE can be copied with the spcopy command while the Instance is active. The spcopy command does not change which copy of the SPFILE is being used. The spmove command changes the Oracle Restart configuration so that the target SPFILE will be used on the next startup, and attempts to delete the source SPFILE. To move the SPIFLE the ASM instance must be stopped, this implies all instances using the ASM diskgroups must also be stoppedStop the database, and asm diskgroup, with the srvctl command;srvctl stop database -d orclsrvctl stop diskgroup -g DATA

2.Check the configuration of the asm instance, determine the current location of the SPFILE using the commandsrvctl config asm

3.Move the SPFILE for the ASM instance out of the ASM file. The SPFILE for ASM is created in the ASM diskgroup by default with the Grid Infrastructure installation. To move the SPFILE out of the ASM diskgroup and into filesystem , use the ASMCMD command spmove. The ASMCMD utility requires that the ASM environment is set.. oraenv

asmcmdASMCMD>spmove +DATA/spfile.ora /u01/app/grid/product/11.2.0/grid/dbs/spfile+ASM.ora

4.Stop and restart the ASM instance to use the SPFILE in the new location. Use the ASMCMD commands shutdown and startup.ASMCMD>shutdownASMCMD>startup

ASMCMD>mount DATA

5.Retrieve the location of the SPFILE registered in Oracle Restart with the spget command.ASMCMD>spgetASMCMD>exit

6.Using SQL*Plus commands, find the current location of the SPFILE. Connect to the ASM instance "as SYSASM"sqlplus / as SYSASMSQL>select sys_context('sys_cluster_properties','asm_spfile') from dual;

7.Move the SPFILE into the ASM diskgroup using SQL*Plus commandSQL>create SPFILE = '+DATA/spfile.ora' from memory;

8.Restart the ASM instance to use the new SPFILE.SQL>shutdown immediateSQL>startupSQL>select sys_context('sys_cluster_properties','asm_spfile') from dual;SQL>exit

9.Restart the orcl instance, and restore the status with the commandsrvctl start database -d orcl

Back to TopicBack to Topic ListAt this point the Grid infrastructure is in place to do theManaging the ASM Cluster File System (ACFS)tutorial. Please go to that tutorial, and return here when it is completed to cleanup the environment.CleanupTo return the OBE environment to the same state it was in at the beginning of this exercise, perform the following steps:1.In a terminal window as the oracle user, and environment set to the orcl instance, stop EM database control and deconfigure with/home/oracle/wkdir/gi_inst/deconfigem.sh

2.Remove objects stored in ASM from database instance orcl./home/oracle/wkdir/gi_inst/rmasmobj.sh

3.Run the deinstall_gi.sh script remove the database and the database listener from the Oracle Restart configuration./home/oracle/wkdir/gi_inst/deinstall_gi.shYou will recieve 4 prompts.The first is "Specify all Oracle Restart enabled listeners that are to be de-configured [LISTENERASM]:" Entercarriage return.The second is :"De-configuring ASM will drop all the diskgroups and it's contents at cleanup time. This will affect all of the databases and ACFS that use this ASM instance(s).If you want to retain the existing diskgroups or if any of the information detected is incorrect, you can modify by entering 'y'. Do you want to modify above information (y|n) [n]: " Entercarriage returnThe third is: "Do you want to continue (y - yes, n - no)? [n]:" Entery.You will be prompted to run one or more scripts as root to complete the deinstallation. When prompted open a terminal and use the su - root command to become root. cut and paste the command from the deinstall script window to the root window and execute.

4.As the root user run the following scriptsu - root/home/oracle/wkdir/gi_inst/cleanup_root.shexit

5.As the oracle OS user, reconfigure EM database control with the command:/home/oracle/wkdir/gi_inst/reconfigem.sh

Back to Topic ListSummaryIn this lesson, you learned how to:Prepare the storage devices for Grid Infrastructure installation

Install Grid Infrastructure

Enable Oracle Restart

Back to Topic ListRelated InformationTo learn more about Grid Installation and ASM you can refer to:AdditionalOBEson the OTN Web site.

Back to Topic ListPlace the cursor over this icon to hide all screenshots.