暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Oracle Single Instance Installation(Release 11.2.0.4)

DB小榴莲 2018-12-06
1357


安装ORACLE数据库分两个部分,第一部分是操作系统,第二部分才是数据库,因为ORACLE就是一个应用软件,需要在操作系统上运行,所以说只有配置好操作系统环境,才能顺利的安装ORACLE数据库软件(software)和数据库(database)。

 

下面是安装oracle数据库的一般步骤,用作参考:

 

1、硬盘分区


[root@VM000001865 ~]# df -h

Filesystem            Size  Used Avail Use% Mounted on

/dev/xvda1             48G  7.1G   39G  16%

tmpfs                 7.8G     0  7.8G   0% dev/shm

 

1.1 查看磁盘信息,看到有一块483.2GB的硬盘/dev/xvde


[root@VM000001865 ~]# fdisk -l

Disk dev/xvda: 53.7 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes 512 bytes

I/O size (minimum/optimal): 512 bytes 512 bytes

Disk identifier: 0x000609d9

 

    Device Boot      Start         End      Blocks   Id  System

/dev/xvda1   *          1        6324    50790400   83  Linux

/dev/xvda2            6324        6515     1536000   82  Linux swap Solaris

 

Disk dev/xvde: 483.2 GB, 483183820800 bytes     >>>483.2GB大小的硬盘/dev/xvde

255 heads, 63 sectors/track, 58743 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes 512 bytes

I/O size (minimum/optimal): 512 bytes 512 bytes

Disk identifier: 0x00000000

 

1.2 格式化磁盘/dev/xvde再分区


[root@VM000001865 ~]# fdisk dev/xvde

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel with disk identifier 0x086ac1ac.

Changes will remain in memory only, until you decide to write them.

After that, of course, the previous content won't be recoverable.

 

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

 

WARNING: DOS-compatible mode is deprecated. It's strongly recommended to

         switch off the mode (command 'c') and change display units to

         sectors (command 'u').

 

Command (m for help): m

Command action

   a   toggle a bootable flag

   b   edit bsd disklabel

   c   toggle the dos compatibility flag

   d   delete a partition

   l   list known partition types

   m   print this menu

   n   add a new partition

   o   create a new empty DOS partition table

   p   print the partition table

   q   quit without saving changes

   s   create a new empty Sun disklabel

   t   change a partition's system id

   u   change display/entry units

   v   verify the partition table

   w   write table to disk and exit

   x   extra functionality (experts only)

 

Command (m for help): n

Command action

   e   extended

   p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-58743, default 1): 

Using default value 1

Last cylinder, +cylinders or +size{K,M,G} (1-58743, default 58743): 

Using default value 58743

 

Command (m for help): w

The partition table has been altered!

 

Calling ioctl() to re-read partition table.

Syncing disks.

 

1.3 查看格式化之后的磁盘


[root@VM000001865 ~]# fdisk -l

 

Disk dev/xvda: 53.7 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes 512 bytes

I/O size (minimum/optimal): 512 bytes 512 bytes

Disk identifier: 0x000609d9

 

    Device Boot      Start         End      Blocks   Id  System

/dev/xvda1   *          1        6324   50790400   83  Linux

/dev/xvda2            6324        6515     1536000   82  Linux swap Solaris

 

Disk dev/xvde: 483.2 GB, 483183820800 bytes

255 heads, 63 sectors/track, 58743 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes 512 bytes

I/O size (minimum/optimal): 512 bytes 512 bytes

Disk identifier: 0x086ac1ac

 

    Device Boot      Start         End      Blocks   Id  System

/dev/xvde1               1       58743  471853116   83  Linux

 

2、关闭防火墙


[root@VM000001865 ~]# chkconfig iptables off


3、创建LVM


3.1 创建物理卷

[root@VM000001865 ~]# pvcreate dev/xvde1

  Writing physical volume data to disk "/dev/xvde1"

  Physical volume "/dev/xvde1" successfully created

 

3.2 扫描物理卷

[root@VM000001865 ~]# pvscan

  PV dev/xvde1                     lvm2 [449.99 GiB]

  Total: 1 [449.99 GiB] in use: 0 [0   ] in no VG: 1 [449.99 GiB]

 

3.3 创建卷组vg_dbdata

[root@VM]# vgcreate vg_dbdata dev/xvde1

  Volume group "vg_dbdata" successfully created

 

 3.4 扫描卷组

