13
Installing Oracle 11g Release 2 on Fedora 14 Installing Oracle 11g Release 2 on Fedora 14 Finnbarr P. Murphy ([email protected]) This post will show you how to install Oracle Database 11g Release 2 on Fedora 14 (Laughlin), configure Oracle Enterprise Manager to access the database and how to access the database from a Window platform using Oracle SQLPlus Instant Client. Note, however, that Oracle Database 11g R2 is not certified by Oracle to run on Fedora 14 so you will not get support from Oracle if you have any questions. The following steps should be done as root . First add a number of kernel parameters to /etc/sysctl.conf if they do not already exist in this file or have values less than what is shown here. fs.aio-max-nr = 1048576 fs.file-max = 6815744 kernel.shmall = 2097152 kernel.shmmax = 536870912 kernel.shmmni = 4096 # semaphores: semmsl, semmns, semopm, semmni kernel.sem = 250 32000 100 128 net.ipv4.ip_local_port_range = 9000 65500 net.core.rmem_default=262144 net.core.rmem_max=4194304 net.core.wmem_default=262144 net.core.wmem_max=1048586 These are minimum required values by the way; they can be higher. The current value of a particular kernel parameter can be displayed using the following command: # /sbin/sysctl -a | grep If you do not want to reboot your system after updating /etc/sysctl.conf, just execute the following command to update the kernel with the new parameters: # /sbin/sysctl -p If the Fedora 14 Development Tools package group is already installed, the majority of the necessary packages to build and run the Oracle database are already installed; otherwise install the Development Tools package group using yum. If the following additional packages are not already installed on your system: binutils libaio, libaio-devel ksh sysstat unixODBC, unixODBC-devel compat-libstdc++-33 For personnal use only 02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 1/13

Installing Oracle 11g Release 2 on Fedora 14

Embed Size (px)

DESCRIPTION

Describes how to install Oracle Database 11g Release 2 on Fedora 14, install an SQLplus client on Microsoft Windows 7 and configure both installations so that the SQLplus client can access the Oracle database running on Fedora 14.

Citation preview

Page 1: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 onFedora 14

Finnbarr P. Murphy([email protected])

This post will show you how to install Oracle Database 11g Release 2 on Fedora 14 (Laughlin),configure Oracle Enterprise Manager to access the database and how to access the database froma Window platform using Oracle SQLPlus Instant Client. Note, however, that Oracle Database 11gR2 is not certified by Oracle to run on Fedora 14 so you will not get support from Oracle if youhave any questions.

The following steps should be done as root. First add a number of kernel parameters to/etc/sysctl.conf if they do not already exist in this file or have values less than what is shown here.

fs.aio-max-nr = 1048576fs.file-max = 6815744kernel.shmall = 2097152kernel.shmmax = 536870912kernel.shmmni = 4096# semaphores: semmsl, semmns, semopm, semmnikernel.sem = 250 32000 100 128net.ipv4.ip_local_port_range = 9000 65500net.core.rmem_default=262144net.core.rmem_max=4194304net.core.wmem_default=262144net.core.wmem_max=1048586

These are minimum required values by the way; they can be higher. The current value of aparticular kernel parameter can be displayed using the following command:

# /sbin/sysctl -a | grep

If you do not want to reboot your system after updating /etc/sysctl.conf, just execute the followingcommand to update the kernel with the new parameters:

# /sbin/sysctl -p

If the Fedora 14 Development Tools package group is already installed, the majority of thenecessary packages to build and run the Oracle database are already installed; otherwise installthe Development Tools package group using yum. If the following additional packages are notalready installed on your system:

binutils●

libaio, libaio-devel●

ksh●

sysstat●

unixODBC, unixODBC-devel●

compat-libstdc++-33●

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 1/13

Page 2: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

you also need to install them using yum.

Next, you need to modify PAM (Plugable Authentication Module) configuration files to increasethe session limits for the oracle user which we will create later on. Add the following line to/etc/pam.d/login if it does not already exist:

session required pam_limits.so

and add the following lines to /etc/security/limits.conf:

oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536

If /etc/security/limits.conf does currently exist on your system, then create this file with theappropriate permissions.

Next create the oracle user account and a number of associated groups using the following script:

groupadd oinstallgroupadd dbagroupadd opergroupadd asmadmin

useradd -g oinstall -G dba,oper,asmadmin oracle

and then set a password for the new oracle user account.

You also must disable Secure Linux (SELINUX) while installing the Oracle database software. Todo this, edit /etc/selinux/config as follows:

SELINUX=disabled

and execute setenforce off. Do not forget to enable SELINUX after you have completed theinstallation!

The release information in /etc/redhat-release is incorrect as far as the Oracle installer isconcerned. It knows nothing about Fedora 14 but does know about Red Hat. Therefore the releasestring needs to be modified as follows:

# cp /etc/redhat-release /etc/redhat-release.org# echo "redhat release 5" > /etc/redhat-release

You must create the directories in which the Oracle database software will be installed. In ourexample, the directory is /app/oracle.

mkdir -p /app/oracle/product/11.2.0/chown -R oracle:oinstall /appchmod -R 775 /app

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 2/13

Page 3: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

The next few steps require that you are logged in as oracle. As user oracle, download OracleDatabase 11g R2 from Oracle and place the two files you downloaded into the same subdirectory.I placed them in ~oracle but you are free to choose any subdirectory. Then unzip both files.

# unzip linux.x64_11gR2_database_1of2.zip# unzip linux.x64_11gR2_database_2of2.zip# ls -d */database/#

A single subdirectory called database is created. This subdirectory contains the unzipped files.

Oracle supplies quite a lot of user documentation. You can access the documention in eitherHTML or PDF format by pointing your web browser to ~oracle/database/doc/index.htm

Assuming that the user oracle is using the bash shell, add the following lines to~oracle/.bash_profile, changing ORACLE_HOSTNAME, ORACLE_HOME, etc. as needed to suityour particular requirements:

# Oracle SettingsTMP=/tmp; export TMPTMPDIR=$TMP; export TMPDIRORACLE_HOSTNAME=ultra.xfpmurphy.com; export ORACLE_HOSTNAMEORACLE_UNQNAME=orcl; export ORACLE_UNQNAMEORACLE_BASE=/app/oracle; export ORACLE_BASEORACLE_HOME=$ORACLE_BASE/product/11.2.0; export ORACLE_HOMEORACLE_SID=orcl; export ORACLE_SIDORACLE_TERM=xterm; export ORACLE_TERMPATH=/usr/sbin:$PATH; export PATHPATH=$ORACLE_HOME/bin:$PATH; export PATHLD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATHCLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATHif [ $USER = "oracle" ]; then

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 3/13

Page 4: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

if [ $SHELL = "/bin/ksh" ]; then ulimit -p 16384 ulimit -n 65536 else ulimit -u 16384 -n 65536 fifi

Note that the ORACLE_UNQNAME environmental variable was previously known asDB_UNIQUE_NAME. This environmental variable is used by Oracle Enterprise Manager; it neednot be the same as ORACLE_SID.

If you are using a different shell, you will need to set up these environmental variables and limitsusing the appropriate shell syntax and shell initialization file. You may also need to set theNLS_LANG environmental variable to match your country, language and desired character set, e.g.ENGLISH_IRELAND.AL32UTF8 for UTF-8 support in Ireland.

Oracle databases are installed using the Oracle Universal Installer (OUI) which is a Java-basedGUI that uses the X Window system. There is no command line installer. You can record your OUIsession to a response file. All the options you selected during the database installation are saved inthe response file. This feature makes it easy to duplicate the results of a successful installation onmultiple systems. You may need to set the your DISPLAY environmental variable and use the xhostutility to configure server access.

Start OUI by issuing the runInstaller command in the ~oracle/database directory. If OUI cannotdetermine your IP address because it is not in /etc/hosts then you will get the following error:

[INS-06101] IP address of localhost could not be determined

