Friday, April 27, 2007

creating a virtual machine in Amazon's Elastic Compute Cloud (EC2)

So instead of reading my usual trade rag for lunch, I decided to check out Amazon's Elastic Compute Cloud (EC2). Amazon.com hosts a service whereby you create a virtual Linux server out in the cloud and install your apps on it: http://developer.amazonwebservices.com/connect/kbcategory.jspa?categoryID=84

The basic install instructions take about an hour or so to go through:
http://docs.amazonwebservices.com/AmazonEC2/gsg/2006-06-26/?ref=get-started

You first need to create a developer account and assign yourself some space on their Simple Storage Service platform (S3):
http://www.amazon.com/S3-AWS-home-page-Money/b/ref=sc_fe_l_2/103-6202354-5495861?ie=UTF8&node=16427261&no=3435361&me=A36L942TSJ2AJA

I did the setup and got a virtual machine up and running as a web server. I would have provided you a test URL to hit, but I have since discontinued the VM I setup. So here is a screen grab of some simple commands I ran on the server:
http://content.serveftp.net/video/amazon.txt


It would probably be pricey for the average user, but a small business could easily afford it:
http://content.serveftp.net/video/amazon.png

The machine specs are somewhat low powered: 2.4Ghz AMD Opteron 250/1GB mem/single proc/160GB, but suitable for web serving. After the base install, an admin would logon via ssh and upload/install whatever apps necessary.

The great thing about this service is that it is going to make development and deployment of new applications much easier, as well as give the ability to scale up or down on demand. Kudos to Amazon!

Thursday, April 26, 2007

Oracle 10G on RHEL3 quick install instructions

One of the more interesting things I've done lately is install Oracle 10G on RHEL3 Advanced Server. Actually, a virtual instance of RHEL3 running under VMware Server. Granted, it's an older version of RHEL, but since this was a development/test platform, our company had some install disks laying around and I decided to take the path of least resistance. The install guide for 10G on RHEL3 is here:
Oracle® Database Installation Guide, 10g Release 2 (10.2) for Linux x86
http://download-east.oracle.com/docs/cd/B19306_01/install.102/b15660/install_overview.htm

OK. So nothing is ever "quick" about an Oracle installation. Maybe I should have said "install synopsis" or something similar. But the point is that the instructions below are not a substitute for the full documentation above, but serve to remind me of what I did to get Oracle up and running. So here is the list of high-level steps and quick diagnostics for folks doing the same:
1) Prepping the operating system
- install RHEL3
- include compatibility libraries and GCC
- create oracle user
- create oinstall and dba groups

2) The oracle installation
- during the install, SYS/SYSTEM/DMSNMP/SYSMAN will get the same password by default
- to configure Enterprise Manager, execute dbca at the command line

3) OS tweaks
- as root, set ORACLE_HOME and ORACLE_SID environment variables
- as oracle, set ORACLE_BASE, ORACLE_HOME, ORACLE_SID environment variables
- as oracle, add ORACLE_HOME/bin to PATH
- set NLS_LANG environment variable
4) configure Oracle net svcs
- Modify the listener.ora file. Here is a sample:
LISTENER =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)
(HOST = oracletest.test.com)
(PORT = 1521) (QUEUESIZE =32)
)
)

- Modify the tnsnames.ora file. Here is a sample:
TEST.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = oracletest)(PORT = 1521))
)
(CONNECT_DATA =
(SID = test)
(SERVER = DEDICATED)
)
)

5) Start the db
In SQL*Plus, as follows:
[oracle@oracletest oracle]$ sqlplus "/ AS SYSDBA"
Start the database:
SQL> STARTUP
Command to shutdown the database:
SQL> SHUTDOWN IMMEDIATE
6) start the listener
[oracle@oracletest oracle]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 26-APR-2007 15:43:39

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Starting /oracle/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /oracle/network/admin/listener.ora
Log messages written to /oracle/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracletest.test.com)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=TCP)(HOST=oracletest.test.com)(PORT=1521)(QUEUESIZE=32))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 26-APR-2007 15:43:39
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/network/admin/listener.ora
Listener Log File /oracle/network/log/listener.log
Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracletest.test.com)(PORT=1521)))
The listener supports no services
The command completed successfully


