Category Archives: ASM

Oracle 12c – Administer ASM

Oracle Automatic Storage Management (ASM) is a storage solution for Oracle that acts as a volume manager providing file system for exclusive use of the database.  When using ASM partitioned disks are assigned to ASM for striping, mirroring, management and ASM implements OMF.   ASM has its own database instance which is specifically designed to manage the disks and distribute I/O for performance.   The benefits of using ASM are:

  1. Simplifies operations by creating database and managing disk space.
  2. Distributes data across physical disks to provide uniform performance.
  3. Rebalance data automatically after storage change.

An ASM instance uses same basic instance as Oracle database instance with a few exceptions.  SGA of ASM is much smaller because it performs fewer activities.   Only function of ASM is to mount disk groups and make associate files available to database instances.  The logical storage elements of an Oracle ASM instance:

  • ASM Disks – Storage devices can be physical disks or LUN (Logical Unit Number) from array or network attached file.
  • ASM Disk Group – Group of ASM Disks managed as a logical unit.
  • ASM Files – File stored in an Oracle ASM disk group can be data files, control files, online redo logs, other types of files.
  • ASM Extents – Raw storage used to hold contents of Oracle ASM file. ASM file is one or more file extents and ASM extent is one or more ASM allocation units.
  • ASM Allocation Units – smallest unit of allocation within a disk group.
  • ASM Instance – special oracle instance to manage ASM disks. Manages metadata and provides access to database instances.

The files that an ASM instance support are:   NOTE ASM does not support trace files, audit files, alert logs, export files, or core files.

  1. Control Files.
  2. Data files
  3. Redo log files
  4. Archive log files.
  5. Temporary files.
  6. Data file backup pieces
  7. Archive log backup pieces.
  8. Persistent initialization parameter files (SPFILE)
  9. Flashback logs
  10. Data Pump dumpset

The file naming conventions in an ASM instance include Fully Qualified Name, Individual Element Names and Alias Names.   A Fully qualified file name is created when a new ASM file is created and gives a complete path name in the ASM file system.   You use the filly qualified file name for existing Oracle ASM files, except for disk group creation.    They have the following format:

 

+diskgroup/dbname/filetype/filetypetag.file.incarnation

 

An individual element Name is the name of a single file in the ASM instance.   The breakdown of Individual elements of file name includes:

 

  • +diskgroup – the disk group name preceded by a plus sign. plus sign(+) means root directory of ASM instance.
  • dbname – DB_UNIQUE_NAME of database owning file.
  • filetype – Oracle file type.
  • filetypetag – Type specific info about the file.
  • incarnation – file/incarnation pair ensure uniqueness.

 

Example of ASM filename.

 

+data/orcl_db/controlfile/current.1234.1234221

 

File creation request do not give full name, it gives alias or disk group name.   If Alias is given, the ASM instance will create it and point at full name.  ASM can take single or multiple file create requests at the same time.

Aliases can be used to reference existing ASM file or create new ones.  Alias name consist of a Disk Group name proceeded by a plus sign (+), a slash (/), and a sting of characters.  Aliases must include the Disk Group name.  They cannot exist in root (+) level.  When a file is created with alias, both are recorded by ASM and you can access by both.  Alias names cannot end in dotted pair of numbers.  Example of Alias names

 

  • +data/orcldb/control_file_main
  • +data/orcldb/control_file_backup
  • +flashback/recover/backup1.dbf

 

Example of tablespace datafile creation with alias name:

 

Create tablespace data_one   datafile ‘+data/orcldb/data_01.dbf’ size 100m;

 

If an alias is used, it is not an OMF file and will not be automatically deleted when tablespace is dropped.    You must manually delete it as shown below.

 

Alter diskgroup data drop file ‘+data/orcldb/data_01.dbf’;

 

 

 

Larry Catt

OCP

Oracle 12c – Manage ASM instance

This article covers the basic management of an ASM instance for database storage.

 

Starting an ASM Instance

  1. You must set the ORACLE_SID variable to ASM SID.
  2. Default ASM SID is +ASM and for RAC is +ASM{node number}.
  3. The ORACLE_HOME variable must be set to Grid infrastructure home where Oracle ASM is installed.
  4. Initialization parameter file must contain text: INSTANCE_TYPE = ASM
  5. When you run STARTUP command, the ASM instance mounst the ASM disk groups.

 

