oracle12c安装、启动、卸载图文教程
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Oracle12c安装和配置1.1配置内核参数
添加如下行:
fs.file-max = 6815744
kernel.sem = 250 32000 100 128
kernel.shmmni = 4096
kernel.shmall = 1073741824
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命令更改当前内核参数
1.2限制oracle用户资源使用
vi /etc/security/limits.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
1.3安装依赖软件包
yum install binutils -y
yum install compat-libcap1 -y
yum install compat-libstdc++-33 -y
yum install compat-libstdc++-33.i686 -y yum install glibc -y
yum install glibc.i686 -y
yum install glibc-devel -y
yum install glibc-devel.i686 -y
yum install ksh -y
yum install libaio -y
yum install libaio.i686 -y
yum install libaio-devel -y
yum install libaio-devel.i686 -y
yum install libX11 -y
yum install libX11.i686 -y
yum install libXau -y
yum install libXau.i686 -y
yum install libXi -y
yum install libXi.i686 -y
yum install libXtst -y
yum install libXtst.i686 -y
yum install libgcc -y
yum install libgcc.i686 -y
yum install libstdc++ -y
yum install libstdc++.i686 -y
yum install libstdc++-devel -y
yum install libstdc++-devel.i686 -y yum install libxcb -y
yum install libxcb.i686 -y
yum install make -y
yum install nfs-utils -y
yum install net-tools -y
yum install smartmontools -y
yum install sysstat -y
yum install unixODBC -y
yum install unixODBC-devel -y
1.4创建新组和新用户
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
useradd -u 54321 -g oinstall -G dba,oper oracle
2附加设置
2.1为oracle用户设置密码
2.2修改设置SELINUX
vi /etc/selinux/config
## 将`SELINUX`修改为permissive
SELINUX=permissive
setenforce Permissive
2.3确保禁用防火墙
systemctl stop firewalld
systemctl disable firewalld
2.4创建Oracle安装目录
mkdir -p /usr/local/products/oracle12c
chown -R oracle:oinstall /usr/local
chmod -R 775 /usr/local/
2.5配置Oracle环境变量并验证
切换到新添加的oracle用户名下,在oracle用户下配置环境变量su oracle
vi .bash_profile
export TMP=/tmp
export TMPDIR=$TMP
export ORACLE_HOSTNAME=DEV-ORACLE-12C-164
export ORACLE_UNQNAME=orcl
export ORACLE_BASE=/usr/local/products
export ORACLE_HOME=$ORACLE_BASE/oracle12c
export ORACLE_SID=orcl
export PATH=/usr/sbin:/usr/local/bin:$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
使配置立即生效
source .bash_profile
echo $ORACLE_HOME
/usr/local/products/oracle12c
3 Oracle安装
3.1上传解压
将下载的linuxx64_12201_database.zip上传到Linux系统/home/oracle目录下解压
unzip linuxx64_12201_database.zip
如果没有unzip要先安装yum install zip unzip
3.2修改响应文件
压缩包解压完成后得到名为database的文件夹,其中包含安装文件。
cd database/response/
vi db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/usr/local/oraInventory
ORACLE_HOME=/usr/local/products/oracle12c
ORACLE_BASE=/usr/local/products
oracle.install.db.InstallEdition=EE
oracle.install.db.OSDBA_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
3.3静默安装Oracle
cd ~/database
./runInstaller -ignoreSysPrereqs -ignorePrereq -waitforcompletion \ -showProgress -silent -responseFile
/home/oracle/database/response/db_install.rsp
安装完毕后切换到root用户执行以下脚本
As a root user, execute the following script(s):
/usr/local/oraInventory/orainstRoot.sh
/usr/local/products/oracle12c/root.sh
执行命令sqlplus / as sysdba
此时数据库软件安装成功。
4 数据库创建
执行命令
dbca -silent -createDatabase \
-templateName
/usr/local/products/oracle12c/assistants/dbca/templates/General_Purpo se.dbc \
-gdbname orcl -sid orcl -responseFile
/home/oracle/database/response/dbca.rsp \
-characterSet AL32UTF8 \
-sysPassword Dev123#$ \
-systemPassword Dev123#$ \
-createAsContainerDatabase false \
-ignorePreReqs
-automaticMemoryManagement false \
再次执行命令sqlplus / as sysdba
5 数据库监听配置
未配置监听前执行lsnrctl status
使用默认的netca.rsp文件
执行命令
netca -silent -responseFile /home/oracle/database/response/netca.rsp
修改一下/usr/local/products/oracle12c/network/admin/listener.ora为下面的内容(10.87.60.52是机器的ip)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.87.60.52)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(SID_NAME = orcl)
)
)
重启监听
lsnrctl stop
lsnrctl start
(如果要远程登陆初创账号,要先修改一下账号密码,可以和之前一样的密码)
Oracle12c 卸载
1.关闭Oracle数据库
2.停止Listener进程
3.使用deinstall工具删除安装的Oracle软件的可执行文件和配置文件
4.删除/etc目录下的oraInst.loc、oratab,删除/opt目录下的ORCLfmap 5.删除/usr/local/bin下面Oracle的所有文件
6.删除/tmp目录下Oracle的相关文件
重启系统,Linux系统下的Oracle 12c已经完全卸载了。