[root@VM]# vgscan

  Reading all physical volumes.  This may take a while...

  Found volume group "vg_dbdata" using metadata type lvm2

 

3.5 查看卷组信息

[root@VM]# vgdisplay

  --- Volume group ---

  VG Name               vg_dbdata

  System ID             

  Format                lvm2

  Metadata Areas        1

  Metadata Sequence No  1

  VG Access             read/write

  VG Status             resizable

  MAX LV                0

  Cur LV                0

  Open LV               0

  Max PV                0

  Cur PV                1

  Act PV                1

  VG Size               449.99 GiB

  PE Size               4.00 MiB

  Total PE              115198

  Alloc PE Size       0 0   

  Free  PE Size       115198 449.99 GiB

  VG UUID              Mqw3q9-ijT1-7Oxq-VMo2-Jyfc-8OwT-njpp4I

 

 3.6 在卷组vg_dbdata中创建逻辑卷lv_data01

[root@VM]# lvcreate -L 100G -n lv_data01 vg_dbdata

  Logical volume "lv_data01" created

 

3.7 在卷组vg_dbdata中创建逻辑卷lv_fra01

[root@VM]# lvcreate -L 50G -n lv_fra01 vg_dbdata

  Logical volume "lv_fra01" created

 

3.8 扫描逻辑卷 

[root@VM000001865 ~]# lvscan

  ACTIVE           '/dev/vg_dbdata/lv_data01' [100.00 GiB] inherit

  ACTIVE           '/dev/vg_dbdata/lv_fra01' [50.00 GiB] inherit

 

[root@VM000001865 ~]# fdisk -l

 

Disk dev/xvda: 53.7 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes 512 bytes

I/O size (minimum/optimal): 512 bytes 512 bytes

Disk identifier: 0x000609d9

 

    Device Boot      Start         End      Blocks   Id  System

/dev/xvda1   *          1        6324    50790400   83  Linux

/dev/xvda2            6324        6515     1536000   82  Linux swap Solaris

 

Disk dev/xvde: 483.2 GB, 483183820800 bytes

255 heads, 63 sectors/track, 58743 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes 512 bytes

I/O size (minimum/optimal): 512 bytes 512 bytes

Disk identifier: 0x086ac1ac

 

    Device Boot      Start         End      Blocks   Id  System

/dev/xvde1               1       58743  471853116   83  Linux

 

Disk dev/mapper/vg_dbdata-lv_data01: 107.4 GB, 107374182400 bytes

255 heads, 63 sectors/track, 13054 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes 512 bytes

I/O size (minimum/optimal): 512 bytes 512 bytes

Disk identifier: 0x00000000

 

Disk dev/mapper/vg_dbdata-lv_fra01: 53.7 GB, 53687091200 bytes

255 heads, 63 sectors/track, 6527 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x00000000


 

4、创建文件系统


[root@VM]# mkfs -t ext3 /dev/vg_dbdata/lv_data01

[root@VM]# mkfs -t ext3 /dev/vg_dbdata/lv_fra01

 

5、创建挂载点 & 挂载


[root@VM]# mkdir /oravl01

[root@VM]# mkdir /oradiag

[root@VM]# mount /dev/vg_dbdata/lv_data01 /oravl01

[root@VM]# mount /dev/vg_dbdata/lv_fra01 /oradiag

[root@VM]# df -h

Filesystem     Size  Used Avail Use% Mounted on

/dev/xvda1     48G  7.1G   39G  16% /

tmpfs              7.8G     0  7.8G   0% /dev/shm

/dev/mapper/vg_dbdata-lv_data01

                       99G  188M   94G   1% /oravl01

/dev/mapper/vg_dbdata-lv_data01

                       99G  188M   94G   1% /oradiag

  

6、安装补丁包


[root@VM]# yum -y install gcc

[root@VM]# yum -y install compat-lib*

[root@VM]# yum -y install libaio*

[root@VM]# yum -y install xorg-x11-xauth

[root@VM]# yum -y install libXext

[root@VM]# yum -y install libXtst

[root@VM]# yum -y install libXp

[root@VM]# yum -y install xdpyinfo

 

 7、创建用户组&用户


[root@VM]# groupadd -g 600 oinstall

[root@VM]# groupadd -g 601 dba

[root@VM]# groupadd -g 602 oper