You can also use "status" or "stop" as arguments to the lsnrctl command:
lsnrctl [stop,start,status]

7) Starting the web based 10G Enterprise Manager database control
If you want to use the web based 10G Enterprise Manager database control, start it up:
[oracle@oracletest oracle]$ emctl start dbconsole
TZ set to US/Eastern
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://oracletest.test.com:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control .............. started.
------------------------------------------------------------------
Logs are generated in directory /oracle/oracletest.test.com_test/sysman/log


Login to the web based console: http://host:port/em
You may get a timezone mismatch. If so, check this out:
http://cacasodo.blogspot.com/2007/04/timezone-mismatch-agenttzregion-does.html

Verifying the database from a client
1) Verify the database listener is up and running
C:\WINDOWS>tnsping test

TNS Ping Utility for 32-bit Windows: Version 9.2.0.7.0 - Production on 23-APR-2007 11:54:19

Copyright (c) 1997 Oracle Corporation. All rights reserved.

Used parameter files:

C:\oracle9i\network\admin\sqlnet.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = oracletest)(PORT = 1521))) (CONNECT_DATA = (SID = test) (SERVER = DEDICATED)))
OK (30 msec)

2) connection errors
a. You may get this error if you do not have a proper tnsnames entry for your database:
C:\WINDOWS>sqlplus web/web@test

SQL*Plus: Release 9.2.0.7.0 - Production on Mon Apr 23 11:53:43 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

ERROR:ORA-12505: TNS:listener could not resolve SID given in connect descriptor

Enter user-name: ^C


b. You may get this error if you are using the wrong user or password to connect to the database:
C:\WINDOWS>sqlplus web/web@test

SQL*Plus: Release 9.2.0.7.0 - Production on Mon Apr 23 11:54:32 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

ERROR:ORA-01017: invalid username/password; logon denied
Enter user-name: ^C


3) Successful connection.
If all is well, select SYSDATE from the DUAL table just to verify you can get data
C:\WINDOWS>sqlplus web/web@test

SQL*Plus: Release 9.2.0.7.0 - Production on Mon Apr 23 11:55:12 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

Connected to:Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining options

SQL> select sysdate from dual;
SYSDATE
---------------
26-APR-07

SQL> quit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - ProductionWith the Partitioning, OLAP and Data Mining options


Other helpful commands
Finding your SID
First, check your environment settings..
[oracle@test]$ set grep SID
ORACLE_SID=test

Then login to oracle:
sqlplus sys as sysdba

SELECT instance_name
FROM v$instance;

Make sure your listener is up!
[oracle@test oracle]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 26-OCT-2010 23:25:17

Copyright (c) 1991, 2005, Oracle. All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=TCP)(HOST=test.test.com)(PORT=1521)(QUEUESIZE=32))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 26-OCT-2010 23:15:19
Uptime 0 days 0 hr. 9 min. 58 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /oracle/network/admin/listener.ora
Listener Log File /oracle/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=test.test.com)(PORT=1521)))
Services Summary...
Service "test" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "testXDB" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "test_XPT" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
The command completed successfully

Good luck!
TAG

References
http://forums.oracle.com/forums/thread.jspa?threadID=260359&tstart=60 http://forums.oracle.com/forums/thread.jspa?threadID=917370
Changing Oracle Enterprise Manager port numbers
Oracle Insert statements
Get list of constraints

Tuesday, April 24, 2007

Timezone mismatch agentTZRegion does not match the current environment TZ setting

To get Oracle's sweet Enterprise Manager Database Control web gui running, you'll need to use the Enterprise Manager control to start it. Use the following command:
emctl start dbconsole

The web gui runs on port 1158. For some reason, though my TZ environment variable matched what was in the emd.properties file, I got the following error:
[oracle@oracletest oracle]$ emctl start dbconsole
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://oracletest.test.com:1158/em/console/aboutApplication

