Oracle12c静默安装步骤总结

--关闭防火墙
systemctl stop firewalld.service 
-- 禁止防火墙开机启动
systemctl disable firewalld.service 

-- 关闭selinux
setenforce 0
vim /etc/selinux/config 
文件中设置SELINUX=disabled

-- 添加必要依赖
yum install binutils compat-libstdc++-33 compat-libstdc++-33.i686 elfutils-libelf elfutils-libelf-devel gcc gcc-c++ glibc glibc.i686 glibc-common glibc-devel glibc-devel.i686 glibc-headers ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel make sysstat unixODBC unixODBC-devel –y
-- 检测必要依赖
rpm -q \binutils \compat-libstdc++-33 \compat-libstdc++-33.i686 \elfutils-libelf \elfutils-libelf-devel \expat \gcc \gcc-c++ \glibc \glibc.i686 \glibc-common \glibc-devel \glibc-devel.i686 \glibc-headers \ksh \libaio \libaio.i686 \libaio-devel \libaio-devel.i686 \libgcc \libgcc.i686 \libstdc++ \libstdc++.i686 \libstdc++-devel \make \sysstat \unixODBC \unixODBC-devel | grep "not installed"

-- hosts文件的修改
127.0.0.1   oracle12c localhost
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.12.215 mirror.hand-china.com


-- 添加用户和组
groupadd oinstall
groupadd dba
useradd -g oinstall -G dba oracle
passwd oracle
-- Hand2019!
id oracle

-- 修改内核参数
vim /etc/sysctl.conf
-- 在文件中添加如下参数
fs.aio-max-nr=1048576
fs.file-max=6815744
kernel.shmall=524288
kernel.shmmax=2147483647
kernel.sem=250 32000 100 128
kernel.shmmni=4096
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
-- 使配置文件生效
sysctl -p

-- 文件句柄限制
vim /etc/security/limits.conf
-- 在文件末尾加上
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle soft stack 10240
oracle hard stack 10240


vim /etc/pam.d/login
session required /lib64/security/pam_limits.so
session required pam_limits.so


vim /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


-- 开始创建数据库
mkdir -p /data/database/oracle
chown -R oracle:oinstall /data/database/oracle/
chmod -R 775 /data/database/oracle/
-- 切换到oracle用户
su - oracle
vim ~/.bash_profile
-- 在末尾添加
export ORACLE_BASE=/data/database/oracle/oracle
export ORACLE_SID=orcl
-- 使配置生效
$ source ~/.bash_profile

-- 安装部署及配置
-- 创建资源目录
mkdir /home/oracle/oradb
su - root
yum install -y unzip zip
su - oracle
unzip xxx.zip

-- 为了不影响原来的文件内容(后面文件脚本内容会作修改)将相应的模板复制一份
cd /home/oracle
mkdir etc
cp /home/oracle/oradb/database/response/* /home/oracle/etc/

*/
-- 设置副本的    权限
su - root
chmod 700 /home/oracle/etc/*.rsp
*/
su - oracle
vim /home/oracle/etc/db_install.rsp

-- 找出以下项,并作修改(根据个人实际情况修改,比如我这边的oracle的目录是做过调整的)

oracle.install.option=INSTALL_DB_SWONLY -- 安装类型  
UNIX_GROUP_NAME=oinstall -- 安装组  
INVENTORY_LOCATION=/data/database/oracle/oraInventory -- INVENTORY目录(不填就是默认值)  
ORACLE_HOME=/data/database/oracle/oracle/product/12/db_1  -- 完整的oralce家目录
ORACLE_BASE=/data/database/oracle/oracle  
oracle.install.db.InstallEdition=EE     -- 企业版本  
oracle.install.db.DBA_GROUP=dba  
oracle.install.db.OPER_GROUP=oinstall  
oracle.install.db.BACKUPDBA_GROUP=oinstall  
oracle.install.db.DGDBA_GROUP=oinstall  
oracle.install.db.KMDBA_GROUP=oinstall  
oracle.install.db.RACDBA_GROUP=oinstall  -- 没找到
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE -- 数据库类型  
oracle.install.db.config.starterdb.globalDBName=orcl  
oracle.install.db.config.starterdb.SID=orcl  
oracle.install.db.config.starterdb.memoryLimit=81920 -- 自动管理内存的内存(M)  
oracle.install.db.config.starterdb.password.ALL=oracle -- 设定所有数据库用户使用同一个密码  
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false  
DECLINE_SECURITY_UPDATES=true

