在OEL6.4上安装Oracle Database 12c[初体验]


收到Oracle Database 12c发布的消息,立马上官方网站下载,下面是我首次安装Oracle 12c,平台为Oracle Enterprise Linux 6.4。

我下载了官方文档,阅读了下,从中提到了下Oracle RDBMS Pre-Install RPM的包,全称为:oracle-rdbms-server-12cR1-preinstall-1.0-3.el6.x86_64.rpm,只要安装它,就给系统配置好了预安装条件。这应该是类似于OVC的软件。

但我在下面是以手动方式去做好了预安装配置,下面分享下。

1、安装OEL 6.4
安装步骤略,安装后系统情况如下:

[root@khm00 ~]# cat /etc/RedHat-release RedHatEnterpriseLinuxServer release 6.4(Santiago)内存分配情况:[root@12c ~]# grep MemTotal /proc/meminfoMemTotal:3515540 kB

Swap空间大小,Swap空间我设小了,后面在校验的时候会出现提示。[root@12c ~]# grep SwapTotal /proc/meminfoSwapTotal:3063804 kB

tmp临时目录大小:[root@12c ~]# df -h /tmpFilesystemSizeUsedAvailUse%Mounted on
/dev/mapper/vg_12c-lv_root
                       50G4.9G42G11%/
