Solaris11_X86安装Oracle12c

硬件环境

DELL R710
系统:ESXI 5.1
    Solaris11_amd64
    内存:4G
    CPU:2X2
    硬盘:60G
    

A 预安装操作

配置repo
详见http://blog.csdn.net/caiwenguang1992/article/details/9330075
获取oracle安装包
http://www.oracle.com/technetwork/database/enterprise-edition/downloads/112010-sparc64soft-088481.html

创建用户
root@oracle:~# groupadd dba
root@oracle:~# groupadd oinstall
root@oracle:~# useradd -g oinstall -G dba -m -s /usr/bin/bash oracle
80 blocks

修改内核参数
root@oracle:~# projadd -U oracle -K "project.max-shm-memory=(priv,4096M,deny)" user.oracle
root@oracle:~# projmod -sK "project.max-sem-nsems=(priv,512,deny)" user.oracle
root@oracle:~# projmod -sK "project.max-sem-ids=(priv,128,deny)" user.oracle
root@oracle:~# projmod -sK "project.max-shm-ids=(priv,128,deny)" user.oracle
root@oracle:~# cat  /etc/project
system:0::::
user.root:1::::
noproject:2::::
default:3::::
group.staff:10::::
user.oracle:100::oracle::project.max-sem-ids=(priv,128,deny);project.max-sem-nsems=(priv,512,deny);project.max-shm-ids=(priv,128,deny);project.max-shm-memory=(priv,4294967296,deny)    #此行就是新增的更改,永久生效
#######################注意#########################
内核参数是通过/etc/system来设置的,需要重启系统来生效
这些参数通过/etc/system文件设置是好点,然后对于非NA项目更改project,进行资源控制。
用system设置的话,修改/etc/system内容如下:
set noexec_user_stack=1
set semsys:seminfo_semmni=100
set semsys:seminfo_semmns=25600
set semsys:seminfo_semmsl=256
set semsys:seminfo_semvmx=32767
set shmsys:shminfo_shmmax=4294967295
set shmsys:shminfo_shmmin=1
set shmsys:shminfo_shmmni=100
set shmsys:shminfo_shmseg=10
用project设置的话如下
创建一个project, 用来控制oracle 的用户资源
projadd -U oracle user.oracle
projmod -sK "project.max-shm-memory=(privileged,4G,deny)" user.oracle
projmod -sK "project.max-shm-ids=(privileged,100,deny)" user.oracle
projmod -sK "process.max-sem-nsems=(privileged,256,deny)" user.oracle
projmod -sK "project.max-sem-ids=(privileged,100,deny)" user.oracle
(此处采用第二种设置方案)
###################################################
查看以设置的参数
例子如下:
root@oracle:~# prctl -n project.max-shm-memory -i process $$
process: 1783: -bash
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
project.max-shm-memory
        privileged      1020MB      -   deny                                 -
        system          16.0EB    max   deny                                 -
root@oracle:~# prctl -n project.max-sem-ids -i process $$
process: 1783: -bash
NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
project.max-sem-ids
        privileged        128       -   deny                                 -
        system          16.8M     max   deny    

修改IP参数
root@oracle:~# ipadm set-prop -p smallest_anon_port=12000 tcp
root@oracle:~# ipadm set-prop -p largest_anon_port=65535 tcp
root@oracle:~# ipadm set-prop -p largest_anon_port=65535 udp
root@oracle:~# ipadm set-prop -p smallest_anon_port=12000 udp
查看以设置的IP参数
root@oracle:~# ipadm show-prop |grep anon|egrep 'tcp|udp'
tcp   largest_anon_port     rw   65535        65535        65535        12000-65535
tcp   smallest_anon_port    rw   12000        12000        32768        1024-65535
udp   largest_anon_port     rw   65535        65535        65535        12000-65535
udp   smallest_anon_port    rw   12000        12000        32768        1024-65535

添加环境变量
root@oracle:/oracle# tail -5 .profile
esac
export ORACLE_BASE=/oracle
export ORACLE_HOME=$ORACLE_BASE/12.1
export PATH=$PATH:/usr/local/bin:$ORACLE_HOME/bin:$CRS_HOME/bin
export NLS_LANG='SIMPLIFIED CHINESE_CHINA.UTF8'
export LANG=zh_CN.UTF8
export DISPLAY=188.188.3.220:0.0 #起动Xmanage的地址
root@oracle:/oracle# reboot    #重启系统让内核参数都生效

部署置安装源和依赖包
root@oracle:~# mkdir /usr/src/oracle
root@oracle:~# cd /usr/src/oracle/
root@oracle:/usr/src/oracle# unzip solaris.x64_12cR1_database_1of2.zip && unzip solaris.x64_12cR1_database_2of2.zip
root@oracle:/usr/src/oracle# cd ~
root@oracle:~# chown -R oracle:oinstall /usr/src/oracle

