Saturday, December 19, 2009
Add Disk to Diskgroup
Instance: ASM Instance
Privilege: Sysdba
Syntax
ALTER DISKGROUP diskgroup_name ADD [FAILGROUP failgroup_name] DISK add_disk_clause rebalance_diskgroup_clause
Where
Add_disk_clause = search_string [NAME disk_name] [SIZE size_clause] [FORCE/NOFORCE]
Force – Add disk to the diskgroup even if the disk is part of some other diskgroup.
NoForce – ASM returns error if the disk is part of some other diskgroup.
Rebalance_diskgroup_clause = REBALANCE POWER integer WAIT/NOWAIT
Integer – 0 to 11. If you omit ASM takes the value from ASM_POWER_LIMIT init parameter.
WAIT – The control is not returned to the user until the rebalance operation completes.
NOWAIT – The control immediately returns to the user and the rebalance operation takes place at the background and user can continue to do other operation.
Example 1
SQL> Alter Diskgroup ASMDATA ADD
FAILGROUP ctrl_1
DISK
'/u01/asmdisks/disk1' NAME data_05 NOFORCE,
'/u01/asmdisks/disk2' NAME data_06 NOFORCE;
Example 2
SQL> Alter Diskgroup ASMIND ADD
DISK '/dev/rhdisk33'
REBALANCE POWER 5 ;
Thanks
Dropping a Diskgroup in ASM
Privilege: Sysdba
Syntax:
DROP DISKGROUP diskgroup_name INCLUDING/EXCLUDING CONTENTS;
Including Contents – Drops all the files associated with the disk group.
Excluding Contents – Drops the disk group only when it is empty. Default.
Example 1
SQL> Drop Diskgroup ASMDATA including contents;
Example 2
SQL> Drop Diskgroup ASMIND;
Thanks
Create a new Diskgroup in ASM
Privilege: Sysdba
Pre-requisite: Disks must be formatted. The path of the disk must be in the ASM_DISKSTRING. Oracle DB user must have read/write permission on the disk.
Syntax:
CREATE DISKGROUP diskgroup_name redundancy_level REDUNDANCY [FAILGROUP failgroup_name]DISK disk_clause
Where,
redundancy_level = HIGH or NORMAL or EXTERNAL
disk_clause = search_string [NAME disk_name] [SIZE size_clause] [FORCE/NOFORCE]
Force – Add disk to the diskgroup even if the disk is part of some other diskgroup.
NoForce – ASM returns error if the disk is part of some other diskgroup.
Example 1
CREATE DISKGROUP asm_data
NORMAL REDUNDANCY
FAILGROUP ctrl_1
DISK
'/u01/asmdisks/disk1' NAME data_01 NOFORCE
,'/u01/asmdisks/disk2' NAME data_02 NOFORCE
FAILGROUP ctrl_2
DISK
'/u03/asmdisks/disk3' NAME data_3 NOFORCE
,'/u03/asmdisks/disk4' NAME data_4 NOFORCE;
If the size clause is omitted the full disk is assigned.
Example 2
SQL> CREATE DISKGROUP ASMIND External REDUNDANCY DISK
'/dev/rhdisk6' SIZE 51200M ,
'/dev/rhdisk7' SIZE 51200M ,
'/dev/rhdisk8' SIZE 51200M ;
If the name clause is omitted the disks are given a system generated name.
Thanks
Thursday, December 10, 2009
Install Oracle 10g on Windows XP - Part 3
Install Oracle 10g on Windows XP - Part 2
- Specify the Disk Group name.
- Choose the redundancy type.
- Select the candidate disks you want to assign for this disk group.
Click the Exit button. The ASM installation is completed.
Note: You can use the DBCA to create addition disk groups.
Thanks
Wednesday, December 9, 2009
Install Oracle 10g on Windows XP using ASM - Part 1
Stamp ASM Disks
To use ASM, the disks must be stamped with a header. Use ASMTOOL to stamp each partition with an ASM label so that oracle can recognize these partitions as candidate disk. Navigate the oracle media to find the asmtool folder. Click the asmtoolg.exe.
Select the Add or change label dialog and press Next button.
Select the Candidate Disk and assign a asmdisk group name. Click Next.
Click Next.
Click Finish.
Repeat the process for each disk group.
Thanks
Wednesday, November 25, 2009
ASMCMD
Before invoking the ASM command, set the following environmental variables,
$ Export ORACLE_SID=+ASM1
$ Export ORACLE_HOME=/oracle/app/oracle/product/10.2.0.1/db_1
To invoke the ASMCMD
$ asmcmd –p
If the –p option is used, it displays the path in the prompt.
To navigate the directories (same as in Unix) case insensitive
To Create a File alias
$ asmcmd
ASMCMD> cd asmdb/gcprod/datafile
ASMCMD> mkalias +asmdb/gcprod/datafile/USERS.259.661355087 users_01.dbf
To remove a file alias
ASMCMD> rmalias +asmdb/gcprod/datafile/users_01.dbf
To check space usage
du – displays disk usage in MB. Similar to du command in unix.
lsdg – lists the disk group usage.
To find the RDBMS instances connected to ASM
lsct – lists the ASM Client information
To create and delete directories and files
ASMCMD> mkdir dummydir
ASMCMD> rm dummydir
ASMCMD> rm +asmdb/gcprod/datafile/USERS.259.661355087
Note: The file must be closed before deleting it otherwise the rm command will throw error.
Searching through the ASM directories
Thanks
Friday, November 6, 2009
ASMLIB
Function of ASMLIB
Disk Discovery: It provides more information about the disk attributes enabling easy discovery of disks. Avoids disks being added to one node and not been discovered by other nodes in the cluster.
IO Processing: Enables more efficient IO.
Thanks
ASM Rebalance
The RBAL background process manages the rebalance activity. It examines the extent map for each file and redistributes the extents to new storage configuration. The RBAL process will calculate estimation time and the work required to perform the rebalance activity and then message the ARBx processes to actually perform the task. The number of ARBx process starts is determined by the parameter ASM_POWER_LIMIT.
There will be one I/O for each ARBx process at a time. Hence the impact of physical movement of file extents will be low. The asm_power_limit parameter determines the speed of the rebalance activity. It can have values between 0 and 11. If the value is 0 no rebalance occurs. If the value is 11 the rebalance takes place at full speed. The power value can also be set for specific rebalance activity using Alter Diskgroup statement.
The rebalance operation has various states, they are
WAIT: No operations are running for the group.
RUN: A rebalance operation is running for the group.
HALT: The DBA has halted the operation.
ERROR: The operation has halted due to errors.
You can query the V$ASM_OPERATION to view the status of rebalance activity.
The rebalance activity is an asynchronous operation, i.e., the operation runs in the background while the users can perform other tasks. In certain situation you need the rebalance activity to finish successfully before performing the other tasks. To make the operation synchronous you add a keyword WAIT while performing the rebalance as shown below.
SQL> Alter diskgroup ASMDB Add Disk ‘/dev/sdc4’ Rebalance power 4 WAIT;
The above statement will not return the control to the user unless the rebalance operation ends.
Thanks
Wednesday, November 4, 2009
ASM redundancy and Failure Groups
A diskgroup is divided in to failure groups. Each disks in the diskgroup is part of one failure group. The disks in different failure groups does not share the same failure component (HBAs, controllers etc).
ASM uses Mirroring for redundancy. Three types of redundancy are supported by ASM. They are,
Normal Redundancy: 2-way mirrored. At least two failure groups are needed.
High Redundancy: 3-way mirrored. At least three failure groups are needed.
External Redundancy: No ASM mirroring. 3rd party redundancy mechanism like RAID is used.
After creating a diskgroup you cannot change the redundancy level. If you want to change it then create a separate diskgroup and move the files to that diskgroup (using RMAN restore or DBMS_FILE_TRANSFER).
ASM mirrors extents instead of disks. The first copy of the extent is called the primary extent and its mirrored extent is called secondary extent. For high redundancy there are two secondary extents. The primary and secondary extents together are known as extent set. An extent set always contains same data. For read/write operations, each extent in an extent set is written in parallel and only primary extent is read.
Note: Disk group meta data is always triple mirrored with normal or high redundancy.
Thanks
Tuesday, November 3, 2009
ASM Templates
Default Template: When you create a disk group, Oracle creates system default template for the disk group. It includes default attributes for various file types like control files or data files. The DBA can mention whether the files created via the template should be 2-way or 3-way mirrored and Coarse or fine striped.
Default templates and their attributes.
Ref: http://www.dbasupport.com/oracle/ora10g/ASM0301.shtml
Some of the attributes of default templates can be modified, but cannot be deleted. The redundancy and striping cannot be modified. You can also create user defined templates.
The drawback of ASM file templates is if you want to modify any of the file attributes after it is created, then you must use RMAN to copy the file to a new file with new settings.
To view the ASM template details use the following query.
SQL> Select * From V$ASM_TEMPLATE;
Thanks
ASM Files
A typical ASM file looks like this
+ASMDB/gcprod/datafile/users.259.661355087
The ASM file has 5 components, they are
ASM Disk Group : +ASMDB
Database name : gcprod
File type : datafile
Tag : Specific information about the file. In this case it is the tablespace name, users
file.incarnation : A number pair that insure uniqueness
ASM File Alias
Alias are used to represent the files using user friendly names.
To create an alias
SQL> Alter Diskgroup ASMDB add alias '+ASMDB/gcprod/datafile/users1.dbf' for '+ASMDB/gcprod/datafile/users.259.661355087' ;
Instead of using full name you can also use only the disk group name and the numeric identifier as shown below,
SQL> Alter Diskgroup ASMDB add alias '+ASMDB/gcprod/datafile/users1.dbf' for '+ASMDB.259.661355087';
To rename an alias
SQL> Alter Diskgroup ASMDB rename alias '+ASMDB/gcprod/datafile/users1.dbf' to '+ASMDB/gcprod/datafile/users2.dbf';
To delete an alias
SQL> Alter Diskgroup ASMDB delete alias '+ASMDB/gcprod/datafile/users1.dbf';
Note: Once you create an alias the files will not become OMF. Hence the files will not be deleted automatically when the tablespace is dropped. You have to delete the files manually as shown below,
Drop file using alias
SQL> Alter Diskgroup ASMDB drop file '+ASMDB/gcprod/datafile/users1.dbf';
Drop file using numeric name
SQL> Alter Diskgroup ASMDB drop file '+ASMDB.259.661355087';
Drop file using fully qualified name
SQL> Alter Diskgroup ASMDB drop file '+ASMDB/gcprod/datafile/users.259.661355087';
Thanks
Monday, November 2, 2009
ASM Background Processes
RABL- Rebalancer: It opens all the device files as part of disk discovery and coordinates the ARB processes for rebalance activity.
ARBx - Actual Rebalancer: They perform the actual rebalancing activities. The number of ARBx processes depends on the ASM_POWER_LIMIT init parameter.
ASMB - ASM Bridge: This process is used to provide information to and from the Cluster Synchronization Service (CSS) used by ASM to manage the disk resources. It is also used to update statistics and provide a heartbeat mechanism.
Thanks
Sunday, November 1, 2009
ASM Instance
ASM breaks the files into multiple extents and spreads the extents across all of the disks available in the disk group. Usually the extent is 1MB in size. The ASM instance creates an extent map, which has a pointer to each 1MB extent. When the database instance wants to create or open the datafile, it messages the ASM instance and ASM instance returns the extent map for that file. The database instance then performs the I/O directly with the datafile.
ASM instance must be started before the database instance starts and must be running as long as the database instance runs.
Initialization Parameters for ASM instance
Unlike database instance, ASM instance does not have physical files and can be started with few initialization parameters. The following are the required parameters.
*.instance_type=asm
*.cluster_database=TRUE
*.instance_number=1
*.remote_login_passwordfile=EXCLUSIVE
*.asm_diskgroups=ASMIND,ASMDB,ASMFLASH
*.background_dump_dest=’/…/’
*.core_dump_dest=’/…/’
*.user_dump_dest=’/…/’
The following size is used for most configurations
*.Shared_pool_size=128MB
*.Large_pool_size= 12MB
*.Db_cache_size=64MB
From Oracle 11g, there is no need to set bdump,cdump,udump. Instead set the following Automatic Diagnostic Repository parameter,
*.diagnostic_dest=’/…/’
Starting ASM instance
There are four modes to start asm instance they are,
SQL> Startup Nomount; -- starts the asm instance.
SQL> Startup Mount; -- mounts the disk groups
SQL> Startup Force; -- shuts down asm and restarts.
SQL> Startup Restrict; -- prevents oracle database from connecting to asm.
Stopping ASM instance
SQL> Shutdown;
Shutting down the ASM instance shuts down any oracle databases connected to that ASM instance in the same mode. When you issue shutdown normal, immediate or transactional ASM instance waits for the corresponding oracle databases to finish all SQL operations before shutting down.
Thanks
If you like the post vote for me by clicking the following button
Automatic Storage Management
ASM is a special kind of volume manager specifically designed for Oracle Database Files. You give all the disks to Oracle and it will manage it for you. ASM groups the disks in the storage system as one or more disk groups and automates the placement of files within these disk groups. This results in better utilization, performance and high availability.
Advantages of ASM
1. Automatic Load Balancing: The data is spread over all the available disks and hence provide equal distribution of I/O loads across all the disks.
2. Automatic Rebalancing of data: When a disk is added or removed the data is automatically rebalanced with the remaining disks without affecting the performance.
3. Fault Tolerance : ASM provides fault tolerance through 2 to 3 levels of mirroring.
4. ASM can be used in single instance as well as RAC environment.
5. ASM files can co-exist with non-asm files in the same database.
Disadvantage of ASM
ASM cannot support some files such as alert log files, trace files, external table files etc.
Types of files stored in ASM
Data Files, Control files, Redo Log files, Archived log files, Temp files, Parameter files, Backup pieces, Flashback logs, Data pump sets.
Thanks
If you like the post vote for me by clicking the following button.
Sunday, October 11, 2009
Force Log Switches
SQL> Alter System Switch LogFile;
SQL> Alter System Archive Log Current;
The difference between the two statements is that the first statement issues a log switch and the control immediately returns to the user. The user can perform other activities while the log file is being archived at the background. However the second statement will not return the control to the user until the current logfile is archived. It issues a log switch and the user session hangs until the log is archived.
A number of DBAs also confuse with the following statement,
SQL> Alter System Archive Log all;
The above statement will not issue a log switch. It will archive all the non-archived log files. If you have no logfiles that are unarchived, then issuing the above statement returns the error message,
ORA-00271 there are no logs that need archiving.
Thanks
If you like the post vote for me by clicking the following button