Timezone mismatch: The agentTZRegion value (EST) in
/oracle/oracletest.test.com_test/sysman/config/emd.properties
does not match the current environment TZ setting(EST).
The dbconsole cannot run with this mismatch.

If EST is the correct timezone, set your timezone environment variable to EST and repeat the 'emctl start dbconsole' operation.

If EST is not the correct timezone, make sure that the timezone in your environment is correct, and then run the following command in your local Oracle Home: 'emctl resetTZ agent'

The output of this command will include detailed instructions to follow, to correct the mismatch
.


If I echo out my timezone, I see that it is set to EST:
[oracle@oracletest oracle]$ echo $TZ
EST


Then, I looked in the emd.properties file and saw that the agentTZRegion is set to the same:
[oracle@oracletest oracle]$ grep Z /oracle/oracletest.test.com_test/sysman/config/emd.properties
agentTZRegion=EST


What the heck? After a bit of googling, I saw someone simply unset the TZ environment variable and the dbconsole started up. So I did the same:
[oracle@oracletest oracle]$ unset TZ
[oracle@oracletest oracle]$ echo $TZ


This seemed to work for me as the dbconsole started and port 1158 was up and listening!
[oracle@oracletest oracle]$ emctl start dbconsole TZ set to US/Eastern
Oracle Enterprise Manager 10g Database Control Release 10.2.0.1.0
Copyright (c) 1996, 2005 Oracle Corporation. All rights reserved.
http://oracletest.test.com:1158/em/console/aboutApplication
Starting Oracle Enterprise Manager 10g Database Control .............. started.
------------------------------------------------------------------
Logs are generated in directory /oracle/oracletest.test.com_test/sysman/log
[oracle@oracletest oracle]$
[root@oracletest oracle]# netstat -na grep 1158
tcp 0 0 0.0.0.0:1158 0.0.0.0:* LISTEN

Ah well..all's well that ends well!

Sunday, April 22, 2007

right-mouse click for XP/Vista on MacBook / Remote Desktop for Mac

As I run both XP, Vista and Fedora in VMware Fusion on my MacBook Pro 17", I was struggling with the fact that since the MacBook only has one button below the trackpad, I did not have access to a right mouse button to get the contextual help and properties menus in XP and Fedora.

Well, if I had looked longer and harder in the System Preferences -> Keyboard and Mouse -> Trackpad properties of my MacBook, I would have found an obscure option called "Place two fingers on trackpad and click button for secondary click."


This option is an advanced finger technique applied to the trackpad. To enable your context-sensitive right-mouse click, just stick two fingers on the trackpad and click an object in XP or Fedora. Voila! You should see your right-mouse option menu appear! Sweet!


Enabling this option allowed me to do everything I needed to do in XP and Fedora, as well as in Remote Desktop Connection (RDC) for Mac:
http://www.microsoft.com/mac/otherproducts/otherproducts.aspx?pid=remotedesktopclient

Nice!

One caveat, though, is that apparently, this option is not available in MacBook 15" models. I don't know why this is, but if I have time, I will find out.

Finally, I learned about three additional key combinations while editing this post. First was using Function (fn) key in combination with the directional keys in the lower right corner of my MacBooks' keyboard. The Function (fn) key is in the lower left hand corner of the corner. The directional keys on the opposite site of the keyboard are PageUp PageDown, Home and End.

Secondly, Fn-delete works as a normal delete key within a Windows session when using Mac RDC. Finally, press the Mac delete key alone to function as a backspace in a Windows RDC session.

Both of these keystrokes are very useful and available cross-platform when you use the freely available Remote Desktop Connection from Microsoft.

7/30/07 Update: I put a more definitive list of keyboard shortcuts and key symbol names here for your enjoyment:
/2007/07/macbook-pro-keyboard-shorcuts-and.html

Here is the most awesome list of key bindings for the mac:
http://support.apple.com/kb/HT1343

cheers!
'sodo

Friday, April 20, 2007

