Archive for the ‘Database’ Category

Stop Using select *

Wednesday, August 6th, 2008

In my time trawling through various systems’s DB code, I see we are using “select *” in many places. This has to stop, and we need to specify the columns we want explicitly every time. The reasons for this are:

- A change to the table structure can break the code
- We end up getting all the columns from the DB when we almost certainly don’t need to. Some of the columns can be enormous, and it is a waster of DB and network resource in getting this data.
- A change to the query can add many more columns to be returned.
- It can make a difference to the query plan the DB uses, and can be many orders of magnitude faster to specify columns individually.

Using “select *” is lazy, suboptimal and a coding time bomb.



Dropping a Repository the easy way

Wednesday, June 25th, 2008

In previous OEM posts I have been dropping the Repository in a variety of ways. In a moment of Instruction Reading, something I rarely do because I love to conform to stereotypes, I found this little obvious-when-you-know beauty:

$ORACLE_HOME/sysman/admin/emdrep/bin/RepManager

[oracle@bbmos01 ~]$ $ORACLE_HOME/sysman/admin/emdrep/bin/RepManager $HOST $PORT $SID -action drop
Enter SYS user’s password :
Enter repository user name : SYSMAN
Enter repository user password :
Getting temporary tablespace from database…
Found temporary tablespace: TEMP
Checking SYS Credentials … OK.
Dropping the repository..
Quiescing DB … Done.
Checking for Repos User … Exists.
Repos User exists..
Clearing EM Contexts … OK.
Dropping EM users …
Done.
Dropping Repos User … Done.
Dropping Roles/Synonymns/Tablespaces … Done.
Unquiescing DB … Done.
Dropped Repository Successfully.

Ho hum. It can do it all.

Downgrading an OEM repository from 10.2.0.3 to 10.1.0.5

Wednesday, May 21st, 2008

If you ever have the misfortune of downgrading an Oracle server, you can run into some silly problems. One such issue raised its head when I needed to downgrade a server for a different project. I downgraded a 10.2.0.3 server to 10.1.0.5 and had a 10.2.0.3 OEM repository already installed. I exported all the schemas and reimported once I had downgraded.

I started the DB console and everything seemed fine, but when browsing to the OEM, I logged on and got a screen showing that it had not connected to the instance. A quick look at the logs followed. You can see the following errors in the emagent.trc file:

2008-05-21 00:57:47 Thread-4120902576 ERROR upload: Failed to upload file A0000001.xml, ret = -2
2008-05-21 00:57:47 Thread-4120902576 WARN upload: FxferSend: received http error in header from repository: http://oracle.oakdene.net:5500/em/upload/
ERROR-400|ORA-06550: line 1, column 18:
PLS-00302: component ‘OBTAIN_LOCK_FOR_EMD_URL’ must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored

I decided that I would accept not having the old repository data for now, I could always import into another schema and do a post fix data import. I needed to drop the repository and recreate the 10.1.0.5 version (theemca commands are different between 10.2 and 10.1).

[oracle@oracle ~]$ emca -x OAKDENE_SID

STARTED EMCA at Wed May 21 01:54:52 PDT 2008
May 21, 2008 1:54:52 AM oracle.sysman.emcp.EMConfig stopOMS
INFO: Stopping the DBConsole …
Enterprise Manager configuration is completed successfully
FINISHED EMCA at Wed May 21 01:54:57 PDT 2008

I then tried installing the db console. I used a response file called emca.txt. This didn’t work properly as can be seen below:

[oracle@oracle ~]$ emca -f emca.txt

STARTED EMCA at Wed May 21 01:55:24 PDT 2008
Password for dbsnmp:
Password for sysman:
Password for sys:
May 21, 2008 1:55:32 AM oracle.sysman.emcp.EMConfig checkConfiguration SEVERE: Repository already exists. Fix the error(s) and run EM Configuration Assistant again in standalone mode. Could not complete the configuration. Refer to the log file for details

