博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
手工建库(oracle11gr2)
阅读量:5016 次
发布时间:2019-06-12

本文共 7171 字,大约阅读时间需要 23 分钟。

一、静默安装oracle11G

1.配置本地yum并装oracle所需包
[root@linux01 /]# yum install -y libXp* xterm* unixODBC sysstat* make* libstdc++* libgomp* libgcc* libaio* kernel-headers* glibc gcc* elfutils binutils* caching-nameserver compat-libcap1* compat-libstdc++-33* openssh xdpyinfo vi unzip
2.添加主机名与IP对应记录

vi /etc/hosts

[root@linux01 ~]# cat /etc/hosts

127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.80.173 linux01
3.关闭Selinux
[root@linux01 sysconfig]# vi selinux

# 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=disable
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted

"selinux" 13L, 456C written

[root@linux01 sysconfig]# pwd
/etc/sysconfig
[root@linux01 sysconfig]#
4.将oracle11g安装包传到本地
5.系统配置
groupadd -g 1000 oinstall
groupadd -g 1200 asmadmin
groupadd -g 1201 dba
groupadd -g 1202 oper
useradd -u 1000 -g oinstall -G dba,oper -d /home/grid -s /bin/bash -c "Grid Infrastructure Owner" -m oracle
passwd oracle
创建相应安装目录
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oraInventory
mkdir -p /u01/app/oracle/oradata
mkdir -p /u01/app/oracle/recovery_data
chown -R oracle:oinstall /u01/app/
chmod -R 755 /u01/app/
修改系统内核参数
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152 //此行默认已有,确认不低于此数即可
kernel.shmmax = 536870912 //此行默认已有,确认不低于此数即可
kernel.shmmni = 4096
kernel.sem = 250 32000 100128
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
# sysctl -p #使配置生效
调整会话限制
vi /etc/pam.d/login 文件最后添加:
session required pam_limits.so
调整oracle用户的进程数与最大文件句柄数
vi /etc/security/limits.conf 文件的最后添加:
oracle soft nproc 10000
oracle hard nproc 16384
oracle soft nofile 52768
oracle hard nofile 6553
root soft nproc 2047
root hard nproc 16384
root soft nofile 1024
root hard nofile 65536
soft是最小值,hard是最大值,nofile是文件句柄,也就是这个用户能打开的文件数,nproc是进程数

6.增加环境变量

cat /home/oracle/.bash_profile
# .bash_profile

# Get the aliases and functions

if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH

export ORACLE_BASE=/u01/app/oracle

export ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
export ORACLE_SID=testdb
export ORACLE_TERM=xterm
export PATH=/usr/sbin:$PATH
export PATH=/u01/app/ogg:$ORACLE_HOME/bin:$PATH
export LD_LIBRARY_PATH=/u01/app/ogg:$ORACLE_HOME/lib:/lib:/usr/lib:$LD_LIBRARY_PATH
export CLASSPATH=$ORACLE_HOME/JRE:$ORACLE_HOME/jlib:$ORACLE_HOME/rdbms/jlib
export NLS_DATE_FORMAT="yyyy-mm-dd HH24:MI:SS"
export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
export LANG=C
export ORACLE_UNQNAME=testdb

source /home/oracle/.bash_profile

7.应答文件修改

路径/home/oracle/database/response
在db_install.rsp中添加

oracle.install.option=INSTALL_DB_SWONLY

ORACLE_HOSTNAME=linux01
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u01/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oinstall
oracle.install.db.config.starterdb.characterSet=AL32UTF8
oracle.install.db.config.starterdb.storageType=FILE_SYSTEM_STORAGE
oracle.install.db.config.starterdb.fileSystemStorage.dataLocation=/u01/app/oracle/oradata
oracle.install.db.config.starterdb.fileSystemStorage.recoveryLocation=/u01/app/oracle/recovery_data
oracle.install.db.config.starterdb.globalDBName=testdb
oracle.install.db.config.starterdb.SID=testdb
oracle.install.db.config.starterdb.memoryLimit=500
oracle.install.db.config.starterdb.password.ALL=oracle
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true

8.静默安装oracle11g软件

./runInstaller -silent -responseFile /home/oracle/database/response/db_install.rsp
#查看日志看进度 /u01/app/oraInventory/logs/installActions2018-05-29_07-17-34PM.log
安装成功
[oracle@linux01 database]$ The installation of Oracle Database 11g was successful.
Please check '/u01/app/oraInventory/logs/silentInstall2019-07-10_11-25-57PM.log' for more details.

As a root user, execute the following script(s):

1. /u01/app/oraInventory/orainstRoot.sh
2. /u01/app/oracle/product/11.2.0/db_1/root.sh

Successfully Setup Software.

root用户执行两个脚本即完成软件安装。

命令行创建监听