ASM SQL*plus STARTUP command is options interpreted as:

  1. FORCE – Issues SHUTDOWN ABORT to ASM instance before restarting it.
  2. MOUNT or OPEN – Mounts the diskgroups in init parameter ASM_DISKGROUPS. This is the default.   An OPEN state for ASM instance really does not exist, if supplied it is treated as MOUNT.
  3. NOMOUNT – Starts ASM Instance without mounting diskgroups.
  4. RESTRICT – Starts up an instance in restricted mode. Have to have both CREATE SESSION and RESTRICTED SESSION privileges to connect.

 

SYSASM database and OSASM OS privileges gives storage permissions with granting high-level to database itself.  Users can be created in ASM instance and given SYSASM privilege.  OSASM system privilege does same at OS layer.

 

Example of creating a user with SYSASM to new user:

 

$ export ORACLE_SID = + ASM

$ sqlplus / as sysasm

 

CREATE USER asm_admin IDENTIFIED by badpassword_nobiscuit;

User created.

SQL > GRANT SYSASM TO asm_admin;

 

SQLPLUS /NOLOG

SQL > CONNECT asm_admin AS SYSASM

Enter password: badpassword_nobiscuit

Connected to an idle instance.

 

SQL > STARTUP

ASM instance started

Total System Global Area 71303168 bytes

Fixed Size 1069292 bytes

Variable Size 45068052 bytes

ASM Cache 25165824 bytes

ASM disk groups mounted

 

 

Shutting Down an Oracle ASM Instance.

  1. ASM instance uses the SQL*Plus shutdown command and you must set the ORACLE_SID variable to ASM SID.
  2. Before shutting down an ASM instance you should shutdown all databases using it, if not they will be shutdown with abort option upon ASM shutdown.
  3. Before shutting down an ASM instance you should dismount all Dynamic Volume Manager volumes.
  4. example of shutdown.

 

SQLPLUS /NOLOG

SQL>  CONNECT asm_user as sysasm

Enter password: *******

Connected.

SQL> SHUTDOWN NORMAL

 

 

SHUTDOWN Options in ASM:

  1. NORMAL – instance waits for all in-progress SQL to complete, dismounts disk groups and shuts down. Instance also waits for all currently connected users to disconnect from instance.  Any database instance connected, will cause the command to return an error and will not shutdown.   NORMAL is default shutdown.
  2. IMMEDIATE or TRANSACTIONAL – instance waits for all in-progress SQL to complete before dismounting all disk groups and shutting down ASM instance. It does not wait for current users to disconnect.  If any database instances are connected to ASM, will cause the command to return an error and will not shutdown.
  3. ABORT – ASM immediately shuts down without dismounting disk groups. This will cause recovery on next ASM startup.  All databases connected to ASM instance will also perform shutdown abort.

 

 

Larry Catt

OCP

Oracle 12c – Manage ASM disks and disk groups

An ASM disk group consists of multiple disks and is the base object ASM manages.  Disk Groups contain information for ASM to manage drive space.  Sub-components of a Disk Group are Disks, files, and allocation units.  A disk group can contain files from several different databases and a single database can use files from multiple disk groups.

