It’s been a long time since my last installment in the Little Things Doth Crabby Make series and to be completely honest this particular topic isn’t really all that fit for a LTDCM installment because it covers something that is possible but less than expedient. That said, there are new readers of this blog and maybe it’s time they google “Little Things Doth Crabby Make” to see where this series has been. This post might rustle up that curiosity!
So what is this blog post about? It’s about stuffing any file system file into Automatic Storage Management space. OK, so maybe this is just morbid curiosity or trivial pursuit. Maybe it’s just a parlor trick. I would agree with any of those descriptions. Nonetheless maybe there are 42 or so people out there who didn’t know this. If so, this post is for them.
ASMCMD cp Command
The cp sub-command of ASM lets you stuff certain database files into ASM. We all know this. However, just to make it all fresh in people’s minds I’ll show a screen shot of me trying to push a compressed tar archive of $ORACLE_HOME/bin/oracle up into ASM:
Well, that’s not surprising. But what happens if I take heed of the error message and attempt to placate? The block size is 8KB so the following screen shot shows me rounding up the size of the compressed tar archive to an 8192B blocking factor:
ASMCMD still won’t gobble up the file. That’s still not all that surprising because after ASMCMD checked the geometry of the file it then read the file looking for a header or any file magic it could understand. As you can see ASMCMD doesn’t see a file type it understands. The following screen shot shows me pre-pending the tar archive with file magic I know ASMCMD must surely understand. I have a database with a tablespace called foo that I created in a non-Oracle Disk Manager naming convention (foo.dbf). The screen shot shows me:
- Extracting the foo.dbf file
- “Borrowing” 1MB from the head of the file
- Creating a compressed tar archive of the Oracle Database executable
- Rounding up the size of the compressed tar archive to an 8192B blocking factor
So now I have a file that has the “shape” of a datafile and the necessary header information from a datafile. The next screen shot shows:
- ASMCMD cp command pushing my file into ASM
- Removal of all of my current working directory files
- ASMCMD cp command pulling the file form ASM and into my current working directory
- Extracting the contents of the “embedded” tar archive
- md5sum(1) proof the file contents survived the journey
OK, so that’s either a) something nobody would ever do or b) something that can be done with some elegant execution of some internal database package in a much less convoluted way or c) a combination of both “a” and “b” or d) a complete waste of my time to post, or, finally, e) a complete waste of your time reading the post. I’m sorry for “a”,”b”,”c” and certainly “e” if the case should be so.
Now you must wonder why I put this in the Little Things Doth Crabby Make series. That’s simple. I don’t like any “file system” imposing restrictions on file types 🙂
That was clever Kevin!
Ah, Amir! Good to see you visiting here. Hope all is well with you.
interesting stuff Kevin. Now how the database chokes on it. Anyone want to predict the error message?
Hi Jared,
What do you mean by chokes on it? What database would be choking?
As you have fooled ASM into accepting it, use Transportable Tablespace to see what happens when the database tries to open it.
@jkstill: oh yeah…that’s a “corrupt” file now for sure. but you can jump on any node in the cluster, suck it out and extract the embedded goodies. Fun calisthenics 🙂
I actually do save very large tar archives this way on occasions FWIW.
Kevin, what is the purpose of saving the files in ASM?
On occasions I’ve found myself in a lab situation where hosts have about zero usable space and I can’t borrow any more space from the SAN to create a file system. Just odd scenarios like that.
You could install ACFS on top of ASM, unless you just don’t want the files to be easily visible.
Yes, you can do that. No surprise. You could setup ADVM and create an Ext3/Ext4 FS in the ASM space.
You could create a DBFS in a database in the ASM space.
You could create a database inside ACFS inside ASM and in that database create a DBFS. Then you’d have a file in a file system in a database inside a file system inside a database volume manager…
The list goes on 🙂
Seeing as the current thought on engineered systems like ODA and EXADATA is to put everything on ACFS in ASM I have a feeling that ACFS is probably the way things are going to go in future…
If so asmcmd copy command will not nbe needed any more 🙂
Okay okay so I drank the oracle Kool Aid… I can’t help it I am a sucker for … ooh shiny !
“Okay okay so I drank the oracle Kool Aid… I can’t help it I am a sucker for … ooh shiny !”
@robinsc : If it alright I think we’ll leave it at that.