Oracle12C静默安装、手工建库

Oracle 12C的静默安装和手工建库## 标题## Oracle 12C的静默安装和手工建库 既然如此,那我就发一篇自己修正的oracle 12C的静默安装和手工建库~

版本:centso7 oracle12.2.0
这是从我自己用的11G的静默修改过来的,并增加了一些12C的配置, 这是从好些篇文章上面得出的。附上一些详细的说明。
如果要使用,修改相关的路径和数据库名称即可。我自己再次按照文档安装的话,复制粘贴就能装好了,基本都是确认过的。
系统安装略过…

贴上自己用的详细步骤
首先是使用yum安装了oracle依赖包
mkdir -p /oracle/sh --1.创建yum目录
vi /oracle/sh/yum.sh --2.创建sh执行文件,加入以下
yum install -y binutils
yum install -y compat-libcap1
yum install -y compat-libstdc+±33
yum install -y compat-libstdc+±33.i686
yum install -y glibc
yum install -y glibc.i686
yum install -y glibc-devel
yum install -y glibc-devel.i686 ksh
yum install -y libaio
yum install -y libaio.i686
yum install -y libaio-devel
yum install -y libaio-devel.i686
yum install -y libX11
yum install -y libX11.i686
yum install -y libXau
yum install -y libXau.i686
yum install -y libXi
yum install -y libXi.i686
yum install -y libXtst
yum install -y libXtst.i686
yum install -y libgcc
yum install -y libgcc.i686
yum install -y libstdc++
yum install -y libstdc++.i686
yum install -y libstdc+±devel
yum install -y libstdc+±devel.i686
yum install -y libxcb libxcb.i686
yum install -y make
yum install -y nfs-utils
yum install -y net-tools
yum install -y smartmontools
yum install -y sysstat
yum install -y unixODBC
yum install -y unixODBC-devel
yum install -y gcc
yum install -y gcc-c++
yum install -y libXext
yum install -y libXext.i686
yum install -y zlib-devel
yum install -y zlib-devel.i686
chmod 755 yum.sh --3.授权755
./yum.sh --4.执行安装包

------------------------------------------------------------------------------------------1
root用户
开始执行安装12c配置
执行 vi /etc/sysctl.conf 加入以下

fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 524288
kernel.shmmax = 2147483647
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
net.ipv4.conf.all.rp_filter = 2
net.ipv4.conf.default.rp_filter = 2
fs.aio-max-nr = 1048576
net.ipv4.ip_local_port_range = 9000 65500
--------------------byte值计算方法,例子为物理内存8G
kernel.shmall = 2097152
(8*1024*1024=8388608)/4=2097152
kernel.shmmax = 8589934591
32位linux系统:可取最大值为4GB(4*1024*1024*1024=4294967296)-1 = 4294967296
64位linux系统:可取的最大值为物理内存值-1byte(8*1024*1024*1024=8589934592) -1 = 8589934591
/sbin/sysctl -p --执行刷新系统内存参数
------------------------------------------------------------------------------------------2
vi /etc/security/limits.d/20-nproc.conf —修改内核限制参数,加入以下
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft nproc 16384
oracle hard nproc 16384
oracle soft stack 10240
oracle hard stack 32768
oracle hard memlock 134217728
oracle soft memlock 134217728
------------------------------------------------------------------------------------------3
创建dba、oinstall用户组
[root@user ~]# groupadd -g 301 dba
[root@user ~]# groupadd -g 302 oinstall
[root@user ~]# groupadd -g 303 oper
[root@user ~]# useradd -u 302 -g oinstall -G dba oracle
[root@user ~]# passwd oracle
------------------------------------------------------------------------------------------4
创建安装目录
[root@user ~]# cd / //切换到根目录
[root@user /]# mkdir -p /xos/oracle //创建安装目录
[root@user /]# chown oracle:oinstall /xos/oracle //修改安装目录的权限
------------------------------------------------------------------------------------------5
vi /etc/selinux/config --关闭防火墙
SELINUX=disabled
------------------------------------------------------------------------------------------6
root执行
修改vi /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
使设置生效 :source /etc/profile
------------------------------------------------------------------------------------------7
root执行
创建 vi /etc/oraInst.loc文件,加入以下

nventory_loc=/xos/oracle/oraInventory
inst_group=oinstall

