Oracle Database Experts

By Charles Kim

September 11th, 2009

ASMCA Command-line Interface

In another post, we learned how to exploit all the ASMCA GUI features. asmca can be invoked with the -silent option and can effectively become a great command line interface.

You can create disk groups with the ASMCA configuration tool (ASMCA) or asmcmd command line interface as shown in this blog entry:
New ways to create disk groups in Oracle Database 11g Release 2

Another useful Oracle Database 11g Release 2 feature is the capability to add disk(s) to an existing disk group using asmca. In our example, we will add ORCL:DATA3 ASMLIB disk to the DATA diskgroup. Before we add the disk group, let’s look at the disks that make up the DATA disk group:

[oracle@jin1 ~]$ asmcmd lsdsk -G data
Path
ORCL:DATA1
ORCL:DATA2

Adding disks to an existing disk group:

Now, using ASM configuration assistant, let’s add a disk to the DATA disk group:

[oracle@jin1 ~]$ asmca -silent -adddisk -diskgroupname DATA -disk 'ORCL:DATA3'

Disks added successfully to diskgroup DATA

Let’s confirm that ORCL:DATA3 disk is added:

[oracle@jin1 ~]$ asmcmd lsdsk -G data
Path
ORCL:DATA1
ORCL:DATA2
ORCL:DATA3

Create ASM Volumes with asmca

You can leverage asmca to create volumes out of existing disk groups. Once you create volumes, you can use them to create ASM cluster file systesm. Let’s go through the process of creating a volume of the DATA disk group and creating an ASM cluster file system and mounting the file system for end users.

[oracle@jin1 tmp]$ ksh cr_asmca_volume.txt 

Volume vol_lob created successfully.

The contents of the file cr_asmca_volume.txt looks like this:

[oracle@jin1 tmp]$ cat cr_asmca_volume.txt
asmca -silent \
      -createVolume \
      -volumeName vol_lob \
      -volumeDiskGroup LOBDATA \
      -volumeSizeGB 4

Listing the /dev/asm directory, you can see that our volume that was create is vol_lob-484:

[oracle@jin1 tmp]$ ls -ltr /dev/asm
total 0
brwxrwx--- 1 root oinstall 252, 174081 Sep  9 00:45 vol_rpts-340
brwxrwx--- 1 root oinstall 252, 174082 Sep 11 06:58 vol_logfile-340
brwxrwx--- 1 root oinstall 252, 247809 Sep 12 13:29 vol_lob-484

Create ASM cluster file system (ACFS) with asmca

Using the vol_lob-484 volume, let’s create an ACFS file system:

[oracle@jin1 tmp]$ asmca -silent -createACFS -acfsVolumeDevice /dev/asm/vol_lob-484

ACFS creation on /dev/asm/vol_lob-484 completed successfully.
The ACFS should be mounted for use.

For the final step, login as root and mount the ASM file system:

[root@jin1 acfsmounts]# pwd
/apps/oracle/acfsmounts
[root@jin1 acfsmounts]# mkdir lobdata
[root@jin1 acfsmounts]# mount -t acfs /dev/asm/vol_lob-484 /apps/oracle/acfsmounts/lobdata

Verify that the newly created file system is mounted:

[root@jin1 acfsmounts]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      122G   11G  106G   9% /
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 1.1G  154M  874M  15% /dev/shm
.host:/               163G  149G   15G  91% /mnt/hgfs
/dev/asm/vol_rpts-340
                      5.0G   49M  5.0G   1% /apps/oracle/acfsmounts/data_vol_rpts
/dev/asm/vol_logfile-340
                      3.0G  221M  2.8G   8% /apps/oracle/acfsmounts/data_vol_logfile
/dev/asm/vol_lob-484  4.0G   45M  4.0G   2% /apps/oracle/acfsmounts/lobdata

Posted by Charles Kim, Oracle ACE

September 11th, 2009

Maintaining ASM Volumes and Cluster File Systems in Oracle Database 11g Release 2

Earlier we created an ASM Volume and created Cluster File System. Let’s continue where we left off and do some maintenance.

From the ASM Cluster File System main screen (Click on the ASM Cluster File System Tab), we will click on the VOL_LOGFILE volume URL to see volume related information:
Picture 132.png

Click on the Edit button to edit the current volume:

Picture 133.png

From the Edit Volume screen, click on the URL next to the Size Field. You will be redirected to the Resize ASM Cluster File System screen:

Picture 135.png

Let’s change the size from 2 GB to 3GB and click on the show command to see what commands EM will submit do to resize the file system:

Show Command

/sbin/acfsutil size 3G /apps/oracle/acfsmounts/data_vol_logfile

The acfsutil above will resize the file system and resize the volume at the same time.

