签到成功

知道了

CNDBA社区CNDBA社区

Oracle 12c 单实例安装

2017-06-04 17:08 3601 0 原创 Oracle 12c
作者: leo

1 准备工作

1.1 配置本地yum

[cndba.cn]
name = CNDBA.CN YUM Server 
baseurl=file:///cndba
gpgcheck=0
enabled=1

mount dev/sr0 /mnt

[[email protected] yum.repos.d]# yum clean all
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: cndba.cn
Cleaning up everything
1.2 安装需要的rpm 包
安装常用软件:
yum -y install autoconf automake binutils-devel bison cpp dos2unix ftp gcc gcc-c++ lrzsz python-devel
安装Oracle 必备软件
yum -y install compat-db compat-db42 compat-db43 compat-gcc-34 compat-gcc-34-c++ compat-libstdc++-33 glibc-* glibc-*.i686 libXpm-*.i686 libXp.so.6 libXt.so.6 libXtst.so.6 libgcc_s.so.1 ksh libXp libaio-devel numactl numactl-devel unixODBC unixODBC-devel compat-libcap*
1.3 修改内核参数/etc/sysctl.conf

在sysctl.conf 中加入以下内容:

http://www.cndba.cn/cndba/leo1990/article/1944

cat >> /etc/sysctl.conf <<EOF 
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 6815744
fs.aio-max-nr = 1048576
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
EOF

如下2个参数直接使用默认值即可:
kernel.shmmax = 68719476736
kernel.shmall = 4294967296

用root用户执行sysctl –p 使修改生效。

http://www.cndba.cn/cndba/leo1990/article/1944

1.4 设置 Oracle 用户的 Shell 限制

在 /etc/security/limits.conf 中添加如下内容

http://www.cndba.cn/cndba/leo1990/article/1944


cat >>/etc/security/limits.conf  <<EOF 
oracle       soft    nproc    2047
oracle       hard   nproc   16384
oracle       soft    nofile    1024
oracle       hard   nofile    65536
oracle       soft    stack    10240
oracle       hard   stack    10240
EOF

注:limits.conf 文件发生更改时,这些更改立即生效。但是,如果 Oracle 用户已登录,
则这些更改将在注销这些用户并重新登录之后生效。必须先完成此操作,然后再使用这些帐户进行安装。
1.5 设置PAM
确保加载了最新版本的 PAM,然后在 /etc/pam.d/login 文件中添加或编辑以下行:

cat >> /etc/pam.d/login   <<EOF 
session required pam_limits.so
EOF  
        
        
1.6 设置ulimit
验证当前 ulimit,如果需要则增大。可以采用多种方式完成此操作,推荐方法是在 /etc/profile 中添加以下行:

cat >> /etc/profile <<EOF 
if [ /$USER = "oracle" ] || [ /$USER = "grid" ]; then     
       if [ /$SHELL = "/bin/ksh" ]; then        
            ulimit -p 16384       
            ulimit -n 65536    
     else         
            ulimit -u 16384 -n 65536   
       fi     
       umask 022 
fi 
EOF  
          
          
1.7 创建Oracle用户和组
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
passwd oracle
1.8 创建目录
mkdir -p /u01/app/oracle/product/12.1.0/db_1 
chown -R oracle.oinstall /u01 
chmod -R 777 /u01
1.9 设置oracle用户的环境变量
修改/home/oracle/.bash_profile 文件添加如下内容:
TMP=/tmp; export TMP
TMPDIR=$TMP; export TMPDIR
ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE
ORACLE_HOME=$ORACLE_BASE/product/12.1.0/db_1; export ORACLE_HOME
ORACLE_SID=cndba; export ORACLE_SID
SHLIB_PATH=$LD_LIBRARY_PATH;export SHLIB_PATH
NLS_LANG=American_America.zhs16gbk;export NLS_LANG
ORA_NLS10=$ORACLE_HOME/nls/data;export ORA_NLS10
TNS_ADMIN=$ORACLE_HOME/network/admin;export TNS_ADMIN
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
 
