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

No comments:

Feel free to drop me a line or ask me a question.