yoalex

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

1. 安装必须的软件包

[root@localhost ~]# yum install oracle-rdbms-server-11gR2-preinstall

===========================================================================================================================================

 Package                                          Arch               Version                           Repository                     Size

===========================================================================================================================================

Installing:

 oracle-rdbms-server-11gR2-preinstall             x86_64             1.0-9.el6                         public_ol6_latest              17 k

Installing for dependencies:

 compat-libcap1                                   x86_64             1.10-1                            public_ol6_latest              17 k

 compat-libstdc++-33                              x86_64             3.2.3-69.el6                      public_ol6_latest             183 k

 ksh                                              x86_64             20120801-10.el6_5.4               public_ol6_latest             756 k

 libaio-devel                                     x86_64             0.3.107-10.el6                    public_ol6_latest              13 k

Transaction Summary

===========================================================================================================================================

Install       5 Package(s)

All necessary prerequisites will be performed automatically.

It is probably worth doing a full update as well, but this is not strictly speaking necessary.

# yum update

 

2.修改系统文件

2.1 修改Hosts File

vi /etc/hosts

#add one new line

10.182.233.248 localhost localhost.localdomain

2.2 Add or amend the following lines in the "/etc/sysctl.conf" file.

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

 

If you yum install oracle-rdbms-server-11gR2-preinstall, i see the file already updated with comments():

# Kernel sysctl configuration file for Red Hat Linux

#

# For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and

# sysctl.conf(5) for more details.

# Controls IP packet forwarding

net.ipv4.ip_forward = 0

# Controls source route verification

net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing

net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel

kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.

# Useful for debugging multi-threaded applications.

kernel.core_uses_pid = 1

# Controls the use of TCP syncookies

net.ipv4.tcp_syncookies = 1

# Controls the default maxmimum size of a mesage queue

kernel.msgmnb = 65536

# Controls the maximum size of a message, in bytes

kernel.msgmax = 65536

# Controls the maximum shared segment size, in bytes

# Controls the maximum number of shared memory segments, in pages

kernel.shmall = 4294967296

# oracle-rdbms-server-11gR2-preinstall setting for fs.file-max is 6815744

fs.file-max = 6815744

# oracle-rdbms-server-11gR2-preinstall setting for kernel.sem is '250 32000 100 128'

kernel.sem = 250 32000 100 128

# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmmni is 4096

kernel.shmmni = 4096

# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 1073741824 on x86_64

# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmall is 2097152 on i386

# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmmax is 4398046511104 on x86_64

# oracle-rdbms-server-11gR2-preinstall setting for kernel.shmmax is 4294967295 on i386

kernel.shmmax = 4398046511104

# oracle-rdbms-server-11gR2-preinstall setting for kernel.panic_on_oops is 1 per Orabug 19212317

kernel.panic_on_oops = 1

# oracle-rdbms-server-11gR2-preinstall setting for net.core.rmem_default is 262144

net.core.rmem_default = 262144

# oracle-rdbms-server-11gR2-preinstall setting for net.core.rmem_max is 4194304

net.core.rmem_max = 4194304

# oracle-rdbms-server-11gR2-preinstall setting for net.core.wmem_default is 262144

net.core.wmem_default = 262144

# oracle-rdbms-server-11gR2-preinstall setting for net.core.wmem_max is 1048576

net.core.wmem_max = 1048576

# oracle-rdbms-server-11gR2-preinstall setting for fs.aio-max-nr is 1048576

fs.aio-max-nr = 1048576

# oracle-rdbms-server-11gR2-preinstall setting for net.ipv4.ip_local_port_range is 9000 65500

net.ipv4.ip_local_port_range = 9000 65500

Run the following command to change the current kernel parameters.

/sbin/sysctl -p

[root@dhcp-cn-<ip> ~]# /sbin/sysctl -p

net.ipv4.ip_forward = 0

net.ipv4.conf.default.rp_filter = 1

net.ipv4.conf.default.accept_source_route = 0

kernel.sysrq = 0

kernel.core_uses_pid = 1

net.ipv4.tcp_syncookies = 1

kernel.msgmnb = 65536

kernel.msgmax = 65536

kernel.shmall = 4294967296

fs.file-max = 6815744

kernel.sem = 250 32000 100 128

kernel.shmmni = 4096

kernel.shmmax = 4398046511104

kernel.panic_on_oops = 1

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

net.ipv4.ip_local_port_range = 9000 65500

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

oracle              soft    nproc   2047
oracle              hard    nproc   16384
oracle              soft    nofile  4096
oracle              hard    nofile  65536
oracle              soft    stack   10240

2.4 (Optional) Add the following line to the "/etc/pam.d/login" file, if it does not already exist.

session    required     pam_limits.so

 

2.5 Add the following lines at the end of the "/home/oracle/.bash_profile" file.

# Get the aliases and functions

if [ -f ~/.bashrc ]; then

        . ~/.bashrc

fi

 

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

# Oracle Settings

TMP=/tmp; export TMP

TMPDIR=$TMP; export TMPDIR

ORACLE_HOSTNAME=localhost.localdomain; export ORACLE_HOSTNAME

ORACLE_UNQNAME=PRMDB; export ORACLE_UNQNAME

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.2.0.4/dbhome_1; export ORACLE_HOME

ORACLE_SID=PRMDB; export ORACLE_SID

ORACLE_TERM=xterm; export ORACLE_TERM

PATH=/usr/sbin:$PATH; export PATH

PATH=$ORACLE_HOME/bin:$PATH; export PATH

LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib; export LD_LIBRARY_PATH

CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib; export CLASSPATH

3.Additional Setup

3.1 Create the group and user

#groupadd oinstall

#groupadd dba

#groupadd oper

#useradd -G dba,oper -g oinstall oracle #userdel oracle if it exist

