Beruflich Dokumente
Kultur Dokumente
Purpose
This 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 Complete
Approximately 1 hour
Topics
This 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 Screenshots
Place 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.
Overview
This 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 Restart This 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 installation Implementing Oracle Restart Moving 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 List
Scenario
This 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 List
Prerequisites
Before 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 the Oracle 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. Note the name of the clusterware directory will change to grid with the production version of 11gR2. If you are not using the Oracle 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 at http://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 the gi_inst.zip file into your working directory which contains the files needed to perform this tutorial.
Oracle 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 List To partition the disks, perform the following steps: 1. Open a terminal window, and become the root OS user. Use the su - root command
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 the fdisk <device_name> command for each disk/dev/sdc, /dev/sdd, /dev/sde, /dev/sdf and specify the values as shown in the screenshots
4.
Check that the expected partitions exist. Partitions named /dev/sdc1, /dev/sdd1, /dev/sde1, and /dev/sdf1should exist. Check by using
cat /proc/partitions
Back to Topic To label the disks for use by ASM, perform the following steps: 1. As the root user, configure oracleasm by using the command oracleasm configure -i and answer the prompts as shown in the screenshot.
2.
Initialize the asmlib with the oracleasm init command. This command loads the oracleasm module and mounts the oracleasm filesystem.
3.
Use the oracleasm createdisk <diskname> <device_name> 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 the oracleasm listdisks command.
5.
Check the the disks are mounted in the oracleasm filesystem with the command ls -l /dev/oracleasm/disks
2.
3.
On the first screen of the installer, select Install 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 the Move All button to select all the available languages. Click Next.
5.
Set Redundancy to External Select the disks: ORCL:DATA1, ORCL:DATA2, and ORCL:DATA3. Click Next
6.
Select 'Use same passwords for these accounts' Enter your password Confirm the password Click Next
7.
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. Click Yes.
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
Click Next
Note: 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 the Ignore All check box and click Next.
On the Summary page, the installation settings are shown. Click Finish to complete the installation.
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 the su - root command 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, Click OK in 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", click Close
Back to Topic To 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 URL https://host01.example.com:1158/em When the login page appears enter:
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. 2. Click the Server tab. On the Server page, click Migrate to ASM.
On 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 Click Continue
5.
6.
Create a tablespace named test with datafile named test01.dbf in the DATA diskgroup of the ASM instance 1. On the Server page, in the Storage section, click Tablespaces
Click Add
Enter File Name: test01.dbf Enter File Directory: +DATA Click Continue
6. On the Tablespaces page confirm that the TEST tablespace has been created. Enter TEST in the search field and click Go.
7.
In a terminal window as the oracle OS user stop, and restart EM database control with the commands. emctl stop dbconsole emctl start dbconsole
8.
View the EM database instance home page, use the URL https: host01.example.com:1158/em Confirm that the ASM instance is now listed as a target.
2.
Determine which components are running. The pgrep -lf <string> command work well for this.
3.
Shutdown the database instance with sqlplus / as sysdba SQL> shutdown immediate SQL> exit
4.
5.
In a terminal window as the oracle user, set the environment to user the ASM home with . oraenv and enter the ORACLE_SID +ASM when prompted.
6.
In the same terminal window, shutdown the ASM instance sqlplus / as sysasm
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 - root chkconfig --del dbora Use the --list option to determine if the dbora service is configured chkconfig --list dbora
9.
Now that all the Oracle related processes are stopped reboot the machine In a terminal window as the root use the reboot command reboot
10. Connect to the machine and Login As 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 running pgrep -lf orcl pgrep -lf ASM pgrep -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. . oraenv crsctl 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.ora vi /u01/app/grid/product/11.2.0/grid/network/admin/listener.ora
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 asm srvctl add asm -l LISTENERASM -p +data/spfile.ora srvctl 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 command srvctl start asm pgrep -lf ASM pgrep -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
19. Enable Oracle Restart for the orcl database instance Start EM database control at URL https://host01.example.com:1158/em
Navigate to the database home page. In the High Availability section click the Disabled link for Oracle Restart
On the Specify Host Credentials page enter Username: oracle and Password:oracle
On the Confirmation: Register Database page, observe the command that will be executed, and then click Continue.
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 the Disabled link 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_1 Click Continue.
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 command srvctl start database -d orcl
22. As the root user reboot the machine with the command su - root reboot
23. Observe the oracle components that are started automatically with the pgrep commands: pgrep -lf tns
Check the EM database control status with the command emctl status dbconsole
Because the EM database is not included in Oracle Restart, it must be started manually. Back to Topic To 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 stopped Stop the database, and asm diskgroup, with the srvctl command; srvctl stop database -d orcl srvctl stop diskgroup -g DATA
2.
Check the configuration of the asm instance, determine the current location of the SPFILE using the command srvctl 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
4.
Stop and restart the ASM instance to use the SPFILE in the new location. Use the ASMCMD commands shutdown and startup. ASMCMD> shutdown ASMCMD> startup
5.
Retrieve the location of the SPFILE registered in Oracle Restart with the spget command. ASMCMD> spget ASMCMD> exit
6.
Using SQL*Plus commands, find the current location of the SPFILE. Connect to the ASM instance "as SYSASM" sqlplus / as SYSASM SQL> select sys_context('sys_cluster_properties','asm_spfile') from dual;
7.
Move the SPFILE into the ASM diskgroup using SQL*Plus command SQL> create SPFILE = '+DATA/spfile.ora' from memory;
8.
Restart the ASM instance to use the new SPFILE. SQL> shutdown immediate SQL> startup SQL> select sys_context('sys_cluster_properties','asm_spfile') from dual; SQL> exit
9.
Restart the orcl instance, and restore the status with the command srvctl start database -d orcl
Back to Topic Back to Topic List At this point the Grid infrastructure is in place to do the Managing the ASM Cluster File System (ACFS) tutorial. Please go to that tutorial, and return here when it is completed to cleanup the environment.
Cleanup
To 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.
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.sh You 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]: " Enter carriage return The third is: "Do you want to continue (y - yes, n - no)? [n]:" Enter y.
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 script su - root /home/oracle/wkdir/gi_inst/cleanup_root.sh exit
5.
As the oracle OS user, reconfigure EM database control with the command: /home/oracle/wkdir/gi_inst/reconfigem.sh
Summary
In this lesson, you learned how to: Prepare the storage devices for Grid Infrastructure installation Install Grid Infrastructure Enable Oracle Restart Back to Topic List
Related Information
To learn more about Grid Installation and ASM you can refer to: Additional OBEs on the OTN Web site. Back to Topic List