Creating the oracle10g ASM Database

Source: Internet
Author: User

                                               Overview
       In a truly massive database environment, DBAs may spend a lot of time doing disk management, such as a table space will fill the entire magnetic
disk, the DBA will need to add another disk to the operating system, and then create a new data file on the new disk, if it is a single disk this
is not very cumbersome, the problem is that if we used raid or LVM, then the large amount of data is still distributed on the previous
those disks, if we want to distribute the data evenly on the previous disk and the newly added disk, we may have to spend a day very much
To a few days to export the original data import. So if there's a way to do that, we'll add a disk to the system, and then
tell Oracle we're going to use this disk, and the rest of the work is done by Oracle, what a great thing! Fortunately
, ORACLE10G has provided this functionality, which is ASM (Automatic Storage Management). We call it "self-
Dynamic storage Management". ORACLE10G's ASM not only helps DBAs get out of cumbersome disk space management, but the more interesting
is that ASM provides both stripe and mirroring capabilities that were originally required to be implemented by individually configuring raid.
This article uses VMware to install RHEL3 + oracle10g to experience the power of the ASM database, why use VMware? Because
we can easily add or delete virtual disks in VMware, which makes it easier to test the ASM Data
Library, I don't think anyone can grab five or six hard drives for such a test

Hardware configuration
IBM R50 5GC Centrino 1.5g,1g memory, 40G HDD
Software configuration
WindowsXP Pro Sp1,vmware GSX Server 2.5.1,rhel3,oracle10g for Linux
installing VMware
This step is not much to say, I installed the VMware GSX Server, did not test the VMware Workstation, so there is no guarantee to
To implement the steps in this article.

Installing RHEL3 in VMware

This process is not much to say, with the actual environment installed RHEL3 the same. It is important to note that the Xwindow can not be started properly during installation because of VMware, so it is possible to install it under the character interface. Reboot the system after installation, Xwindow will start automatically. Remember to install all the development packages, which will try to avoid the link errors that may occur later. In my test environment, I gave RHEL3 the total
A total of 384M of memory.

Select Add Hardware in the properties of the virtual machine as follows, and then add a dummy disk

Next, since the virtual disk we created is just a data file for the Oracle, and we will use the Failgroup stripe feature in ASM, it is sufficient to set the maximum size to 1G.

Next, specify the name and location of the virtual disk file, which is stored by default in the same directory as the virtual machine. Here we specify the file name Physical1

Click the Advanced button, set the physical mount point of the virtual disk, usually we choose and the virtual machine has the system disk on different SCSI ports, such as our virtual machine system disk is scsi0:0, then set this disk to scsi1:0. The additional three disks that will be added are scsi1:1, Scsi1:2, and Scsi1:3 in turn

Because of the characteristics of virtual disk, when the new disk file is created, it will not use the largest size, so even if the entire partition free capacity is not 4G (we want to create 4 maximum size is 1G virtual disk), there is no problem, The size of the virtual disk file continues to increase as needed and increases to the specified max size. Of course, this feature also leads to lower I/O efficiency using virtual disk than using Plaindisk (which takes up the size of the max size), so if you have enough disk space, plain disk is the recommended creation plain Disk is checked in front of the "Allocate all disk space now" checkbox in the second step above, creating a virtual disk file with the extension of PLN and Dat. The benefit of Plain disk is that it can emulate shared disks in a RAC environment, which virtual disk cannot. Analog RAC is not in the scope of this article.

Update kernel
>uname-a
RHEL3 the Linux kernel version installed by default is 2.4.21-4, in order to properly install Oracleasm lib, we need to upgrade the kernel to 2.4.21-15.el, otherwise the oracleasm will not be enabled properly. The reason is that we installed the Oracleasmlib is already compiled RPM package, and our current operating system kernel must be the same as the system kernel version at compile time, or even if it seems to be installed properly, but at the start of oracleasm when the/var/log/ An error message similar to the following is found in the messages file:
Kernel-module version mismatch
^I/LIB/MODULES/2.4.21-EL-ABI/ORACLEASM/ORACLEASM.O is compiled for kernel version
2.4.21-15.el ^iwhile This kernel is version 2.4.21-4.el.
From this error message we can also know that the kernel version should be installed, in order to know more exactly which version of the downloaded ORACLEASM package needs the kernel, we can also download the oracleasm, install, start and then view the error message, and then upgrade the kernel to the appropriate version.