更改文件的权限
chown oracle:oinstall /etc/oraInst.loc
chmod 664 /etc/oraInst.loc
------------------------------------------------------------------------------------------8
修改环境变量(此次重启linux,以上面创建的oracle用户登录)
[oracle@user ~]$
export ORACLE_SID=smj
export ORACLE_BASE=/xos/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
export PATH=$PATH:$ORACLE_HOME/bin
保存使其生效: source .bash_profile
------------------------------------------------------------------------------------------9
传输oracle安装文件。之后解压(略…)解压时找不到 unzip命令执行yum install -y unzip zip安装
oracley用户传送文件到/xos/oracle下面。之后解压
------------------------------------------------------------------------------------------10
修改安装Oracle软件的响应文件vi /xos/oracle/database/response/db_install.rsp

oracle.install.responseFileVersion=/xos/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=dba
INVENTORY_LOCATION=/xos/oracle/oraInventory
ORACLE_HOME=/xos/oracle/product/12.2.0/db_1
ORACLE_BASE=/xos/oracle
oracle.install.db.InstallEdition=EE ------------oracle版本 EE企业版,SE标准
oracle.install.db.OSDBA_GROUP=dba
oracle.install.db.OSOPER_GROUP=dba
oracle.install.db.OSBACKUPDBA_GROUP=dba
oracle.install.db.OSDGDBA_GROUP=dba
oracle.install.db.OSKMDBA_GROUP=dba
oracle.install.db.OSRACDBA_GROUP=dba
oracle.install.db.isRACOneInstall=false
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
oracle.install.db.config.starterdb.globalDBName=smj
oracle.install.db.config.starterdb.SID=smj
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.memoryLimit=6144
oracle.install.db.config.starterdb.password.ALL=oracle
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true

------------------------------------------------------------------------------------------11
进行静默安装Oracle软件
cd database
./runInstaller -silent -force -responseFile /xos/oracle/database/response/db_install.rsp

查看安装日志信息了解安装进度
cd /xos/oracle/oraInventory/logs
tail -50f installActions*.log

安装中,如果提示[WARNING]不必理会,此时安装程序仍在进行,如果出现[FATAL],则安装程序已经停止了。
提示root执行以下,执行完即安装完成
/xos/oracle/product/12.2.0/db_1/root.sh
------------------------------------------------------------------------------------------12

export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=oracle
export ORACLE_UNQNAME=smj
export ORACLE_BASE=/xos/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0/db_1
export ORACLE_SID=smj
export PATH=/usr/sbin:$PATH
export PATH=$ORACLE_HOME/bin:$PATH
export PATH=$ORACLE_HOME/perl/bin:$ORACLE_HOME/jdk/bin:$PATH
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib:/usr/lib
export CLASSPATH=$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
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
export LANG=en_US
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export NLS_DATE_FORMAT=‘yyyy/mm/dd hh24:mi:ss’
export PS1="\u@\h \w>"

保存使其生效: source .bash_profile
------------------------------------------------------------------------------------------13
静默配置网络
$ORACLE_HOME/bin/netca /silent /responseFile /xos/oracle/database/response/netca.rsp

------------------------------------------------------------------------------------------14
监听文件配置:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /xos/oracle/product/12.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = SMJ)
(ORACLE_HOME = /xos/oracle/product/12.2.0/db_1)
(SID_NAME = SMJ)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.120)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
------------------------------------------------------------------------------------------15
手工建库
[oracle@user ~]$ mkdir /xos/oracle/admin
[oracle@user ~]$ mkdir /xos/oracle/admin/smj/
[oracle@user ~]$ mkdir /xos/oracle/admin/smj/{a,b}dump
[oracle@user ~]$ mkdir /xos/oracle/oradata
[oracle@user ~]$ mkdir /xos/oracle/oradata/smj
[oracle@user ~]$ mkdir /xos/oracle/flash_recovery_area
[oracle@user ~]$ cd /xos/oracle/flash_recovery_area

密码文件在dbs下-----cd /xos/oracle/product/12.2.0/db_1/dbs
创建密码文件在$ORACLE_HOME/dbs下
orapwd file=orapwsmj password=oracle entries=30 format=12
------------------------------------------------------------------------------------------16
创建参数文件
cat $ORACLE_HOME/dbs/init.ora | grep -v ^$ | grep -v ^# > initsmj.ora
修改参数文件:vi initsmj.ora

