CentOS 7 安裝 Oracle12C
1. 優化、安裝必要的工具
yum -y install unzip vim lrzsz
sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
sed -i 's/#UseDNS yes/UseDNS no/' /etc/ssh/sshd_config
service sshd restart
2. 安裝依賴
yum -y install binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33*.i686 elfutils-libelf-devel gcc gcc-c++ glibc*.i686 glibc glibc-devel glibc-devel*.i686 ksh libgcc*.i686 libgcc libstdc++ libstdc++*.i686 libstdc++-devel libstdc++-devel*.i686 libaio libaio*.i686 libaio-devel libaio-devel*.i686 make sysstat unixODBC unixODBC*.i686 unixODBC-devel unixODBC-devel*.i686 libXp
3. 建立使用者和組
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
passwd oracle
4. 建立安裝、備份目錄
mkdir -p /u01/app/oracle/product/12.2.0
chown -R oracle:oinstall /u01
5. 更改共享記憶體
echo "shmfs /dev/shm tmpfs size=12g 0" >> /etc/fstab
6. 修改核心引數
vim /etc/sysctl.conf
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 4294967296
kernel.shmmax = 4398046511104
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
7. 改檔案限制
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
8. vim /etc/pam.d/login
session required pam_limits.so
9. 修改ulimit
if [ $USER = "oracle" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65536a
else
ulimit -u 16384 -n 65536
fi
fi
10. 修改環境變數、hosts檔案
vim ~/.bashrc
PATH=$PATH:$HOME/.local/bin:$HOME/bin:$ORACLE_HOME/bin
ORACLE_BASE=/app/oracle
ORACLE_HOME=$ORACLE_BASE/product/12.2.0
ORACLE_SID=orcl
export ORACLE_BASE ORACLE_HOME ORACLE_SID
export NLS_LANG="AMERICAN_AMERICA.UTF8"
export PATH
11. 靜默安裝資料庫軟體
./runInstaller -silent -ignoreSysPrereqs -ignorePrereq -responseFile /backup/oracle_setup/db_install.rsp
+ db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=dba
INVENTORY_LOCATION=/u01/app/oracle/oraInventory
ORACLE_HOME=/u01/app/oracle/product/12.2.0
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
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.CLUSTER_NODES=
oracle.install.db.isRACOneInstall=false
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
12. 建立資料庫
$ORACLE_HOME/bin/dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname orcl -sid orcl -responseFile NO_VALUE -characterSet AL32UTF8 -memoryPercentage 50 -emConfiguration LOCAL
- root 使用者下執行以下命令
/oracle/oraInventory/orainstRoot.sh /oracle/product/12.2.0/root.sh
13. 修改引數
sqlplus / as sysdba
sql> alter system set sga_target=0 scope=spfile;
sql> alter system set pga_aggregate_target=0 scope=spfile;
sql> alter system set db_files=2000 scope=spfile;
sql> alter system set memory_max_target=12g scope=spfile;
sql> alter system set memory_target=8g scope=spfile;
sql> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1='LOCATION=/backup/arch' scope=spfile;
sql> alter SYSTEM SET db_recovery_file_dest_size=4096M scope=spfile;
sql> alter system set undo_retention=3600 scope=spfile;
sql> alter system set processes=6000 scope=spfile;
sql> alter system set sessions=8000 scope=spfile;
sql> alter system set open_cursors=2000 scope=both;
sql> create pfile='/tmp/pfile.ora' from spfile;
sql> alter system set filesystemio_options='asynch' scope=spfile;
sql> ALTER SYSTEM SET disk_asynch_io=true SCOPE=SPFILE;
sql> create directory expdp_dir as '/backup/expdp';
sql> grant write,read on directory expdp_dir to public;
sql> alter database add logfile group 4 '/oracle/oradata/logs/redo04.log' size 1G;
sql> alter database add logfile group 5 '/oracle/oradata/logs/redo05.log' size 1G;
sql> alter database add logfile group 6 '/oracle/oradata/logs/redo06.log' size 1G;
sql> alter system switch logfile;
sql> alter system switch logfile;
sql> alter system switch logfile;
sql> alter system checkpoint;
sql> alter database drop logfile group 1;
sql> alter database drop logfile group 2;
sql> alter database drop logfile group 3;
sql> host rm -rf /oradata/orcl/redo0[1-3].log
sql> alter database add logfile group 1 '/oracle/oradata//logs/redo01.log' size 1G;
sql> alter database add logfile group 2 '/oracle/oradata//logs/redo02.log' size 1G;
sql> alter database add logfile group 3 '/oracle/oradata//logs/redo03.log' size 1G;
sql> alter system switch logfile;
sql> alter system switch logfile;
sql> alter system switch logfile;
sql> alter system checkpoint;
sql> shutdown immediate
sql> startup mount
sql> alter database archivelog;
sql> alter database open;
sql> alter profile default limit FAILED_LOGIN_ATTEMPTS unlimited;
sql> create pfile='/tmp/pfile20180514.ora' from spfile;
相關文章
- CentOS7 安裝Oracle12c資料庫CentOSOracle資料庫
- Centos7-VMware+Centos7安裝配置CentOS
- 【CentOS】CentOS7安裝PostgreSQLCentOSSQL
- Centos 7 Docker 安裝CentOSDocker
- CentOS 7 安裝redisCentOSRedis
- CentOS 7安裝ElasticsearchCentOSElasticsearch
- Centos 7安裝iscsiCentOS
- centos 7 安裝 rabbitMqCentOSMQ
- CentOS7安裝rabbitmqCentOSMQ
- CentOS 7安裝RedisCentOSRedis
- CentOS 7 安裝 lnmpCentOSLNMP
- Centos 7安裝FTPCentOSFTP
- Centos 7 安裝JDKCentOSJDK
- Centos 7 安裝NginxCentOSNginx
- CentOS 7 - 安裝NginxCentOSNginx
- CentOS 7安裝MySQLCentOSMySql
- CentOS7安裝php、安裝MySqlCentOSPHPMySql
- Centos7安裝安裝部署dockerCentOSDocker
- centos7安裝nginxCentOSNginx
- Centos7 安裝 NginxCentOSNginx
- centos7 安裝 rcloneCentOS
- centos7安裝mysqlCentOSMySql
- centos7 安裝rocketmqCentOSMQ
- Centos 7 yum 安裝nginxCentOSNginx
- centos7安裝supervisorCentOS
- centos7安裝composerCentOS
- CentOS7安裝RedisCentOSRedis
- CentOS 7 yum 安裝 NGINXCentOSNginx
- CentOS7 安裝 dockerCentOSDocker
- CentOS 7 yum 安裝 MySQLCentOSMySql
- CentOS 7安裝 hping教程CentOS
- centos7安裝dockerCentOSDocker
- Centos7安裝RabbitMQCentOSMQ
- CentOS7 安裝 memcacheCentOS
- CentOS7 安裝 libreofficeCentOS
- CentOS 7 中安裝 SwooleCentOS
- CentOS 7 安裝PHP 5.4.16CentOSPHP
- centos7安裝HadoopCentOSHadoop