-- 开始安装
cd /home/oracle/oradb/database

./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion \
-showProgress -silent -responseFile /home/oracle/etc/db_install.rsp

-- 以 root 用户的身份执行以下脚本
su - root
/data/database/oracle/oraInventory/orainstRoot.sh
/data/database/oracle/oracle/product/12/db_1/root.sh

--修改oracle用户环境变量
su - oracle
vim ~/.bash_profile

export ORACLE_BASE=/data/database/oracle/oracle
export ORACLE_SID=orcl 
export ROACLE_PID=oral12
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib
export ORACLE_HOME=/data/database/oracle/oracle/product/12/db_1
export PATH=$PATH:$ORACLE_HOME/bin
export LANG="zh_CN.UTF-8"
export NLS_LANG="SIMPLIFIED CHINESE_CHINA.AL32UTF8"
export NLS_DATE_FORMAT='yyyy-mm-dd hh24:mi:ss'
-- 生效配置文件
source ~/.bash_profile

-- 配置监听 监听的配置文件不需要改动
netca /silent /responsefile /home/oracle/etc/netca.rsp
-- 启动监听
lsnrctl start
-- 查看监听情况
lsof -i:端口号
netstat -tunlp|grep 端口号

-- 修改静默库文件
vim /home/oracle/etc/dbca.rsp

responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=orcl
sid=orcl
databaseConfigType=SI
createAsContainerDatabase=true
numberOfPDBs=1
pdbName=orclpdb
templateName=/data/database/oracle/oracle/product/12/db_1/assistants/dbca/templates/General_Purpose.dbc
emExpressPort=5500
omsPort=0
characterSet=AL32UTF8
listeners=LISTENER
memoryPercentage=40
automaticMemoryManagement=false
totalMemory=0

-- 执行静默库
dbca -silent -createDatabase  -responseFile  /home/oracle/etc/dbca.rsp

-- 验证
sqlplus /nolog
conn / as sysdba
sqlplus / as sysdba

desc dba_users;
select username,password from dba_users

*****搭建中遇到的问题******
-- initorcl.ora文件不存在问题
cp /data/database/oracle/oracle/admin/orcl12c/pfile/init.ora.852019215416 /data/database/oracle/oracle/product/12/db_1/dbs/initorcl.ora
/data/database/oracle/oracle/product/12/db_1/dbs/initorcl.ora

cd /database/oracle/oracle/product/12/db_1/network/admin/

-- 开启远程监听问题
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 202.120.8.219)(PORT = 1539))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )

ORCL12C =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.16.205)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl12c.us.oracle.com)
    )
  )

LISTENER_ORCL12C =
  (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.16.205)(PORT = 1521))

-- 账户问题
alter user scott account unlock;
alter profile default limit password_life_time unlimited;
alter user scott identified by root;


-- 挂载数据库出错问题
/sbin/fuser -u lkTEST
/sbin/fuser -k lkTEST


CREATE BIGFILE TABLESPACE tbs_perm_hpay_dev_plus
DATAFILE 'tbs_perm_hpay_dev_plus.dat'
SIZE 200M
AUTOEXTEND ON NEXT 20M MAXSIZE 500M;

CREATE TEMPORARY TABLESPACE tbs_temp_hpay_dev_plus
TEMPFILE 'tbs_temp_hpay_dev_plus.dbf'
SIZE 200M
AUTOEXTEND ON NEXT 20M MAXSIZE 500M;

CREATE USER hpay_dev_plus
IDENTIFIED BY hpay_dev_plus
DEFAULT TABLESPACE tbs_perm_hpay_dev_plus
TEMPORARY TABLESPACE tbs_temp_hpay_dev_plus
QUOTA 200M on tbs_perm_hpay_dev_plus;

GRANT create session TO hpay_dev_plus;
GRANT create table TO hpay_dev_plus;
GRANT create view TO hpay_dev_plus;
GRANT create any trigger TO hpay_dev_plus;
GRANT create any procedure TO hpay_dev_plus;
GRANT create sequence TO hpay_dev_plus;
GRANT create synonym TO hpay_dev_plus;

你可能感兴趣的:(Oracle)