I decided to drop the repository manually by dropping the SYSMAN user:

[oracle@oracle ~]$ sqlplus / as sysdba

SQL*Plus: Release 10.1.0.5.0 - Production on Wed May 21 01:55:42 2008

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

Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> drop user sysman cascade;

User dropped.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
[oracle@oracle ~]$ emca -f emca.txt

STARTED EMCA at Wed May 21 02:01:35 PDT 2008
Password for dbsnmp: Password for sysman: Password for sys:
May 21, 2008 2:01:43 AM oracle.sysman.emcp.EMConfig updateReposVars
INFO: Updating file /home/oracle/oracle10db/sysman/emdrep/config/repository.variables …
May 21, 2008 2:01:48 AM oracle.sysman.emcp.EMConfig perform
SEVERE: Error creating the repository. Repository creation could not be completed successfully
May 21, 2008 2:01:48 AM oracle.sysman.emcp.EMConfig perform
INFO: Please refer to the log file at /home/oracle/oracle10db/cfgtoollogs/emca_repos_create<DATE>.log for more details.
Could not complete the configuration. Refer to the log file for details
[oracle@oracle ~]$ vi /home/oracle/oracle10db/cfgtoollogs/emca_repos_create2008-05-21_02-01-43-AM.log

But it still failed. In the log mentioned here is is quite obvious what has happened:

CREATE ROLE MGMT_USER
*
ERROR at line 1:
ORA-01921: role name ‘MGMT_USER’ conflicts with another user or role name

After fixing this issue (and others) by repeating, there are a series of other objects which need dropping as well:

[oracle@oracle ~]$ cat drop_sysman.sql

drop public synonym SETEMVIEWUSERCONTEXT;
drop role mgmt_user;
drop public synonym mgmt_target_blackouts;
drop user sysman cascade;
drop user mgmt_view cascade;
exit

[oracle@oracle ~]$ sqlplus ‘/ as sysdba’ @drop_sysman

SQL*Plus: Release 10.1.0.5.0 - Production on Wed May 21 02:02:16 2008

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

Connected to:
Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

Synonym dropped.

Role dropped.

Synonym dropped.

User dropped.

User dropped.

Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.5.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

And this works now, the repository gets create properly:

[oracle@oracle ~]$ emca -f emca.txt

STARTED EMCA at Wed May 21 02:24:32 PDT 2008
Password for dbsnmp: Password for sysman: Password for sys:
May 21, 2008 2:24:42 AM oracle.sysman.emcp.EMConfig updateReposVars
INFO: Updating file /home/oracle/oracle10db/sysman/emdrep/config/repository.variables …
May 21, 2008 2:26:18 AM oracle.sysman.emcp.EMConfig createRepository
INFO: Creating repository …
May 21, 2008 2:26:18 AM oracle.sysman.emcp.EMConfig perform
INFO: Repository was created successfully
May 21, 2008 2:26:19 AM oracle.sysman.emcp.EMConfig addPortEntries
INFO: Updating file /home/oracle/oracle10db/install/portlist.ini …
May 21, 2008 2:26:19 AM oracle.sysman.emcp.EMConfig updateEmdProps
INFO: Updating file /home/oracle/oracle10db/sysman/config/emd.properties …
May 21, 2008 2:26:19 AM oracle.sysman.emcp.EMConfig updateConfigFiles
INFO: targets.xml file is updated successfully
May 21, 2008 2:26:19 AM oracle.sysman.emcp.EMConfig updateEmomsProps
INFO: Updating file /home/oracle/oracle10db/sysman/config/emoms.properties …
May 21, 2008 2:26:19 AM oracle.sysman.emcp.EMConfig updateConfigFiles
INFO: emoms.properties file is updated successfully
May 21, 2008 2:26:20 AM oracle.sysman.emcp.EMConfig startOMS
INFO: Starting the DBConsole …
May 21, 2008 2:27:54 AM oracle.sysman.emcp.EMConfig perform
INFO: DBConsole is started successfully
May 21, 2008 2:27:54 AM oracle.sysman.emcp.EMConfig perform
INFO: >>>>>>>>>>> The Enterprise Manager URL is http://oracle.oakdene.net:5500/em <<<<<<<<<<<
Enterprise Manager configuration is completed successfully
FINISHED EMCA at Wed May 21 02:27:54 PDT 2008

