<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Only Four Left... &#187; Mac</title>
	<atom:link href="http://only4left.jpiwowar.com/category/mac/feed/" rel="self" type="application/rss+xml" />
	<link>http://only4left.jpiwowar.com</link>
	<description>Oracle stuff.  Some Linux and Mac stuff.  ALTER TABLE blog DISABLE UNIQUE (content_type);</description>
	<lastBuildDate>Thu, 02 Sep 2010 07:00:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Oracle 10gR2 RDBMS for Mac OS X (Intel) has arrived!</title>
		<link>http://only4left.jpiwowar.com/2009/04/os-x-intel-native-10gr2-rdbms-is-here/</link>
		<comments>http://only4left.jpiwowar.com/2009/04/os-x-intel-native-10gr2-rdbms-is-here/#comments</comments>
		<pubDate>Sat, 11 Apr 2009 21:22:34 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Oracle RDBMS]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/2009/04/os-x-intel-native-10gr2-rdbms-is-here/</guid>
		<description><![CDATA[<p>Oracle has, at long last, released a version of the RDBMS for Mac OS X Intel. Not all features are supported, but on the other hand, it will run natively even on a non-Server version of Leopard. Woohoo!</p>]]></description>
			<content:encoded><![CDATA[<p><i>This post was written before Snow Leopard (OS X 10.6) shipped.  If you're interested in an installation guide for Oracle 10gR2 on Snow Leopard, Raimonds Simanovskis has <a href="http://blog.rayapps.com/2009/09/14/how-to-install-oracle-database-10g-on-mac-os-x-snow-leopard/" title="10gR2 RDBMS on Snow Leopard, by @rsim">provided instructions</a> on his blog</i>.
</p>
</p>
<p>In the wake of a <a href="http://twitter.com/oracletechnet/status/1492024522" title="Justin's tweet">small</a> flurry of <a href="http://blogs.oracle.com/otn/2009/04/mac_daddy_oracle_database_10g.html" title="Justin's blog post">announcements</a> yesterday about the release of <a href="http://www.oracle.com/technology/software/products/database/oracle10g/htdocs/10204macsoft_x86-64.html" title="OTN download for Oracle 10gR2 on Mac OS X Intel">Oracle 10gR2 for Mac OS X Intel</a> (almost two weeks after April Fools' Day, so knock it off with the jokes already <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> ), I decided to try a test installation on my Macbook Pro. The good news is that it works, even if you aren't running OS X Server 10.5.4 as specified in the release notes:</p>
<p><a href="http://only4left.jpiwowar.com/wp-content/uploads/2009/04/oradbcasuccess.jpg"><img src="http://only4left.jpiwowar.com/wp-content/uploads/2009/04/oradbcasuccess-tm.jpg" width="480" height="300" alt="OraDBCASuccess.jpg" title="OraDBCASuccess.jpg" /></a></p>
<p>For the record, this is Mac OS X Leopard, desktop version 10.5.6. I'm still considering whether or not to post an "install guide," since everything more or less worked as advertised. And really, does the Internet need another dozen screenshots of OUI and DBCA doing their usual thing? I feel guilty enough for the screenshot above. </p>
<p><em>Install guide updates, 12-13 April 2009:
<ul>
<li><a href="http://ronr.blogspot.com/2009/04/how-to-install-oracle-10204-on-intel.html" title="how to install oracle 10.2.0.4 on intel (client) macs - quick">Ronald Rood</a> has posted a quick installation guide.
</li>
<li><a href="http://blog.rayapps.com/2009/04/12/how-to-install-oracle-database-10g-on-mac-os-x-intel/" title="How to install Oracle Database 10g on Mac OS X Intel">So has Raimonds Simanovskis</a>, with additional instructions on how to auto-start oracle on boot.  </li>
<li><a href="http://www.pythian.com/news/1937/quick-install-guide-for-oracle-10g-release-2-on-mac-os-x-leopard-intel" title="Quick Install Guide for Oracle 10g Release 2 on Mac OS X Leopard (Intel)">Alex Gorbachev</a> also has posted his install guide, so you now have a wide variety of options.</li>
</ul>
<p></em></p>
<h3>So now what?</h3>
<p>Apart from the novelty of it all, is this a worthwhile exercise? I'm not sure yet. I've been using the "Oracle in a VM" approach for a really long time, and I really like the flexibility of being able to play around with system configurations, etc. without worrying about doing any damage to my host system. With snapshots enabled, I don't even have to worry very much about permanently damaging the VM itself. Also, as stated in the <a href="http://download.oracle.com/docs/cd/B19306_01/relnotes.102/b25285/toc.htm#BABIJEFG" title="Release notes">release notes</a>&nbsp;&nbsp;(and called out in <a href="http://forums.oracle.com/forums/thread.jspa?threadID=654233&amp;tstart=0&amp;messageID=3395164#3395164" title="OTN Apple thread">this thread on the OTN Apple forum</a>, where hope springs eternal and no one is ever bitter or cranky), the list of supported features for the OS X version is a bit shorter than one might expect. On the other hand, "unsupported" doesn't always mean "won't work," and the memory footprint of a native database is a bit less than that of a full OS + database running in a virtualized environment. My expectation is that for quick testing and tinkering, the native database install could fit a niche, but VM still rules for more advanced stuff like RAC, ASM, 11g, etc.</p>
<p>What's encouraging is that it appears that Oracle hasn't abandoned OS X as a platform. Feature set aside, I suspect they'll need to do more frequent releases before many people would be very comfortable using this in an enterprise setting. But this also opens the possibility of different licensing options...Express Edition for OS X, anyone? OSXXE? <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>If someone manages to port this to iPhone, though, let me know. That would rock.</p>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2009/04/os-x-intel-native-10gr2-rdbms-is-here/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Running oidadmin on Mac OS X</title>
		<link>http://only4left.jpiwowar.com/2008/10/running-oidadmin-on-mac-os-x/</link>
		<comments>http://only4left.jpiwowar.com/2008/10/running-oidadmin-on-mac-os-x/#comments</comments>
		<pubDate>Fri, 17 Oct 2008 18:32:32 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Oracle misc]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[Unity]]></category>
		<category><![CDATA[VMware Fusion]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/?p=39</guid>
		<description><![CDATA[Being a Mac user and an Oracle DBA need not be an "oil and water" situation.  This post describes a way to leverage virtualization (in this case, VMware Fusion) to access tools that are not currently available on OS X.  My example is how to launch oidadmin on Mac OS X, but it can easily be adapted to other favorite applications.]]></description>
			<content:encoded><![CDATA[<p><i><b>Update:</b> Between <a href="http://only4left.jpiwowar.com/2008/10/running-oidadmin-on-mac-os-x/#comment-427">Brian's suggestion</a> for native oidadmin and the arrival of <a href="http://only4left.jpiwowar.com/2009/04/os-x-intel-native-10gr2-rdbms-is-here/">Oracle 10gR2 for Mac OS X Intel</a>, which includes the oidadmin utility, there are now much better ways to run oidadmin on OS X than the route described in this post.</i></p>
<p>It's almost a perfect setup.  Between <a href="http://www.oracle.com/technology/software/products/sql/index.html" title="SQL Developer">SQL Developer</a>, <a href="http://www.oracle.com/technology/software/products/jdev/index.html" title="JDeveloper">JDeveloper</a>, and <a href="http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/intel_macsoft.html" title="Instant Client">Instant Client</a>, I can do a lot of Oracle-related work natively on my Mac.  For those instances where I need a tool that doesn't exist for OS X, virtualization software like <a href="http://www.parallels.com/" title="Parallels">Parallels</a> and <a href="http://www.vmware.com/products/fusion/" title="VMware Fusion">VMware Fusion</a> can help to fill in the gaps.  One feature of VMware Fusion that I really like is Unity, especially now that it's available for Linux in Fusion 2.0.  Simply put, Unity allows the display of individual windows from a virtual machine without displaying that VM's desktop, offering a slightly more seamless user experience.  The application launched from the VM behaves like any other application window on the Mac desktop: it appears in the Dock; I can use Cmd-Tab to select the app, minimize it, etc.</p>
<p>To tie all of that introductory rambling together, here's the topic of the post:  an example of creating a Linux Unity application for an Oracle tool that I miss having on my Mac.  I use Linux Unity to launch the Oracle 10gAS oidadmin client.  The method I'm about to describe is a little bit clunky, but until VMware provides a more straightforward way to add your own apps, it'll do.</p>
<h3 id="setup">Setup steps</h3>
<ol>
<li>Launch a Linux virtual machine that has the oidadmin tool installed.  For my example, I just installed the 10gR2 client software in an <a href="http://edelivery.oracle.com/linux" title="Oracle Enterprise Linux">OEL5</a> VM, which was pretty straightforward.  <a href="http://blog.mclaughlinsoftware.com/" title="Maclochlainn’s Weblog">Michael McLaughlin</a> has some <a href="http://blog.mclaughlinsoftware.com/oracle-architecture-configuration/how-to-configure-mac-os-x-as-an-oracle-client/" title="">good material</a> on his blog on installing and configuring Oracle software in VMware Fusion, if you're looking for more direction.</li>
<li>Log in to your VM as a user that can run the oidadmin tool.  </li>
<li>Invoke Unity mode.  (cmd-ctrl-U)</li>
<li>Launch an application from the VMware Fusion Applications menu (cmd-L).  I used Terminal for this example, which for me is the under Utility menu.  This will create an application at the host level in your VM bundle, which you'll be using to create an application (oidadmin) of your own.  <i>Note:  in the course of testing these instructions, I found that I needed to launch Terminal twice to generate the application bundle used in subsequent steps.  <a href="http://en.wiktionary.org/wiki/your_mileage_may_vary" title="Your mileage may vary">YMMV</a>.</i></li>
<li>Locate the package on your host that contains your VM, navigate to the folder named Applications, and create a copy of the Terminal application.  If you're doing this in Finder, you'll need to 'Show package contents' on the VM bundle, as shown:
<p><a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-showpkg.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-showpkg-150x150.png" alt="Open contents of virtual machine bundle" title="Show VM package contents" width="150" height="150" class="alignnone size-thumbnail wp-image-45" /></a>  <a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-copyapp.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-copyapp-150x150.png" alt="Copy existing application" title="Copy application" width="150" height="150" class="alignnone size-thumbnail wp-image-40" /></a></p>
</li>
<li>Rename the copied application to something suitable.  In my case, I chose 'oidadmin'.</li>
<li>Open the Contents folder of the copied application (again, if you're using Finder, you'll need to Show Package Contents on the app bundle):
<p><a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-showpkg2.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-showpkg2-150x150.png" alt="Open contents of new application" title="Open application contents" width="150" height="150" class="alignnone size-thumbnail wp-image-46" /></a>
</li>
<li>Edit the Info.plist file, and change the values of the CFBundleDisplayName, CFBundleName, and DOGuestAppURI keys to the appropriate values.  the first two should reflect the new name of your app, and DOGuestURI needs to contain the absolute path to your oidadmin executable in your VM:
<p><a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-openplist.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-openplist-150x150.png" alt="Open application\&#039;s info.plist file" title="Open Info.plist" width="150" height="150" class="alignnone size-thumbnail wp-image-41" /></a> <a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-plistbefore.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-plistbefore-150x150.png" alt="Contents of info.plist before edit" title="Info.plist: before" width="150" height="150" class="alignnone size-thumbnail wp-image-43" /></a>  <a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-plistafter.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-plistafter-150x150.png" alt="Contents of Info.plist after edits" title="Info.plist:  after" width="150" height="150" class="alignnone size-thumbnail wp-image-42" /></a>
</li>
<li>Save the changes to Info.plist and close the file.
</li>
<li><a href="#launch">Launch</a> your new application!</li>
</ol>
<h3 id="textmode">Wow, that's a lot of screenshots</h3>
<p>It's true; I went a little <a href="http://www.flyingmeat.com/flysketch/" title="Lightweight screenshots for OS X">Flysketch</a>-happy with this one.  If you prefer the command line, here are alternatives to steps 5-8:</p>
<ol start="5">
<li>Use cd to navigate to the Applications folder of the VM bundle.  No need to 'show package contents,' since the VM bundle just appears as a directory.  In my example, the command would be: <code>cd ~/VMs/VMware/ClientSoup.vmwarevm/Applications</code></li>
<li>Make a copy of the app bundle created in step 4: <code>cp -r Terminal\ —\ ClientSoup.app oidadmin\ —\ ClientSoup.app</code></li>
<li>Use your favorite text editor to modify the Info.plist file: <code>vi oidadmin\ —\ ClientSoup.app/Contents/Info.plist</code>  The contents won't be as pretty to browse as they are with the Property List Editor, but hey, they're all just strings, right? <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </li>
<li>Enjoy having one less step than those non-command-line people.
</li>
</ol>
<h3 id="launch">Launching the app</h3>
<p>Here's your reward for all that hard work:</p>
<p><a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-tadah.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-tadah-300x244.png" alt="oidadmin on a Mac desktop.  Neato!" title="Ta-dah!" width="300" height="244" class="alignnone size-medium wp-image-47" /></a></p>
<p>Once the new application is created, you can launch it just as you would any other Mac application.  For best results, your virtual machine should be running and logged in as the use that can launch oidadmin.  It's worth noting, however, that if the VM is suspended, attempting to launch the application will resume the VM.  You'll just need to wait for the VM to restore its previous state.  Here are just a few ways to launch the new oidadmin application:</p>
<ul>
<li>Navigate to the Applications folder of your VM package, as in step 5 above, to find the oidadmin.app and launch it directly. (yeah, I know: Ugh.)</li>
<li>Create an alias to the new application and put the alias somewhere that's easier to access.</li>
<li>For launching from the command line, you could create an alias:
<pre>zathras:~ jpiwowar$ alias oidadmin='open -a ~/VMs/VMware/ClientSoup.vmwarevm/Applications/oidadmin\ —\ ClientSoup.app'
zathras:~ jpiwowar$ oidadmin</pre>
</li>
<li>Use <a href="http://www.blacktree.com/" title="Mouse-free Nerdvana">QuickSilver</a>, if you're into that sort of thing:
<p><a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-qs.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/10/oidadmin-qs-300x75.png" alt="Launching oidadmin with QuickSilver" title="Launching oidadmin with QuickSilver" width="300" height="75" class="alignnone size-medium wp-image-44" /></a></li>
</ul>
<h3 id="caveats">It's still not perfect</h3>
<p>I'm still tinkering with using the Unity feature in Linux VMs, and figuring out whether the limitations I'm seeing are perceived or real.  This is what I've seen so far that is less than ideal:</p>
<ul>
<li>I haven't found a way to easily add my own applications to the seeded list in the Applications menu, which is why I engage in the copy app/rename app/edit info.plist cycle described above.</li>
<li>The host OS doesn't seem to always recognize when an application launched from the VM has exited.  Even after closing the window on the VM, an icon for the app still remains in the Dock.  To re-open the application, I've found that I either have to launch it twice, or click on the orphan Dock icon to make it go away prior to attempting a re-launch.</li>
</ul>
<h3>That's all, folks</h3>
<p>And that's how I run oidadmin on my Mac.  I hope that someone out there in Internet-land finds this to be useful.  If so, toss me a comment!</p>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2008/10/running-oidadmin-on-mac-os-x/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Good times ahead for virtualization on Intel Macs</title>
		<link>http://only4left.jpiwowar.com/2008/07/vmware-fusion-2-beta-2-whee/</link>
		<comments>http://only4left.jpiwowar.com/2008/07/vmware-fusion-2-beta-2-whee/#comments</comments>
		<pubDate>Fri, 01 Aug 2008 03:17:53 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[VMware Fusion]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/?p=24</guid>
		<description><![CDATA[Oh boy, this is going to be fun.  The recent release of VMware Fusion 2.0 Beta 2 offers a big boost to the feature set of VMware Fusion (not to be confused with that other company's "Fusion" product).   The Windows/Mac integration and 3D/2D graphics improvements aren't deeply appealing to me, since I'm [...]]]></description>
			<content:encoded><![CDATA[<p>Oh boy, this is going to be fun.  The recent release of <a href="http://blogs.vmware.com/teamfusion/2008/07/safer-stronger.html" title="VMware Team Fusion Blog">VMware Fusion 2.0 Beta 2</a> offers a big boost to the feature set of VMware Fusion (not to be confused with <a href="http://www.oracle.com/applications/fusion.html" title="Oracle.com: Fusion Applications">that other company's "Fusion" product</a>).   The Windows/Mac integration and 3D/2D graphics improvements aren't deeply appealing to me, since I'm mostly running Linux VMs, but there are a number of <a href="http://www.vmware.com/beta/fusion/releasenotes_fusion.html#new20b2" title="VMware Fusion 2.0 Beta 2 new features">new features</a> that really jump out as a big deal to me:</p>
<ul>
<li><b>Multiple snapshots</b> can be a blessing and a curse.  The curse mostly comes into play when cleaning up snapshots on VMs that have large disks (such as E-Business Suite servers), but there are a lot of instances where I wish I had more than one "save point."</li>
<li><b>Lower resource utilization</b> probably doesn't mean the ability to <a href="http://forums.oracle.com/forums/message.jspa?messageID=2671762#2671762" title="OTN Forum thread re: VMware">create 4GB of RAM from 2GB</a>, but anything that frees up more resources for the host has to be a good thing, and based on my experience using ESX server, VMware knows resource management pretty well. </li>
<li><b>Linux Unity</b> may seem like a fluffy thing to like, but it fits a need for me:  the ability to run non-Mac-native Oracle client tools, such as oidadmin, without having to deal with either setting an X display (involves typing) or using a Windows OS (involves, um, Windows).</li>
<li><b>Scripting with vmrun</b> may allow me to throw out my functional-but-clunky Perl script for cloning VMs, and stop worrying if a vmx file format change in future releases will break the script.</li>
<li><b>Running a VM "headless"</b> would be pretty cool.  That's not in the release notes, but it is in the <a href="http://communities.vmware.com/docs/DOC-1201" title="VMware Communities">VMware Fusion Power User's Guide</a>, which, by the way, is a document well worth reading.</li>
</ul>
<p>The current version of VMware Fusion is already a pretty solid product, but the 2.0 features are really bringing Fusion up to a level that more closely matches its Windows counterpart, VMware Workstation.  Virtualization on the Mac is becoming a much richer experience.  Now, if VMware could just release a Mac version of the <a href="http://www.vmware.com/products/vi/vc/features.html" title="VMware VirtualCenter Features">Virtual Infrastructure Client</a>, my VMware+Mac wish-list would be all but complete.</p>
<p>Of course, I've yet to take the beta for a test drive, so maybe I'm falling prey to marketing ("Ooo, look, shiny things").  Regrettably, it wouldn't be the first time. <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  My initial plan was to hold off rocking the boat with my VMware machines and just wait until VMware Fusion 2.0 was fully released, but some of these features are making me rethink my "betas in VMs, not VMs in betas" rule.  If nothing else, I think I have to satisfy my "I wonder if that means <a href="http://www.imdb.com/title/tt0093779/quotes#qt0306379" title="gratuitous nerdy movie reference">what I think it means</a>" curiosity.  After all, it's not like I have a production environment to worry about these days...</p>
<h3>Whoops</h3>
<p>Apologies for the two-post drift into Mac-land.  It is a bit of a risk when reading here...I try not to be a drooling fanboy, but I really like my <a href="http://www.apple.com/macbookpro/" title="Apple.com: MacBook Pro">MBP</a>. <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />   I'll be getting back to Oracle stuff, Oracle Apps specifically, with my next few posts.  </p>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2008/07/vmware-fusion-2-beta-2-whee/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Launching SQL*Plus from SQL Developer on Mac  OS X</title>
		<link>http://only4left.jpiwowar.com/2008/07/launch-sqlplus-from-osx-sqldev/</link>
		<comments>http://only4left.jpiwowar.com/2008/07/launch-sqlplus-from-osx-sqldev/#comments</comments>
		<pubDate>Fri, 25 Jul 2008 03:49:51 +0000</pubDate>
		<dc:creator>jpiwowar</dc:creator>
				<category><![CDATA[Mac]]></category>
		<category><![CDATA[Oracle misc]]></category>
		<category><![CDATA[SQLDeveloper]]></category>

		<guid isPermaLink="false">http://only4left.jpiwowar.com/?p=17</guid>
		<description><![CDATA[I recently upgraded my Macbook Pro to Leopard, and along with all of the other goodies that come with that upgrade, I've been able to install and use the long-awaited (and Intel Leopard-only) Oracle Instant Client for OS X. I've been using SQL Developer on my Mac for a long time, but I've missed the [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded my Macbook Pro to Leopard, and along with all of the other <a title="OS X Leopard features" href="http://www.apple.com/macosx/features/">goodies</a> that come with that upgrade, I've been able to install and use the long-awaited (and <a title="Instant Client software requirements for OS X" href="http://download.oracle.com/docs/cd/B19306_01/install.102/e12121/toc.htm#BABHDBHB">Intel Leopard-only</a>) Oracle <a title="OS X Instant Client, wahoo!" href="http://www.oracle.com/technology/software/tech/oci/instantclient/htdocs/intel_macsoft.html">Instant Client for OS X</a>. I've been using SQL Developer on my Mac for a long time, but I've missed the ability to launch SQL*Plus from the command line.  Once I got the Instant Client installed (which was exactly as easy as "Instant" implies), I thought it would be useful to be able to launch SQL*Plus from within SQL Developer.  The script runner in SQL Developer offers <a title="SQL Developer script runner" href="http://download.oracle.com/docs/cd/E12151_01/doc.150/e12152/intro.htm#sthref183">limited SQL*Plus emulation</a>, and you never know when you might want to use one of your favorite SQL scripts from days gone by...</p>
<h3 id="setup">The setup</h3>
<p>As it turns out, while the release notes provide an <a title="SQLDev Release Notes" href="http://www.oracle.com/technology/products/database/sql_developer/files/relnotes_v15.html#sec2">example</a> for configuring the desired behavior, getting SQL Developer to effectively launch SQL*Plus is non-trivial on a system where Instant Client is the only other client software available.  I'll discuss the reasons in the next section, but for the benefit of any impatient googlers, here's what I ended up doing.</p>
<p>First, I created a small shell script, called launchsqlplus.sh, as shown below.  The values for the three environment variables (ORACLE_HOME, PATH, DYLD_LIBRARY_PATH) on your system will likely be different from mine, but you get the idea.</p>
<pre class="brush: bash; toolbar: true;">#!/bin/bash
export ORACLE_HOME=/u01/app/oracle/product/10gClient
export PATH=$PATH:$ORACLE_HOME/bin
export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$ORACLE_HOME/instantclient_10_2
dbuser=$1
dbconn=`echo $2 | awk -F \@ '{print $2}'`
sqlfile=$3
sqlplus $dbuser@\'$dbconn\' @$sqlfile
</pre>
<p>This shell script does the following:</p>
<ol>
<li>Adds the location of sqlplus on my system to the PATH.  I've deviated slightly from the Instant Client install docs here, and created a separate bin directory for sqlplus.</li>
<li>Adds the location of the Instant Client shared libraries to DYLD_LIBRARY_PATH.</li>
<li>Assigns more human-readable names to the input parameters for the script, and parses the database connect string generated by SQL Developer to something usable by the Instant Client (more on that later).</li>
<li>Launches SQL*Plus with the arguments passed from SQL Developer</li>
</ol>
<p>After saving the script in an appropriate place, and setting it executable <code>(chmod u+x launchsqlplus.sh)</code>, I moved on to setting up SQL Developer.  The following screenshots demonstrate the steps:</p>
<p><a href="http://only4left.jpiwowar.com/wp-content/uploads/2008/07/extsetup1.png"><img class="alignnone size-medium wp-image-18" title="External Tools Setup, step 1" src="http://only4left.jpiwowar.com/wp-content/uploads/2008/07/extsetup1-300x226.png" alt="" width="300" height="226" /></a></p>
<p>Quick notes on the contents of the fields, especially since the 'Arguments' field would require a ridiculously wide (and large) screenshot:</p>
<dl>
<dt>Program executable</dt>
<dd>I'm launching SQL*Plus in an xterm.  If you have a favorite terminal window that takes arguments in a way that's similar to xterm's -e option, you could probably substitute the path to that window here.  I briefly played around with trying to launch SQL*Plus with Terminal.app, but decided I just didn't care enough and stuck with xterm instead. <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  </dd>
<dt>Arguments</dt>
<dd>Pasted here in full since they don't show in the screenshot:<br />
<code>-e  /Users/jpiwowar/bin/launchsqlplus.sh ${sqldev.dbuser} ${sqldev.conn} ${file.path}</code><br />
Note the full path to the shell script, and the use of some of the macros discussed in the SQL Developer <a title="SQLDev Release Notes" href="http://www.oracle.com/technology/products/database/sql_developer/files/relnotes_v15.html#sec2">release notes</a>. </dd>
<dt>Run Directory</dt>
<dd>I don't have anything defined here, but if your SQL script dumps out log information without an absolute path for the logfile, you might want to set up a default directory here. </dd>
<dt>Command sample</dt>
<dd>Not user-editable, but a thoughtful feature nonetheless for debugging purposes.  Here's how it looks for my demo:<br />
<code>/usr/X11/bin/xterm -e  /Users/jpiwowar/bin/launchsqlplus.sh system jdbc:oracle:thin:@vir:1563/JPTEST.dbdomain /Applications/SQLDeveloper.app/Contents/Resources/sqldeveloper/sqldeveloper/bin/test.sql</code> </dd>
</dl>
<p><a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/07/extsetup2.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/07/extsetup2-300x226.png" alt="" title="External Tools Setup, step 2" width="300" height="226" class="alignnone size-medium wp-image-19" /></a></p>
<p>Not too much to say here. Specify whatever you like for the menu item label...</p>
<p><a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/07/extsetup3.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/07/extsetup3-300x226.png" alt="" title="External Tools Setup, step 3" width="300" height="226" class="alignnone size-medium wp-image-20" /></a></p>
<p>Choose what you like for Step 3 as well.  I leave the "Save All before tool starts" option unchecked, because I'd rather forget to save before running the script than accidentally wreck a file by running SQL*Plus.  But maybe that's just me. <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p><a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/07/extsetup4.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/07/extsetup4-300x226.png" alt="" title="External Tools Setup, step 4" width="300" height="226" class="alignnone size-medium wp-image-21" /></a></p>
<p>...and we're done!</p>
<h3 id="payoff">The payoff</h3>
<p>After putting it all together, here's the outcome:</p>
<p><a href='http://only4left.jpiwowar.com/wp-content/uploads/2008/07/sqlpluslaunch.png'><img src="http://only4left.jpiwowar.com/wp-content/uploads/2008/07/sqlpluslaunch-300x189.png" alt="" title="Demo of SQL*Plus launched from SQL Developer" width="300" height="189" class="alignnone size-medium wp-image-22" /></a></p>
<p>Some things to note:</p>
<ul>
<li>I ran the script in SQL Developer with the "Run script" option before invoking SQL*Plus.  As far as I know, this is necessary to associate the script with a database connection and populate the sqldev.user and sqldev.conn macros used in the External Tools definition.  As you can see from the screenshot, SQL Developer strips out the 'set linesize' output format command.</li>
<li>The password prompt for the SQL*Plus connection appears in the xterm.  It may be possible to make SQL Developer prompt for the password and pass it along to the shell script, probably via the "Prompt" or "Prompt with Label" macro.  I haven't tinkered with that option yet.</li>
<li>The log window at the bottom of the SQL Developer UI can be a useful place to start investigation if SQL*Plus doesn't launch as you'd expect.</li>
</ul>
<h3 id="argh">The annoying bits</h3>
<p>Why go through all the work of setting up a shell script wrapper for launching SQL*Plus?  Well, for a handful of reasons.  First, SQL Developer's database connection string generated by the sqldev.conn macro doesn't work as-is with the Instant Client.  The JDBC Thin connect string provided needs to be parsed a little to strip out the <code>jdbc:oracle:thin:@</code>, which is the purpose of the awk command in the shell script.</p>
<p>There are a lot of ways to work around the above issue without resorting to a shell script.  The tougher problem is that SQL Developer doesn't seem to care about your environment.  Well, you know, it <em>cares</em>, but it's just been really <em>busy</em>... <img src='http://only4left.jpiwowar.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />    I not only had to call executables by absolute path, but also had to find a way to set DYLD_LIBRARY_PATH in order for SQL*Plus to run.  In theory, it's possible to use <a title="Apple Developer Connection:  Setting Runtime Environment Variables" href="http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html#//apple_ref/doc/uid/20002093-113982">environment.plist</a> at the user level to set these environment variables, or to modify the <a title="Apple Developer Connection: Information Property List Files" href="http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/ConfigFiles.html#//apple_ref/doc/uid/20002091">Info.plist</a> file for SQL Developer, or even insert the environment variable definitions in the sqldeveloper.sh script that launches the application.  In practice, however, the ability to set DYLD_LIBRARY_PATH via environment.plist was <a title="Drat, no more DYLD_LIBRARY_PATH" href="http://lists.apple.com/archives/carbon-dev/2007/May/msg00275.html">apparently broken a while back</a>, perhaps intentionally as part of a security update, and I'm reluctant to modify files shipped with the application that are likely to be overwritten during an update.</p>
<p>I'll admit that I haven't researched all of these issues to the point where I am 100% certain that they are unresolvable.  After spending a little time playing around with different options (and engaging in some decidedly unprofessional muttering), I just decided to slap together a short shell script to do what I wanted.  Inelegant, but predictable.  I'm sure a cleaner solution exists, and would love a demonstration that I'm making this way more complicated than it needs to be.</p>
]]></content:encoded>
			<wfw:commentRss>http://only4left.jpiwowar.com/2008/07/launch-sqlplus-from-osx-sqldev/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