Click on Return to go back to the Resize ASM Cluster File System screen
Click on the OK button
Again, you will be prompted to provide ASM Cluster File System Host Credentials if you have not saved your credentials as a preferred credential yet.
Enter your username credentials and click on Continue
When the task is complete, you will be routed to the ASM Cluster File System: /apps/oracle/acfsmounts/data_vol_logfile screen
(You may see a screen stating that the no monitoring data has been collected for this ASM Cluster File system.)
Click on the ASM Cluster File System breadcrumb URL
In the ASM Cluster File System main screen, you will see the changed size for the /apps/oracle/acfsmounts/data_vol_logfile file system.

From the ASM Cluster File System main screen, you will see buttons to Delete the mount point, to view the contents of the file system, register/deregister a file system, mount all and dismount all file systems. You will also notice that the actions drop list has the functions to resize an existing file system and to check and repair a file system. In order to perform a check and repair function, the file system must be dismounted.

Picture 137.png

Let’s go an dismount a file system:
Click on the radio button of the file system that you want to dismount
Picture 120.png
You will see the Dismount ASM Cluster File System screen. As you can guess, Enterprise Manager only generates the syntax that need to be executed by someone with root privileges (or sudo). Click on the Return button to go back to the ASM Cluster File System main page.

Posted by Charles Kim, Oracle ACE

September 11th, 2009

Creating ASM Volumes and Cluster File Systems with Enterprise Mangers in 11g Release 2

Earlier in another blog post, I wrote on the subtle differences in how to start Enterprise Manager Database Control (dbconsole) in Oracle Database 11g Release 2

Let’s login to the EM Database Control. Your URL to login should be something like this:

https://jin1:1158/em

Scroll to the bottom of the screen to the instances section. You will see the database and ASM instance information as shown here:
Picture 107.png

Click on the +ASM1_[HOSTNAME] instance URL
The Automatic Storage Management Home page now includes sections for ASM Clustered File Systems (ACFS) and Volumes.

Picture 108.png

You will also notice a new tab dedicated to support the new ASM Cluster File System feature. The ASM Cluster File System tab will simplify your ability to create volumes, create cluster file systems and ACFS snapshots. In this blog post, we will only cover creating volumes and ASM cluster file systems.

Oracle ASM Dynamic Volume Manager (Oracle ADVM)

The new Oracle ASM Dynamic Volume Manager (Oracle ADVM) provides volume management services and a standard disk device driver interface. A volume device is constructed from an ASM volume. You can create one or more volumes devices within a disk group. Once you create a volume, you can create a file system using that volume. You can create an ASM cluster file system off of the ASM volume. Likewise, you can create an EXT3 or OCFS2 file system based on the ASM volume. Likewise, as Oracle ports ACFS to other Unix Platforms, you can create the OS native file systems using Oracle ASM disk group volumes. Oracle ACFS is layered on ASM through the ADVM interface.

Note:
Creating an OCFS2 file system on top of ASM Disk Group does not make sense, but it is do-able.

Requirements for ADVM
1. COMPATIBLE.ASM and COMPATIBLE.ADVM attributes must be set to 11.2.
2. Volume name can be a maximum of 11 alphanumeric characters (no dashes and first character must be alphabetic)

Let’s click on the new ASM Cluster File System tab and create ourselves an ASM Cluster File System.

You will see the following screen:
Picture 110.png

Notice that we already created the VOL_RPTS volume that is already mounted as /apps/oracle/acfsmounts/data_vol_rpts mount point. Let’s create a new volume and mount another file system. To start this process, click on the Create button on the right corner. You will be directed to the Create ASM Cluster File System screen. Before we can create an ASM Cluster File System, we must first create a volume. Click on the the Create ASM Volume button. From the Create ASM Volume screen,
Picture 111.png
Enter the values for Volume, Data Group, and Size.

Notice the size can be specified in MB, GB and TB.
If you want to see the SQL, click on the Show Command button
Picture 112.png
Click on the Return button to go back to the Create ASM Cluster File System Screen
You will notice that the Volume Device field is populated with the new Volume that you just created
Specify a label (optional) if you want and specify a Mount Point

Picture 113.png
Again, click on the Show Command button

Picture 115.png
Click on the Return button to back to the Create ASM Cluster File System screen
Click on the OK button to create the ACFS file system
You will be requested to enter OS credentials – This operating system user name and password will be used to perform ASM Cluster File System operations on this host.

You will receive a confirmation status on top of the screen indicating that the file system was successfully created:
Picture 116.png

Next, click on the VOL_LOGFILE Volume radio button and click on the Mount button on the top left portion of the screen. You will be routed to the Mount ASM Cluster File System: [VOLUME_NAME] screen.
Picture 117.png

Unfortunately, you will not be able to mount the file system from Enterprise Manager. Only thing you will be able to do is generate the command and ask your system administrator to mount the file system.
Picture 118.png

As the root user, issue the mount command shown from this screen.

[root@jin1 oracle]# /bin/mount -t acfs /dev/asm/vol_logfile-340 /apps/oracle/acfsmounts/data_vol_logfile

Now from the OS, you can see the output from the df -h command to see the new file system mounted:

[root@jin1 oracle]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
                      122G   11G  106G   9% /
