Oracle 11g release 2 (11.2.0.1.0) on Fedora 11

 

来自:http://staff.in2.hr/denis/oracle/11gr2install_fedora11_en.html

 

・文中取消线的位置是这次安装的时候没有使用的,但在安装oracle之前设置了SELinux不可用。

 

Oracle  11g  release 2 (11.2.0.1.0) on Fedora  11

Please note that Oracle Database 11g is not certified to run on Fedora Linux, therefore you should not use this combination on a production server. You can examine Oracle certification matrix at Metalink
Contents

    * 1. Downloading installation files
    * 2. Preparing your system
    * 2.1 Steps to perform as root user
    * 2.2 Steps to perform as oracle user
    * 3. Running the installer
    * 4. Post-installation steps
    * 4.1 Setting up environment
    * 4.2 Configure Oracle Net
    * 4.3 Creating the database
    * 4.4 Starting database services
    * 4.5 Stopping database services
    * 4.6 Automating oracle startup and shutdown

1. Downloading installation files

Download Oracle Database 11gR2 from Oracle Technology Network . Two files are needed to install the database , Disk1 and Disk2 (2.1 GB total).
2. Preparing your system
2.1 Steps to perform as root user

Install following fedora packages using yum :

yum install compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel ksh

 

安装前可以执行查询看一下哪个包没有安装:

rpm -q compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc-devel libaio libaio-devel libgcc libstdc++ libstdc++-devel make sysstat unixODBC unixODBC-devel ksh

然后把“is not installed”的包安装上。



If you are on a 64-bit system, you will also need to install some 32-bit packages:

yum install compat-libstdc++-33.i586 glibc.i686 glibc-devel.i586 libaio.i586 libaio-devel.i586 libgcc.i586 libstdc++.i586 unixODBC.i586 unixODBC-devel.i586



Change kernel parameters by adding the following lines in /etc/sysctl.conf

:

kernel.sem = 250 32000 100 128
kernel.shmmax = 4294967295
kernel.shmmni = 4096
kernel.shmall=2097152
fs.file-max = 6815744
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 = 1048576
fs.aio-max-nr = 1048576
Update kernel configuration:

[root@n001914 ~]# sysctl -e -p /etc/sysctl.conf 



Add the following lines to /etc/security/limits.conf file:

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



Add the following to /etc/profile:

if [ $USER = "oracle" ]; then
        if [ $SHELL = "/bin/ksh" ]; then
              ulimit -p 16384
              ulimit -n 65536
        else
              ulimit -u 16384 -n 65536
        fi
umask 022
fi



Create user and groups that will own oracle software. Normally we name this user oracle

:

[root@n001914 ~]# groupadd oinstall
[root@n001914 ~]# groupadd dba
[root@n001914 ~]# useradd -g oinstall -G dba oracle
[root@n001914 ~]# passwd oracle






Create Optimal Flexible Architecture Compliant directory structure which will hold Oracle software and database files:

[root@n001914 ~]# mkdir -p /u01/app/oracle
[root@n001914 ~]# chown -R oracle:oinstall /u01/app



Now is good time to move the two zip files you downloaded to a directory writable by user oracle and to unpack them:

[root@n001914 ~]# mkdir /home/oracle/install
[root@n001914 ~]# mv linux.x64_11gR2_database_?of2.zip /home/oracle/install
[root@n001914 ~]# chown -R oracle:oinstall /home/oracle/install



2.2 Steps to perform as oracle user

Unzip both files while logged on as oracle user. They will both unzip in the same directory 'database ':

[oracle@n001914 install]$ unzip linux.x64_11gR2_database_1of2.zip
[oracle@n001914 install]$ unzip linux.x64_11gR2_database_2of2.zip

3. Running the installer

Oracle installer needs to be run from GUI, so start your favorite window manager if you are still in CLI and logon as user oracle .
Start the installer:

[oracle@n001914 ~]$ /home/oracle/install/database/runInstaller



Now the installer should be up and running.
Remember the ORACLE_SID and path to ORACLE_HOME that you set at the installer file locations prompt, you'll need this later on.