Note: The 2.4.21-15.el kernel that is mentioned in this article is the kernel that is used by Oracleasm compilation when this article is written, and as Oracle continues to push
A new version of Asmlib, the required kernel version may also be changing.
Download the new kernel:
kernel-2.4.21-15.el.i686:http://public.planetmirror.com/pub/pmstuff/patches/kernel-
2.4.21-15.el.i686.rpm

Install the new kernel:
# rpm–ivh–-nodeps kernel-2.4.21-15.el.i686.rpm
After the installation is complete, the modified/boot/grub/grub.conf,rpm installation, should have been automatically added in the grub.conf file
In the new version of kernel, we need to change the default=1 to default=0 so that each boot is started with a fresh kernel,
We can also delete the title Red Hat Enterprise Linux as in the grub.conf file directly after the test has no problem
(2.4.21-4.el) section to prevent the use of the original system kernel boot system due to incorrect operation.
# cat/boot/grub/grub.conf
# grub.conf generated by Anaconda
#
# Note that you don't have the to rerun grub after making changes to the This file
# notice:you does not have a/boot partition. This means
# all kernel and INITRD paths is relative to/, eg.
# root (hd0,0)
# kernel/boot/vmlinuz-version RO root=/dev/sda1
# initrd/boot/initrd-version.img
#boot =/DEV/SDA
Default=0
timeout=10
Splashimage= (hd0,0)/boot/grub/splash.xpm.gz
Title Red Hat Enterprise Linux as (2.4.21-15.el)
Root (hd0,0)
Kernel/boot/vmlinuz-2.4.21-15.el ro root=label=/
Initrd/boot/initrd-2.4.21-15.el.img
Title Red Hat Enterprise Linux as (2.4.21-4.el)
Root (hd0,0)
Kernel/boot/vmlinuz-2.4.21-4.el ro root=label=/
Initrd/boot/initrd-2.4.21-4.el.img
After the modification, reboot the system to ensure that the new kernel is used
# Uname–a
Linux LinuxNode1 2.4.21-15.el #1 Thu Apr 00:27:41 EDT 2004 i686 i686 i386
Gnu/linux
Installing Oracle Asmlib
Download the three files that Asmlib requires:
asmlib:http://otn.oracle.com/software/tech/linux/asmlib/files/rpms/rhel3/x86/oracleasmlib-
1.0.0-1.i386.rpm