静默建库
*********************************************************************
vi /home/oracle/database/response/dbca.rsp, 覆盖以下选项:

注意:一定要按原来的参数所在的位置修改,不然报错

复制代码

RESPONSEFILE_VERSION = "11.2.0" //不能更改
OPERATION_TYPE = "createDatabase"
GDBNAME = "dg1" //全局数据库的名字=SID+主机域名
SID = "dg1" //对应的实例名字
TEMPLATENAME = "General_Purpose.dbc" //建库用的模板文件
SYSPASSWORD = "sys" //SYS管理员密码
SYSTEMPASSWORD = "sys" //SYSTEM管理员密码
DATAFILEDESTINATION = /u01/app/oracle/oradata //数据文件存放目录
RECOVERYAREADESTINATION=/u01/app/oracle/oradata_back //恢复数据存放目录
CHARACTERSET = " AL32UTF8" //字符集,重要!!! 建库后一般不能更改,所以建库前要确定清楚。
TOTALMEMORY = "4069" //oracle内存4069MB
复制代码
**********************************************************************
netca /silent /responsefile /home/oracle/database/response/netca.rsp

二、手动创建数据库。

1.指定sid
export ORACLE_SID=testdb
2.创建pfile
[root@linux01 dbs]# cat inittestdb.ora
db_name='testdb'
control_files='/u01/app/oracle/oradata/testdb/control01.ctl','/u01/app/oracle/oradata/testdb/control02.ctl'
memory_target=900m
3.打开空实例创建spfile
sqlplus / as sysdba

create spfile from pfile;

startup nomount 启动到nomount状态。

4.创建createdb.sql

vi /home/oracle/createdb.sql

CREATE DATABASE testdb

USER SYS IDENTIFIED BY oracle
USER SYSTEM IDENTIFIED BY oracle
LOGFILE GROUP 1 ('/u01/app/oracle/oradata/testdb/redo01a.log','/u01/app/oracle/oradata/testdb/redo01b.log') SIZE 100M BLOCKSIZE
512,
GROUP 2 ('/u01/app/oracle/oradata/testdb/redo02a.log','/u01/app/oracle/oradata/testdb/redo02b.log') SIZE 100M BLOCKSIZE 512,
GROUP 3 ('/u01/app/oracle/oradata/testdb/redo03a.log','/u01/app/oracle/oradata/testdb/redo03b.log') SIZE 100M BLOCKSIZE 512
MAXLOGFILES 5
MAXLOGMEMBERS 5
MAXLOGHISTORY 1
MAXDATAFILES 100
CHARACTER SET AL32UTF8
NATIONAL CHARACTER SET AL16UTF16
EXTENT MANAGEMENT LOCAL
DATAFILE '/u01/app/oracle/oradata/testdb/system01.dbf' SIZE 325M REUSE
SYSAUX DATAFILE '/u01/app/oracle/oradata/testdb/sysaux01.dbf' SIZE 325M REUSE
DEFAULT TABLESPACE users
DATAFILE '/u01/app/oracle/oradata/testdb/users01.dbf'
SIZE 500M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED
DEFAULT TEMPORARY TABLESPACE tempts1
TEMPFILE '/u01/app/oracle/oradata/testdb/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/u01/app/oracle/oradata/testdb/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED;

sqlplus / as sysdba

@createdb.sql

5.执行脚本

@?/rdbms/admin/catalog.sql

@?/rdbms/admin/catproc.sql
@?/rdbms/admin/utlrp.sql
@?/sqlplus/admin/pupbld.sql
6.手工创建数据库成功
SYS@testdb> select open_mode from v$database;

OPEN_MODE

--------------------
READ WRITE

1 row selected.

SYS@testdb>

 

转载于:https://www.cnblogs.com/Wardenking/p/11169845.html

你可能感兴趣的文章
ADO特有的流化和还原
查看>>
window精选软件
查看>>
Deepin/Ubuntu 环境下搭建Intel FPGA OpenCL 环境
查看>>
CF #324 DIV2 E题
查看>>
KLT 光流
查看>>
老罗锤子手机公布会,我感到深深地愧疚
查看>>
数字精确运算BigDecimal经常用法
查看>>
【solr专题之四】关于VelocityResponseWriter
查看>>
(TIP 2018)Technology details of FFDNet
查看>>
javascript js 等待多少秒
查看>>
http协议和telnet指令讲解
查看>>
暂不分类,统一记录
查看>>
iOS下子控件中的子控件的位置转换成在父控件的位置
查看>>
设计模式之工厂模式(Factory)
查看>>
Redis -- sort
查看>>
Android安全相关书籍汇总
查看>>
debian9下安装toturn
查看>>
Android安全开发之UXSS漏洞分析
查看>>
Android安全之Intent Scheme Url攻击
查看>>
.NET MVC下的日志文件生成法
查看>>