Overview of Automatic Storage Management (ASM)
Automatic Storage Management (ASM) simplifies administration of Oracle related files by allowing the administrator to reference disk groups rather than individual disks and files, which are managed by ASM. The ASM functionality is an extention of the Oracle Managed Files (OMF) functionality that also includes striping and mirroring to provide balanced and secure storage. The new ASM functionality can be used in combination with existing raw and cooked file systems, along with OMF and manually managed files.
The ASM functionality is controlled by an ASM instance. This is not a full database instance, just the memory structures and as such is very small and lightweight.
The main components of ASM are disk groups, each of which comprise of several physical disks that are controlled as a single unit. The physical disks are known as ASM disks, while the files that reside on the disks are know as ASM files. The locations and names for the files are controlled by ASM, but user-friendly aliases and directory structures can be defined for ease of reference.
The level of redundancy and the granularity of the striping can be controlled using templates. Default templates are provided for each file type stored by ASM, but additional templates can be defined as needed.
Failure groups are defined within a disk group to support the required level of redundancy. For two-way mirroring you would expect a disk group to contain two failure groups so individual files are written to two locations.
In summary ASM provides the following functionality:
Manages groups of disks, called disk groups.
Manages disk redundancy within a disk group.
Provides near-optimal I/O balancing without any manual tuning.
Enables management of database objects without specifying mount points and filenames.
Supports large files.
Initialization Parameters and ASM Instance Creation
The initialization parameters that are of specific interest for an ASM instance are:
INSTANCE_TYPE - Set to ASM or RDBMS depending on the instance type. The default is RDBMS.
DB_UNIQUE_NAME - Specifies a globally unique name for the database. This defaults to +ASM but must be altered if you intend to run multiple ASM instances.
ASM_POWER_LIMIT -The maximum power for a rebalancing operation on an ASM instance. The valid values range from 1 to 11, with 1 being the default. The higher the limit the more resources are allocated resulting in faster rebalancing operations. This value is also used as the default when the POWER clause is omitted from a rebalance operation.
ASM_DISKGROUPS - The list of disk groups that should be mounted by an ASM instance during instance startup, or by the ALTER DISKGROUP ALL MOUNT statement. ASM configuration changes are automatically reflected in this parameter.
ASM_DISKSTRING - Specifies a value that can be used to limit the disks considered for discovery. Altering the default value may improve the speed of disk group mount time and the speed of adding a disk to a disk group. Changing the parameter to a value which prevents the discovery of already mounted disks results in an error. The default value is NULL allowing all suitable disks to be considered.
Create ASM in PC or Laptop
ASM can be implemented without having expensive additional disks/logical volumes/partition for testing purpose on your laptop/desktop.
All you need is a free space on your hard disk to store your database.
It's much intresting to do in practice than to describe in theory, so let's begin!
1) Creating a dummy disks
In 10gR2 installation, Oracle ships an executable called asmtool, and it can be used to create 'solid' files -solid in the sense that they are filled with zeros, as opposed to being full of empty space. These are the sorts of files ASM demands if it is to treat them as hard disks. The utility is found in the ORACLE_HOME\bin.
E:\>mkdir asmdisks
E:\>cd asmdisks
E:\asmdisks>asmtool -create E:\asmdisks\disk1 1024
E:\asmdisks>asmtool -create E:\asmdisks\disk2 1024
E:\asmdisks>asmtool -create E:\asmdisks\disk3 1024
Now you have 3 disks(dummy) of 1 GB each which can be used to create a ASM disk group.
2) Create ASM instance
a) Configure Cluster Synchronization Servie
Before you can create an ASM instance on 10g Release 2, though, you must first run a script which instantiates the Oracle Cluster Registry and its associated processes & services. That's done by issuing the command:
E:\>E:\oracle\product\10.2.0\db_1\BIN\localconfig reset
Step 1: stopping local CSS stack
Step 2: deleting OCR repository
Step 3: creating new OCR repository
Successfully accumulated necessary OCR keys.
Creating OCR keys for user 'ap\arogyaa', privgrp ''..
Operation successful.
Step 4: creating new CSS service
successfully created local CSS service
successfully reset location of CSS setup
b) Create Init pfile
Open notepad edit the following parameters and save file as "E:\oracle\product\10.2.0\db_1\database\init+ASM.ora"
INSTANCE_TYPE=ASM
DB_UNIQUE_NAME=+ASM
LARGE_POOL_SIZE=8M
ASM_DISKSTRING='E:\asmdisks\*'
_ASM_ALLOW_ONLY_RAW_DISKS=FALSE
c) Create service and password file
oradim will create an ASM instance and start it automatically.
E:\> orapwd file=E:\oracle\product\10.2.0\db_1\database\PWD+ASM.ora password=asm
E:\> oradim -NEW -ASMSID +ASM -STARTMODE auto
3) Create ASM disk group
a) Create asm disk group
SQL> select path, mount_status from v$asm_disk;
PATH MOUNT_S
--------------------------------
E:\ASMDISKS\DISK1 CLOSED
E:\ASMDISKS\DISK3 CLOSED
E:\ASMDISKS\DISK2 CLOSED
SQL> create diskgroup data external redundancy disk
2 'E:\ASMDISKS\DISK1',
3 'E:\ASMDISKS\DISK2',
4* 'E:\ASMDISKS\DISK3';
Diskgroup created.
b) Change PFILE to SPFILE, Add ASM Diskgroup parameter and your all set to go and use ASM.
SQL> create spfile from pfile;
SQL> startup force;
SQL> alter system set asm_diskgroups=data scope=spfile;
SQL> startup force;
SQL> startup force
ASM instance started
Total System Global Area 83886080 bytes
Fixed Size 1247420 bytes
Variable Size 57472836 bytes
ASM Cache 25165824 bytes
ASM diskgroups mounted
SQL>
Now you can go ahead and use your DBCA and create a database and on step 6 of 13, you can use Automatic Storage management as your Filesystem.
Thursday, October 23, 2008
How to send email from Oracle server.
When we configure Oracle E-MAIL notification method through OEM then it is not include notification for DB shutdown or startup events. For these two events we have to configure manually.
Connect sys as sysdba user and run two scripts for install and configure utl_mail package
SQL> conn sys@orcl as sysdba
Enter password:
Connected.
SQL> @c:\oracle\product\10.1.0\db_1\rdbms\admin\utlmail.sql
Package created.
Synonym created.
SQL> @c:\oracle\product\10.1.0\db_1\rdbms\admin\prvtmail.plb;
Package body created.
No errors.
Set SMTP_OUT_SERVER parameter for smtp_exchange_server. This parameter is not modifiable means we have to bounce our database to set this parameter
SQL> alter system set smtp_out_server = 'smtp_exchange_server_name' scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
Grant EXECUTE privs to user which use utl_mail package.
SQL> grant execute on utl_mail to scott;
Grant succeeded.
Create two trigger for startup and shutdown event on database which send us email notification
SQL> create or replace trigger scott.db_shutdown
2 before shutdown on database
3 begin
4 sys.utl_mail.send (
5 sender =>'xyz@xyz.com',
6 recipients =>'xyz@xyz.com',
7 subject => 'Oracle Database DOWN',
8 message => 'May be DB Down ’||
‘ but also contact to DBA for further details. ’
9 );
10 end;
11 /
Trigger created.
SQL> create or replace trigger scott.db_startup
2 after startup on database
3 begin
4 sys.utl_mail.send (
5 sender =>'xyz@xyz.com',
6 recipients =>'xyz@xyz.com',
7 subject => 'Oracle Database UP',
8 message => 'DB OPEN .'
9 );
10 end;
11 /
Trigger created.
Connect sys as sysdba user and run two scripts for install and configure utl_mail package
SQL> conn sys@orcl as sysdba
Enter password:
Connected.
SQL> @c:\oracle\product\10.1.0\db_1\rdbms\admin\utlmail.sql
Package created.
Synonym created.
SQL> @c:\oracle\product\10.1.0\db_1\rdbms\admin\prvtmail.plb;
Package body created.
No errors.
Set SMTP_OUT_SERVER parameter for smtp_exchange_server. This parameter is not modifiable means we have to bounce our database to set this parameter
SQL> alter system set smtp_out_server = 'smtp_exchange_server_name' scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
Grant EXECUTE privs to user which use utl_mail package.
SQL> grant execute on utl_mail to scott;
Grant succeeded.
Create two trigger for startup and shutdown event on database which send us email notification
SQL> create or replace trigger scott.db_shutdown
2 before shutdown on database
3 begin
4 sys.utl_mail.send (
5 sender =>'xyz@xyz.com',
6 recipients =>'xyz@xyz.com',
7 subject => 'Oracle Database DOWN',
8 message => 'May be DB Down ’||
‘ but also contact to DBA for further details. ’
9 );
10 end;
11 /
Trigger created.
SQL> create or replace trigger scott.db_startup
2 after startup on database
3 begin
4 sys.utl_mail.send (
5 sender =>'xyz@xyz.com',
6 recipients =>'xyz@xyz.com',
7 subject => 'Oracle Database UP',
8 message => 'DB OPEN .'
9 );
10 end;
11 /
Trigger created.
How to send email from Oracle server.
When we configure Oracle E-MAIL notification method through OEM then it is not include notification for DB shutdown or startup events. For these two events we have to configure manually.
Connect sys as sysdba user and run two scripts for install and configure utl_mail package
SQL> conn sys@orcl as sysdba
Enter password:
Connected.
SQL> @c:\oracle\product\10.1.0\db_1\rdbms\admin\utlmail.sql
Package created.
Synonym created.
SQL> @c:\oracle\product\10.1.0\db_1\rdbms\admin\prvtmail.plb;
Package body created.
No errors.
Set SMTP_OUT_SERVER parameter for smtp_exchange_server. This parameter is not modifiable means we have to bounce our database to set this parameter
SQL> alter system set smtp_out_server = 'smtp_exchange_server_name' scope=spfile;
System altered.
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
Grant EXECUTE privs to user which use utl_mail package.
SQL> grant execute on utl_mail to scott;
Grant succeeded.
Create two trigger for startup and shutdown event on database which send us email notification
SQL> create or replace trigger scott.db_shutdown
2 before shutdown on database
3 begin
4 sys.utl_mail.send (
5 sender =>'xyz@xyz.com',
6 recipients =>'xyz@xyz.com',
7 subject => 'Oracle Database DOWN',
8 message => 'May be DB Down ’||
‘ but also contact to DBA for further details. ’
9 );
10 end;
11 /
Trigger created.
SQL> create or replace trigger scott.db_startup
2 after startup on database
3 begin
4 sys.utl_mail.send (
5 sender =>'xyz@xyz.com',
6 recipients =>'xyz@xyz.com',
7 subject => 'Oracle Database UP',
8 message => 'DB OPEN .'
9 );
10 end;
11 /
Trigger created.
Wednesday, October 22, 2008
Pre-Install checks for RDBMS
Unix InstallPrep Script
The Unix InstallPrep Script should be run prior to installing the Oracle 8.0.5 to 9.2 DataServer. This script checks for all known items that will cause the install to fail.
Follow these steps to download and run the script:
Change the name of the script to InstallPrep.sh
Ftp the InstallPrep.sh script (in ascii format) to the Unix system that you will be installing the Oracle DataServer on.
Change the permissions of the script to execute for the user running the script:
chmod 777 InstallPrep.sh
Log in as the user that will be installing the Oracle software.
Copy the InstallPrep.sh script to the /tmp directory and run it from this location.
Note: on some Linux platforms you may get the error "bad interpreter", just run the command 'sh InstallPrep.sh' and the try running it. Otherwise, you can try "dos2unix InstallPrep.sh" and then retry it.
Note: on Linux if you get messages like:
'tmp/InstallPrep.sh: line 138: syntax error near unexpected token `in
'tmp/InstallPrep.sh: line 138: `case $OS in
do "dos2unix InstallPrep.sh"
Answer the first few questions, the output from the script will be written to /tmp/InstallPrep.out and the errors written to /tmp/InstallPrep.err.
Resolve any problems found in /tmp/InstallPrep.err and then install the Oracle DataServer software.
Important Note: If you experience difficulties or errors with this script, please do not call Oracle Support or log an iTAR for this issue. Instead, send feedback to RELATED DOCUMENTS
Note 109229.1 UNIX: Quick Start Guide Reference List
Note 169706.1 Oracle RDBMS on AIX,HP-UX,Solaris,Tru64,Linux,MacOSX:Versions, Sizes, Requirements Quick Reference
Note 334563.1 Pre-Install checks for 10gR2 RDBMS (10.2.x) - HPUX Platforms
Note 334562.1 Pre-Install checks for 10gR2 RDBMS (10.2.x) - AIX Platforms
Note 334567.1 Pre-Install checks for 10gR2 RDBMS (10.2.x) - SUN Solaris
Note 283731.1 Pre-install Checks for 10g RDBMS on HPUX Platforms
Note 283743.1 Pre-install Checks for 10g RDBMS on AIX
Note 283747.1 Pre-install Checks for 10g RDBMS on HPUX Itanium Platforms
Note 283748.1 Pre-install Checks for 10g RDBMS on Linux
Note 283749.1 Pre-install Checks for 10g RDBMS on Linux Itanium 64
Note 296665.1 Pre-Install Checks for 10g RDBMS on Linux AMD64/EM64T
Note 283750.1 Pre-install Checks for 10g RDBMS on Sun Solaris
Note 283751.1 Pre-install Checks for 10g RDBMS on Tru64
Note 296661.1 Pre-Install Checks for 10g RDBMS on Apple MAC OS X
The Unix InstallPrep Script should be run prior to installing the Oracle 8.0.5 to 9.2 DataServer. This script checks for all known items that will cause the install to fail.
Follow these steps to download and run the script:
Change the name of the script to InstallPrep.sh
Ftp the InstallPrep.sh script (in ascii format) to the Unix system that you will be installing the Oracle DataServer on.
Change the permissions of the script to execute for the user running the script:
chmod 777 InstallPrep.sh
Log in as the user that will be installing the Oracle software.
Copy the InstallPrep.sh script to the /tmp directory and run it from this location.
Note: on some Linux platforms you may get the error "bad interpreter", just run the command 'sh InstallPrep.sh' and the try running it. Otherwise, you can try "dos2unix InstallPrep.sh" and then retry it.
Note: on Linux if you get messages like:
'tmp/InstallPrep.sh: line 138: syntax error near unexpected token `in
'tmp/InstallPrep.sh: line 138: `case $OS in
do "dos2unix InstallPrep.sh"
Answer the first few questions, the output from the script will be written to /tmp/InstallPrep.out and the errors written to /tmp/InstallPrep.err.
Resolve any problems found in /tmp/InstallPrep.err and then install the Oracle DataServer software.
Important Note: If you experience difficulties or errors with this script, please do not call Oracle Support or log an iTAR for this issue. Instead, send feedback to RELATED DOCUMENTS
Note 109229.1 UNIX: Quick Start Guide Reference List
Note 169706.1 Oracle RDBMS on AIX,HP-UX,Solaris,Tru64,Linux,MacOSX:Versions, Sizes, Requirements Quick Reference
Note 334563.1 Pre-Install checks for 10gR2 RDBMS (10.2.x) - HPUX Platforms
Note 334562.1 Pre-Install checks for 10gR2 RDBMS (10.2.x) - AIX Platforms
Note 334567.1 Pre-Install checks for 10gR2 RDBMS (10.2.x) - SUN Solaris
Note 283731.1 Pre-install Checks for 10g RDBMS on HPUX Platforms
Note 283743.1 Pre-install Checks for 10g RDBMS on AIX
Note 283747.1 Pre-install Checks for 10g RDBMS on HPUX Itanium Platforms
Note 283748.1 Pre-install Checks for 10g RDBMS on Linux
Note 283749.1 Pre-install Checks for 10g RDBMS on Linux Itanium 64
Note 296665.1 Pre-Install Checks for 10g RDBMS on Linux AMD64/EM64T
Note 283750.1 Pre-install Checks for 10g RDBMS on Sun Solaris
Note 283751.1 Pre-install Checks for 10g RDBMS on Tru64
Note 296661.1 Pre-Install Checks for 10g RDBMS on Apple MAC OS X
How to Identify Oracle 64 bit or 32 bit
Oracle Software is 32 bit or 64 bit.
Method 1:
--------------
Go to $ORACLE_HOME/bin and see.
# cd $ORACLE_HOME/bin
# file oracle
oracle: ELF 64-bit LSB executable AMD64 Version 1, dynamically linked, not stripped
Here it comes 64 bit and hence oracle software is 64 bit. If the output of the "file oracle" command does not say 64-bit explicitly then you are running 32-bit Oracle.
If you had 32 bit oracle software installed then output will be like,
oracle@sol:/db/oracle/bin$ file oracle
oracle: setuid setgid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
Method 2:
----------------------
Log on to SQL*plus and see the banner.
-bash-3.00$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.2.0 - Production on Thu May 15 02:50:37 2008
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
Method 3:Query from v$version.
-------------------------------------
sys@THERAP> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
PL/SQL Release 10.2.0.2.0 - Production
CORE 10.2.0.2.0 Production
TNS for Solaris: Version 10.2.0.2.0 - Production
NLSRTL Version 10.2.0.2.0 - Production
Method 4: Check for lib, lib32
--------------------------------------
1) $ORACLE_HOME/lib32
2) $ORACLE_HOME/lib
If the two directories $ORACLE_HOME/lib32 and $ORACLE_HOME/lib are existing then it is 64 bit.
If there is only an ORACLE_HOME/lib directory then it is 32 bit client.
Method 1:
--------------
Go to $ORACLE_HOME/bin and see.
# cd $ORACLE_HOME/bin
# file oracle
oracle: ELF 64-bit LSB executable AMD64 Version 1, dynamically linked, not stripped
Here it comes 64 bit and hence oracle software is 64 bit. If the output of the "file oracle" command does not say 64-bit explicitly then you are running 32-bit Oracle.
If you had 32 bit oracle software installed then output will be like,
oracle@sol:/db/oracle/bin$ file oracle
oracle: setuid setgid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), not stripped
Method 2:
----------------------
Log on to SQL*plus and see the banner.
-bash-3.00$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.2.0 - Production on Thu May 15 02:50:37 2008
Copyright (c) 1982, 2005, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Production
With the Partitioning, OLAP and Data Mining options
Method 3:Query from v$version.
-------------------------------------
sys@THERAP> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
PL/SQL Release 10.2.0.2.0 - Production
CORE 10.2.0.2.0 Production
TNS for Solaris: Version 10.2.0.2.0 - Production
NLSRTL Version 10.2.0.2.0 - Production
Method 4: Check for lib, lib32
--------------------------------------
1) $ORACLE_HOME/lib32
2) $ORACLE_HOME/lib
If the two directories $ORACLE_HOME/lib32 and $ORACLE_HOME/lib are existing then it is 64 bit.
If there is only an ORACLE_HOME/lib directory then it is 32 bit client.
How to Identify OS 64 bit or 32 bit
Check whether OS is 64 bit or 32 bit.
-----------------------------------------
On Solaris,
SQL> !/usr/bin/isainfo -kv
64-bit amd64 kernel modules
SQL> !/usr/bin/isainfo -v
64-bit amd64 applications
cx16 mon sse3 pause sse2 sse fxsr mmx cmov amd_sysc cx8 tsc fpu
32-bit i386 applications
cx16 mon sse3 pause sse2 sse fxsr mmx cmov sep cx8 tsc fpu
This output tells us that solaris operating systems allow co-existence of 32-bit and 64-bit files.
On AIX,
$ getconf -a | grep KERN
$ file /usr/lib/boot/unix*
On Linux,
On HP-UX,
/usr/bin/ getconf KERNEL_BITS
/usr/bin/file /stand/vmunix
Linux:
getconf LONG_BIT
gives 32/64 bit..
though it's common sense that 64 bit os cannot sit on 32 bit proc , x86 in uname -m are indication of 32 bit processor rahter than kernel
On linux,
$uname -a
Linux debian 2.6.18-4-686 #1 SMP Wed May 9 23:03:12 UTC 2007 i686 GNU/Linux
If the output is x86_64 then 64-bit and i686 or similar for 32-bit.
On windows,
Start>All Programs>accessories> System Tools>System Information>look for under System summary.
Or start>run>dixdiag>Then check for WHQL digital signature.
-----------------------------------------
On Solaris,
SQL> !/usr/bin/isainfo -kv
64-bit amd64 kernel modules
SQL> !/usr/bin/isainfo -v
64-bit amd64 applications
cx16 mon sse3 pause sse2 sse fxsr mmx cmov amd_sysc cx8 tsc fpu
32-bit i386 applications
cx16 mon sse3 pause sse2 sse fxsr mmx cmov sep cx8 tsc fpu
This output tells us that solaris operating systems allow co-existence of 32-bit and 64-bit files.
On AIX,
$ getconf -a | grep KERN
$ file /usr/lib/boot/unix*
On Linux,
On HP-UX,
/usr/bin/ getconf KERNEL_BITS
/usr/bin/file /stand/vmunix
Linux:
getconf LONG_BIT
gives 32/64 bit..
though it's common sense that 64 bit os cannot sit on 32 bit proc , x86 in uname -m are indication of 32 bit processor rahter than kernel
On linux,
$uname -a
Linux debian 2.6.18-4-686 #1 SMP Wed May 9 23:03:12 UTC 2007 i686 GNU/Linux
If the output is x86_64 then 64-bit and i686 or similar for 32-bit.
On windows,
Start>All Programs>accessories> System Tools>System Information>look for under System summary.
Or start>run>dixdiag>Then check for WHQL digital signature.
Subscribe to:
Posts (Atom)