Tuesday, April 24, 2012

Considering the Cloud? You Might Already Be There.

I'm at IOUG Collaborate 12 this week, and one of the sessions I attended gave me a new perspective on "The Cloud", or at least what it means to have and use a "Private Cloud". I've always had a bit of an eye-roll response to the concept of a Private Cloud - why put a trendy name on something as commonplace and mundane as putting more than one thing on a server/SAN/mainframe, which was my view of a private cloud.

The session I attended was by Michael Timpanaro-Perrotta, of Oracle Corporation. The prentation was one of the more enlightening overviews of what cloud architecture is that I have come across. I won't re-present Michael's work here, but will share a few of my "Aha!" moments.

Aha Moment #1

There is nothing magical about "the cloud". A cloud is presenting technology as a standardized service. It is less about the technology itself or where it is hosted and more about how the service is deployed and delivered. If we are deploying servers in a cowhere fashion where the upkeep becomes transparent to our customers, that is one type of cloud.

Aha Moment #2

In the database sense, a cloud database can be a centrally-managed, consolidated instance that serves a variety of customers and applications. It turns out much of my career has been "cloudy", in this sense. Whenever I have the opportunity, I am a proponent of consolidating instances for ease of manageability and reduced maintenance cost. These are key cloud concepts - common, standardized deployments that serve multiple purposes.

Aha Moment #3

I'm building a private cloud database today. Who knew? Our project is labelled a "server refresh" - nothing about "cloud" in the name, design, or requirements - but we are consolidating similar instances with compatible workload into a single instance. We are migrating from a dedicated host to a shared O/S infrastructure. Eventually this database will move from the shared O/S cluster into an even-more-shared RAC cluster. This is the very process Michael layed out in discussing how organizations move from silos into a private cloud model.

"Cloud" may be the buzzword of the year, but it is not as mysterious as you may think. If you look at your current technology projects, those that simplify things, standardize, virtualize, or share architecture at some level may very well be cloud projects.

Saturday, June 11, 2011

APEX 4

I've been working on a small hobby application recently with Oracle XE and finally put an APEX front end on it. I started with the default APEX that installed with 10g XE (Apex 2.2). Knowing APEX 4 has nicer features I considered upgrading sooner, but didn't see the need for my project.

The tipping point came when I tried to use make some changes using Firefox 4. Most things worked fine, except when I tried to modify a PL/SQL package. In FF4, the text was in a red, uneditable text box instead of the usual text box.

I exported my APEX schemas (FLOWS_020000 and FLOWS_FILES) as a precaution, then followed the APEX install/upgrade instructions found here: http://download.oracle.com/docs/cd/E17556_01/doc/install.40/e15513/otn_install.htm#BABHHIJB .

I was a little concerned with the documentation's description of the various components to think about when installing APEX (APEX listener, Oracle HTTP server, etc) but I expected the APEX install to figure out what I was running and take care of things since I was upgrading a functional, stock install on 10gXE. That expectation proved mostly true.

(Sidebar: I'm normally much more thorough about reading documentation before jumping into upgrades, and I like to understand what is changing before I change it. In this case, APEX is promoted as something that is easy to use and doesn't take a lot of deep technical knowledge to manage, so I purposely read as little as possible to see how well that assertion held up.)

After downloading and unzipping files, the actual upgrade process took about 45 minutes on a desktop-class machine, running Windows 7 Enterprise and Oracle 10g XE. The new APEX objects installed as expected into the schema APEX_040000, and my application was also upgraded without incident.

Thank you for installing Oracle Application Express.

Oracle Application Express is installed in the APEX_040000 schema.

The structure of the link to the Application Express administration services is as follows:
http://host:port/pls/apex/apex_admin (Oracle HTTP Server with mod_plsql)
http://host:port/apex/apex_admin (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)

The structure of the link to the Application Express development interface is as follows:
http://host:port/pls/apex (Oracle HTTP Server with mod_plsql)
http://host:port/apex (Oracle XML DB HTTP listener with the embedded PL/SQL gateway)

After installation, application upgrades, and validation completed, I had to update the image directory using @apxldimg.sql C:\apex_4.0.2_en (because I was upgrading, not installing fresh) . I ran this twice: the first time I specified a deeper path to APEX files (second-guessing the documentation) and it failed. I re-ran with only the path to the directory I extracted files to (like the documentation said) and it worked. Trust the documentation. The image update took about 4 minutes.