Perseverance is the key :).

Installing PokerTracker on a Mac

Wednesday, March 12th, 2008

Download the pokertracker installer and install using the unsupported software installation for crossover. I want to use the postgres database server as the database as I have always hated Access and getting that to work with crossover has had mixed reviews according to some forum posts I have seen, although crossover lists various Access versions as supported.

To install postgres I used the instructions on the developer.apple site - http://developer.apple.com/internet/opensource/postgres.html

I need to install fink (http://www.finkproject.org/download/index.php) as well. I am using Leopard, and at the time of writing, there is no binary, so I need to get the source. After downloading I realised I had no c compiler installed! A handy error message told me I needed the developer tools:

....
Checking cc... not found.
ERROR: There is no C compiler on your system. Make sure that the Developer
Tools are installed.

Got the XCode3 stuff from http://developer.apple.com/tools/download/ and just installed the XCodeTools.mpkg package. This took just under 10 minutes to install, most of the time seemed to be installing documentation, which is nice. Seems a bit strange that a Mac doesn’t come with any compiler, but I am used to Linux when it comes to non-Windows machines, and this is my first Mac.

I have used WebObjects before and had no interest in that, so left it out. Reminds me too much of a sketchy project I worked on in another lifetime.

Once the dev tools are all installed, I can run the fink ./bootstrap command again. Unsurprisingly, I went for the defaults for most of the options, although I did turn on the unstable option as I like new broken stuff and I went for UK based mirrors…
I then was told to make a cup of tea in the INSTALL notes, so I did. At 23.58. Lets see how long this takes :)
… good job i waited as first curl call timed out :) happily downloading from another mirror.

I also notice, as I sit back down that my MacBook Pro is making more fan noise than ever. Hardest its worked so far methinks. At least it now knows what is ahead of it.

While this was grinding away, I downloaded the PostgreSQL source, as there is obviously no binary for OSX. I went for the 8.3 version and seeing as I saw bzip2 flash past on this fink thing, I went for the postgresql-8.3.0.tar.bz2 source files.

Fink finished at 00.11. Might be a late one, but I am warming to this task I think.

Now the instructions say install the readline using fink, but this happens:

me:fink-0.28.0 me$ sudo  /sw/bin/fink install readline
Password:
Scanning package description files..........
Information about 268 packages read in 0 seconds.
Failed: no package found for specification 'readline'!

This sucks. I added /sw/bin to my $PATH to make things easier and had a look at the other options for fink. A list was what i was after and this gave me:

me:fink-0.28.0 me$ fink list readline
Scanning package description files..........
Information about 268 packages read in 0 seconds.
 p   term-readline-pm588                      [virtual package]

This doesn’t look right. As readline is a GNU app, I wondered if the gnu mirror was cocked up, so went looking for a conf file rather than having to rerun the configuration again. It is /sw/etc/fink.conf and all the mirrors are listed there. As the terminal window does not have infinite window buffer size, the other mirror options had vanished into terminal nirvana, so I checked the gnu site for different mirrors (I could just download the readline source from here, but I am determined now). I added Mirror-gnu: ftp://ftp.cwru.edu to the list. This did sweet FA. I ran a fink selfupdate and watched the Dual Core go. I did have a lot of mirror trouble it seemed. Not sure if my connection is crapping out or if they are just unavailable. Got one in the end.