Source 参数使生效:
[[email protected] ~]$ source ~/.bash_profile
2 开始安装
[[email protected] ~]$ cd /database/
[[email protected] database]$ ls
install  response  rpm  runInstaller  sshsetup  stage  welcome.html
[[email protected] database]$ ./runInstaller

http://www.cndba.cn/cndba/leo1990/article/1944

http://www.cndba.cn/cndba/leo1990/article/1944

yum install compat-libcap*http://www.cndba.cn/cndba/leo1990/article/1944

http://www.cndba.cn/cndba/leo1990/article/1944


root 用户下 运行上面两个脚本
[root@dg1 yum.repos.d]# /u01/app/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@dg1 yum.repos.d]# /u01/app/oracle/product/12.1.0/db_1/root.sh
Performing root user operation.

The following environment variables are set as:
    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 by
Database Configuration Assistant when a database is created
Finished running generic part of root script.
Now product-specific root actions will be performed.
Do you want to setup Oracle Trace File Analyzer (TFA) now ? yes|[no] : 
yes
Installing Oracle Trace File Analyzer (TFA).
Log File: /u01/app/oracle/product/12.1.0/db_1/install/root_dg1_2017-05-25_14-42-53-472430239.log

Finished installing Oracle Trace File Analyzer (TFA)

http://www.cndba.cn/cndba/leo1990/article/1944


http://www.cndba.cn/cndba/leo1990/article/1944

3 查询数据库信息

[[email protected] ~]$ sqlplus /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Thu May 25 15:21:28 2017

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

SQL> conn /as sysdba
Connected.
SQL> set line 140
SQL> select?*?from?v$version;
SP2-0734: unknown command beginning "select?*..." - rest of line ignored.
SQL> select * from v$version;

BANNER										     CON_ID
-------------------------------------------------------------------------------- ----------
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production		  0
PL/SQL Release 12.2.0.1.0 - Production							  0
CORE	12.2.0.1.0	Production								  0
TNS for Linux: Version 12.2.0.1.0 - Production						  0
NLSRTL Version 12.2.0.1.0 - Production							  0

SQL> SELECT CDB FROM V$DATABASE;

CDB
---
YES

SQL> set lines 120
SQL> col pdb_name for a40
SQL> col status for a40
SQL> select PDB_NAME,CON_UID,pdb_id,status from dba_pdbs;

PDB_NAME	 CON_UID	   PDB_ID  STATUS
---------------------------------------- ---------- ---------- ----------------------------------------
PDBCNDBA 	 4271691857      3     NORMAL
PDB$SEED 	 3932609193      2     NORMAL
SQL> col name for a30
SQL> col open_mode for a50
SQL> select con_id,dbid,NAME,OPEN_MODE from v$pdbs;

    CON_ID	 DBID       NAME	    OPEN_MODE
---------- ---------- ------------------------------ --------------------------------------------------
      2     3932609193  PDB$SEED		READ ONLY
      3     4271691857  PDBCNDBA		READ WRITE

SQL> show con_name

CON_NAME
------------------------------
CDB$ROOT

SQL> alter session set container=pdbcndba;

Session altered.

SQL> show con_name

CON_NAME
------------------------------
PDBCNDBA
SQL> show con_name

CON_NAME
------------------------------
PDBCNDBA

http://www.cndba.cn/cndba/leo1990/article/1944

版权声明:本文为博主原创文章,未经博主允许不得转载。

用户评论
* 以下用户言论只代表其个人观点,不代表CNDBA社区的观点或立场
leo

leo

关注

坚持你的坚持

  • 202
    原创
  • 0
    翻译
  • 39
    转载
  • 16
    评论
  • 访问:765852次
  • 积分:1270
  • 等级:核心会员
  • 排名:第8名
精华文章
    最新问题
    查看更多+
    热门文章
      热门用户
      推荐用户
        Copyright © 2016 All Rights Reserved. Powered by CNDBA · 皖ICP备2022006297号-1·

        QQ交流群

        注册联系QQ