[root@VM]# useradd -u 700 -g oinstall -G dba,oper oracle

 

ORACLE这样描述 oinstall, dba, oper:




                

8、更改oracle用户密码   


[root@VM]# passwd oracle

Changing password for user oracle.

New password: 

BAD PASSWORD: it is based on a dictionary word

BAD PASSWORD: is too simple

Retype new password: 

passwd: all authentication tokens updated successfully.

 

 9、创建ORACLE软件使用的目录


[root@VM]# mkdir -p /oravl01/11.2.0.4/product

[root@VM]# mkdir -p /oradiag/oracle/admin/orcl/adump

[root@VM]# mkdir -p /oradiag/oracle/flash_recovery_area

[root@VM]# chown -R oracle:oinstall /oravl01/11.2.0.4/product

[root@VM]# chmod  755 /oravl01/

 

10、更改操作系统文件


[root@VM]# vi /etc/sysctl.conf

[root@VM]# vi /etc/security/limits.conf

[root@VM]# vi /etc/profile

[root@VM]# vi /etc/pam.d/login


10.1 Create or edit the /etc/sysctl.conf file, and add or edit lines similar to the following


fs.aio-max-nr = 1048576

fs.file-max = 6815744

kernel.shmall = 2097152

kernel.shmmax = 4294967295

kernel.shmmni = 4096

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 = 1048576


kernel.shmall表示系统一次可以使用的共享内存总量(页数),Linux共享内存页大小为4KB,共享内存段的大小都是共享内存页大小的整数倍。一个共享内存段的最大大小是16G,需要共享内存页数是16GB/4KB=4194304(页)


kernel.shmmax定义了共享内存段的最大值(以字节为单位),shmmax是核心参数中最重要的参数之一,shmmax设置应足够大,这样能在一个共享内存段中容纳整个SGA,设置的过低可能会导致需要创建多个共享内存段,导致系统性能下降


kernel.shmmni用于设置系统范围内共享内存段的最大数量


kernel.sem表示设置的信号量,它对应4个值SEMMSL、SEMMNS、SEMOPM、SEMMNI


fs.file-max表示文件句柄的最大数量,文件句柄设置表示在linux系统中可以打开的文件数量


net.core.rmem_default默认的接收窗口大小


net.core.rmem_max接收窗口的最大大小


net.core.wmem_default默认的发送窗口大小


net.core.wmem_max发送窗口的最大大小

 

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


oracle               soft    nproc  2047

oracle               hard    nproc  16384

oracle               soft    nofile 1024

oracle               hard    nofile 65536


10.3 Edit /etc/profile


if [ "$USER" = "oracle" ]; then

    if [ $SHELL = "/bin/ksh" ]; then

        ulimit -p 16384

        ulimit -n 65536

    else

        ulimit -u 16384 -n 65536

    fi

 

fi


11、配置ORACLE用户环境变量


[root@VM000001865 ~]# more .bash_profile

export PATH

export ORACLE_SID=test

export ORACLE_HOME=/oravl01/10.2.0.4/product

export ORACLE_BASE=/oradiag/oracle

export UMASK=022

export PATH=$ORACLE_HOME/bin:$PATH

export DISPLAY=x.x.x.x:0.0

export AIXTHREAD_SCOPE=S

 

12、编辑/etc/hosts文件


[root@VM000001865 etc]# vi hosts

"hosts" 4L, 215C127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4

::1 localhost localhost.localdomain localhost6 localhost6.localdomain6

139.196.20.20 www.dh.com

123.59.28.152 as.lxin.cn

 

13、解压ORACLE安装介质


[oracle@VM]$ unzip p13390677_112040_Linux-x86-64_1of7.zip

[oracle@VM]$ unzip p13390677_112040_Linux-x86-64_2of7.zip

 

14、调用图形化界面(远程图形化安装会出现问题,推荐静默安装)


[oracle@V]$ export DISPLAY=172.29.0.97:0.0

[oracle@VM000001865 database]$ ./runInstaller

Starting Oracle Universal Installer...

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

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

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

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-07-19_08-48-16PM. Please wait ...

 

15、静默安装


[oracle@VM000001865 database]$ cd response

[oracle@VM000001865 response]$ ls -lrt

total 80

-rwxr-xr-x. 1 oracle oinstall  5871 Aug 27 2013 netca.rsp

-rwxr-xr-x. 1 oracle oinstall 44533 Aug 27  2013 dbca.rsp