If Oracle installer cannot determine your host's IP address i.e. you got IP address from DHCP but DNS doesn't know about you, then you'll get the following error: [INS-06101] IP address of localhost could not be determined

Then put the name of your host (n001914.local in this example) under 127.0.0.1 in /etc/hosts along with localhost:

127.0.0.1    n001914.local n001914 localhost.localdomain localhost



and restart the installer.

Step 1: hit 'next' You will do fine without recieving security updates info.
Step 2: check 'Install database software only'
Step 3: check 'Single instance database installation '
Step 4: select product languages
Step 5: select Database edition you want to install (i.e. Enterprise edition) and optionally hit 'Select
options' button to choose which options will be installed.
Step 6: Specify Oracle base location (/u01/app/oracle ) and Oracle home directory (/u01/app/oracle /product/11.2.0/dbhome_1 )
Step 7: Specify Inventory Directory (/u01/app/oraInventory )
Step 8: For OSDBA group choose dba and for OSOPER group choose oinstall
Step 9: The following packages with status 'Failed' here:
libaio-0.3.105, compat-libstdc++-33-3.2.3, libaio-devel-0.3.105, libgcc-3.4.6, libstdc++-3.4.6, unixODBC-2.2.11 , unixODBC-devel-2.2.11 and pdksh-5.2.14 .
Check 'Ignore All' and hit 'next' Step 10: hit 'Finish'

At the end of installation you will be prompted to execute two scripts as root:

[root@n001914 ~]# /u01/app/oraInventory/orainstRoot.sh
[root@n001914 ~]# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh



Installation process is now finished.
4. Post-installation steps
4.1. Setting up environment

Login as user oracle and add the following variables in ~/.bash_profile

:

export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1
export NLS_LANG=croatian_croatia.ee8iso8859p2
export PATH=$ORACLE_HOME/bin:$PATH
export ORACLE_SID=ora11



Note on NLS_LANG parameter:
You should modify NLS_LANG parameter to match your country, language and desired character set, e.g. german_germany.we8iso8859p15, american_america.we8iso8859p1 etc. Full listing of available locale data is available here . Source profile to set the environment in current session:

[oracle@n001914 ~]$ source ~/.bash_profile



4.2. Configure Oracle Net

Before running netca (Oracle Net Configuration Assistant) on a system with enforcing SELinux we must first change the file context for libclntsh.so.11.1 to textrel_shlib_t. to avoid errors of type:
SELinux is preventing lsnrctl from loading /u01/app/oracle /product/11.2.0/dbhome_1/lib/libclntsh.so.11.1 which requires text relocation

[root@n001914 ~]# chcon -t textrel_shlib_t '/u01/app/oracle


/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1'



You must also change the default file context files on the system in order to preserve them even on a full relabel:

[root@n001914 ~]# semanage fcontext -a -t textrel_shlib_t '/u01/app/oracle


/product/11.2.0/dbhome_1/lib/libclntsh.so.11.1'



Run netca to set-up Oracle net:

[oracle@n001914 ~]$ netca

Choose "Listener configuration", then "Add". Leave default Listener name "LISTENER", select TCP protocol, and use standard port 1521 (if available). Next, choose "Naming Methods configuration" and select "Local Naming" and "Easy Connect Naming". Oracle Net configuration is finished and TNS listener should be up and running:

[oracle@n001914 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 09-LIS-2009 12:38:58
Copyright (c) 1991, 2009, Oracle.  All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=n001914.in2.hr)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.1.0 - Production
Start Date                09-LIS-2009 12:38:52
Uptime                    0 days 0 hr. 0 min. 6 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/n001914/listener/alert/log.xml



Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=n001914.in2.hr)(PORT=1521)))
The listener supports no services
The command completed successfully



4.3. Creating the database

Run Database Configuration Assistant:

[oracle@n001914 ~]$ dbca