If you see an error message similar to one of the following: “Failed to connect to server”,“Connection refused by server” or “Can’t open display”, then you have a problem with X Windows,either with permissions or the DISPLAY variable. I am going to assume you know how to fix suchproblems.

After answering a few basic questions, you should see the following Typical Install Configurationscreen:

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 4/13

Page 5: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

Check the settings carefully before proceeding further.

Next OUI checks that the installed software development and runtime packages are correct:

Fedora 14 will fail all these checks. Just tick the check box Ignore All on the top right hand toignore these errors. So long as you have the latest version of each of these packages installed, allwill be fine. Note that you do not need to install pdksh (Public Domain Korn Shell) if you have kshinstalled.

During the installation, OUI will popup a dialog window advising you that an error has occurred

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 5/13

Page 6: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

with ins_emagent.mk. See below:

This error is due to a change to GCC linker which first occurred in Fedora 13. The announcementis here. The fix is to edit $ORACLE_HOME/sysman/lib/ins_emagent.mk, search for the line$(MK_EMAGENT_NMECTL) and replace the line with $(MK_EMAGENT_NMECTL) -lnnz11 asshown above.

After saving the changed file, select the Retry option, and the install should successfully continue.Eventually you should see the Database Configuration Assistant screen followed shortly by aPassword Management screen as shown below:

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 6/13

Page 7: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

Do not ignore the Password Management button; press it and change the passwords for SYS andSYSTEM.

After this you will be asked to run two shell scripts as root. Just open up a root terminal windowand execute these shell scripts. One script installs three scripts, coraenv, oraenv and dbhome in/usr/local/bin (or another user-specified directory) and the other creates /etc/oratab.

At this stage the installer has finished installing the Oracle database and you can press the Finishbutton. The Oracle database does not need to be started; it is already up and running.

If you would like to do a basic smoketest of the installed database software to confirm theinstallation was successful, try doing the following:

$ cd $ORACLE_HOME$ pwd/app/oracle/product/11.2.0$$ iduid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper),504(asmadmin)$ emctl stop dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.

https://ultra.xfpmurphy.com:1158/em/console/aboutApplication

Stopping Oracle Enterprise Manager 11g Database Control ... ... Stopped.$ lsnrctl stop

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-DEC-2010 14:28:44

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))The command completed successfully[oracle@ultra 11.2.0]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sat Dec 4 14:28:54 2010

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

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdownDatabase closed.Database dismounted.ORACLE instance shut down.SQL> quit$$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 04-DEC-2010 14:30:21

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

Starting /app/oracle/product/11.2.0/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionSystem parameter file is /app/oracle/product/11.2.0/network/admin/listener.oraLog messages written to /app/oracle/diag/tnslsnr/ultra/listener/alert/log.xmlListening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ultra.xfpmurphy.com)(PORT=1521)))

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 7/13

Page 8: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))STATUS of the LISTENER------------------------Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.1.0 - ProductionStart Date 04-DEC-2010 14:30:21Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File /app/oracle/product/11.2.0/network/admin/listener.oraListener Log File /app/oracle/diag/tnslsnr/ultra/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))) (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ultra.xfpmurphy.com)(PORT=1521)))The listener supports no servicesThe command completed successfully$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sat Dec 4 14:30:45 2010

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

Connected to an idle instance.

SQL> startupORACLE instance started.

Total System Global Area 839282688 bytesFixed Size 2217992 bytesVariable Size 524290040 bytesDatabase Buffers 310378496 bytesRedo Buffers 2396160 bytesDatabase mounted.Database opened.SQL> quitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options$$ emctl start dbconsoleOracle Enterprise Manager 11g Database Control Release 11.2.0.1.0Copyright (c) 1996, 2009 Oracle Corporation. All rights reserved.

https://ultra.xfpmurphy.com:1158/em/console/aboutApplication

Starting Oracle Enterprise Manager 11g Database Control ....... started.------------------------------------------------------------------Logs are generated in directory /app/oracle/product/11.2.0/ultra.xfpmurphy.com_orcl/sysman/log$