Disk Group attributes are parameters that belong to disk group and not the ASM instance.  Common ASM disk group attributes are:

  • ENABLED – Can be TRUE or FALSE – determines if access control is possible. Default is false and have to use alter disk group to change.
  • UMASK – determine the permission mask on created oracle ASM user file. Permission for owner, users in same user group, and users not in users group.  Applies to all files on a disk group.
  • AU_SIZE – File extent consists of one or more allocation units. Oracle ASM file consists of one or more file extents.   When creating disk group, you can set the Oracle ASM allocation unit size, value can be 1, 2, 4, 8,16,32,64 MB, depending on the specific disk group compatibility level.
  • ASM – The attribute defines the version used. ASM version must be greater or equal to COMPATIBLE.RDBS version to access disks.  If COMPATIBLE.ASM is 11.0 any database instance with version of 10.1 or higher can access, but to manage disk group it must be 11 or higher.
  • RDBMS – controls the format of message between ASM instance and database instance. Defines the minimum database client release that can access a disk group.
  • TYPE – Id disk group type: data, recovery, or system. Determines the distance to nearest neighbor disk in failure group mirror.   Default is data giving value of 1, recovery – 3, and system – 5 to nearest disk group.
  • DISK_REPAIR_TIME – Amount of time a disk can be unavailable to failure before it is dropped from disk group.  To use both COMPATIBLE.ASM and COMPATIBLE.RDBMS must be set to 11.1 or higher.  Cannot set during disk group creation, but use ALTER DISKGROUP… SET ATTRIBUTE.    Default is 3.6 hours.  If either ASM or RDBMS are set to less then 11.1, disk is immediately dropped from disk group.

 

CREATE DISKGROUP SQL command is used to create diskgroups and specifies the following:

  1. Unique diskgroup name.
  2. Redundancy level:
    1. NORMAL REDUNDANCY – 2 way mirroring is the default
    2. HIGH REDUNDANCY – 3 way mirroring
    3. EXTENAL REDUNDANCY – no mirroring
  3. Disks to format for diskgroup.
  4. Optional – specify disk to specific failure groups.
  5. Optional – specify type of failure group.
  6. Optional – specify diskgroup attributes software compatibility or allocation unit size.

 

Example:

CREATE DISKGROUP data NORMAL REDUNDANCY

FAILGROUP fg1

DISK ‘/u01/ diska1’ NAME diska1,

‘/u01/ diska2’ NAME diska2,

‘/u01/ diska3’ NAME diska3

FAILGROUP fg2

DISK ‘/u01/ diskb1’ NAME diskb1,

‘/u01/ diskb2’ NAME diskb2,

‘/u01/ diskb3’ NAME diskb3

ATTRIBUTE ‘au_size’ =’ 2M’, ‘compatible.asm’ = ‘11.2’, ‘compatible.rdbms’ = ‘11.2’;

 

The ALTER DISKGROUP SQL statement enables you to alter a disk group configuration. It is possible to add, resize, or drop disks while the database remains online. Multiple operations in a single ALTER DISKGROUP statement are both possible and recommended. Grouping operations in a single ALTER DISKGROUP statement can reduce rebalancing operations. Oracle ASM automatically rebalances a disk group when its configuration changes. The V$ASM_OPERATION view allows you to monitor the status of rebalance operations. The following command adds two more disks to the data diskgroup.

 

ALTER DISKGROUP data ADD DISK ‘/u01/ diska4’ NAME diska4, ‘/u01/ diska5’ NAME diska5;

 

When rebalancing a disk group, if the POWER clause is not specified in an ALTER DISKGROUP statement, or if a rebalance is executed implicitly because a disk has been added or dropped, the ASM_POWER_LIMIT initialization parameter determines the power used. The value of this parameter can be adjusted dynamically. Higher power values will cause a rebalance operation to complete faster, but consumes more processing and I/ O resources. The default value of 1 minimizes disruption to other applications.

 

 

Larry Catt

OCP

Oracle DBCA – Database Configuration assistant.

Oracle provides several Configuration Assistant tools to facility administrative duties required by an Oracle DBA or Developer. The Oracle’s DBCA (Database Configuration Assistant) is the GUI tool used to create starter databases within the Oracle RDBMS. The DBCA utility was introduced in Oracle 8i and provides the user a GUI to eliminate the need for manual configuration of database creation scripts. In this article we will review the startup of the Database Configuration Assistant within a RHEL environment.

1. Logon to your Oracle Database server as the Oracle software owner.
2. Change directories to your $ORACLE_HOME/bin.

mylinux:> cd $ORACLE_HOME/bin
mylinux:>

3. Export your display to your local machine if you are not logon to the server itself.

mylinux:> export DISPLAY=192.168.0.110:0.0
mylinux:>

4. You will require a terminal emulation program executing on your local machine to produce the display from your database server. Any terminal display software will do, however I would suggest VNC which can be downloaded for free at the URL: www.realvnc.com

5. Execute the dbca shell script to startup the database configuration assistant.