磁盘分配信息:
[root@12c ~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_12c-lv_root
                       50G5.1G42G11%/
tmpfs                 1.7G  260K  1.7G   1% /dev/shm
/dev/sda1             485M55M405M12%/boot
/dev/mapper/vg_12c-lv_home
                      6.5G143M6.1G3%/home
/dev/sr0              3.5G3.5G0100%/media/OL6.4 x86_64 Disc120130225/dev/sr0              3.5G3.5G0100%/mnt

[root@12c ~]# uname -m
x86_64

 

2、下载上传介质
从官方网站下载Oracle12c安装介质,并上传到刚刚安装好的OEL 6.4服务器上。
介质如下:
linuxamd64_12c_database_1of2.zip
linuxamd64_12c_database_2of2.zip

另外还上传一个rlwrap-0.37-1.el6.x86_64.rpm,并安装:

[root@12c ~]# rpm -ivh /install/rlwrap-0.37-1.el6.x86_64.rpm 

 

3、配置/etc/hosts
修改/etc/hosts文件,前两行不懂,添加hostname对应信息。

[root@12c ~]# cat /etc/hosts127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.3512c.luocs.com   12c

 

4、系统配置
修改/etc/sysctl.conf,添加如下内容:

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
kernel.shmmax = 4398046511104
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

生效:
sysctl -p

修改/etc/security/limits.conf,添加如下内容:

oracle  soft  nofile    1024
oracle  hard  nofile    65536
oracle  soft  nproc    2047
oracle  hard  nproc    16384
oracle  soft  stack    10240
oracle  hard  stack    32768

5、配置YUM源并安装所需包
先将默认的yum配置文件删除或者移动,然后创建一个新的

[root@12c ~]# cd /etc/yum.repos.d[root@12c yum.repos.d]# mkdir bk[root@12c yum.repos.d]# mv public-yum-ol6.repo bk/[root@12c yum.repos.d]# vi luocs.repo --添加如下内容[Oracle]
name=OEL-$releasever -Media
baseurl=file:///mnt
gpgcheck=0
enabled=1将光驱挂载上[root@12c yum.repos.d]# mount /dev/cdrom /mnt
mount: block device /dev/sr0 is write-protected, mounting read-only

下面就可以Yum方式安装所需包了[root@12c yum.repos.d]# yum -y install binutils compat-libstdc++-33 elfutils-libelf elfutils-libelf-devel elfutils-libelf-devel-static gcc gcc-c++ glibc glibc-common glibc-devel kernel-headers ksh libaio libaio-devel libgcc libgomp libstdc++ libstdc++-devel make numactl-devel sysstat unixODBC unixODBC-devel pdksh

 

下面给出官方文档中Linux 6所需要具备的包:

binutils-2.20.51.0.2-5.11.el6 (x86_64)
compat-libcap1-1.10-1 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (x86_64)
compat-libstdc++-33-3.2.3-69.el6 (i686)
gcc-4.4.4-13.el6 (x86_64)
gcc-c++-4.4.4-13.el6 (x86_64)
glibc-2.12-1.7.el6 (i686)
glibc-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (x86_64)
glibc-devel-2.12-1.7.el6 (i686)
ksh
libgcc-4.4.4-13.el6 (i686)
libgcc-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (x86_64)
libstdc++-4.4.4-13.el6 (i686)
libstdc++-devel-4.4.4-13.el6 (x86_64)
libstdc++-devel-4.4.4-13.el6 (i686)
libaio-0.3.107-10.el6 (x86_64)
libaio-0.3.107-10.el6 (i686)
libaio-devel-0.3.107-10.el6 (x86_64)
libaio-devel-0.3.107-10.el6 (i686)
libXext-1.1 (x86_64)
libXext-1.1 (i686)
libXtst-1.0.99.2 (x86_64)
libXtst-1.0.99.2 (i686)
libX11-1.3 (x86_64)
libX11-1.3 (i686)
libXau-1.0.5 (x86_64)
libXau-1.0.5 (i686)
libxcb-1.5 (x86_64)
libxcb-1.5 (i686)
libXi-1.3 (x86_64)
libXi-1.3 (i686)
make-3.81-19.el6
sysstat-9.0.4-11.el6 (x86_64)
加上UnixODBC Driver Manager:
unixODBC-2.2.14-11.el6 (64-bit) or later
unixODBC-devel-2.2.14-11.el6 (64-bit) or later

6、创建用户和组

创建组:[root@12c ~]# /usr/sbin/groupadd -g 54321 oinstall[root@12c ~]# /usr/sbin/groupadd -g 54322 dba[root@12c ~]# /usr/sbin/groupadd -g 54323 oper[root@12c ~]# /usr/sbin/groupadd -g 54324 backupdba[root@12c ~]# /usr/sbin/groupadd -g 54325 dgdba创建用户:[root@12c ~]#  /usr/sbin/useradd -u 54321 -g oinstall -G dba,backupdba,dgdba oracle[root@12c ~]# passwd oracle

 

7、确定防火墙和SELinux是禁用的

[root@12c ~]# iptables -LChain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination  

如果防火墙没禁用,那么通过如下方式修改:[root@12c ~]# service iptables stop[root@12c ~]# chkconfig iptables off[root@12c ~]# getenforce Disabled如果SELinux没有被禁止,那就通过如下方式修改:[root@12c ~]# cat /etc/selinux/config --改成SELINUX=disabled
# This file controls the state of SELinux on the system.# SELINUX= can take one of these three values:#     enforcing - SELinux security policy is enforced.#     permissive - SELinux prints warnings instead of enforcing.#     disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:#     targeted - Targeted processes are protected,#     mls - Multi Level Security protection.
SELINUXTYPE=targeted

 

8、创建安装目录以及授权

[root@12c ~]# mkdir -p /u01/app/oracle/product/12.1.0/db_1[root@12c ~]# chown -R oracle:oinstall /u01[root@12c ~]# chmod -R 775 /u01

 
9、配置oracle环境变量

[oracle@12c ~]$ vi .bash_profile 
export PATH
export TMP=/tmp
export TMPDIR=$TMP      
export ORACLE_HOSTNAME=12c.luocs.com
export ORACLE_UNQNAME=luocs12c
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1
export ORACLE_SID=luocs12c
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
	
alias sqlplus="rlwrap sqlplus"alias rman="rlwrap rman"

 
10、解压介质

[root@12c ~]# chown -R oracle.oinstall /install/[root@12c ~]# su - oracle[oracle@12c ~]$ cd /install/[oracle@12c install]$ unzip linuxamd64_12c_database_1of2.zip 
[oracle@12c install]$ unzip linuxamd64_12c_database_2of2.zip 
	
解压之后大小为:[oracle@12c install]$ du -sh database/2.6G    database/

 

11、安装

[oracle@12c database]$ pwd
/install/database

我打开Xmanager-Passive,设置DISPLAY,调用runInstaller启动OUI
[oracle@12c database]$ export DISPLAY=192.168.1.1:0.0[oracle@12c database]$ ./runInstaller 

 
 

 

我首次安装选择了第一项,安装完软件之后接着创建输数据库

注意,Global database name不能以数字开头,需要设置高强度密码,大小写+数字

这里校验的时候提示Swap空间大小不够大,忽略也可完成

[root@12c ~]# /u01/app/oraInventory/orainstRoot.shChanging permissions of /u01/app/oraInventory.Adding read,write permissions forgroup.Removing read,write,execute permissions for world.Changing groupname of /u01/app/oraInventory to oinstall.The execution of the script is complete.[root@12c ~]# /u01/app/oracle/product/12.1.0/db_1/root.shPerforming root user operation forOracle12cThe following environment variables are setas:
    ORACLE_OWNER= oracle
    ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_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 byDatabaseConfigurationAssistantwhen a database is created
Finished running generic part of root script.Now product-specific root actions will be performed.

 

等软件安装完毕之后紧接着创建数据库

 


12、最后
查看进程,发现进程多了很多,新增进程以后慢慢去了解

[oracle@12c ~]$ ps -ef | grep ora_
oracle    66231022:21?00:00:00 ora_pmon_luocs12c
oracle    66251022:21?00:00:00 ora_psp0_luocs12c
oracle    66271222:21?00:00:14 ora_vktm_luocs12c
oracle    66311022:21?00:00:00 ora_gen0_luocs12c
oracle    66331022:21?00:00:00 ora_mman_luocs12c
oracle    66371022:21?00:00:00 ora_diag_luocs12c
oracle    66391022:21?00:00:00 ora_dbrm_luocs12c
oracle    66411022:21?00:00:00 ora_dia0_luocs12c
oracle    66431022:21?00:00:01 ora_dbw0_luocs12c
oracle    66451022:21?00:00:00 ora_lgwr_luocs12c
oracle    66471022:21?00:00:01 ora_ckpt_luocs12c
oracle    66491022:21?00:00:01 ora_lg00_luocs12c
oracle    66511022:21?00:00:00 ora_lg01_luocs12c
oracle    66531022:21?00:00:00 ora_smon_luocs12c
oracle    66551022:21?00:00:00 ora_reco_luocs12c
oracle    66571022:21?00:00:00 ora_lreg_luocs12c
oracle    66591022:21?00:00:02 ora_mmon_luocs12c
oracle    66611022:21?00:00:01 ora_mmnl_luocs12c
oracle    66631022:21?00:00:00 ora_d000_luocs12c
oracle    66651022:21?00:00:00 ora_s000_luocs12c
oracle    66771022:21?00:00:00 ora_tmon_luocs12c
oracle    66791022:21?00:00:00 ora_tt00_luocs12c
oracle    66811022:21?00:00:00 ora_smco_luocs12c
oracle    66831022:21?00:00:00 ora_aqpc_luocs12c
oracle    66871122:21?00:00:12 ora_p000_luocs12c
oracle    66891222:21?00:00:15 ora_p001_luocs12c
oracle    66911022:21?00:00:01 ora_p002_luocs12c
oracle    66931022:21?00:00:01 ora_p003_luocs12c
oracle    66951022:21?00:00:03 ora_p004_luocs12c
oracle    66971022:22?00:00:01 ora_p005_luocs12c
oracle    66991022:22?00:00:00 ora_p006_luocs12c
oracle    67011022:22?00:00:00 ora_p007_luocs12c
oracle    67031022:22?00:00:00 ora_p008_luocs12c
oracle    67051022:22?00:00:00 ora_p009_luocs12c
oracle    67071022:22?00:00:00 ora_p00a_luocs12c
oracle    67091022:22?00:00:00 ora_p00b_luocs12c
oracle    67111022:22?00:00:00 ora_p00c_luocs12c
oracle    67131022:22?00:00:00 ora_p00d_luocs12c
oracle    67151022:22?00:00:00 ora_p00e_luocs12c
oracle    67171022:22?00:00:00 ora_p00f_luocs12c
oracle    67191022:22?00:00:01 ora_w000_luocs12c
oracle    67491122:22?00:00:09 ora_cjq0_luocs12c
oracle    67541022:22?00:00:00 ora_p00g_luocs12c
oracle    67561022:22?00:00:00 ora_p00h_luocs12c
oracle    67581022:22?00:00:00 ora_qm02_luocs12c
oracle    67621022:22?00:00:01 ora_q002_luocs12c
oracle    67641022:22?00:00:00 ora_q003_luocs12c
oracle    67881022:23?00:00:00 ora_p00i_luocs12c
oracle    67901022:23?00:00:00 ora_p00j_luocs12c
oracle    67921022:23?00:00:01 ora_w001_luocs12c
oracle    68551022:26?00:00:00 ora_p00k_luocs12c
oracle    68571022:26?00:00:00 ora_p00l_luocs12c
oracle    68881022:30?00:00:00 ora_w002_luocs12c

 

如下方式可以访问OEM Database Express 12c:
https://192.168.1.35:5500/em/login

SQL> COL PRODUCT FORMAT A40
SQL> COL VERSION FORMAT A15
SQL> COL STATUS FORMAT A15 
SQL> SELECT * FROM PRODUCT_COMPONENT_VERSION;

PRODUCT                                  VERSION         STATUS
----------------------------------------------------------------------
NLSRTL                                   12.1.0.1.0ProductionOracleDatabase12cEnterpriseEdition12.1.0.1.064bitProductio
                                                         n

PL/SQL                                   12.1.0.1.0Production
TNS forLinux:12.1.0.1.0Production


SQL>set line 150 pages 9999
SQL>select*from v$version;

BANNER                                                                               CON_ID
------------------------------------------------------------------------------------------OracleDatabase12cEnterpriseEditionRelease12.1.0.1.0-64bitProduction0
PL/SQL Release12.1.0.1.0-Production0
CORE    12.1.0.1.0Production0
TNS forLinux:Version12.1.0.1.0-Production0
NLSRTL Version12.1.0.1.0-Production0[oracle@12c ~]$ lsnrctl status

LSNRCTL forLinux:Version12.1.0.1.0-Production on 26-JUN-201322:44:44Copyright(c)1991,2013,Oracle.All rights reserved.Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))
STATUS of the LISTENER
------------------------Alias                     LISTENER
Version                   TNSLSNR forLinux:Version12.1.0.1.0-ProductionStartDate26-JUN-201322:09:51Uptime0 days 0 hr.34 min.53 sec
TraceLevel               off
Security                  ON:Local OS Authentication
SNMP                      OFF
ListenerParameterFile/u01/app/oracle/product/12.1.0/db_1/network/admin/listener.ora
ListenerLogFile/u01/app/oracle/diag/tnslsnr/12c/listener/alert/log.xml
ListeningEndpointsSummary...(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=12c.luocs.com)(PORT=1521)))(DESCRIPTION=(ADDRESS=(PROTOCOL=tcps)(HOST=12c.luocs.com)(PORT=5500))(Security=(my_wallet_directory=/u01/app/oracle/admin/luocs12c/xdb_wallet))(Presentation=HTTP)(Session=RAW))ServicesSummary...Service"luocs12c" has 1 instance(s).Instance"luocs12c", status READY, has 1 handler(s)forthis service...Service"luocs12cXDB" has 1 instance(s).Instance"luocs12c", status READY, has 1 handler(s)forthis service...Service"pdbluocs12c" has 1 instance(s).Instance"luocs12c", status READY, has 1 handler(s)forthis service...The command completed successfully

相关内容