macbook pro airport seems to need SSID broadcast

After spending an hour of troubleshooting, I found that my new MacBook Pro 2.33Ghz Intel Core 2 Duo needs SSID broadcast enabled for it to connect to my NetGear WGT624. I have not confirmed that with the Apple documentation yet, but an hour of troubleshooting and experimentation shows that the MacBook will not connect to my wireless router without the router broadcasting the SSID.

Speaking of which, here is a short list of things with which to verify your wireless connection. Hope they are helpful:

On the Router:
1) make sure SSID Broadcast is enabled :)
2) verify the wireless mode (g&b, g only, b only, 108Mbps only, Auto 108Mbps)
3) verify what security you are using (none, WEP or WiFi Protected Access Pre-Shared Key (WPA-PSK))
4) verify any advanced 108Mbps or extended range features are enabled or disabled

On the attaching computer:
1) verify that the wireless network name you are connecting to is the same as your router is broadcasting
2) verify that the type of wireless security (none, WEP, WPA, LEAP, 802.1X WEP) matches what is being used by your wireless router
3) verify that your WPA passphrase or WEP key is correctly entered as Hex or ASCII
- Hex will allow a longer, more difficult to remember password
- ASCII will give you the english language translation of the Hex password, usually shorter
4) for WEP, verify the Authentication Type (auto, open system, shared key) and the encryption strength

good luck!

Tuesday, April 17, 2007

lefty mouse mess in Fedora under VM on Mac

OK. So here's a little humorous incident that happened to me while I was getting the Fedora virtual machine to run under the Mac.

The Fedora VM that I imported to my MacBook Pro was originally created on my PC. On my PC, I occasionally swap the left and the right mouse buttons, depending upon the amount of carpal tunnel I am experiencing in either hand. At the time I built out the Fedora virtual machine, Fedora was configured to use a left-handed mouse. When I moved the VM over to my MacBook Pro and started it up, I saw that when I clicked the mouse button, the alternative/properties menus appeared as if I had clicked the right mouse button in a left-handed mouse configuration! Yarg! Navigating the menus proved frustrating this way, because clicking on the menus just gave me the few dumb right-mouse-click options:
Help
Edit
Remove From Panel
Lock to Panel

Also, in my ignorance, I didn't know the correct key combinations to get to the menus. I poked around on google a bit on which Core 6 system file on controlled the left/right mouse selection and found some reference to /etc/sysconfig/mouse. This file didn't exist on my system. Next, /etc/X11/xorg.conf could have had some mouse configuration commands, but alas, my xorg.conf was clean of any mouse controls.

What was an idiot to do?

Well, when you don't know what you're doing, redo the setup! So, I re-ran "setup" and changed the Xconfiguration in a terminal window.

Lame? Of course! But sometimes you just get tired of researching ALL the time.

Mental note: for next time, find out the key combination to get to the menus in Fedora Core 6. Life will be SO much easier that way.

Monday, April 16, 2007

Fedora Core 6 in Parallels on a MacBook Pro blowup

I've been away at Web2.0 in San Francisco, but I thought I'd drop a quick entry regarding my experience with Parallels Desktop for Mac (Intel Mac) and my new MacBook Pro. In order to run Cinelerra, I installed Parallels on my brand spanking new MacBook Pro and wouldn't you know it, I got this lovely message when the new install of Core 6 booted up:
(0)Kernel panic - not syncing: Attempted to kill init!

I briefly googled that message, but you know, when you just need to get something working and are tired of doing the research, fall back on the tried and true. In that vein, I found that VMware's Fusion product was available in beta for the Mac. Oooh. Beta..that might not be so good. But since I already had a Fedora Core 6 installation that had everything I needed already running in VMware Server, I thought I'd give it a try. Here's the URL for the beta download..you'll have to register first:
http://register.vmware.com/content/beta/fusion/registration.html