配置repo安装依赖包
root@oracle:~# pkg set-publisher -Pe -O http://188.188.3.223 solaris #设置repo源(此源配置方法详见http://blog.csdn.net/caiwenguang1992/article/details/9330075)
##################################
如果用oracle提供的repo执行如下命令:
pkg set-publisher -Pe -O http://pkg.oracle.com/solaris/release solaris
##################################
root@oracle:~# pkginfo -i SUNWarc SUNWbtool SUNWhea SUNWlibm SUNWlibms SUNWpool SUNWpoolr SUNWsprot SUNWtoo SUNWuiu8 SUNWfont-xorg-core SUNWfont-xorg-iso8859-1 SUNWmfrun SUNWxorg-client-programs SUNWxorg-clientlibs SUNWxwfsw SUNWxwplt        #检测这些包是否安装
system      SUNWarc                 Lint Libraries (usr)
system      SUNWbtool               CCS tools bundled with SunOS
system      SUNWfont-xorg-core      X.Org Foundation X11 core fonts
system      SUNWfont-xorg-iso8859-1 X.Org Foundation X11 iso8859-1 fonts
system      SUNWlibm                Math & Microtasking Library Headers & Lint Files (Usr)
system      SUNWlibms               Math & Microtasking Libraries (Usr)
system      SUNWpool                Resource Pools
system      SUNWpoolr               Resource Pools (Root)
system      SUNWsprot               Solaris Bundled tools
system      SUNWtoo                 Programming Tools
system      SUNWuiu8                Iconv modules for UTF-8 Locale
system      SUNWxwfsw               X Window System platform required font software
ERROR: information for "SUNWhea" was not found    #was not found的属于没安装的
ERROR: information for "SUNWmfrun" was not found
ERROR: information for "SUNWxorg-client-programs" was not found
ERROR: information for "SUNWxorg-clientlibs" was not found
ERROR: information for "SUNWxwplt" was not found
root@oracle:~# pkg install SUNWhea SUNWmfrun SUNWxorg-client-programs SUNWxorg-clientlibs  #没安装的进行安装
   要安装的软件包:   8
      创建引导环境: 否
创建备份引导环境: 否

下载                             软件包        文件    XFER (MB)  速度
已完成                                8/8     2375/2375      8.3/8.3  695k/s

阶段                                        项目
正在安装新操作                      2733/2733
正在更新软件包状态数据库          完成
正在更新映像状态                      完成
正在创建快速查找数据库             完成
root@oracle:~# pkginfo -i SUNWarc SUNWbtool SUNWhea SUNWlibm SUNWlibms SUNWpool SUNWpoolr SUNWsprot SUNWtoo SUNWuiu8 SUNWfont-xorg-core SUNWfont-xorg-iso8859-1 SUNWmfrun SUNWxorg-client-programs SUNWxorg-clientlibs SUNWxwfsw SUNWxwplt
system      SUNWarc                  Lint Libraries (usr)
system      SUNWbtool                CCS tools bundled with SunOS
system      SUNWfont-xorg-core       X.Org Foundation X11 core fonts
system      SUNWfont-xorg-iso8859-1  X.Org Foundation X11 iso8859-1 fonts
system      SUNWhea                  SunOS Header Files
system      SUNWlibm                 Math & Microtasking Library Headers & Lint Files (Usr)
system      SUNWlibms                Math & Microtasking Libraries (Usr)
system      SUNWmfrun                Motif RunTime Kit
system      SUNWpool                 Resource Pools
system      SUNWpoolr                Resource Pools (Root)
system      SUNWsprot                Solaris Bundled tools
system      SUNWtoo                  Programming Tools
system      SUNWuiu8                 Iconv modules for UTF-8 Locale
system      SUNWxorg-client-programs X.Org Foundation X Client Programs
system      SUNWxorg-clientlibs      X.Org Foundation X Client Libraries
system      SUNWxwfsw                X Window System platform required font software
system      SUNWxwplt                X Window System platform software
root@oracle:~# su - oracle
Oracle Corporation      SunOS 5.11      11.1    September 2012
oracle@oracle:~$ echo $ORACLE_HOME
/oracle/12.1
oracle@oracle:~$
oracle@oracle:~$
oracle@oracle:~$ echo $DISPLAY
188.188.3.220:0.0 #在这个机器上启动xmanage,默认启动就是0.0,如果是0.X的话,可以更改这儿的环境变量
oracle@oracle:~$ /usr/src/oracle/database/runInstaller
安装完成后执行脚本如下
oracle@oracle:/oracle$ su - cai
Password:
Oracle Corporation      SunOS 5.11      11.1    September 2012
cai@oracle:~$ sudo -s
Password:
root@oracle:/home/cai#
root@oracle:/home/cai#
root@oracle:/home/cai# su -
Oracle Corporation      SunOS 5.11      11.1    September 2012
root@oracle:~# /oracle/oraInventory/orainstRoot.sh
更改权限/oracle/oraInventory.
添加组的读取和写入权限。
删除全局的读取, 写入和执行权限。