db_name=‘smj’
memory_target=1024M
processes = 150
audit_file_dest=’/xos/oracle/admin/smj/adump’
audit_trail =‘db’
db_block_size=8192
db_domain=’’
db_recovery_file_dest=’/xos/oracle/flash_recovery_area’
db_recovery_file_dest_size=1024M
diagnostic_dest=’/xos/oracle’
dispatchers=’(PROTOCOL=TCP) (SERVICE=ORCLXDB)’
open_cursors=300
remote_login_passwordfile=‘EXCLUSIVE’
undo_tablespace=‘UNDOTBS1’
control_files = (’/xos/oracle/oradata/smj/control01.ctl’,’/xos/oracle/oradata/smj/control02.ctl’,’/xos/oracle/oradata/smj/control03.ctl’) --在这里创建控制文件
enable_pluggable_database=true --12C增加的
compatible =‘12.2.0.1’

------------------------------------------------------------------------------------------17
startup nomount
create spfile from pfile

运行建库脚本 -------创建一个目录:mkdir /xos/oracle/oradata/smj/smj1
CREATE DATABASE smj
user sys identified by oracle
user system identified by oracle
LOGFILE GROUP 1 (’/xos/oracle/oradata/smj/redo01.log’) SIZE 100M,
GROUP 2 (’/xos/oracle/oradata/smj/redo02.log’) SIZE 100M,
GROUP 3 (’/xos/oracle/oradata/smj/redo03.log’) SIZE 100M
MAXLOGFILES 50
MAXLOGMEMBERS 5
MAXLOGHISTORY 10
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE ‘/xos/oracle/oradata/smj/system01.dbf’ SIZE 500M REUSE
AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
SYSAUX DATAFILE ‘/xos/oracle/oradata/smj/sysaux01.dbf’ SIZE 500M REUSE
AUTOEXTEND ON NEXT 10240K MAXSIZE UNLIMITED
DEFAULT TABLESPACE users
DATAFILE ‘/xos/oracle/oradata/smj/users01.dbf’ SIZE 500M REUSE
AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE ‘/xos/oracle/oradata/smj/temp01.dbf’
SIZE 20M REUSE AUTOEXTEND ON NEXT 1024K MAXSIZE UNLIMITED
UNDO TABLESPACE undotbs1
DATAFILE ‘/xos/oracle/oradata/smj/undotbs01.dbf’
SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED
ENABLE PLUGGABLE DATABASE
SEED
FILE_NAME_CONVERT =(’/xos/oracle/oradata/smj’,
‘/xos/oracle/oradata/smj/smj1’)
SYSTEM DATAFILES SIZE 125M AUTOEXTEND ON NEXT 10M MAXSIZE UNLIMITED
SYSAUX DATAFILES SIZE 100M
USER_DATA TABLESPACE usertbs
DATAFILE ‘/xos/oracle/oradata/smj/smj1/usertbs01.dbf’
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;
------------------------------------------------------------------------------------------18
sqlplus执行,注意填写Enter value for
SQL> @?/rdbms/admin/catcdb.sql
Enter value for 1:/xos/oracle/product/12.2.0/db_1/rdbms/admin
Enter value for 2:/xos/oracle/product/12.2.0/db_1/rdbms/admin/catcdb.pl

报错就修改catcdb.pl文件35行把unil修改成Util
vi /xos/oracle/product/12.2.0/db_1/rdbms/admin/catcdb.pl
cd /xos/oracle/product/12.2.0/db_1/perl/lib/5.22.0/x86_64-linux-thread-multi/Hash
注意:在该目录再进去sqlplus / as sysdba nomount执行@?/rdbms/admin/catcdb.sql
1./xos/oracle/product/12.2.0/db_1/rdbms/admin
2./xos/oracle/product/12.2.0/db_1/rdbms/admin/catcdb.pl
3.oracle
4.oracle
5.smj-temp
等待时间较长,可以查看日志是否在运行
tail -50f /xos/oracle/product/12.2.0/db_1/rdbms/admin/catalog*.log
------------------------------------------------------------------------------------------19
创建数据字典视图
SQL> @?/rdbms/admin/catalog.sql

创建PL/SQL的软件包和过程
SQL> @?/rdbms/admin/catproc.sql

conn system/oracle
@$ORACLE_HOME/sqlplus/admin/pupbld.sql
------------------------------------------------------------------------------------------20
完成,至此,可以使用了。

你可能感兴趣的:(数据库,oracle,linux)