/dev/sda1              99M   12M   82M  13% /boot
tmpfs                 1.1G  154M  874M  15% /dev/shm
.host:/               163G  141G   23G  87% /mnt/hgfs
/dev/asm/vol_rpts-340
                      5.0G   49M  5.0G   1% /apps/oracle/acfsmounts/data_vol_rpts
/dev/asm/vol_logfile-340
                      2.0G   41M  2.0G   2% /apps/oracle/acfsmounts/data_vol_logfile

Click on the Return button to go back to the Mount Cluster File System screen. Click the Return button again to back to the ASM Cluster File System main screen.

Posted by Charles Kim, Oracle ACE

September 11th, 2009

Creating ASM Snapshots with Enterprise Mangers in 11g Release 2

Earlier we went through the exercise to create ASM Volumes and Cluster File Systems within ASM disk groups. Another great feature introduced in Oracle Database 11g Release 2 is the capability to create snapshot images of the ASM cluster file systems. Oracle allows up to 63 read-only snapshots of their file system leveraging the Copy-on-write (COW) technology. When a snapshot request is submitted, COW technology stores only the meta-data about where the original data is stored is copied. The creation of the snapshot should be almost instantaneous since only the meta-data is being copied. The snapshot copy then tracks changed blocks to a snapshot storage location as writes are being performed. The original data that is being written to is copied into the designated area on the file system before the original data is overwritten. This is where the name copy-on-write comes from.

Read requests for unchanged data blocks go directly to the original file system. Read requests for changed data blocks are directed to the copied block on the snapshot storage volume. Please remember that the original data is only copied once. Subsequence change to the same block is not copied more than once.

EM provides full support for ASM snapshots. Let’s go EM Database Control and see how this is done. From the ASM Cluster File System tab, select a mount point and click on the Create Snapshot button.
Picture 125.png
You should se the Create Snapshot on ASM Cluster File System screen. Notice that the Snapshot Name column is auto-populated for you with shapshot_[date]_[time] format. You can change this to any kind of standard you may designate for your company.

Notice the Delete the oldest snapshot (62 remaining before the maximum limit is reached) check box. You will see this check box as you create your second and subsequent ASM snapshots. You will also see the oldest snapshot with the URL for easy convenience.

Click on the Show Command button to see the command line syntax that EM is about to submit:
Picture 126.png

For the command line DBAs, we can create snapshots copying and pasting from the following syntax:

/sbin/acfsutil snap create "snapshot_20090911_104833" /apps/oracle/acfsmounts/data_vol_logfile

Click on the Return button
From the Create Snapshot on ASM Cluster File System screen, click on the OK button. You will be routed to the ASM Cluster File System Host Credentials screen. Enter the username and password for oracle. If you want EM Database Control to remember the username and password, you can click on the option to save as preferred credential checkbox.
Picture 123.png
Click on the Continue button
You will be redirected to the ASM Cluster File System main page and will see a successful confirmation status:
Picture 127.png

We created our snapshot of the /apps/oracle/acfsmounts/data_vol_logfile file system. From the ASM Cluster File System main screen, click on the file system URL and look at some General information about that mount point.
Picture 128.png
You can see the general usage information and alerts for the file system. Usage information of the file system include Size (GB), Used (GB), Free (GB), Used (%), Allocated Space (GB) and Space Used by Snapshots (MB) or (GB).
Also in this screen, you will notice the Snapshots tab. Click on the Snapshots tab to see all the snapshot history for this ACFS file system. You can create additional snapshots or even delete existing snapshots from this screen:
Picture 130.png
And, of course, you can search for a specific snapshot using the search option on the snapshot name.

Posted by Charles Kim, Oracle ACE

September 11th, 2009

Starting dbconsole from command line in Oracle Database 11g Release 2

Note:
1. We are running a single node RAC on Red Hat 5 Update 3
2. We are running 11.2.0.1 of the database

[oracle@jin1 ~]$ . oraenv
ORACLE_SID = [dbtools1] ? +ASM1
The Oracle base for ORACLE_HOME=/apps/11.2.0/grid is /apps/oracle
[oracle@jin1 ~]$ srvctl start database -d DBTOOLS
[oracle@jin1 ~]$ . oraenv
ORACLE_SID = [+ASM1] ? DBTOOLS1
The Oracle base for ORACLE_HOME=/apps/oracle/product/11.2.0/dbhome_1 is /apps/oracle
[oracle@jin1 ~]$ emctl start dbconsole
Environment variable ORACLE_UNQNAME not defined. Please set ORACLE_UNQNAME to database unique name.

Interestingly new, you have to set the ORACLE_UNQNAME environment variable to start dbconsole.

[oracle@jin1 ~]$ export ORACLE_UNQNAME=DBTOOLS
[oracle@jin1 ~]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.

https://jin1.dbaexpert.com:1158/em/console/aboutApplication

Starting Oracle Enterprise Manager 11g Database Control ............... started.
------------------------------------------------------------------
Logs are generated in directory /apps/oracle/product/11.2.0/dbhome_1/jin1_DBTOOLS/sysman/log

Posted by Charles Kim, Oracle ACE

|