Step 1: choose "Create a Database "
Step 2: choose "Custom Database "
Step 3: Choose Global Database Name and SID. We'll use "ora11" for both global name and SID in this example.
Step 4: Leave "Configure Enterprise Manager" checked and "Enable Alert Notifications" and "Daily Disk Backup to Recovery Area" unchecked
Step 5: choose passwords for database system accounts
Step 6: Leave Storage Type on File System and choose "Use Database File Locations from Template"
Step 7: Leave default values for everything
Step 8: Select database components you want to use in your database . If in doubt, leave unchanged.
Step 9: Memory tab: Choose available amount of memory Oracle and leave checked "Use Automatic Memory Management"
Step 9: Sizing tab: leave default values
Step 9: Character Sets tab: Choose the database character set. Oracle recommends that you use Unicode AL32UTF8 as the database character set. Also pick your Language and Territory.
Step 9: Connection Mode: Leave at Dedicated server Mode
Step 10: You can safely hit "Next". You can always add or modify these things later.
Step 11 : Leave "Create Database " checked. It won't hurt to save template and generate scripts, too.
Hit "Finish" and enjoy.
4.4. Starting database services

In order to use provided dbstart and dbshut scripts to start and shut down Oracle instance, you should modify the /etc/oratab file.
Find the line in /etc/oratab that looks similar to this:

ora11:/u01/app/oracle/product/11.2.0/dbhome_1:N



Change the last field (N) to Y, and you will be able to start the database using dbstart utility.

Start TNS Listener:

[oracle@n001914 ~]$ lsnrctl start



You can start the database via dbstart utility:

[oracle@n001914 ~]$ dbstart



or via SQL*Plus:

[oracle@n001914 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Pet Lis 23 13:12:18 2009
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.

SQL> startup
ORACLE


 instance started.
Total System Global Area 1252663296 bytes
Fixed Size                  2212936 bytes
Variable Size             822086584 bytes
Database
Buffers          419430400 bytes
Redo Buffers                8933376 bytes
Database mounted.
Database opened.

SQL> exit
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



[oracle@n001914 ~]$



Start Enterprise manager server (optional):

[oracle@n001914 ~]$ emctl start dbconsole
Oracle Enterprise Manager 11g Database Control Release 11.2.0.1.0
 Copyright (c) 1996, 2009 Oracle Corporation.  All rights reserved.
http://n001914.in2.hr:1158/em/console/aboutApplication

Starting Oracle Enterprise Manager 11g Database


 Control ................ started.



------------------------------------------------------------------



Logs are generated in directory /u01/app/oracle/product/11.2.0/dbhome_1/n001914.in2.hr_ora11/sysman/log



[oracle@n001914 ~]$



Now you cal log on to Enterprise manager console by entering the following URL in your favorite browser: http://your.server.name.here:1158/em
4.5. Stopping database services

Stop Enterprise manager server:

[oracle@n001914 ~]$ emctl stop dbconsole



You can stop the database via dbshut utility:

[oracle@n001914 ~]$ dbshut



or via SQL*Plus:

[oracle@n001914 ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.1.0 Production on Pet Lis 23 13:21:39 2009
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 immediate

Database closed.
Database dismounted.
ORACLE instance shut down.



SQL> exit
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



[oracle @n001914 ~]$



Stop TNS listener:

[oracle @n001914 ~]$ lsnrctl stop



4.6 Automating oracle startup and shutdown

To automatically start/shut oracle database during system startup/shutdown you need to write a script in /etc/rc.d/init.d directory. You can view or Download an example script.
This script is written for oracle 10g, but it is very simple to modify (and rename to let's say oracle11 :) Copy the script to /etc/rc.d/init.d as root user, edit environment variables to match your settings and modify its permissions:

[root@denisnb ~]# chown root:root /etc/rc.d/init.d/ora10



[root@denisnb ~]# chmod 755 /etc/rc.d/init.d/ora10



This startup/shutdown script uses chkconfig utility to simplify service management. It is configured to start oracle services in runlevels 3 and 5,with start priority 95 and stop priority 1.
Initialize new service:

[root@denisnb ~]# chkconfig ora10 reset



[root@denisnb ~]# chkconfig --list ora10



ora10            0:off   1:off   2:off    3:on    4:off    5:on    6:off



Now oracle services will be automatically started when entering runlevels 3 and 5, and shut down when entering any other runlevel. For more information on chkconfig utility refer to its man page.
To manually start/stop oracle services you can use

[root@denisnb ~]# service ora10 start



and

[root@denisnb ~]# service ora10 stop

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值