更改组名/oracle/oraInventory 到 oinstall.
脚本的执行已完成。
root@oracle:~# /oracle/12.1/root.sh
Performing root user operation for Oracle 12c

The following environment variables are set as:
    ORACLE_OWNER= oracle
    ORACLE_HOME=  /oracle/12.1

Enter the full pathname of the local bin directory: [/usr/local/bin]:
Creating /usr/local/bin directory...
   Copying dbhome to /usr/local/bin ...
   Copying oraenv to /usr/local/bin ...
   Copying coraenv to /usr/local/bin ...


Creating /var/opt/oracle/oratab file...
Entries will be added to the /var/opt/oracle/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.
root@oracle:~# exit
logout
root@oracle:/home/cai# exit
exit
cai@oracle:~$ exit
logout
oracle@oracle:/oracle$

接下来启动监听程序
oracle@oracle:/oracle$ lsnrctl start #启动监听
oracle@oracle:/oracle$ lsnrctl status #查看监听状态

LSNRCTL for Solaris: Version 12.1.0.1.0 - Production on 16-JUL-2013 09:31:11

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Solaris: Version 12.1.0.1.0 - Production
Start Date                16-JUL-2013 09:30:48
Uptime                    0 days 0 hr. 0 min. 24 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Log File         /oracle/diag/tnslsnr/oracle/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
The listener supports no services
The command completed successfully

创建数据库
oracle@oracle:/oracle$ dbca #用创建数据库助手dbca创建库和实例
oracle@oracle:/oracle/12.1/network/admin$ pwd #在此目录下
/oracle/12.1/network/admin
oracle@oracle:/oracle/12.1/network/admin$ vi listener.ora #编辑监听文件内容如下
oracle@oracle:/oracle/12.1/network/admin$ cat listener.ora
SID_LIST_COOKIE_LSN =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /oracle/12.1)
      (PROGRAM = extproc)
    )
  )

COOKIE_LSN =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )
oracle@oracle:/oracle/12.1/network/admin$ cat tnsnames.ora #客户端链接设置
JHON =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = oracle)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = JHON)
    )
  )
oracle@oracle:/oracle/12.1/network/admin$ lsnrctl reload #重新加载listener.ora

LSNRCTL for Solaris: Version 12.1.0.1.0 - Production on 17-7月 -2013 03:39:48

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

正在连接到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
命令执行成功
oracle@oracle:/oracle/12.1/network/admin$ lsnrctl status #查看监听状态

LSNRCTL for Solaris: Version 12.1.0.1.0 - Production on 17-7月 -2013 03:40:24

Copyright (c) 1991, 2013, Oracle.  All rights reserved.

正在连接到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
LISTENER 的 STATUS
------------------------
别名                      LISTENER
版本                      TNSLSNR for Solaris: Version 12.1.0.1.0 - Production
启动日期                  17-7月 -2013 03:33:50
正常运行时间              0 天 0 小时 6 分 33 秒
跟踪级别                  off
安全性                    ON: Local OS Authentication
SNMP                      OFF
监听程序参数文件          /oracle/12.1/network/admin/listener.ora
监听程序日志文件          /oracle/diag/tnslsnr/oracle/listener/alert/log.xml
监听端点概要...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=oracle)(PORT=1521)))
服务摘要..
服务 "jhon" 包含 1 个实例。    #此处的服务名归sqlplus来链接
  实例 "jhon", 状态 READY, 包含此服务的 1 个处理程序...   
服务 "jhonXDB" 包含 1 个实例。
  实例 "jhon", 状态 READY, 包含此服务的 1 个处理程序...
命令执行成功
oracle@oracle:/oracle/12.1/network/admin$ sqlplus sys/jhon@jhon as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on 星期三 7月 17 03:41:33 2013

Copyright (c) 1982, 2013, Oracle.  All rights reserved.


连接到:
Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

SQL>

OK至此,Oracle12c for Solaris11_X86就安装完了。


#########################################

本文由笔者亲测原创

作者:john

转载请注明出处!


你可能感兴趣的:(unix服务篇,Oracle)