me:fink-0.28.0 me$ fink list readline
Information about 6504 packages read in 1 seconds.
     readline               4.3-1028          Comfortable terminal input library
     readline-java          0.8.0-1024        Readline support for Java
     readline-shlibs        4.3-1028          Comfortable terminal input library
     readline5              5.0-1005          Comfortable terminal input library
     readline5-shlibs       5.0-1005          Comfortable terminal input library
     term-readline-gnu-pm5  1.15-1004         Perl extension for the GNU Readline
     term-readline-pm       1.0203-12         Minimal interface to Readline
 p   term-readline-pm588                      [virtual package]

Cool. Went for the 5 version. More Core Duo action.

On to Postgres, files downloaded, we are nearly ready to crack on with this latest nonsense:

me:Downloads me$ md5 postgresql-8.3.0.tar.bz2
MD5 (postgresql-8.3.0.tar.bz2) = 53d6816eac7442f9bc8103439ebee22e
me:Downloads me$ cat postgresql-8.3.0.tar.bz2.md5
MD5 (postgresql-8.3.0.tar.bz2) = 53d6816eac7442f9bc8103439ebee22e

Rock n Roll. I can feel the tiredness of getting up early because of a timezone mistake and an evening boxing training taking its toll.
The INSTALL document has a short install instructions at the top. I will go through it and only put stuff here that deviated from the expected. I have a feeling old Core Duo is going to get another pounding.

First up, we need to do some extra includes for the ./configure, as mentioned in the apple.developer doc /configure –with-includes=/sw/include/ –with-libraries=/sw/lib
Second, I don’t have gmake, I have make so I used that instead.
Third, I forgot to sudo the make install, so got permission problems. If that is the only cock-up left in me tonight I will be very happy. Install completed pretty quick..
Some graphical UI stuff next according to apple.developer doc. I added the postgres user. When this was done, I could create a data directory for the db and then initialise it:

me:postgresql-8.3.0 me$ sudo sh
sh-3.2# mkdir /usr/local/pgsql/data
sh-3.2# chown postgres /usr/local/pgsql/data/
sh-3.2# su -l postgres
me:~ postgres$ /usr/local/pgsql/bin/initdb -D /usr/local/pgsql/data/
The files belonging to this database system will be owned by user "postgres".
This user must also own the server process.

The database cluster will be initialized with locale C.
The default database encoding has accordingly been set to SQL_ASCII.
The default text search configuration will be set to "english".

fixing permissions on existing directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 20
selecting default shared_buffers/max_fsm_pages ... 2400kB/20000
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
vacuuming database template1 ... ok
copying template1 to template0 ... ok
copying template1 to postgres ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the -A option the
next time you run initdb.

Success. You can now start the database server using:

    /usr/local/pgsql/bin/postgres -D /usr/local/pgsql/data
or
    /usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

Oh man we are getting close now!

me:postgresql-8.3.0 me$ sudo su - postgres
me:~ postgres$ echo $PATH
/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/pgsql/bin:/sw/bin
me:~ postgres$ pg_ctl -D /usr/local/pgsql/data -l logfile start
server starting
me:~ postgres$ createdb pokertracker
me:~ postgres$ psql pokertracker
Welcome to psql 8.3.0, the PostgreSQL interactive terminal.

Type:  \copyright for distribution terms
       \h for help with SQL commands
       \? for help with psql commands
       \g or terminate with semicolon to execute query
       \q to quit

pokertracker-# \q
me:~ postgres$

Started up the PokerTracker application through crossover and lo and behold, it fails with:

unable to connect to the PTREG2 database

Goddamnit, is it trying to connect to Access DB first. If I remember correctly I think it does, and you have to convert the DB to be a Postgres one. Shite. It is now 1.30am and I need sleep. Next post is how I got hold of a version of Access 2000 :).

Some Issues Installing OEM for Oracle 10.2

Wednesday, February 13th, 2008

The Oracle installations tend to be on remote boxes which call for the use of text-shell based installations. In order for us to do this we need to start off any Oracle tool installation with a response file, which contains all the details required for the installer to run.