mylinux:> ./dbca

6. The Welcome screen will display and the wizard from here on is pretty self explanatory. The DBCA utility provides you the ability to Create Databases, Configure Database Options, Delete Databases, Manage Database Templates, and Configure ASM instances for storage.

Larry J. Catt, OCP 9i, 10g
oracle@allcompute.com
www.allcompute.com

Senior-Level DBA Interview Question:

With well over a decade of Oracle experience from version 6 to 11g, I have had my share of interviewing prospective DBA employees in a range from Junior to Senior DBAs. Needless to say in this field, technical competence is the key to any new hire and early on I made the blunder of not asking the write questions during the interview. I am sure every senior person or manager has made this mistake and had to deal with either training the person from scratch or letting them go. Either of these options is not desirable in our fast past business world. So, I decided to write a couple of articles which cover what I believe a Junior, Mid, and Senior Oracle DBA should know to fill their prospective positions.

In this article we will cover what a Senior Level DBA should know to be successful. If you have any comments or questions, please email me at larry.catt@relidb.com.

Questions: NOTE: Answers here can be very broad, however they not always wrong. That is why it is important to have a proven DBA on staff or one you can call to review the answers. I have seen very inventive ways to get around the most impossible tasks and while they do not actually meet the standard way of doing the work, I would not count these people out. A person whom thinks outside of the box is very valuable in IT and believe it or not, some of the best DBA’s I have ever met thought completely outside the box, however always accomplished the task.

1. You have a brand new Solaris Machine, freshly built by the SA, with all Oracle RDBMS recommended patching and Kernel Parameters set. Please give the order of tasks to install Oracle up to its latest CPU?

2. You have just moved Oracle Binary files from an ORACLE_HOME on one server to another server. What is the oracle utility command you would use to make this new ORACLE_HOME usable?

3. Tell me why just copying the oracle datafiles from HP-UX to LINUX RHEL and starting the database would not work?

4. In what months does Oracle release CPU patches and what is the utility to apply them.

5. You need to shutdown the oracle database but it will not shutdown with SHUTDOWN IMMEDIATE. How will you shutdown the database?

6. How do you logon to Oracle server without knowing any oracle passwords?

7. How would you determine that SCATTERED READ where occuring?

8. How would you see the SQL of the currently active sessions from a command prompt?

9. When having multiple oracle homes on a single server or client what is the parameter that points all Oracle installs at one TNSNAMES.ORA file.

10. You have ASM database that used by three production systems. The server which the ASM database is shutdown. What happens to the production RDBMS?

Answers:

1. You have a brand new Solaris Machine, freshly built by the SA, with all Oracle RDBMS recommended patching and Kernel Parameters set. Please give the order of tasks to install Oracle up to its latest CPU?

– Verify that all patches are installed and kernel parameters set.(Some not all SA say the system is ready when it is not. You can save yourself a lot of problems by double checking)
– Configuration of .profile or .bash_profile for the Oracle owner.
– Base Installation of Oracle (ie what to get to 10.2.0.4 must install Oracle 10.1 first).
– Upgrade to Oracle Version Desired.
– Upgrade the database(if upgrade is necessary)
– Run UTLRP.SQL.
– Apply lastest CPU patch.
– Run UTLRP.SQL.
– Configuration of Listener.
– Configuration of client TNSNAMES.ORA file.

2. You have just moved Oracle Binary files from an ORACLE_HOME on one server to another server. What is the oracle utility command you would use to make this new ORACLE_HOME usable?

Solution:
Relink all

3. Tell me why just copying the oracle datafiles from HP-UX to LINUX RHEL and starting the database would not work?

Solution:
Differing Indian codes.

4. In what months does Oracle release CPU patches and what is the utility to apply them.

Solution:
JAN, APR, JUL, OCT

5. You need to shutdown the oracle database but it will not shutdown with SHUTDOWN IMMEDIATE. How will you shutdown the database?

Solution:
Kill the smon process.

6. How do you logon to Oracle server without knowing any oracle passwords?

Solution:
Sudo to the Oracle software owners account and logon with the command sqlplus ‘/ as sysdba’

7. How would you determine that SCATTERED READ where?
Solution:

