1.配置hostname
興山ssl適用于網站、小程序/APP、API接口等需要進行數據傳輸應用場景,ssl證書未來市場廣闊!成為創(chuàng)新互聯的ssl證書銷售渠道,可以享受市場價格4-6折優(yōu)惠!如果有意向歡迎電話聯系或者加微信:13518219792(備注:SSL證書合作)期待與您的合作!
[root@oracledb ~]#hostnamectl set-hostname oracledb
[root@oracledb ~]#echo " 10.100.1.10 oracledb" /etc/hosts
2.關閉selinux和防火墻
[root@oracledb ~]#sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
[root@oracledb ~]#setenforce 0
[root@oracledb ~]#systemctl stop firewalld
[root@oracledb ~]#systemctl disable firewalld
[root@oracledb ~]#systemctl status firewalld
3.下載Oracle軟件包 且上傳到服務器上,進行解壓縮
建議使用winSCP工具進行上傳到服務器的/opt目錄下
[root@oracledb ~]# ls -lh /opt/
-rw-r--r-- 1 root root 1.2G Mar 30 16:12 linux.x64_11gR2_database_1of2.zip
-rw-r--r-- 1 root root 1.1G Mar 30 16:11 linux.x64_11gR2_database_2of2.zip
4.安裝oracle環(huán)境所需要的依賴包-配置YUM源
安裝依賴包之前,一定要設置好服務器上的安裝源,原因是:可以在沒有互聯網的時候安裝服務所需依賴包;常用的安裝源有兩種方式:
(1) 配置本地yum源
新建配置文件vi /etc/yum.repos.d/localsource.repo輸入如下內容:
[localsource]
name=localsource
baseurl=
enabled=1
gpgcheck=0
(2) 生成本地yum 緩存
注意:從Oracle 11g 11.2.0.2版本開始,在Linux x86_64上安裝時,只需要安裝64位的軟件包,但是,對于11.2.0.2之前的任何Oracle database 11g,下表中列出的32位和64位的安裝包都必須安裝
5.安裝oracle環(huán)境所需要的依賴包-安裝依賴包
(1)安裝依賴包
[root@oracledb ~]# yum -y install binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel zlib zlib-devel pcre-devel unzip
(2)安裝完成后,檢查依賴是否全部安裝成功
[root@oracledb ~]# rpm -q binutils compat-libcap1 compat-libstdc++-33 gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXi libXtst make sysstat unixODBC unixODBC-devel zlib zlib-devel pcre-devel unzip | grep "not installed"
(3)創(chuàng)建所需的用戶組和用戶
如果要安裝Oracle數據庫,通常需要以下本地操作系統(tǒng)用戶組和用戶:
Oracle inventory組(通常為 oinstall)
OSDBA組 (通常為 dba)
OSOPER組 (通常為 oper)
Oracle軟件所有者(通常為 oracle)
創(chuàng)建用戶組和用戶:
[root@oracledb ~]# groupadd oinstall
[root@oracledb ~]# groupadd dba
[root@oracledb ~]# groupadd oper
[root@oracledb ~]# useradd -g oinstall -G dba oracle
(4)修改oracle用戶密碼:建議密碼配置為字符+數字+特殊字符
[root@oracledb ~]# passwd oracle
6.配置內核參數和資源限制
(1)編輯配置文件vi /etc/sysctl.conf添加如下參數:
vm.max_map_count = 655360
fs.aio-max-nr = 1048576
fs.file-max = 6815744
kernel.shmall = 2097152
kernel.shmmax = 2147483648 ###最小值: 536870912
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
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
注意:如果系統(tǒng)中某個參數高于上面的參數的值 ,保留較大的值,上面的數值只是官方要求的最小值,可以根據系統(tǒng)調整數值,以優(yōu)化系統(tǒng)性能
(2)使內核參數生效
[root@oracledb ~]# sysctl -p
7.創(chuàng)建oracle安裝目錄
如下目錄,根據自己的實際情況可做修改:
[root@oracledb ~]# mkdir -p /data/app/oracle/product/11.2.0
[root@oracledb ~]# cd /data/app/oracle/
[root@oracledb oracle]# mkdir oradata inventory fast_recovery_area
[root@oracledb ~]# chown -R oracle:oinstall /data/app/oracle
[root@oracledb ~]# chmod -R 775 /data/app/oracle
8.配置oracle用戶環(huán)境變量
編輯配置文件vi /home/oracle/.bash_profile添加如下內容:
export ORACLE_BASE=/data/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/11.2.0
export ORACLE_SID=orcl
export PATH=$PATH:$ORACLE_HOME/bin
9. 解壓下載好的兩個Oracle數據庫文件
[root@oracledb ~]# cd /opt
[root@oracledb ~]# unzip linux.x64_11gR2_database_1of2.zip -d /data
[root@oracledb ~]# unzip linux.x64_11gR2_database_2of2.zip -d /data
10. 編輯靜默安裝響應文件
(1)切換到oracle用戶執(zhí)行
[root@oracledb ~]# su - oracle
(2)切換到響應文件的目錄下
[oracle@oracledb ~]$ cp -R /data/database/response/ .
[oracle@oracledb ~]$ cd response/
[oracle@oracledb response]$ ls
dbca.rsp db_install.rsp netca.rsp
11.修改配置文件:vi /home/oracle/response/db_install.rsp,修改以下變量的值
oracle.install.option=INSTALL_DB_SWONLY
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/data/app/oracle/inventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME=/data/app/oracle/product/11.2.0
ORACLE_BASE=/data/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=dba
DECLINE_SECURITY_UPDATES=true
12. 開始靜默安裝Oracle 11g
(1)開始安裝oracle數據庫
[oracle@oracledb ~]$ cd /data/database
[oracle@oracledb ~]$ ./runInstaller -silent -responseFile /home/oracle/response/db_install.rsp -ignorePrereq
注意:安裝期間可以使用tail命令查看oracle的安裝日志,且日志文件名稱是根
據自己的實際執(zhí)行時間確定的,安裝日志文件會在安裝時提示,需要等待3分鐘左右,注意不要停止運行;安裝完成后有如下提示,如果有類似如下提示,說明安裝完成。
The following configuration scripts need to be executed as the "root" user.
#!/bin/sh
#Root scripts to run
/data/app/oraInventory/orainstRoot.sh
/data/app/oracle/product/11.2.0/db_1/root.sh
To execute the configuration scripts:
1. Open a terminal window
2. Log in as "root"
3. Run the scripts
4. Return to this window and hit "Enter" key to continue
Successfully Setup Software.
13.使用 root用戶執(zhí)行腳本
(1)切換到root用戶執(zhí)行
[root@oracledb ~]# su - root
(2)執(zhí)行兩個用戶腳本
[root@oracledb ~]# sh /data/app/oracle/inventory/orainstRoot.sh
[root@oracledb ~]# sh /data/app/oracle/product/11.2.0/root.sh
14.配置監(jiān)聽程序
(1)切換到oracle用戶執(zhí)行(建議退出重進oracle用戶)
[root@oracledb ~]# su - oracle
(2)配置監(jiān)聽,查看輸出結果
[oracle@oracledb ~]$ netca /silent /responsefile /home/oracle/response/netca.rsp
(3)查看監(jiān)聽服務狀態(tài),若沒啟動需要啟動
[oracle@oracledb ~]$ lsnrctl status
[oracle@oracledb ~]$ lsnrctl start
查看結果:
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /data/etc/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/data/app/oracle/product/11.2.0/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
(4)查看監(jiān)聽端口
[oracle@oracledb ~]$ netstat -tnpl | grep 1521
15.靜默創(chuàng)建數據庫
GDBNAME = "orcl"
SID = "orcl"
SYSPASSWORD = "oracle"
SYSTEMPASSWORD = "oracle"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
DATAFILEDESTINATION =/data/app/oracle/oradata
RECOVERYAREADESTINATION=/data/app/oracle/fast_recovery_area
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = " 6552 "
##其中TOTALMEMORY = " 6552 " 為6552 MB,物理內存8G*80%
(2)切換到oracle用戶執(zhí)行
[root@oracledb ~]# su - oracle
(3)執(zhí)行靜默建庫
[oracle@oracledb ~]$ dbca -silent -responseFile /home/oracle/response/dbca.rsp
執(zhí)行過程如下:
Copying database files
1% complete
3% complete
11% complete
18% complete
26% complete
37% complete
Creating and starting Oracle instance
40% complete
45% complete
50% complete
55% complete
56% complete
60% complete
62% complete
Completing Database Creation
66% complete
70% complete
73% complete
85% complete
96% complete
100% complete
Look at the log file "/data/app/oracle/cfgtoollogs/dbca/orcl/orcl.log" for further details.
(4)查看進程
[oracle@oracledb ~]$ ps -ef | grep ora_ | grep -v grep
(5)再次查看監(jiān)聽狀態(tài)進行確認
[oracle@oracledb ~]$ lsnrctl status
結果顯示:
The command completed successfully
16.至此數據庫就安裝成功了,下面我們登錄下數據庫
(1)切換到oracle用戶執(zhí)行
[root@oracledb ~]# su - oracle
(2)登錄數據庫
[oracle@oracledb ~]$ sqlplus / as sysdba
(3)查詢實例狀態(tài)
SQLselect status from v$instance;
(4)查看數據庫版本
SQL select * from v$version;
(5)激活scott用戶
SQLalter user scott account unlock;
SQLalter user scott identified by tiger;
SQLselect username,account_status from dba_users;
17.設置Oracle開機啟動
(1)修改配置文件vi /data/app/oracle/product/11.2.0/bin/dbstart 修改如下內容:
將腳本中的ORACLE_HOME_LISTNER=$1,修改為ORACLE_HOME_LISTNER=$ORACLE_HOME
(2)修改配置文件vi /data/app/oracle/product/11.2.0/bin/dbshut 修改如下內容:
將腳本中的ORACLE_HOME_LISTNER=$1,修改為ORACLE_HOME_LISTNER=$ORACLE_HOME
(3)修改配置文件 vi /etc/oratab修改如下內容,
orcl:/data/app/oracle/product/11.2.0:Y
(4)新建文件:vi /etc/rc.d/init.d/oracle 注意:建議全部復制腳本內容
#! /bin/bash
# oracle: Start/Stop Oracle Database 11g R2
# chkconfig: 345 90 10
# description: The Oracle Database is an Object-Relational Database Management System.
# processname: oracle
. /etc/rc.d/init.d/functions
LOCKFILE=/var/lock/subsys/oracle
ORACLE_HOME=/data/app/oracle/product/11.2.0
ORACLE_USER=oracle
case "$1" in
start)
if [ -f $LOCKFILE ]; then
echo $0 already running.
exit 1
fi
echo -n #34;Starting Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbstart $ORACLE_HOME"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl start dbconsole"
touch $LOCKFILE
;;
stop)
if [ ! -f $LOCKFILE ]; then
echo $0 already stopping.
exit 1
fi
echo -n #34;Stopping Oracle Database:"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/dbshut"
su - $ORACLE_USER -c "$ORACLE_HOME/bin/emctl stop dbconsole"
rm -f $LOCKFILE
;;
restart)
$0 stop
$0 start
;;
status)
if [ -f $LOCKFILE ]; then
echo $0 started.
else
echo $0 stopped.
fi
;;
*)
echo "Usage: $0 [start|stop|status]"
exit 1
esac
exit 0
(5)給 /etc/init.d/oracle添加執(zhí)行權限
[root@oracledb ~]# chmod +x /etc/init.d/oracle
(6)開機啟動oracle
[root@oracledb ~]# chkconfig oracle on
(7)給啟動文件加權限
[root@oracledb ~]# cd /data/app/oracle/product/11.2.0/bin/
[root@oracledb bin]# chmod 6751 oracle
[root@oracledb bin]# cd /var/tmp
[root@oracledb tmp]# chown -R oracle:oinstall .oracle
(8)重啟測試
[root@oracledb ~]# reboot
(9)切換到oracle用戶登錄狀態(tài)下
[root@oracledb ~]# su - oracle
[oracle@oracledb ~]$ sqlplus / as sysdba
(10)解除鎖定
SQL alter user SYSTEM account unlock;
(11)這時候就可以用Navicat連接了
SQL conn;
用戶名:SYSTEM
密碼:oracle
如果不能正確連接,改下密碼試試
alter user system identified by 新密碼
[root@oracledb ~]# mkdir -p /data/szzt
[root@oracledb ~]# cd /data/
[root@oracledb data]# chown oracle:oinstall -R szzt
[root@oracledb data]# ll
total 0
drwxr-xr-x 3 root root 20 Apr 8 21:14 app
drwxr-xr-x 8 root root 128 Aug 21 2009 database
drwxr-xr-x 2 oracle oinstall 6 Apr 14 16:17 szzt
[root@oracledb ~]# su - oracle
[oracle@oracledb ~]$ sqlplus / as sysdba
SQL conn cshi
Enter password: 登錄失敗
Connected.
SQL create temporary tablespace DB_DATA_TMP tempfile'/data/szzt/DB_DATA_TMP.dbf' size 500m autoextend on next 100m maxsize 10240m extent management local;
顯示結果:
Tablespace created.
SQL create tablespace DB_DATA logging datafile'/data/szzt/DB_DATA.dbf' size 2048m autoextend on next 100m maxsize 10240m extent management local;
顯示結果:
Tablespace created.
SQL create user ceshi identified by ceshi default tablespace DB_DATA temporary tablespace DB_DATA_TMP;
顯示結果:
User created.
SQL grant dba to ceshi;
顯示結果:
Grant succeeded.
SQL conn ceshi ###用戶名和密碼一樣,此時登錄成功
[oracle@oracledb ~]$ cd /data/app/oracle/product/11.2.0/bin/
注意:數據庫導出操作是在 源服務器 上進行
[oracle@oracledb bin]$ exp 用戶名/密碼@ IP地址 /orcl file =/data/szzt/ceshi.dmp owner='用戶名'
Export terminated successfully without warnings.
注意:數據庫導入操作是在 目標服務器 上進行
[oracle@oracledb bin]$ imp ceshi/ceshi@ 10.100.1.10 /orcl file=/data/szzt/ceshi.dmp fromuser=ceshi touser=ceshi
顯示結果:可以看到導入的表過程(10.100.1.10是自己的目標數據庫服務器)
Import terminated successfully without warnings .
(1)、數據導入完畢后,我們可以使用DBeaver對數據庫進行遠程管理
(2)、測試連接,沒問題后完成新建
(3)、連接上來后,我們就可以使用工具來進行管理數據庫
一、使用腳本初始化環(huán)境
腳本如下:(標紅處修改對應的配置需求)
#!/bin/bash
#1.配置主機名/etc/hosts 并關閉防火墻及selinux
echo ' 172.168.0.xx linux.tk ' /etc/hosts
#注意修改為服務器的ip和主機名
systemctl stop firewalld
systemctl disable firewalld
setenforce 0
#sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
#2.安裝相關軟件包
yum -y install telnet vim lszrz gcc make binutils gcc-c++ compat-libstdc++-33 elfutils-libelf-devel
elfutils-libelf-devel-static ksh libaio libaio-devel numactl-devel sysstat
unixODBC unixODBC-devel pcre-devel wget unzip
#3.配置內核參數
echo "fs.aio-max-nr = 1048576" /etc/sysctl.conf
echo "fs.file-max = 6815744" /etc/sysctl.conf
echo "kernel.shmmni = 4096" /etc/sysctl.conf
echo "kernel.sem = 250 32000 100 128" /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 9000 65500" /etc/sysctl.conf
echo "net.core.rmem_default = 262144" /etc/sysctl.conf
echo "net.core.rmem_max = 4194304" /etc/sysctl.conf
echo "net.core.wmem_default = 262144" /etc/sysctl.conf
echo "net.core.wmem_max = 1048576" /etc/sysctl.conf
sysctl -p
#4.oracle用戶資源限制
echo "oracle soft nproc 2047" /etc/security/limits.conf
echo "oracle hard nproc 16384" /etc/security/limits.conf
echo "oracle soft nofile 4096" /etc/security/limits.conf
echo "oracle hard nofile 65536" /etc/security/limits.conf
#5.登錄配置
echo "session required /lib64/security/pam_limits.so" /etc/pam.d/login
echo "session required pam_limits.so" /etc/pam.d/login
#改授權
echo "if [ $USER = 'oracle' ];then" /etc/profile
echo "if [ $SHELL = '/bin/ksh' ];then" /etc/profile
echo "ulimit -p 16384" /etc/profile
echo "ulimit -n 65536" /etc/profile
echo "else" /etc/profile
echo "ulimit -u 16384 -n 65536" /etc/profile
echo "fi" /etc/profile
echo "fi" /etc/profile
source /etc/profile
#6.創(chuàng)建用戶組和用戶
groupadd oinstall
groupadd dba
groupadd oper
useradd -g oinstall -G dba,oper oracle
echo 'oracle' | passwd --stdin oracle
#7.創(chuàng)建相關目錄
mkdir -p /u01/app/oracle
mkdir -p /u01/app/oraInventory
chown -R oracle:oinstall /u01/app
#8.配置oracle用戶環(huán)境變量
echo "ORACLE_SID=ora; export ORACLE_SID" /home/oracle/.bash_profile
#sid指定為現場的sid
echo "ORACLE_BASE= /u01/app/oracle ; export ORACLE_BASE" /home/oracle/.bash_profile
echo "ORACLE_HOME=$ORACLE_BASE/ product/11.2.0/dbhome_1 ; export ORACLE_HOME" /home/oracle/.bash_profile
echo "ORACLE_PATH=/u01/app/common/oracle/sql; export ORACLE_PATH" /home/oracle/.bash_profile
echo "ORACLE_TERM=xterm; export ORACLE_TERM" /home/oracle/.bash_profile
echo "TNS_ADMIN=$ORACLE_HOME/network/admin; export TNS_ADMIN" /home/oracle/.bash_profile
echo "ORA_NLS11=$ORACLE_HOME/nls/data; export ORA_NLS11" /home/oracle/.bash_profile
echo "PATH=.:${JAVA_HOME}/bin:${PATH}:$ORACLE_HOME/bin " /home/oracle/.bash_profile
echo "PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin " /home/oracle/.bash_profile
echo "export PATH " /home/oracle/.bash_profile
echo "export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK" /home/oracle/.bash_profile
echo "LD_LIBRARY_PATH=$ORACLE_HOME/lib" /home/oracle/.bash_profile
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib " /home/oracle/.bash_profile
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib " /home/oracle/.bash_profile
echo "export LD_LIBRARY_PATH" /home/oracle/.bash_profile
echo "export LANG=en_US.UTF-8 " /home/oracle/.bash_profile
echo "export NLS_LANG=AMERICAN_AMERICA.ZHS16GBK" /home/oracle/.bash_profile
echo "CLASSPATH=$ORACLE_HOME/JRE " /home/oracle/.bash_profile
echo "CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib" /home/oracle/.bash_profile
echo "CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib" /home/oracle/.bash_profile
echo "CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib" /home/oracle/.bash_profile
echo "export CLASSPATH" /home/oracle/.bash_profile
echo "THREADS_FLAG=native; export THREADS_FLAG" /home/oracle/.bash_profile
echo "nls_date_format='yyyy-mm-dd hh24:mi:ss' " /home/oracle/.bash_profile
echo "export nls_date_format " /home/oracle/.bash_profile
echo "export TEMP=/tmp " /home/oracle/.bash_profile
echo "export TMPDIR=/tmp " /home/oracle/.bash_profile
echo "umask 022 " /home/oracle/.bash_profile
source ~/.bash_profile
二、上傳或者下載oracle安裝包并解壓,例如放置在/opt/目錄下
unzip p13390677_112040_Linux-x86-64_1of7.zip
unzip p13390677_112040_Linux-x86-64_2of7.zip
直接在目錄解壓,會在當前目錄中生成database目錄
三、修改應答文件安裝數據庫軟件
修改前建議先備份下
cp /opt/database/response/*.rsp /opt/database/rspbak
3.1、生成修改響應文件(/opt/database/response/db_install.rsp)
備注:清空源文件,復制粘貼如下內容(標紅處需要修改對應的設置需求):
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v11_2_0
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME= linux.tk
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION= /u01/app/oraInventory
SELECTED_LANGUAGES=en,zh_CN
ORACLE_HOME= /u01/app/oracle/product/11.2.0/dbhome_1
ORACLE_BASE= /u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.EEOptionsSelection=false
oracle.install.db.optionalComponents=oracle.rdbms.partitioning:11.2.0.4.0,oracle.oraolap:11.2.0.4.0,oracle.rdbms.dm:10.2.0.4.0,oracle.rdbms.lbac:11.2.0.4.0,oracle.rdbms.rat:11.2.0.4.0
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
DECLINE_SECURITY_UPDATES=true
oracle.installer.autoupdates.option=SKIP_UPDATES
3.2、開始安裝
1)、用oracle用戶登錄操作
# su - oracle
$ cd /opt/database
$ ./runInstaller -silent -responseFile /opt/database/response/db_install.rsp
2)、在安裝過程中可以新開會話,使用tailf 命令查看進度
# tailf /u01/app/oraInventory/logs/installActions2022-XX-XX_03-28-06PM.log
提示安裝結束,需要在root用戶執(zhí)行兩個腳本,如下:
# /u01/app/oraInventory/orainstRoot.sh
# /u01/app/oracle/product/11.2.0/dbhome_1/root.sh
四、修改應答文件安裝數據庫實例(/opt/database/response/dbca.rsp)
安裝實例前,需要新建一個實例存放的目錄(/home/OracleData/),如下:
# mkdir /home/OracleData
# chown -R oracle:oinstall /home/OracleData/
4.1、修改應答文件
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "ora"
SID = "ora"
TEMPLATENAME = "General_Purpose.dbc"
SYSPASSWORD = "***012"
SYSTEMPASSWORD = "***012"
DATAFILEDESTINATION = /home/OracleData/
RECOVERYAREADESTINATION = /u01/app/oracle/flash_recovery_area
CHARACTERSET = "ZHS16GBK"
TOTALMEMORY = "2048"
4.2、建實例,登錄oracle用戶
# su - oracle
$ dbca -silent -responseFile /opt/database/response/dbca.rsp
此安裝過程是有進度顯示,不用tailf查看,不過也可以查看對應的log日志查看進度
4.3、刪除實例
編輯應答文件
#vim /opt/database/response/del_dbca.rsp
[GENERAL]
RESPONSEFILE_VERSION = "11.2.0"
OPERATION_TYPE = "deleteDatabase"
[DELETEDATABASE]
SOURCEDB = "ora "
$ dbca -silent -responseFile del_dbca.rsp
五、啟動監(jiān)聽,配置自啟動等
5.1、啟動監(jiān)聽
# su – oracle
$ lsnrctl start
查看狀態(tài) lsnrctl status
# netstat -tnulp | grep 1521
# ps -ef | grep ora_ | grep -v grep
5.2、設置自啟動
修改vim /etc/oratab 如下
ora:/u01/app/oracle/product/11.2.0/dbhome_1: Y
5.3、修改dbstart文件
vim /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
將ORACLE_HOME_LISTNER=$1
修改為ORACLE_HOME_LISTNER=$ORACLE_HOME
5.4、將dbstart加入開機自啟動,/etc/rc.d/rc.local中增加
su - oracle -lc /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
賦權限 chmod +x /etc/rc.d/rc.local
5.3、登錄數據庫設置權限等
sqlplus / as sysdba
startup;
alter system register;
create user ora identified by ***012;
grant dba to ora;
exit
六、遠程連接數據庫
6.1、開放1521端口
firewall-cmd --zone=public --add-port=1521/tcp --permanent
firewall-cmd –reload
firewall-cmd --list-ports
切入到oracle用戶下
進入/u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca
目錄,vim編輯靜默安裝文件dbca.rsp
主要配置[GENERAL][CREATEDATABASE]這2個模塊下的配置即可
執(zhí)行如下命令安裝
dbca -silent -responseFile /u01/app/oracle/product/11.2.0/dbhome_1/assistants/dbca/dbca.rsp
安裝完成,lsnrctl status檢查監(jiān)聽吧。
首先,否定樓上說法。靜默安裝甚至于用腳本結合響應文件實現靜默自動安裝都是可以實現的,你可以參照下面這篇文章作為入門。