-rw-r--r--. 1 oracle oinstall 25293 Jul 19 22:49 db_install.rsp

 

15.1 编辑db_install.rsp & 安装 oracle software


[oracle@VM000001865 response]$ vi db_install.rsp

[oracle@VM000001865 database]$ ./runInstaller -silent -ignoreSysPrereqs -showProgress -responseFile /oravl01/soft/database/response/db_install.rsp

Starting Oracle Universal Installer...

 

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

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

Preparing to launch Oracle Universal Installer from /tmp/OraInstall2018-07-19_11-27-47PM. Please wait ...[oracle@VM000001865 database]$ [WARNING] [INS-32018] The selected Oracle home is outside of Oracle base.

   CAUSE: The Oracle home selected was outside of Oracle base.

   ACTION: Oracle recommends installing Oracle software within the Oracle base directory. Adjust the Oracle home or Oracle base accordingly.

[WARNING] [INS-13014] Target environment do not meet some optional requirements.

   CAUSE: Some of the optional prerequisites are not met. See logs for details. /tmp/OraInstall2018-07-19_11-27-47PM/installActions2018-07-19_11-27-47PM.log

   ACTION: Identify the list of failed prerequisite checks from the log: /tmp/OraInstall2018-07-19_11-27-47PM/installActions2018-07-19_11-27-47PM.log. Then either from the log file or from installation manual find the appropriate configuration to meet the prerequisites and fix it manually.

You can find the log of this install session at:

 /oravl01/app/oracle/oraInventory/logs/installActions2018-07-19_11-27-47PM.log

 

Prepare in progress.

..................................................   9% Done.

Prepare successful.

 

Copy files in progress.

..................................................   14% Done.

..................................................   20% Done.

..................................................   26% Done.

..................................................   31% Done.

..................................................   36% Done.

..................................................   41% Done.

..................................................   46% Done.

..................................................   51% Done.

..................................................   56% Done.

..................................................   63% Done.

..................................................   68% Done.

..................................................   73% Done.

..................................................   78% Done.

..................................................   83% Done.

..............................

Copy files successful.

Link binaries in progress.

..........

Link binaries successful.

Setup files in progress.

..................................................   88% Done.

..................................................   94% Done.

Setup files successful.

The installation of Oracle Database 11g was successful.

Please check '/oravl01/app/oracle/oraInventory/logs/silentInstall2018-07-19_11-27-47PM.log' for more details.

 

Execute Root Scripts in progress.

 

As a root user, execute the following script(s):

       1. /oravl01/app/oracle/oraInventory/orainstRoot.sh

       2. /oravl01/10.2.0.4/product/root.sh

..................................................   100% Done.

 

Execute Root Scripts successful.

Successfully Setup Software.

 

15.2 根据ORACLE提供的数据库模版创建数据库


[oracle@VM000001865 oradiag]$ dbca -silent -createDatabase -templateName /oravl01/10.2.0.4/product/assistants/dbca/templates/Data_Warehouse.dbc -gdbName test -sid test -responseFile NO_VALUE -characterSet ZHS16GBK

 

Enter SYS user password:

A value for the command line argument "sysPassword" is not provided. We cannot proceed without a value for this argument.

 

执行以上命令失败,提示没有提供SYS用户的密码,调整参数重新执行


[oracle@VM000001865 oradiag]$ dbca -silent -createDatabase -templateName $ORACLE_HOME/assistants/dbca/templates/Data_Warehouse.dbc -gdbname test -sid test -sysPassword oracle -systemPassword oracle -responseFile NO_VALUE -datafileDestination /oravl01/app/oracle/oradata/ -redoLogFileSize 50 -recoveryAreaDestination /oradiag/oracle/flash_recovery_area -storageType FS -characterSet ZHS16GBK -sampleSchema true -emConfiguration NONE


copying database files

1% complete

3% complete

11% complete

18% complete

26% complete

37% complete

Creating and starting Oracle instance

40% complete

45% complete

50% complete

55% complete

56% complete

57% complete

60% complete

62% complete

Completing Database Creation

66% complete

70% complete

73% complete

85% complete

96% complete

100% complete

Look at the log file "/oradiag/oracle/cfgtoollogs/dbca/test/test.log" for further details.


最后修改时间:2020-01-04 19:39:26
文章转载自DB小榴莲,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论