Once I downloaded and installed fusion, I needed to bring over my 8GB Core 6 virtual machine from my PC. I zipped up the entire VM directory and found that zip very kindly reduced the size of the VMDK file from 8GB to 2.8GB. Cool! As I copied the zip over the network, I noticed it was taking a very, very long time. So I stopped the transfer, unplugged my network connections from my PC and Mac and wired them together with a crossover cable. Wired in this way, I increased my download speed from 500Kbps to 5400Kbps! Sweet!

Once the zip file had copied to the Mac, I unzipped it to my home directory and then created a new virtual machine from my pre-existing VM.

This process was a bit confusing at first. But what you need to do to utilize an existing VMware virtual machine is to select "Use an Existing virtual disk" under the Advanced Disk Options on the Virtual Hard Disk step of the create new virtual machine process:




Once I figured that little tricky bit out, I was good to go! I clicked Start on my newly created virtual machine et Voila! She came up! I turned off debugging as this seemed to slow things down a bit and made sure to install VMware tools for better mouse and graphic behavior.

Long live VMware!

Monday, April 02, 2007

VMware Converter experience

As I undersized my Red Hat Enterprise Linux 3 virtual machine, I needed to expand the / (root) partition for an Oracle 10G install. Normally, I would have used VMware vdiskmanager to do the resize, but I thought I'd give VMware Converter a try. 4sysops.com has a great introduction to VMware Converter 3.0 here:
http://4sysops.com/archives/resize-a-virtual-disk-with-vmware-converter/

I installed the software and followed along the same path as the 4Sysops. However, when I got to the point to resizing any of my Linux partitions (two ext3/one swap), I was confronted with the following dialog box that read:
"Warning: Cannot configure the source image"

That first error did not stop my progress and I was able to choose "Select volumes and resize to save or add space". However, when I chose that option, the New Disk Space drop down was grayed out and I was unable to resize any of my Linux partitions. After a bit of Googling, I found a number of articles:
http://www.google.com/search?hl=en&q=vmware+converter+%22cannot+configure+the+source+image%22

A number of the sites pointed out that the VMware converter does have problems with resizing linux partitions. That's fine, but what about a solution? This was found on the mojocode.com site:
http://www.mojocode.com/

They resolved the issue by resizing the virtual machine by using vdiskmanager. I tried their suggestion and expanded the virtual machine to 40GB by using the following command:
C:\Virtual Machines\Red Hat Enterprise Linux 3>"\Program Files\VMware\VMware Server\vmware-vdiskmanager.exe" -x 40gb "Red Hat Enterprise Linux 3.vmdk"

Using log file C:\DOCUME~1\USER\LOCALS~1\Temp\vmware-user-3279696342\vdiskmanager.log Grow: 100% done.
The old geometry C/H/S of the disk is: 1044/255/63
The new geometry C/H/S of the disk is: 5221/255/63
Disk expansion completed successfully.

WARNING: If the virtual disk is partitioned, you must use a third-party utility in the virtual machine to expand the size of the partitions. For more information, see: http://www.vmware.com/support/kb/enduser/std_adp.php?p_faqid=1647

Luckily, this resize worked. After the resizing, I successfully booted the virtual machine and saw via fdisk that indeed, I had about 32GB extra space, so I created a new ext3 partition:
[root@oracletest root]# fdisk /dev/sda
Command (m for help): Command (m for help): p
Disk /dev/sda: 42.9 GB, 42949672960 bytes255 heads, 63 sectors/track, 5221 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System/dev/sda1 * 1 13 104391 83 Linux/dev/sda2

14 790 6241252+ 83 Linux/dev/sda3
791 1044 2040255 82 Linux swap/dev/sda4
1045 5221 33551752+ 83 Linux

After the creation, I rebooted. I then formatted the disk properly with the following command:
mkfs.ext3 -b 4096 /dev/sda4

Hot dog! I've got plenty of space for my Oracle 10G install!

vdiskmanager , 4sysops and google save the day!

UPDATE: If you're interested, I've recently done a physical to virtual conversion of a Win2K box here:
2007/06/converting-physical-server-using-vmware.html
Feel free to drop me a line or ask me a question.