Look in the views v$session_wait or v$session_wait_history.

Could give:

Statspack or EM report.

8. How would you see the SQL of the currently active sessions from a command prompt?

Solution:
Compare tables V$SQL view by sql_address with V$SESSION view of currently active sessions.

9. When having multiple oracle homes on a single server or client what is the parameter that points all Oracle installs at one TNSNAMES.ORA file.

Solution:
TNS_ADMIN

10. You have ASM database that used by three production systems. The server which the ASM database is shutdown. What happens to the production RDBMS?

Solution:
Other database would shutdown abort.

Larry Catt, OCP 9i, 10g
oracle@allcompute.com
www.allcompute.com

ASM with RAW Disks will not start after reboot

ASM (Automatic Storage Management) instances for the storage of database files have become a very popular option in the database world since the release of ORACLE 10g. However, there exist several administration concerns over ASM, which the DBA must take into consideration. This article covers the problem of ASM instance not starting after a reboot of a Linux server and applies to most Unix systems while using RAW Disks.

Error: ORA-15042: ASM disk is missing.

Reason: This error is caused by the RAW device being removed from the OS, corrupted, or/and most likely, not owned by the ORACLE user.

1. Verify that the ASM disk exists.

[root@mylinux1 /]# cd /dev/raw
[root@mylinux1 /dev/raw]# ls
/dev/raw/raw1
/dev/raw/raw2
/dev/raw/raw3
[root@mylinux1 u06]#

2. Check the ownership of the disks.

[root@mylinux1 /]# cd /dev/raw
[root@mylinux1 /dev/raw]# ls –la
-rw-r–r– 1 root root 2 Sep 2 08:33 raw1
-rw-r–r– 1 root root 2 Sep 2 08:33 raw2
-rw-r–r– 1 root root 2 Sep 2 08:34 raw3
[root@mylinux1 /dev/raw]#

NOTE: These raw devices are now owned by ROOT after the reboot, thus ORACLE does not have access.

3. On most UNIX systems you will see that the ownership of RAW devices is reset to ROOT after reboot. To correct this behavior, enter the following code into your init process before the Oracle database startup scripts are executed.

chown oracle:dba /dev/raw/raw1
chown oracle:dba /dev/raw/raw2
chown oracle:dba /dev/raw/raw3

Larry J Catt, OCP
oracle@allcompute.com
www.allcompute.com

CRS setup for ORACLE 10g ASM instance

In order for ASM and RAC to work properly the CRS (Cluster Ready Service) must first be configured. This procedure outlines the configuration of CRS in a Linux environment.

1. Logon to Linux server as the root user.

2. Verify that the correct support packages are installed.

[root@mylinux_1 RPMS]# ls compat-libstdc++*
compat-libstdc++-296-2.96-132.7.2.i386.rpm

3. NOTE: depending on your OS you may require a different version or bit setting of this package. I am running x86_64 system so I will install the newest compat-listdc++ package for this system.

[root@mylinux_1 RPMS]# rpm -i compat-libstdc++-33-3.2.3-47.3.x86_64.rpm
[root@mylinux_1 RPMS]#

4. As the ROOT user navigate to the directory $ORACLE_HOME/bin. Execute the command ./localconfig add. The localconfig command cannot be run as the ORACLE user.

[root@mylinux_1 bin]# ./localconfig add
Successfully accumulated necessary OCR keys.
Creating OCR keys for user ‘root’, privgrp ‘root’..
Operation successful.
Configuration for local CSS has been initialized

Adding to inittab
Startup will be queued to init within 30 seconds.
Checking the status of new Oracle init process…
Expecting the CRS daemons to be up within 600 seconds.
CSS is active on these nodes.
mylinux_1
CSS is active on all nodes.
Oracle CSS service is installed and running under init(1M)
[root@mylinux_1 bin]#

5. If CRS fails to install you must back out the files created with the command ./localconfig delete. Most likely the failure has occurred due to missing support packages. Verify that all packages suggested by Oracle Corporation for your OS and product version exist. You can find this listing at www.oracle.com/technology/index.html.

Larry Catt, OCP
oracle@allcompute.com
www.allcompute.com