Asmsupport:
http://otn.oracle.com/software/tech/linux/asmlib/files/rpms/rhel3/x86/oracleasmsupport-
1.0.2-1.i386.rpm
Asmkernel:
http://otn.oracle.com/software/tech/linux/asmlib/files/rpms/rhel3/x86/oracleasm-
2.4.21-el-1.0.0-1.i686.rpm
If it is a multiprocessor version, you can download the following file to replace the third file:
Asm-smpkernel:
http://otn.oracle.com/software/tech/linux/asmlib/files/rpms/rhel3/x86/oracleasm-
2.4.21-el-smp-1.0.0-1.i686.rpm
Installation:
$SU –
# RPM-UVH oracleasm-support-1.0.2-1.i386.rpm \
ORACLEASM-LIB-1.0.0-1.I386.RPM \
oracleasm-2.4.21-el-1.0.0-1.i686.rpm
Configuration asmlib:
#/etc/init.d/oracleasm Configure
Configuring the Oracle ASM Library driver.
This would configure the On-boot properties of the Oracle ASM Library
Driver. The following questions would determine whether the driver is
Loaded on boot and what permissions it would have. The current values
Would be shown in brackets (' [] '). Hitting without typing an
Answer would keep that current value. Ctrl-c'll abort.
Default user to own the driver interface []: Oracle
Default Group to own the driver interface []: DBA
Start Oracle ASM Library driver on Boot (y/n) [n]: Y
Fix Permissions of Oracle ASM disks on Boot (y/n) [y]: Y
Writing Oracle ASM Library driver configuration [OK]
Creating/dev/oracleasm mount point [OK]
Loading module "Oracleasm" [OK]
Mounting Asmlib driver filesystem [OK]
Scanning system for ASM disks [OK]
The above operation will load the ORACLEASM.O driver, and the ASM file system on mount, and we can manually unload and load the Asmlib by the following command
#/etc/init.d/oracleasm Disable
Writing Oracle ASM Library driver configuration [OK]
unmounting asmlib driver filesystem [OK]
Unloading module "Oracleasm" [OK]
#/etc/init.d/oracleasm Enable
Writing Oracle ASM Library driver configuration [OK]
Loading module "Oracleasm" [OK]
Mounting Asmlib driver filesystem [OK]
Scanning system for ASM disks [OK]
If the kernel of the current operating system is different from the kernel of the compiled asmlib, then the above operation will be error, please check
Check the/var/log/messages file to confirm the system kernel version that needs to be updated.
Adding an init file to automatically load the system when it starts Asmlib
$ su–
# CD/ETC/RC3.D
# ln-s. /init.d/oracleasm s99oracleasm
# ln-s. /init.d/oracleasm k01oracleasm
Note: If the system boot is automatically entered into the graphical interface, that is, the system's init level is 5, then the command to generate the link above should
Operate in the/ETC/RC5.D directory.
Reboot the system to confirm that Asmlib is ready to load automatically
#lsmod | grep oracleasm
Oracleasm 14224 1
#dmesg | grep oracleasm
Asm:oracleasmfs Mounted with options:
Creating an ASM Disk
#/etc/init.d/oracleasm Createdisk Vol1/dev/sdb
Marking disk "/dev/sdb" as an ASM disk [OK]
#/etc/init.d/oracleasm Createdisk VOL2/DEV/SDC
Marking disk "/DEV/SDC" as an ASM disk [OK]
#/etc/init.d/oracleasm Createdisk VOL3/DEV/SDD
Marking disk "/DEV/SDD" as an ASM disk [OK]

#/etc/init.d/oracleasm Createdisk VOL4/DEV/SDE
Marking disk "/dev/sde" as an ASM disk [OK]
#/etc/init.d/oracleasm Listdisks
VOL1
VOL2
VOL3
VOL4
If you want to remove the ASM disk, use the following command:
#/etc/init.d/oracleasm Deletedisk VOL4
Removing ASM Disk "VOL4" [OK]
Note: If you add an ASM disk to one of the nodes in the RAC environment, you need to run ScanDisk on the other node to get
This change.
#/etc/init.d/oracleasm Scandisks
Scanning system for ASM disks [OK]
Detailed installation documentation can be viewed through the following connections:
Http://otn.oracle.com/tech/linux/asmlib/install.html
Now that we have completed the physical foundation for creating an ASM instance, we will begin to install the database below.
Installing oracle10g
Installing oracle10g on RHEL3 is already a very simple operation, as long as the system kernel parameters are set correctly, you will hardly encounter any questions.
Problem.
Detailed steps for installing oracle10g on RHEL3 can be obtained from the following connections, which are not described in this article.
Http://www.puschitz.com/InstallingOracle10g.shtml
When installing oracle10g, we chose not to create the database, only install the software, and then through the DBCA after the end of the software installation
Create an ASM instance and database.
Creating an ASM instance
<!--[if!supportlists]-->1. <!--[endif]--> Create an initialization file
$ su–oracle
$ cd $ORACLE _home/dbs
$ VI Init+asm.ora