The documentation contains a lot of steps specific to Oracle 11g. Since this is on 10g XE I skipped those altogether. Maybe if I want to explore a REST API I will install the APEX listener, but that is a project for another time.

I attempted to connect to the APEX administration site. I was asked to change the admin password, and I found the new APEX has much stricter password rules than before (at least for the administrator - default settings for APEX users are less strict, but easily configurable). After changing the password I could access the administration page. I saw several new panels and features to explore. I reset the password for my main development workspace, and re-connected to APEX as that developer.

Now that I was fully upgraded and ready to try things out, here's what I found...

So the first test - did this solve the problem I was having?

Yes. The path to the database object browser changed a little, but once I found it I was able to edit the package spec using Firefox 4 . In APEX 2.2 the Object Browser was on the home screen of the workspace. In APEX 4 It is under Home>SQL Workshop>Object Browser


Now the more important test - what changes did I observe in my application?
When I built my application in APEX 2.2 I used APEX internal authentication, so the password for the application user (call it "XYZ") was not the same as the schema owner/APEX workspace user "XYZ". After upgrading the IDs were merged and use the same password. When I used the new password I entered the application fine.

The look and features of my application continued to work as they always had. I found no differences in my application itself.


Finally - what did I see that wasn't there before (new toys)?
Where to begin?
  • The new APEX Administration tab has an Activity Monitor and a Dashboard with metrics at the database, application, web server, and user levels. There is a lot to explore here, and a lot that will be useful in monitoring a deployment (at least one larger than my hobby system).
  • The Manage Service tab has features for managing the system and application Meta Data and features to better support collaborative development.
  • The Team Development tab offers a host of project management features. I'm eager to dive into this and use it as a development task list, project tracking, and other features.
  • The Application Builder adds a tab for Supporting Objects which generates application deployment and upgrade scripts. This supports more structured deployments from a development server to test and production servers... much easier than APEX 2.2.
  • The SQL Workshop contains simpler (or at least more obvious to me) tools to import and export spreadsheet, text, and XML data.
These options only scratch the surface.

Conclusion: The upgrade was simple, but not automatic. Follow the documentation. It will save you from mistakes. In my case I didn't worry about the APEX listener yet, but I may explore that in the future.

The new tools and look are welcome improvements. I look forward to diving in with APEX 4.

Sunday, April 10, 2011

Oracle XE 11g Early Adopter