The command we need to run to install the OEM is the emca.

  • Connect to the Oracle server using ssh.
  • sudo to the oracle user.
  • create a response file called emca_resp.txt

The response file should look like this (substituting your own values obviously):

HOST=db.property.site.com
SID=orcl
PORT=1521
ORACLE_HOME=/home/oracle/app/oracle/product/10g
EMAIL_ADDRESS=my_admin@site.com
MAIL_SERVER_NAME=smtp.db.site.com
DBSNMP_PWD=xxxxxxxxxx
SYSMAN_PWD=xxxxxxxxx
SYS_PWD=xxxxxxxx
  • run emca -config dbcontrol db -repos create -respFile emca_resp.txt

If there are existing versions of the OEM tool, or the above has previously failed, then just run

emca -config dbcontrol db -repos recreate -respFile emca_resp.txt

which will delete the original installation before installing a fresh copy.

If the installation fails for any particular reason (and it has been known…) then the errors get written to a log file specified in the error message displayed in the console. Tail this log file for the reasons, which usually are fairly obvious (eg wrong passwords, missing files, wrong ORACLE_HOME) and then when the issues are fixed, use the second recreate statement above, which will clear the previous failed attempt.

If everything goes according to plan then the output will be something like

[oracle@pre-db1 ~]$ emca -config dbcontrol db -repos create -respFile emca.txt 

STARTED EMCA at Nov 13, 2007 4:27:00 AM
EM Configuration Assistant, Version 10.2.0.1.0 Production
Copyright (c) 2003, 2005, Oracle.  All rights reserved.

Enter the following information:
Nov 13, 2007 4:27:00 AM oracle.sysman.emcp.EMConfig perform
INFO: This operation is being logged at /home/oracle/app/oracle/product/10g/cfgtoollogs/emca/qa_yocal/emca_2007-11-13_04-27-00-AM.log.
Nov 13, 2007 4:27:01 AM oracle.sysman.emcp.EMReposConfig createRepository
INFO: Creating the EM repository (this may take a while) ...
Nov 13, 2007 4:28:26 AM oracle.sysman.emcp.EMReposConfig invoke
INFO: Repository successfully created
Nov 13, 2007 4:28:33 AM oracle.sysman.emcp.util.DBControlUtil startOMS
INFO: Starting Database Control (this may take a while) ...
Nov 13, 2007 4:30:07 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: Database Control started successfully
Nov 13, 2007 4:30:07 AM oracle.sysman.emcp.EMDBPostConfig performConfiguration
INFO: >>>>>>>>>>> The Database Control URL is http://pre-db1.site.com:1158/em <<<<<<<<<<<
Enterprise Manager configuration completed successfully
FINISHED EMCA at Nov 13, 2007 4:30:07 AM

Once the OEM has been successfully installed remove the emca_resp.txt file as it contains sensitive information.

If you get errors, a logfile, similar to the one above will be listed. If you open this error file, you will see what went wrong with your installation.

Any errors encountered from now on will get added below for future reference:

Previously Encountered Installation Issues

After a failure, make sure you use the second command above to clear out anything the previous installation might have left behind.

oraInst.loc problems

  • Error

oracle.sysman.oii.oiii.OiiiInventoryDoesNotExistException: The inventory pointer location /etc/oraInst.loc is either not readable or does not exist

  • Solution

I symlinked the oraInst.loc which in our installations is in the /home/oracle/app/oracle/oraInventory directory: ln -s /home/oracle/app/oracle/oraInventory/oraInst.loc /etc/oraInst.loc

Account is locked

  • Error
CONFIG: SQLEngine connecting with SID: orcl, oracleHome: /home/oracle/app/oracle/product/10g, and user: DBSNMP
Oct 11, 2007 8:19:04 AM oracle.sysman.emcp.util.GeneralUtil initSQLEngine
CONFIG: ORA-28000: the account is locked

oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-28000: the account is locked
  • Solution

Log on as sys, and run alter user dbsnmp account unlock; then try again.

character string buffer too small

  • Error
oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
Oct 15, 2007 3:55:14 AM oracle.sysman.emcp.EMReposConfig createRepository
CONFIG: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at line 269

This is because the hostname exceeds 32 characters and one of the repository creation scripts has a 32 character limit.

  • Solution
    • Make a backup copy of the file: $ORACLE_HOME/sysman/admin/emdrep/sql/core/latest/self_monitor/self_monitor_post_creation.sql
    • Change the l_host_name variable in self_monitor_post_creation.sql to have 128 characters. The l_host_name variable needs to be changed twice in the script.
    • Drop and recreate the DB Control configuration files and repository

oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-24344: success with compilation error

ORA-06512: at line 38

Jan 30, 2008 8:26:27 AM oracle.sysman.emcp.EMReposConfig createRepository
CONFIG: ORA-24344: success with compilation error
ORA-06512: at line 38

oracle.sysman.assistants.util.sqlEngine.SQLFatalErrorException: ORA-24344: success with compilation error
ORA-06512: at line 38

        at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeImpl(SQLEngine.java:1467)
        at oracle.sysman.assistants.util.sqlEngine.SQLEngine.executeScript(SQLEngine.java:841)
        at oracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java:265)
        at oracle.sysman.assistants.util.sqlEngine.SQLPlusEngine.executeScript(SQLPlusEngine.java:306)
        at oracle.sysman.emcp.EMReposConfig.createRepository(EMReposConfig.java:360)
        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:182)
        at oracle.sysman.emcp.EMReposConfig.invoke(EMReposConfig.java:124)
        at oracle.sysman.emcp.EMConfig.perform(EMConfig.java:142)
        at oracle.sysman.emcp.EMConfigAssistant.invokeEMCA(EMConfigAssistant.java:479)
        at oracle.sysman.emcp.EMConfigAssistant.performConfiguration(EMConfigAssistant.java:1123)
        at oracle.sysman.emcp.EMConfigAssistant.statusMain(EMConfigAssistant.java:463)
        at oracle.sysman.emcp.EMConfigAssistant.main(EMConfigAssistant.java:412)
Jan 30, 2008 8:26:27 AM oracle.sysman.emcp.EMReposConfig invoke
SEVERE: Error creating the repository

This was traced to the UTL_SMTP package being invalid on the server, which meant a package body was failing to compile, which causes this cryptic error. I commented the code out of the procedure which simply sent emails and the installation succeeded.

Insufficient privileges connecting as SYS

Could not connect to SYS/(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=oracle.site.com)(PORT=1521)))(CONNECT_DATA=(SERVICE_NAME=ORCL))): ORA-01031: insufficient privileges (DBD ERROR: OCISessionBegin)

This is caused by the lack of a password file, which allows remote SYSDBA logins. The problem can be repeated by running the following, which shows that we can connect via the @ORCL net name using a created answers user, but not with the SYS user:

[oracle@oracle ~]$ sqlplus answers@ORCL

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Feb 11 23:09:02 2008

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Enter password: 

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
[oracle@oracle ~]$ sqlplus sys@ORCL as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Feb 11 23:09:17 2008

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Enter password:
ERROR:
ORA-01031: insufficient privileges

Enter user-name:
[oracle@oracle ~]$
[oracle@oracle ~]$ sqlplus sys as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Feb 11 23:09:25 2008

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Enter password: 

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
[oracle@oracle ~]$

To allow the SYS to connect, we need to create a password file. This is done using the orapwd utility:

[oracle@oracle admin]$ orapwd file=/usr/libexec/oracle10db/dbs/orapwORCL password=oracle entries=5 force=y
[oracle@oracle admin]$ sqlplus sys@ORCL as sysdba

SQL*Plus: Release 10.2.0.3.0 - Production on Mon Feb 11 23:14:43 2008

Copyright (c) 1982, 2006, Oracle.  All Rights Reserved.

Enter password: 

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options

SQL>

We can now rerun the OEM install.