If you have got this far with your installation of Oracle 11g, all is well. The core Oracle 11gdatabase software is installed and working. You may have some tweaking to do for your particularrequirements but that is outside the scope of this post.

Before you go any further, as root, you need to do some housekeeping and fix up a couple of files.Edit the /etc/oratab file and change the restart flag for the orclinstance to Y:

orcl:/app/oracle/product/11.2.0:Y

Then replace /etc/redhat-release to restore the correct release information:

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 8/13

Page 9: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

# mv /etc/redhat-release.org /etc/redhat-release

If the Oracle Enterprise Manager dbconsole is running (start with emctl start dbconsole, checkstatus with emctl status dbconsole), you should be able to use your web browser to access theconsole at port 1158. For the initial login, use the username SYS, the password you configured forthis user and set the role to SYSDBA.

To display graphs on certain pages of the Enterprise Manager console you need to have an AdobeFlash plugin installed. If you are on 64-bit Fedora, I recommend that you install the new AdobeSquare Flash plugin. See this post for details of how to download and install this plugin.

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 9/13

Page 10: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

As part of the database installation a sample HR schema was installed but left locked. Here is howto unlock this sample schema using sqlplus:

$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.1.0 Production on Sat Dec 4 16:51:07 2010

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

Connected to:Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> ALTER USER hr ACCOUNT UNLOCK IDENTIFIED BY xxxxxxx;

User altered.

SQL> quitDisconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing options$

At this stage you should be able to invoke the Oracle sqldeveloper GUI by invoking$ORACLE_HOME/sqldeveloper/sqldeveloper/bin/sqldeveloper. However before you can log in, youhave to configure a valid connection. As an example of how to configure a valid connection, here ismy HR connection properties:

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 10/13

Page 11: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

Once you have configured a valid connection, you will be able to login as user HR and examine theHR schema.

To automatically start and stop the Oracle database during system startup and shutdown you needto place an appropriate script in the /etc/rc.d/init.d directory and symbolically link it to theappropriate rc directories. See this post for an example of such a script.

An Oracle Instant Client gives customers the ability to quickly install and deploy Oracleapplications including sqlplus on various platforms including Microsoft Window 7 withoutinstalling the standard Oracle client or having an ORACLE_HOME. Instant Clients for 32-bit

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 11/13

Page 12: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

Microsoft Windows are available here. You need to download two packagee, i.e the Instant ClientPackage – Basic Lite (contains English error messages and Unicode, ASCII, and Western Europeancharacter set support) and the Instant Client Package – SQL*Plus (contains additional librariesand executable for running SQL*Plus with Instant Client.)

Unzip the two packages into a single directory such as C:\SQLPLUS. Then edit the configurationfile tnsnames.ora which you will find in this directory to configure the connection to your Fedora14 system.

ORCL = (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL =TCP) (HOST = ultra.xfpmurphy.com) (PORT = 1521) ) ) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl.xfpmurphy.com) ) )

If you are using a firewall on your Fedora 14 platform (which you should be!), you will have tomodify iptables to open port 1521 for TCP packet send and receive. Here are the appropriate linesto add to /etc/sysconfig/iptables:

-A INPUT -p tcp --dport 1521 -j ACCEPT-A OUTPUT -p tcp --sport 1521 -j ACCEPT

In a production environment these rules should be modified to restrict the range of IP addressesthat can access the 1521 port.

Once you have configured a valid connection, you will be able to connect to the Oracle databasefrom your Windows 7 platform.

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 12/13

Page 13: Installing Oracle 11g Release 2 on Fedora 14

Installing Oracle 11g Release 2 on Fedora 14

If security is not an issue, you can add a shortcut as shown above so that you are automaticallyconnected to a schema.

Well, time to stop. The information in this post should be enough to get you up and running.Please let me know if I left out anything important that you feel would of been of help to you ininstalling Oracle 11g on Fedora 14 and I will add it to this post.

For p

erson

nal u

se on

ly

02-25-2011 Copyright 2004-2011 Finnbarr P. Murphy. All rights reserved. 13/13