I was excited to see Oracle XE 11g has finally been released on OTN for early adopters. Loading it up, I was disappointed by a couple things right off the bat. I know, "early adopter" is a big red flag. (See update below. My disappointment is a result of my ready-fire-aim approach to trying XE 11g. Read the DOCS first and you won't be surprised).


First off, I had to uninstall my 10g XE since I can only have one "OracleServiceXE" service. I can live with this one - I purposely wanted to deal with the default install. The real surprise here was that uninstalling XE also uninstalled my 10g XE DATA, not just the binaries. I made a cold backup copy before uninstalling, but still - uninstallers should KEEP the data files or at least warn me. Grr.


Second off, I saw the terms and conditions were the usual OTN terms, including "don't use this for internal data processing without a license" (paraphrased). I found that odd, since the 10g XE had its own language that states "OK for production use" (paraphrased again, I didn't look up the exact language for the sake of this post).


So, 11g XE installed. (Still no notice of what the restrictions of the XE license are for 11g? Are they the same as 10g? More storage? Don't know, nothing in the download, install, or terms of service have enlightened me yet). Install is simple enough. I would have preferred an option to install clean or upgrade an existing 10g XE database, but this is an early adopter release, so I can live with that... I guess.


Command line sqlplus works... no surprise there... try SQL Developer. Surprise! SQL Developer is not working now. Why should that have changed? Now I have some investigation and troubleshooting to do.


I'm at Collaborate 2011 this week, so maybe in some of the evening downtime I'll poke around and try to get everything working again.





UPDATE: A quick search of the OTN Forums led me to the fine documentation I did not bother looking up before. In it is the familiar language licensing 11g XE for "purposes of developing, prototyping and running your applications for your own internal data processing operations".


So, any relaxed (improved) restrictions?



  • Single instance per server (no change)

  • Only uses 1 CPU (no change)

  • Supports up to 11GB of user data (up from 4GB, that is a welcome increase)

  • May use up to 1GM RAM (no change)

How about features? Here are the quick standouts from perusing the list of what is NOT available (see the documentation for the full list):



  • Pre-compilers and SQLJ

  • Java support in the database

  • Block Change tracking for incremental backup

  • Flashback (in just about any form)

  • Online table redefinition and index rebuilds

  • Tablespace point-in-time recovery

  • Rolling upgrades

  • Advanced Security

  • VPD / Label Security / DB Vault

  • Secure External Password Store

  • Client-side query, and other types of results caches

  • Partitioning

  • Transportable Tablespaces

  • Streams

  • Multimedia

  • Spatial

  • ASM

  • Resource Manager

Besides the license and feature summary, the full 11g XE Documentation set is available at http://download.oracle.com/docs/cd/E17781_01/nav/portal_booklist.htm.


In the README document, we find why SQL Developer stopped working. SQL Developer 3.0 must be used. This is a known issue and is stated that it will be fixed when 11g XE is no longer beta. In the meantime, I was thinking of moving to SQL Developer 3 anyway, since it is no longer in pre-release status.

Monday, January 18, 2010

Twists, Turns, Convergence

I decided to take a full-time opportunity a couple months ago, and it is has taken my career on an interesting, but unexpected turn. One of my career goals has always been to continue learning, becoming more technologically well-rounded. I try to balance this to avoid the adage "Jack of all trades, Master of none." In college I studied a fairly broad software curriculum, yet I found an affinity for data management, and throughout my career that has been the focus.

I had been expecting a career move to take me deeper into Oracle-specific technology, where I hoped to gain more technical skills in core database administration and new features. As it turns out the opportunity that presented itself was not one of more depth in Oracle, but less - however it is adding breadth via exposure to Informix and DB2.

Today I find myself needing to support Oracle at the application/schema level, but also needing to support DB2 at a similar level, and Informix from the installation on up. At one point of my career I may have said "I'm an Oracle guy, no thanks". Today I'm more of a "right tool for the job" guy, so I welcome the chance to learn the competing DB systems.

In studying both DB2 and Informix, I find myself translating the concepts of each into the concepts I am familiar with from Oracle. Sometimes I must be careful, such as when seeing the word "tablespace", which means different things in each RDBMS. But overall I am finding conceptually they are more alike in operation than I exepected. I am finding specific parts about each that I like, and other parts where I prefer Oracle's approach. (Perhaps a "universal translator" cross-reference would be an interesting summary to put together and post here at a later date.)

Professionally, I like where this is going. I believe this experience is going to make me a better DBA overall, as I will get to know the differences and strengths of different vendor's database systems. Down the road this could give me the ability to pick the most appropriate system for a specific project, or it could help me understand the "gotchas" to expect when migrating a system from one platform to another (for example, how are NULLs treated in a query in each system?).

Tuesday, September 22, 2009

Learning ASM: Installing a Database

REVIEW

In my previous posts I logged my experience installing the 11gR2 Grid Infrastructure and getting familiar with ASM. At this point I have a working ASM instance, as well as Oracle High Availability and Cluster Services running, and an ACFS file system, for kicks.

My ASM Disk groups available are:

ASMDATA - Where my database files will go
FRA - Where my Flash Recovery Area will go
FS - Hosts my ACFS partition, where database files will go that wouldn't normally go on an ASM disk.

My goal in this post is not to reproduce the steps in the manual, but to record my own notes of things that are interesting or troublesome along the way. I'm following the steps as documented in the Database Installation Guide 11g Release 2 (11.2) for Linux.

I already configured the kernel parameters and made sure the necessary libraries were installed, and I already created a separate user account (oracle11r2) to host all my 11.2.0.1 files. ASM was installed under the user oragrid, to keep the installations distinct.

HERE WE GO:

First note of "something new" in the install guide is the enhanced Secure Configuration option. I'm a security nut, so I'll be taking this option, especially since it gives more opportunity to learn.

Files are unzipped, X DISPLAY is verified, let's do this...

$ ./runInstaller
You do not have sufficient permissions to access the inventory '/u01/app/oraInventory/orainstRoot.sh.ASMbackup'...

Hit the first issue sooner than I thought.

$ ls /u01/app/oraInventory/orainstRoot.sh.ASMbackup
-rwxr-x--- 1 oragrid oinstall 1623 Sep 8 23:08 /u01/app/oraInventory/orainstRoot.sh.ASMbackup

This one's my own fault. I made a backup of the ASM root.sh script after the ASM install. It does not have group write permissions. Apparently runInstaller checks to see if all directories are accessible, not just specific directories that it will use. I changed the group write permission on the directory, since I don't expect it to be touched anyway. Now runInstaller is able to move onto the prerequisites, and we get the spiffy new 11gR2 Installer GUI.

Note: I'm posting this blog on a different machine, so I'm not taking screen shots as I go. There may be typos since I'm re-typing instead of copy-and-pasting. If you find one, please let me know so I can fix the post.


CONFIGURE SECURITY OPTIONS

I'm not setting this up for a connection to MetaLink so I uncheck that, and leave the email blank for now. I get a dialog box letting me know that Uncle Larry won't be looking over my shoulder to inform me of security updates now. That's fine with me for this project.

INSTALLATION OPTION

I'm selecting "Create and configure a database". I can always create another later for the DBCA experience. I'm more curious what this installer does on autopilot.

SYSTEM CLASS

Even though I am using a desktop class machine, in power, I have been treating it as a server, in function. ASM features are only available under this option, so I'm choosing "Server Class" here.

GRID OPTIONS

While I would really like to play with RAC features here at home, I know I don't have the infrastructure for it, so I won't risk confusing myself with a single-node RAC-ish installation. I'm sticking with "Single instance database installation" for this option.

INSTALL TYPE

The whole point of this exercise is to learn ASM, so I need to choose "Advanced Install" here, for the opportunity to install on ASM. (Of course I could start with non-ASM and convert to ASM as another exercise, but I have not layed out my partitions to do so).

PRODUCT LANGUAGES

Self-explanatory.

DATABASE EDITION

Enterprise, Standard, or Standard Edition ONE? Here is where licensing would come into play. Since this is under an OTN "get familiar, non-production" license, I'm going with EE with all the options, including Database Vault.

INSTALLATION LOCATION

Oracle Base: /u01/app/oracle11r2
Software Location: /u01/app/oracle11r2/product/11.2.0/dbhome_1

I'll take the defaults here, since I expect most places I go will install things in the default layouts. If they don't I'll be able to spot the difference right away.

Since the Oracle Inventory was created when I installed Grid Infrastructure, I'm not given that option here. I like this. I have enough ways to shoot myself in the foot. If Oracle can prevent me from a confusing multiple-inventory situation, I appreciate it.

CONFIGURATION TYPE

For now I'm interested in "General Purpose / Transaction Processing".

DATABASE IDENTIFIERS

Global Database Name: ora11r2.localdomain
SID: ora11r2

Normally I would change the localdomain to something appropriate, but I'm not worried about that for this machine. I left it at that default in the Infrastructure install, so that's what the Listener is expecting. I'll leave localdomain here, too.

CONFIGURATION OPTIONS

MEMORY

Enable Auto Memory Management. Yes, please. I'll start with the default 40% of memory (604MB in my case). In the real world I would do some capacity planning beforehand and size this based on a more educated guess, then tune as needed over time.

CHARACTER SETS

I'm taking the default here. I'll play with UNICODE in another instance, another time.

SECURITY

Assert All New Security Settings. I'm not upgrading an older database, and I am interested in learning new features, so I'll stick to the default here, which is yes... use the new security settings.

SAMPLE SCHEMAS

Good, the default is unchecked. I like that. I'll check it here, but for an application database I prefer to not have the sample schemas - less to secure or clean up.

MANAGEMENT OPTIONS

I don't have a Grid Control installation, or agent here, so that's grayed out. That leaves DB Control, which is fine. I'm skipping email notifications for now.

DATABASE STORAGE

Here's where we get interesting. ASM is selected by default. I put in the password I created for ASMSNMP during the ASM installation. There were fewer options than I expected here.

AUTOMATED BACKUPS

I haven't allocated space for multiple backups, so I'll leave the automated backups disabled. 11gR2 RMAN features and backup strategies will be an exercise for another time.

ASM DISK GROUP

Here is the option I expected to see earlier. My database files will go on ASMDATA.

SCHEMA PASSWORDS

Self-explanatory.

OPERATING SYSTEM GROUPS

Default.

PREREQUISITE CHECKS

I ran into the same prerequisite failure here on pdksh that I did on the Infrastructure installation. I know I have ksh available, even if it is not pdksh, so I'm Ignoring this issue and continuing. I wouldn't ignore this on a system that needs to remain stable.

SUMMARY

I'll save a response file (ora11r2.rsp) to use or review later.

INSTALL PRODUCT

Now we wait while OUI does it's thing.

For status freaks like me, who like to know more than just watching the checklist of what's been done so far, the Details window lets me watch the install log and scroll back through the history without 'tail'ing it in a separate window. Nice touch.

I didn't keep a timer, but for a full EE install on an underpowered machine, the install process moves along pretty well. I'm eager for the opportunity to see it on some bigger iron.

DBCA, on the other hand, is really pokey, but I don't blame DBCA. Now we're hitting the expected performance problems of my machine.

My system is CPU-bound. CPU is pegged at 100% for extended periods. No surprise on this box.
Memory is in good shape - hovering around 30% used.
top shows the database being created using more resources than the ASM database.
iostat DOES show activity spread out across the various partitions representing my ASM disks.

At this point I am seeing ASM get its first workout and I see the load spreading across what would normally be multiple devices. If you didn't read my first post on learning ASM, you missed the fact that I'm simulating 10 disks using 10 partitions on a single physical drive. High Speed anything was never a goal in this exercise.

dbca finished, root.sh run.

The root.sh script complained about dbhome, oraenv, and coraenv already existing in /usr/local/bin. I made backup copies of these and allowed root.sh to overwrite them. diff showed the new files identical to the old, and permissions are such that oragrid won't have a problem, so it appears to be OK to just overwrite what the Grid Installation installed.

FINISH

This screen simply reminds us of the URL for DB Control. Closed the installer.


TEST DRIVE

Start FireFox, browse to the EM URL, accept the security certificate, and ... waiting ...

DB Control reports the database components are unavailable.
Attempting to connect via sqlplus also fails, with a TNS error.

Clearly, something is misconfigured at this point. Before banging my head and making things worse, I turn the page to the Post-Installation Tasks.

I reboot just to clean things up a bit, and start a piece at a time. I notice my network interface failed on boot - that explains a number of things. I corrected the networking issue and lsnrctl status under oragrid responded as expected.

I login as oracle11r2, set ORACLE_HOME and ORACLE_SID as needed.

Now sqlplus works, and I see the database is already up. This is odd, t me, since the startup flag in /etc/oratab for this instance is 'N'. Oracle Restart is coming into play here. The startup configuration I already did for ASM laid the groundwork for the new instance "ora11r2" being started automatically.

$ ./emctl start dbconsole

DB Console appeared to come up, but crashed upon first login attempt.

I set up the .bash_profile for oracle11r2 to have the proper ORACLE_HOME and ORACLE_SID, created a DBA ID for myself in the database (so I didn't have to login as SYS), then I restarted the DB Console.

When DB Console is running, it appears to be the big CPU hog on this machine. CPU and disk I/O is moderate and acceptable when DB Console is not running.

POST_INSTALLATION TASKS

I followed the relevant steps for post-installation tasks that applied to my instance.

Via DB Console, I found my way to the Flash Recovery Area setting. I changed this from +ASMDATA to +FRA and increased the size to make use of more of the ASM disk group allocated to flash recovery.

THE END, AND THE BEGINNING
At this point Oracle 11g Release 2 is up and running on a tiny machine, with ASM.
Let the learning continue...

Friday, September 18, 2009

Learning ASM: Breakin' the Rules (or, Running ACFS on CentOS)

Part 2 mentioned that I could not get ACFS to work on CentOS. This is, of course, because it is not supported. I did find a way to work around this.

---------------------------------------------------------------------------------------
DISCLAIMER:

This post is provided as a log of personal experimentation only. If you attempt to replicate these steps on your system, it is wholly at your own risk with no guarantee you will get the same results as I did. It is in no way supported by Oracle, and I take no responsibility for any ill effects on your system - and Oracle won't either. This is wholly undocumented and unrecommended. I'm purposely changing things to understand them better. If you want a stable (and simpler) experience, use the Linux versions documented to be supported by Oracle.

---------------------------------------------------------------------------------------

With the lawyers held at bay, I can proceed. Remember, don't try this at work, kids - only on a system no one else uses, that you don't mind reinstalling if things go haywire.

My environment (CentOS 5.3)

$ uname -r
2.6.18-128.el5

According to the Oracle Database Storage Administrator's Guide ACFS on a non-clustered system requires some manual steps to launch the volume driver. The steps outlined at the hyperlink above detail what to do manually.

login as root
$ cd /u01/app/oragrid/product/11.2.0/grid/bin
$ ./acfsload start -s
ADVM/ACFS is not supported on centos-release-5-3.el5.centos.1

Not surprising, the documentation said as much. Let's see if we can work around that.

Some backtracking through the shell and perl scripts leads us to ../lib/osds_acfslib.pm
$ cd ../lib
$ cp -p osds_acfslib.pm osds_acfslib.pm.orig

Now I edit osds_acfslib.pm (carefully) Search for "support this release" to get to the section to tweak. (line 278 in my case)

Since CentOS5 is equivalent to RedHat 5, we'll modify the test for RedHat to look like this...

if (($release =~ /enterprise-release-5/) ||
($release =~ /redhat-release-5/) ||
($release =~ /centos-release-5/))

That gets us past the supported version check, based on the version string. Now we get ACFS-9129: ADVM/ACFS not installed

$ mkdir /lib/modules/2.6.18-128.el5/extra/usm
$ cp /u01/app/oragrid/product/11.2.0/grid/install/usm/EL5/i386/2.6.18-8/2.6.18-8.el5-i686/bin/*ko /lib/modules/2.6.18-128.el5/extra/usm
$ chmod 744
/lib/modules/2.6.18-128.el5/extra/usm

This puts the modules in the expected location. We can check it by:
$ cd /u01/app/oragrid/product/11.2.0/grid/bin
$ ./acfsdriverstate -orahome
/u01/app/oragrid/product/11.2.0/grid version
ACFS-9205: OS/ADVM,ACFS installed version = 2.6.18-8.el5(i386)/090715.1

Record dependencies for the kernel modules. (The modules won't load if you skip this step).

$ depmod

Now running acfsload start -s completes without any further messages.


In a cluster install the system executables get copied from the install directory to /sbin as part of the root.sh script. Since this was a standalone install, they did not get copied. We get to do that manually (and set permissions).

$ cd /u01/app/oragrid/product/11.2.0/grid/install/usm/EL5/i386/2.6.18-8/2.6.18-8.el5-i686/bin

For each file that does not end in .ko (there are 12 of them):
$ cp acfsdbg /sbin
$ chmod 755 /sbin/acfsdbg


TEST FOR SUCCESS:

Now connect as oragrid.
Running asmca is noticeably different - the Volumes and ASM Cluster File System tabs are available. (They were greyed out when I tried before).

Now we'll try the command that failed before in ASMCMD

ASMCMD > volcreate -G FS -s 2G --redundancy mirror acfs1

This completed without any error message. Switching back to asmca to see it in the GUI...
ACFS1 now appears in the Volume tab, with a device /dev/asm/acfs1-287. It is unmounted. We could also find out this virtual device using the volinfo command in asmcmd.


Now make a file system on that volume and mount it...


$ /sbin/mkfs -t acfs /dev/asm/acfs1-287

mkfs.acfs: version = 11.2.0.1.0.0
mkfs.acfs: on-disk version = 39.0
mkfs.acfs: volume = /dev/asm/acfs1-287
mkfs.acfs: volume size = 2147483648
mkfs.acfs: Format complete.

$ /sbin/acfsutil registry -a /dev/asm/acfs1-287 /u01/app/acfsmounts/acfstrial

acfsutil registry: mount point /u01/app/acfsmounts/acfstrial successfully added
to Oracle Registry

At this point, the ASM Cluster File Systems tab in asmca shows our registered mount point, in a DISMOUNTED state. ls /u01/app shows no directory .../acfsmounts.

To mount a filesystem, you need root privilege.

add the following to the beginning of /sbin/mount.acfs, after the header comments

ORACLE_HOME=/u01/app/oragrid/product/11.2.0/grid

Create a directory to mount the filesystem on. This step wasn't in the install guide. I got an error if I didn't pre-create a directory.

$ mkdir /u01/app/acfsmounts/acfstrial

Perform the mount and set permissions

$ mount -t acfs /dev/asm/acfs1-287 /u01/app/acfsmounts/acfstrial
$ chown -R oracle11r2:dba /u01/app/acfsmounts/acfstrial

And we are done! A usable file system, owned by the ID we will later install the Oracle 11gR2 Database using.

$ su - oracle11r2

$ cd /u01/app/acfsmounts/acfstrial
$ ls
lost+found
$ echo hello world > myfile
$ ls
lost+found myfile
$ cat myfile
hello world


And there we have it... ASM Cluster File System running on a standalone CentOS box. Now I have a place to experiment and build up my skill set, with no money out of pocket!


EPILOGUE (TODO):

This doesn't come up automatically following a reboot. I need to add startup scripts to perform the following steps:

1. Load the ADVM drivers
2. Enable the ASM volumes
3. Mount the ACFS filesystems

I can do these steps manually with a combination of the steps above, and with asmca.

Wednesday, September 9, 2009

Learning ASM: Part 2

In the previous post, I installed ASM on a woefully underpowered machine. Things I learned along the way included:
  • Don't skip steps. If Oracle says install Grid Infrastructure First, don't start by setting up a user id for the Oracle Database.
  • Partitions on a single physical drive will work for experimenting with ASM, but for hopefully obvious reasons is not something you would do on a system that actually supports development or production.
  • 11g Release 2 changes a few of the familiar installation steps, especially the Oracle listener.
  • It is helpful to plan (and document) your desired disk group layout before you start. ASM will manage everything for you, but that is no substitute for a diagram on a piece of paper to keep everything straight.
LEARNING THE TOOLS: ASMCMD

ASMCMD is the command-line tool for managing ASM. You can also manage it through Enterprise Manager, but that is not installed yet, so not an option. I always like to know how to do things at the command line, since that is always available. For this section I'm using a chapter from the Oracle Database Storage Administrators Guide .

First we need to make sure ORACLE_HOME and ORACLE_SID are set appropriately. This was not a step in the install guide, or I missed it. I added the following to my .bash_profile for oragrid

umask 022 ORACLE_HOME=/u01/app/oragrid/product/11.2.0/grid ORACLE_SID=+ASM export ORACLE_HOME ORACLE_SID PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin export PATH

Now asmcmd will start properly
[oragrid@loclahost ~]$ . .bash_profile [oragrid@loclahost ~]$ asmcmd ASMCMD> ls ASMDATA/ FRA/ FS/

Next I spent some time playing around with ASM commands. shutdown and startup were straightforward and behaved as expected. I exited asmcmd and restarted it with th e-p and -v options to show the current directory in the prompt (-p) and more verbose output (-v). At the asmcmd prompt, 'help' displays the list of valid asm commands. I could go through the manual, but I like to poke around sometimes on my own in this situation.

ls and cd navigate through the directory. ls -l provides a longer list, as I expected.

ASMCMD [+] > cd +ASMDATA/asm/asmparameterfile ASMCMD [+ASMDATA/asm/asmparameterfile] > ls REGISTRY.253.697071913 ASMCMD [+ASMDATA/asm/asmparameterfile] > ls -l Type Redund Striped Time Sys Name ASMPARAMETERFILE MIRROR COARSE SEP 08 23:00:00 Y REGISTRY.253.697071913

Wonder where a file is located?
ASMCMD [+]> find + registry* +ASMDATA/ASM/ASMPARAMETERFILE/REGISTRY.253.697071913

Need to manage the available disk groups?
ASMCMD [+] > ls -l State Type Rebal Name MOUNTED NORMAL N ASMDATA/ MOUNTED NORMAL N FRA/ MOUNTED NORMAL N FS/ ASMCMD [+] > umount FS ASMCMD [+] > ls -l State Type Rebal Name MOUNTED NORMAL N ASMDATA/ MOUNTED NORMAL N FRA/ ASMCMD [+] > mount FS
ASMCMD [+] > ls -l State Type Rebal Name MOUNTED NORMAL N ASMDATA/ MOUNTED NORMAL N FRA/ MOUNTED NORMAL N FS/



At certain points, such as when a new device is added to a disk group, ASM will rebalance the data among the devices in a group to spread the I/O evenly throughout. You can also force a rebalance to happen immediately.

ASMCMD [+] > rebal FRA

While the Rebalance is occuring, ls -l will report the diskgroup with a Y in the Rebal column.

Curios about the I/O load across disks?

ASMCMD [+] > iostat Group_Name Dsk_Name Reads Writes ASMDATA DATA1 7421952 5046272 ASMDATA DATA2 8433664 2883584 ...

Need to check integrity of a disk grou? chkdg
Did your disk develop bad sectors? the remap command will avoid them. (for more info, help remap).

Let's try taking a disk out of a disk group
ASMCMD [+] > offline -G ASMDATA -D DATA3 ORA-15032: not all alterations performed ORA-15283: ASM operation requires compatible.rdbms of 11.1.0.0.0 or higher Really? Why is that?
ASMCMD [+] > lsattr -G ASMDATA -l rdbms
Name Value
compatible.rdbms 10.1.0.0.0
Interesting, the default is to be compatible with a 10g database, not an 11g database. This setting is probably to assist with upgrades, since 10g will be more prevalent still that 11g for a while. We don't have a 10g database right now, so I'll change it to test the offlining. ASMCMD [+] > setattr -G ASMDATA compatible.rdbms 11.1.0.0.0
Now, let's try that offline again:
ASMCMD [+] > offline -G ASMDATA -D DATA3 ASMCMD [+] > lsdsk -G ASMDATA Path ORCL:DATA1 ORCL:DATA2 ORCL:DATA4 ORCL:DATA5 ORCL:DATA6

GETTIN' CRAZY: CREATING AN ACFS VOLUME VIA ASMCMD (FAIL)

To have ASM act as a storage manager, or volume manager, for a general-purpose file system, we first define a volume within a disk group. We have the FS disk group defined for this purpose, so we'll create 2 volumes within that.

ASMCMD [+] > volcreate -G FS -s 2G --redundancy mirror acfs1
ORA-15032: not all alterations performed
ORA-15477: cannot communicate with the volume driver


Apparently something else is not installed. According to documentation, ACFS is only supported on Oracle Enterprise Linux 5 or Red Had Enterprisxe Linux 5. CentOS 5 is supposed to be equivalent to RHEL, perhaps this is a point where it is not equivalent enough?

My lesson to myself here - stick with supported O/S versions. Oracle Enterprise Linux is supported, and designed around running ASM and the Oracle Database. I'll be switching to that later to study ACFS, but in the meantime I'll table the ACFS exploration and continue looking at ASM and 11gR2.

REBOOT: GETTING ASM TO START AUTOMATICALLY ON BOOT

I want ASM to start on boot, so I modified /etc/oratab to start +ASM.

I stopped ASM using ASMCMD
ASMCMD> shutdown --immediate
ASM diskgroups dismounted
ASM instance shutdown
Connected to an idle instance.

The O/S was restarted.

Following the restart, a ps-fu oragrid showed a few processes running, but not enough.
ASMCMD startup yielded an ORA-01078: failure in processing system parameters, and ORA-29701: unable to connect to Cluster Synchronization Service. The supporting cluster software is not fully functioning. To start it:

login as root
cd /u01/app/oragrid/product/11.2.0/grid/bin
./crsctl start resource -all

Now ps -fu oragrid shows an instance running. logout of root, back in as oragrid, and now asmcmd shows the disk groups available. Interestingly, the startup=Y was changed back to N in /etc/oratab for the +ASM instance. Note to self: +ASM should not be managed by oratab.

The installer added oracleasm and ohasd to the /etc/init.d and rc3.d and rc5.d, but not the cluster services. I created an init script to do the steps we just did manually

cd /etc/init.d
cp -p ohasd ocrs

Edit ocrs changing the start() subroutine to include
/u01/app/oragrid/product/11.2.0/grid/bin/crsctl start resource -all
and the stop() subroutine to include
/u01/app/oragrid/product/11.2.0/grid/bin/crsctl stop resource -all
as well as modifying any descriptive text in the script.

I created symbolic links in rc5.d and rc3.d for Start and Stop at step 97 (after OHASD has started)

cd ../rc5.d
ln -s /etc/init.d/ocrs S97ocrs
ln -s /etc/init.d/ocrs K97ocrs

cd ../rc3.d
(same thing)

And now ASM starts on boot.

Next post: actually installing a database on 11gR2 ASM.