To create an initialization script for an ASM instance, the script contents are as follows:
# ******below is the init script for ASM instance******
*.asm_diskstring= ' orcl:vol* '
*.background_dump_dest= '/oracle/admin/+asm/bdump '
*.core_dump_dest= '/oracle/admin/+asm/cdump '
*.instance_type= ' ASM '
*.large_pool_size=12m
*.remote_login_passwordfile= ' SHARED '
*.user_dump_dest= '/oracle/admin/+asm/udump '
# ******above is the init script for ASM instance******
Description
<!--[if!supportlists]-->1. <!--[Endif]-->dump directory points to $oracle_base/, ASM instance in this article
The SID is +asm. It is best not to modify this instance name, otherwise DBCA will not find the available when you create the database in the next step with DBCA
Disk group, I think this should be a bug in DBCA, the manual creation of ASM type database should not have this limit.
<!--[if!supportlists]-->2. <!--[endif]-->asm_diskstring to check available ASM magnets When the instance is started
Disk, because the name of the ASM disk we created earlier is VOL1 to VOL4, so we use the * wildcard here, the preceding ' ORCL: ' not
Otherwise, the ASM instance will not be able to check the disk.
<!--[if!supportlists]-->2. <!--[endif]--> Create a password file
$ su–oracle
$ cd $ORACLE _home/dbs
$ orapwd file=orapw+asm PASSWORD=DBA
<!--[if!supportlists]-->3. <!--[endif]--> Create a directory structure
$ su–oracle
$ cd $ORACLE _home/dbs
$ mkdir–p $ORALCE _base/admin/+asm/udump
$ mkdir–p $ORALCE _base/admin/+asm/bdump
$ mkdir–p $ORALCE _base/admin/+asm/cdump
<!--[if!supportlists]-->4. <!--[endif]--> Launch instance
$ Export Oracle_sid=+asm
$ sqlplus/as SYSDBA
Sql> Startup
ASM instance started
Total System Global area 100663296 bytes

Fixed Size 777616 bytes
Variable Size 99885680 bytes
Database buffers 0 bytes
Redo buffers 0 bytes
Ora-15110:no diskgroups Mounted
Because we are starting the ASM instance for the first time and have not created the diskgroup, it is normal to display a 15110 error.
If you start an instance, you encounter the following error:
Ora-29701:unable to connect to Cluster Manager
Then please check the/etc/inittab file to see if there is a line below
H1:35:RESPAWN:/ETC/INIT.D/INIT.CSSD Run >/dev/null 2>&1
If not please add, uncomment if it is commented.
<!--[if!supportlists]-->5. <!--[endif]--> Create SPFile, restart
Sql> create SPFile from Pfile;
sql> shutdown immediate;
Sql> startup;
<!--[if!supportlists]-->6. <!--[endif]--> Create DiskGroup
sql> Create DiskGroup dgroup1 normal redundancy
2 failgroup fgroup1 disk ' orcl:vol1 ', ' orcl:vol2 '
3 failgroup fgroup2 disk ' orcl:vol3 ', ' orcl:vol4 ';
DiskGroup created.
Sql> col name for A10
Sql> select Name,state from V$asm_diskgroup;
NAME State
---------- ----------------------
DGROUP1 Mounted
If the state returned by the above command is dismounted, then we need to manually mount the DiskGroup
sql> ALTER diskgroup dgroup1 MOUNT;
DiskGroup Altered

The database initialization parameters are checked and the asm_diskgroups parameter values are automatically set to DGROUP1, indicating that the next reboot
The diskgroup is automatically mounted when the ASM instance is moved.
Sql> col name for A10
Sql> col type for A10
Sql> col value for A20
Sql> Show Parameter Asm_diskgroups
NAME TYPE VALUE
------------------------------------ ---------- ------------------------------
Asm_diskgroups string DGROUP1
If you want to uninstall DiskGroup, use the following command:
ALTER DiskGroup all dismount;

Creating the oracle10g ASM Database

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.