Install Oracle 11gr2 on Fedora 14

作者: blue_wind 2010-12-20 22:32:54
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

you also need to install them using yum.

Next, you need to modify PAM (Plugable Authentication Module) configuration files to increase the 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 the appropriate permissions.

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

groupadd oinstall
groupadd dba
groupadd oper
groupadd 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. To do this, edit /etc/selinux/config as follows:

SELINUX=disabled


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

The release information in /etc/redhat-release is incorrect as far as the Oracle installer is concerned. It knows nothing about Fedora 14 but does know about Red Hat. Therefore the release string 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 our example, the directory is /app/oracle.

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


The next few steps require that you are logged in as oracle. As user oracle, download Oracle Database 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 either HTML or PDF format by pointing your web browser to ~oracle/database/doc/index.htm

oracle documentation

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 suit your particular requirements:
view source
print?
01 # Oracle Settings
02 TMP=/tmp; export TMP
03 TMPDIR=$TMP; export TMPDIR
04
05 ORACLE_HOSTNAME=ultra.xfpmurphy.com; export ORACLE_HOSTNAME
06 ORACLE_UNQNAME=orcl; export ORACLE_UNQNAME
07 ORACLE_BASE=/app/oracle; export ORACLE_BASE
08 ORACLE_HOME=$ORACLE_BASE/product/11.2.0; export ORACLE_HOME
09 ORACLE_SID=orcl; export ORACLE_SID
10 ORACLE_TERM=xterm; export ORACLE_TERM
11 PATH=/usr/sbin:$PATH; export PATH
12 PATH=$ORACLE_HOME/bin:$PATH; export PATH
13
14 LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH
15 CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH
16
17 if [ $USER = "oracle" ]; then
18 if [ $SHELL = "/bin/ksh" ]; then
19 ulimit -p 16384
20 ulimit -n 65536
21 else
22 ulimit -u 16384 -n 65536
23 fi
24 fi


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

If you are using a different shell, you will need to set up these environmental variables and limits using the appropriate shell syntax and shell initialization file. You may also need to set the NLS_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-based GUI that uses the X Window system. There is no command line installer. You can record your OUI session to a response file. All the options you selected during the database installation are saved in the response file. This feature makes it easy to duplicate the results of a successful installation on multiple systems. You may need to set the your DISPLAY environmental variable and use the xhost utility to configure server access.

Start OUI by issuing the runInstaller command in the ~oracle/database directory. If OUI cannot determine 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 such problems.

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

oracle installer screenshot

Check the settings carefully before proceeding further.

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

oracle installer screenshot

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

During the installation, OUI will popup a dialog window advising you that an error has occurred with ins_emagent.mk. See below:

oracle installer screenshot

This error is due to a change to GCC linker which first occurred in Fedora 13. The announcement is 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 as shown 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 a Password Management screen as shown below:

oracle installer screenshot

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

After this you will be asked to run two shell scripts as root. Just open up a root terminal window and 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 Finish button. 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 the installation was successful, try doing the following:

$ cd $ORACLE_HOME
$ pwd
/app/oracle/product/11.2.0
$
$ id
uid=501(oracle) gid=501(oinstall) groups=501(oinstall),502(dba),503(oper),504(asmadmin)
$ emctl stop dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (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 Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> shutdown
Database 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 - Production
System parameter file is /app/oracle/product/11.2.0/network/admin/listener.ora
Log messages written to /app/oracle/diag/tnslsnr/ultra/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ultra.xfpmurphy.com)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date 04-DEC-2010 14:30:21
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /app/oracle/product/11.2.0/network/admin/listener.ora
Listener Log File /app/oracle/diag/tnslsnr/ultra/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ultra.xfpmurphy.com)(PORT=1521)))
The listener supports no services
The 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> startup
ORACLE instance started.

Total System Global Area 839282688 bytes
Fixed Size 2217992 bytes
Variable Size 524290040 bytes
Database Buffers 310378496 bytes
Redo Buffers 2396160 bytes
Database mounted.
Database opened.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
$
$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
Copyright (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 11g database software is installed and working. You may have some tweaking to do for your particular requirements 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:

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

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

oracle enterprise manager

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

oracle enterprise manager

As part of the database installation a sample HR schema was installed but left locked. Here is how to 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 Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> ALTER USER hr ACCOUNT UNLOCK IDENTIFIED BY xxxxxxx;

User altered.

SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With 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, you have to configure a valid connection. As an example of how to configure a valid connection, here is my HR connection properties:

sqldeveloper

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

sqldeveloper

To automatically start and stop the Oracle database during system startup and shutdown you need to place an appropriate script in the /etc/rc.d/init.d directory and symbolically link it to the appropriate 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 Oracle applications including sqlplus on various platforms including Microsoft Window 7 without installing the standard Oracle client or having an ORACLE_HOME. Instant Clients for 32-bit Microsoft Windows are available here. You need to download two packagee, i.e the Instant Client Package - Basic Lite (contains English error messages and Unicode, ASCII, and Western European character set support) and the Instant Client Package - SQL*Plus (contains additional libraries and executable for running SQL*Plus with Instant Client.)

Unzip the two packages into a single directory such as C:\SQLPLUS. Then edit the configuration file tnsnames.ora which you will find in this directory to configure the connection to your Fedora 14 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 to modify iptables to open port 1521 for TCP packet send and receive. Here are the appropriate lines to 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 addresses that can access the 1521 port.

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

sqldeveloper

If security is not an issue, you can add a shortcut as shown above so that you are automatically connected 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 in installing Oracle 11g on Fedora 14 and I will add it to this post.

相关资讯