In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
In this issue, the editor will bring you about the concept and working principle of Oracle ASM. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.
ASM:Automatic Storage Management is introduced by ORACEL10G in order to simplify the complexity of storage management and to get rid of dependence on other manufacturers. As the preferred storage scheme recommended by ORACLE, ASM not only has the function of cluster file system, but also integrates the functions of volume manager such as redundancy, IO dispersion and so on. We can use ASM in two ways, including building on bare devices or building block devices if ASMLib is installed.
To use ASM, you need to download the ASM driver package from the official ORACLE website, which generally includes two parts: ASM and ASMLib. Note that ASM and ASMLib are two parts. ASMLib is just a management kit for ASM. We often use ASMLib packages to create ASM disks, such as / etc/init.d/oracleasm VOL1 / dev/sdb1 [here can also be bare devices]. As mentioned above, if we directly use the bare device as our ASM disk, then we don't have to install ASMLib (mainly specified by the asm_disstring='' parameter).
For some of the following ASM packages, you need to choose according to your operating system kernel version to download ASM packages:
Oracleasm-2.6.18-194.el5-2.0.5-1.el5.i686.rpmoracleasm-2.6.18-194.el5debug-2.0.5-1.el5.i686.rpmoracleasm-2.6.18-194.el5-debuginfo-2.0.5-1.el5.i686.rpmoracleasm-2.6.18-194.el5PAE-2.0.5-1.el5.i686.rpmoracleasm-2.6.18-194.el5xen-2.0.5-1.el5. I686.rpmoracleasmlib-2.0.4-1.el5.i386.rpmoracleasm-support-2.1.8-1.el5.i386.rpm
1. Background process
ASM is very similar to ordinary RDBMS. ASM is made up of background processes and can also be maintained through sql*plus tools.
ASM instances have two more processes than traditional RDBMS instances: RBAL and ABRn
RBAL: this process, also known as the rebalancer process, is responsible for planning rebalancer activities for ASM disk groups.
ABRn: is a child of the RBAL process, which can have multiple, n from 1 to 9, which are responsible for completing the real rebalancer activity.
Traditional processes: ASM instances also have DBWR, LGWR and other processes.
For RDBMS instances that use ASM as storage, there will be two more processes: RBAL and ASMB.
RBAL: the main function of this process is to open the rebalancer of all disks and data for each disk group.
ASMB: this process acts as an information channel between the ASM instance and the database instance. This process is responsible for communicating with ASM instances. It first uses Diskgroup Name to obtain a connection string from CSS that manages the ASM instance of the Diskgroup, and then resumes a persistent connection to ASM. The two instances exchange information periodically through this connection, which is also a heartbeat mechanism. This also explains why we should start a separate CSS process when our single instance data is stored using ASM.
O0nn01~10: this is a set of processes that establish connections to ASM instances through which RDBMS sends information to ASM for long-term operations such as creating data files.
Note: the ASM instance must start before the database instance, run synchronously with the database instance, and shut down later than the database instance.
Installation location of 2.ASM
The relationship between ASM instance and RDBMS instance needs to pay attention to the following two points:
If the ASM instance and RDBMS instance on a node is a 1ASM instance that provides storage for multiple RDBMS instances at the same time, it is best to install a separate $ASM_HOME for ASM and distinguish it from the $ORACLE_HOME of RDBMS, in which case you need to use a listener under ASM_HOME.
If the relationship between the ASM instance and the RDBMS instance on the node is 1:1, that is, the ASM instance provides storage for only one RDBMS instance, then ASM and RDBMS can share a $ORACLE_HOME
3. Create an ASM disk
There are the following points to note when configuring ASM disks:
ASM runs as the Oracle user, and for it to be able to discover disk partitions and manage and use them, the owner of those partitions must be set to Oracle.
ASM disks can be created in two ways, one is a bare device, and the other is ASMLib.
ASM disk parameters created with bare devices can be specified as follows:
Asm_diskstring='/dev/raw/raw1','/dev/raw/raw5' or asm_diskstring='/dev/raw/raw*'
ASM disk parameters created using ASMLib can be specified in the format "ORCL: disk name":
Asm_diskstring='ORCL:VOL1','ORCL:VOL2' or asm_diskstring='ORCL:VOL*'
# # #
Configure bare Devic
I will not describe the configuration of the bare device in detail, just give the command below. There are also related articles in my blog. Note that after configuring a naked device, the owner of the bare device needs to be changed to Oracle. The configuration varies slightly with different operating system versions:
(1) partition fdisk-l / fdisk / dev/sdb
(2) Edit the rawdevices configuration file and add binding entries for bare devices and block devices.
Vi / etc/sysconfig/rawdevices
/ dev/raw/raw1 / dev/sdb1
(3) start the rawdevices service service rawdevices start
(4) configure chkconfig rawdevices on automatically with the system. Generally, the default is all on.
(5) confirm that the rawdevices service starts service rawdevices status
(6) check bare device raw-qa or direct cd / dev/raw;ls
(7) modify permissions cd / dev/raw;chown oracle:dba raw*
When setting permissions, the chown command will expire when the system is rebooted. You can configure this command in / etc/rc.local.
# # #
ASMLib mode
Using ASMLib, you don't need to create a bare device, you can create it directly on a block device (or on a bare device, of course).
(1) download and install rpm-ivh oracleasm*.rpm according to the operating system kernel version
(2) configure driver / etc/init.d/oracleasm configure
(3) confirm that the configuration is successful. There are # 3 ways to load ASMLib.
-- confirm that ASMLib is loaded
Lsmod | grep asm
-- confirm that the oracleasmfs file system exists in the system memory
Cat / proc/filesystem
-- confirm that oracleasmfs is mounted
Df-ha
(4) create ASM disk
/ etc/init.d/oracleasm createdisk VOL1 / dev/sdb1...
(5) check whether the ASM disk is created successfully (ASMLib disk)
Cd / etc/init.d/oracleasm listdisks
(6) View the physical devices corresponding to each ASM disk
/ etc/init.d/oracleasm querydisk VOL1
Storage structure of 4.ASM
There are two things we need to understand about ASM storage:
Each disk group has an ASM file system.
The ASM disk group itself has striping and mirroring capabilities.
The storage structure of the database instance stored by ASM is different from that of the database instance using file system. The RDBMS part of the database instance stored by ASM still uses the structure of tablespace,segment,extent to organize the space, which is the same as the traditional way. The difference is that extent no longer corresponds to data block, but corresponds to AU (Allocation Unit) of ASM. The allocation of space is no longer in the form of data file, but ASM file, which also proves the existence of ASM file system.
ASM storage features:
Asm can aggregate multiple disk partitions (asm disk) into a disk group (asm diskgroup) for RDBMS use. For RDBMS, ASM DiskGroup is no different from a normal disk, and files can be created on it. The use of asm storage isolates the dependence of RDBMS instances on the underlying storage technology, and RDBMS can only focus on its own transaction functions without paying attention to the implementation details of the underlying storage.
A Disk Group consists of one or more ASM DISK, and an ASM DISK can only belong to one Disk Group.
A Disk Group can contain multiple Disk File, but a Disk file can only be within one Disk Group, and each Disk File will be evenly distributed among the ASM Disk, dispersing the IO to improve performance.
If there is not enough space in the disk group, you can dynamically add and delete disks to the disk group, and then ASM re-stripe the data files, all of which are transparent to RDBMS.
ASM also provides mirror protection that is unique to volume managers, which are mirrored at the ASM file level, unlike other volume managers.
ASM divides asm disk into several storage units called Allocation Unit (AU); generally, each AU is 1MB.
The database still uses extent as the basic unit, extent is the content of RDBMS, and the correspondence between AU,extent and AU that needs to correspond to ASM is generally 1:1, but if you use the redundancy of ASM, the relationship becomes 1:2 or 1:3 (called 2-way or 3-way mirroring).
The database still uses extent map to manipulate the data. In traditional storage, the extent map is obtained from the data file; in the ASM environment, the extent map is not obtained from the data file
Instead, it is obtained from the ASM instance.
# = =
What extent map: the space allocation and expansion of Data file and segment in the database is not in Data Block units, but in Extent units, and this extent size is specified when the table space is created; all the extent information in the entire table space constitutes the extent map. According to whether the extent map is recorded in the data dictionary or in the data file, it can be divided into two management modes: data dictionary and local management. After Oracle10g, the default is local management.
After the database instance obtains the extent map from asm to operate on extent map, subsequent read and write operations directly manipulate the disk instead of going through ASM.
The asm instance is only responsible for the maintenance of asm disk groups, including creating and deleting disk groups, adding and deleting disks, but not reading and writing data files. These operations are completed by the database instance.
Interaction between 5.RDBMS and ASM
When a disk group is mounted on an ASM instance, ASM registers Disk Group Name, ASM Instance Name, Oracle Home Path and other information with CSS, which is used by RDBMS to construct Connect String.
When you need to access an ASM File during RDBMS startup, RDBMS will contact CSS, get Connect String from CSS, and then initiate a connection to the ASM instance. The initial connection between this ASM and the RDBMS instance is called Umbilicu (umbilical cord), and the connection will remain active as long as RDBMS opens ASM File. This connection will not be closed until all ASM File is closed by RDBMS. On the RDBMS side, the connection is the ASMB background process; on the ASM side, it is a foreground process called Umbilicus Forground (UFG). ASM and RDBMS send interactive messages over this connection.
If you check the registration information of the ASM instance in the LISTENER, you can see that the ASM is not in the OPEN state, but in the BLOCKED state. The BLOCKED state forbids the usual database connections, thus ensuring that all connections are routed through the ASMB background process, ensuring the security of ASM operations.
The process of creating an ASM file is as follows:
The user enters the create file command in RDBMS
, RDBMS will generate a foreground process to connect to the process of the ASM instance
The instructions for creating the file will be sent to the ASM instance through this connection
The ASM instance creates a file according to the instruction, and allocating AU;ASM from disk will determine the redundancy and stripe policy of the file according to the template or Diskgroup default template specified in the instruction.
After the AU allocation is completed, ASM sends the extent map of the file to RDBMS;ASM to create a COD record to track the current pending operation
, RDBMS initiates IO operation. Initializing this ASM File; does not require ASM intervention.
After initialization, RDBMS sends a commit request to ASM
After ASM receives the commit request, the LGWR process of ASM writes ACD change Record to ACD Directory;, and then the DBWR process of ASM writes Allocation Table, File Directory, and Alias Directory back to disk asynchronously
If RDBMS aborts creation, ASM rolls back the file operation using COD (the equivalent of a rollback segment in ASM). The rollback operation marks the Allocation Entries as free and releases the entries in the File Directory.
The opening and IO process of ASM File
, RDBMS makes a file-open request to ASM Instacne
, ASM to check whether there is a corresponding Extent Map in ASM SGA, if so, generate Extent Map to RDBMS directly through ASMB, if not, from File Directory, and then generate Extent Map to RDBMS through ASMB
ASM will send the extent map of the entire ASM FILE to RDBMS in 10g, and only the first 60 Direct Extent,Indirect Extent will be returned in 11g and will be loaded when needed.
The whole IO process of ASM FILE is operated directly by RDBMS without the intervention of ASM instance.
The process of deleting ASM File
RDBMS instance sends delete request to ASM instance
, ASM create a COD record for the rollback operation, then mark the entry in allocation table as free, and release the File directory record
Delete the alias record in alias direcotry.
If the ASM instance crashes at this time, the COD record is used for rollback
6.ASM, RDBMS, CSS relationship
CSS plays an important role in the running of ASM instance and RDBMS instance. We know that storage is maintained by ASM instances, but when RDBMS is running, not all reads and writes need to rely on ASM instances. RDBMS instances only need to obtain Extent Map information from ASM instances when opening data files, and save this information in SGA. The future data reading and writing are directly operated and stored. Therefore, if the ASM instance terminates, all RDBMS instances that use the ASM must be closed to confirm that these RDBMS instances cannot manipulate the data on the storage managed by the ASM, that is, IO isolation (IO Fencing).
When an ASM instance is started, it needs to be registered in CSS, and when all practical ASM storage RDBMS instances are started, they also need to register like CSS, and obtain the connection string of ASM from CSS. RDBMS instance and ASM instance communicate through a channel composed of UFG on the ASM instance side and ASMB process on the RDBMS instance side.
If the ASM instance Crash,UFG terminates the ASMB process of RDBMS, for RDBMS, this process is a key process, and its termination will lead to the termination of RDBMS.
In addition to actively registering with CSS, the ASM process and the RDBMS process also track the health status of the IO of the two instances. If the instance of RDBMS terminates, CSS notifies the ASM,ASM instance to perform some resource recovery and release work on behalf of the RDBMS instance. The ASM instance will continue to operate normally without being affected.
7.ASM alias
Let's take a look at OMF:
OMF, whose full name is Oracle_Managed Files, is Oracle file management. Using OMF can simplify the management of administrators without specifying the name, size and path of the file.
Its name, size, and path are automatically assigned by oracle. When deleting logs, data, and control files that are no longer in use, OMF can also automatically delete their corresponding OS files.
If you want to use OMF, you need to set three parameters. We can set these three parameters as needed. The functions of the three parameters are not explained.
Db_create_file_dest
Db_create_online_log_dest_n
Db_recover_file_dest
ASM aliases can be seen as an extension of OMF on ASM, which defines where various files are stored on ASM disk, so the storage path and file naming of ASM file are in a sequence-specific format, as follows:
+ diskgroup_name/database_name/database file type/tag_name.file_number.incarnation
The full name is FQDN (Fully Qualified Filename Notation). But FQDN is not easy to remember for DBA, so Oracle provides ASM Alias to facilitate management and memory.
The purpose of ASM aliases is to facilitate management and memory, so there is not much truth to say, but there are some tips to pay attention to. Aliases can be specified at the beginning of file creation or added after file creation, with a slight difference between the two.
There are two ways to create an ASM alias:
Aliases are specified when the data file is created in RDBMS.
Create tablespace test datafile'+ data/test.dbf' size 10m
Create an alias for an existing ASM file in ASM.
Alter diskgroup data add alias'+ data/test.dbf' for'+ data/ORCL/datafile/test.273.660075820'
The difference between the two approaches is that the alias specified by the latter is not visible to the database.
Limitations of 8.ASM
Currently, ASM only supports database files (including control files, spifle, data files, log files, backup files), but not other files. ASM will check the header of each file, only those that meet the requirements can be saved to ASM, and ORA-27047: "unable to read the header block or the file" error is reported for files that cannot be recognized.
The above is the concept and working principle of Oracle ASM shared by the editor. If you happen to have similar doubts, you might as well refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.