Saturday, December 19, 2009

Add Disk to Diskgroup

Note: Adding new disks to diskgroup invokes implicit rebalancing of all the disks within the 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

Instance: ASM Instance
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

Instance: ASM Instance.
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

In the last part2 we discussed ASM installation. In this part we will see the RDBMS installation.

Step 1: Invoke the OUI. Select the Advanced installation option and then click Next.
Step 2: Select the installation type for eg., Enterprise, standard edition etc.
Step 3: Specify the Oracle Home details. Choose a different path from ASM home.



Step 4: In the next page select the option to create the database.



Step 5: Specify a Database Name. Choose the character set.


Step 6: Select Database control for Database Management.


Step 7: In the select database storage option page, select ASM.


Step 8: In the next page click the option that best matches your requirement.


Step 9: Select the ASM Disk Group.

If the space available is not enough it will show the following screen.

Select the disks so that the required space is available. Click Next

Step 10: Click Install.






Click Exit.
The oracle RDBMS is installed.


Thanks

Install Oracle 10g on Windows XP - Part 2

In this part we will see the ASM installation and ASM instance Creation.

Step 1: Invoke the Oracle Universal Installer. In the Welcome Screen select Advanced Installation and click Next button.


Step 2: In the Select Installation Type, select the appropriate choice. In our case we select Standard Edition.


Step 3: Specify the ASM Home details.


Click Next.


Step 4: Check for any errors and correct it if any. Click Next.


Step 5: Choose the Configure Automatic Storage Management option and specify the SYS password. Click Next.


Step 6: In the next screen do the following,
  1. Specify the Disk Group name.
  2. Choose the redundancy type.
  3. Select the candidate disks you want to assign for this disk group.

Note: You must have stamped the disks before to make Oracle recognize the disks. If you have not stamped the disks already, click the stamp disks button to invoke the asmtool utility. You can then stamp the disks as shown in the Stamp disks section in the part 1.


Click Next


Step 7: Click Install.





Click the Exit button. The ASM installation is completed.

Note: You can use the DBCA to create addition disk groups.

Click Here for Part 1

Click Here for Part 3

Thanks

Wednesday, December 9, 2009

Install Oracle 10g on Windows XP using ASM - Part 1

Hardware Requirements

RAM - 256MB Minimum. 512 MB Recommended
Virtual Memory - 512 MB to 1 GB
Disk Space - 2.5 GB Minimum

Software Requirements

System Architecture - Processor: Intel X86, AMD 64 and Intel EM64T
Operating System - Windows XP Professional, Windows 2000

Install Loopback Adapter

If you are installing Oracle Database on a DHCP computer or on a Non-Networked Computer, then you may want to install Loopback Adapter. The Loopback adapter and the local IP address simulate a networked computer. If the Computer is connected to a network then this step may be ignored.

Click Here for the steps to install loopback adapter.

Preparing Diskgroups for Automatic Storage Management

Step 1: Create Disk Partitions

For this sample installation I use only one Disk and create logical partitions on it. For production implementation create a primary partition on each disk.


To create partitions,
C:\> Diskpart
DISKPART> list disk
DISKPART> Select disk 0

To create a logical partition, the size is in MB.
DISKPART> Create partition logical size=1024

To create a primary partition , the size is in MB
DISKPART> Create partition primary size=1024

To view the partitions created
DISKPART> List partition

Repeat for other disks

The created volumes must be unformatted, that is, the Fs column must be blank in the following command. In the following output NTFS indicates NT File system and hence cannot be used as ASM disk.

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.

Click Here for Part 2

Click Here for Part 3

Thanks

Wednesday, November 25, 2009

ASMCMD

In this post I will provide you with some commonly used ASM commands and how to use it to perform some day to day activities.

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

Top Blogs

Friday, November 6, 2009

ASMLIB

ASMLIB is a storage management interface. ASMLIB is not required for ASM to function; it is an add-on library that simplifies the tasks of managing and discovering the disks.

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 Rebalance operation provides an even distribution of file extents across all disks in the diskgroup. The rebalance is done on each file to ensure balanced I/O load.

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

Top Blogs

Wednesday, November 4, 2009

ASM redundancy and Failure Groups

A Failure group is a collection of disks that can become unavailable due to failure of one of its associated components (controllers, HBAs, Fiber channel switches, Disks, Entire arrays etc).

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

Top Blogs

Tuesday, November 3, 2009

ASM Templates

A template is a collection of file attributes that are applied to the ASM files. It is associated with a Disk Group. Whenever a file is created the file attributes specific to the template are applied to the files. For eg., if we want to create a users tablespace that contains data file we use the DATAFILE template.

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

Top Blogs

ASM Files

ASM Files are named using OFA standard and employs OMF for managing files for example when you drop a tablespace ASM will automatically deletes the files associated with the tablespace. Also I need not specify a file name while creating a data file, ASM will automatically assign a unique name.

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

Top Blogs

Monday, November 2, 2009

ASM Background Processes

Like normal database instances ASM instance too have the usual background processes like SMON, PMON, DBWr, CKPT and LGWr. In addition to that the ASM instance also have the following 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

Top Blogs

Sunday, November 1, 2009

ASM Instance

ASM instance is a special kind of Oracle Instance which has only SGA and Background process and no Physical Files except parameter file. It manages the disk group activity. Each server has an ASM instance that manages the disk groups for that server. If the server has more than one database a single ASM instance can manage the disk group for all the databases. In an RAC configuration each node has a separate ASM instance that manages disk groups for that node.

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

Top Blogs

Automatic Storage Management

What is 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.

Top Blogs

Sunday, October 11, 2009

Force Log Switches

You can force the log switches using the following statements,

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

Top Blogs

Followers

Powered By Blogger
 

Oracle Database Administration. Copyright 2008 All Rights Reserved Revolution Two Church theme by Brian Gardner Converted into Blogger Template by Bloganol dot com