#passwd oracle

3.2 Create folders and

#mkdir -p /u01/app/oracle/product/11.2.0.4/dbhome_1

#mkdir -p /u01/setup

#chown -R oracle:oinstall /u01

#chmod -R 775 /u01

 

3.3 Others

If you have the Linux firewall enabled, you will need to disable or configure it, as shown here or here. To disable it, do the following.

# systemctl stop firewalld
# systemctl disable firewalld

 

Unless you are working from the console, or using SSH tunnelling, login as root and issue the following command.

xhost +<machine-name>

 

 

  1. Install Oracle Database software

./runInstaller

Starting Oracle Universal Installer...

 

Checking Temp space: must be greater than 120 MB.   Actual 14522 MB    Passed

Checking swap space: must be greater than 150 MB.   Actual 2899 MB    Passed

Checking monitor: must be configured to display at least 256 colors.    Actual 16777216    Passed

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2016-04-08_02-45-57AM. Please wait ...[oracle@dhcp-cn-10-182-233-248 database]$

4.1 Configure Security Updates:

 

4.2 Select Install Option

 

 

 

 

 

 

Perform Prerequisite Checks

Swap Size waring:

[oracle@dhcp-cn-10-182-233-248 Desktop]$ su -

Password:

[root@dhcp-cn-10-182-233-248 ~]# dd if=/dev/zero of=/tmp/swapfile bs=1M count=5000

5000+0 records in

5000+0 records out

5242880000 bytes (5.2 GB) copied, 14.8711 s, 353 MB

[root@dhcp-cn-10-182-233-248 ~]# mkswap /tmp/swapfile

mkswap: /tmp/swapfile: warning: don't erase bootbits sectors

        on whole disk. Use -f to force.

Setting up swapspace version 1, size = 5119996 KiB

no label, UUID=6651ef30-e0b4-4bd4-8229-a5bda80850e1

[root@dhcp-cn-10-182-233-248 ~]# swapon /tmp/swapfile

Summary

Install Product

 

[root@dhcp-cn-10-182-233-248 oraInventory]# ./orainstRoot.sh

Changing permissions of /u01/app/oraInventory.

Adding read,write permissions for group.

Removing read,write,execute permissions for world.

 

Changing groupname of /u01/app/oraInventory to oinstall.

The execution of the script is complete.

 

[root@dhcp-cn-10-182-233-248 dbhome_1]# ./root.sh

Performing root user operation for Oracle 11g

 

The following environment variables are set as:

    ORACLE_OWNER= oracle

    ORACLE_HOME=  /u01/app/oracle/product/11.2.0.4/dbhome_1

 

Enter the full pathname of the local bin directory: [/usr/local/bin]:

   Copying dbhome to /usr/local/bin ...

   Copying oraenv to /usr/local/bin ...

   Copying coraenv to /usr/local/bin ...

 

 

Creating /etc/oratab file...

Entries will be added to the /etc/oratab file as needed by

Database Configuration Assistant when a database is created

Finished running generic part of root script.

Now product-specific root actions will be performed.

Finished product-specific root actions.

 

Finish install Oracle Database 11.2.0.4 software.

[oracle@dhcp-cn-10-182-233-248 ~]$ echo $ORACLE_HOME

/u01/app/oracle/product/11.2.0.4/db_1

[oracle@dhcp-cn-10-182-233-248 ~]$ echo $ORACLE_BASE

/u01/app/oracle

  • If you updated the .bash_profile 使其生效 run

.<space> ./.bash_profile

或者重新登录

Database Configuration Assistant

cd $ORACLE_HOME

dbca

 

 

 

 

 

 

 

 

 

 

 

 

 

 

DBCA configuration Finished.

 

Netca:

netca

 

 

 

 

 

 

 

# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/listener.ora

# Generated by Oracle configuration tools.

LISTENER =

  (DESCRIPTION_LIST =

    (DESCRIPTION =

      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))

      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))

    )

  )

 

ADR_BASE_LISTENER = /u01/app/oracle

 

Will generate sqlnet.ora

 

 

 

 

 

 

 

 

 

 

 

You will get tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0.4/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

 

PRMDB =

  (DESCRIPTION =

    (ADDRESS_LIST =

      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

    )

    (CONNECT_DATA =

      (SERVICE_NAME = PRMDB)

    )

  )

To be continued…

[oracle@dhcp-cn-10-182-233-248 Desktop]$ lsnrctl status

bash: lsnrctl: command not found

[oracle@dhcp-cn-10-182-233-248 Desktop]$ sqlplus / as sysdba

bash: sqlplus: command not found

[oracle@dhcp-cn-10-182-233-248 Desktop]$ lsncrtl status

bash: lsncrtl: command not found

Listner sample:

SID_LIST_LISTENER =

  (SID_LIST =

    (SID_DESC =

      (GLOBAL_DBNAME = PRMDB)

      (ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)

      (SID_NAME = PRMDB)

    )

  (SID_DESC =

      (GLOBAL_DBNAME = STLDB)

      (ORACLE_HOME = /u01/app/oracle/product/11.2.0.4/dbhome_1)

      (SID_NAME = STLDB)

  )

 )

SQL> select NAME from v$datafile;

 

NAME

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

/u01/app/oracle/oradata/PRMDB/system01.dbf

/u01/app/oracle/oradata/PRMDB/sysaux01.dbf

/u01/app/oracle/oradata/PRMDB/undotbs01.dbf

/u01/app/oracle/oradata/PRMDB/users01.dbf

/u01/app/oracle/oradata/PRMDB/example01.dbf

 

SQL> select name from v$database;

 

NAME

---------

PRMDB

posted on 2016-04-08 19:45  yoalex  阅读(1194)  评论(0编辑  收藏  举报