- 一、检查硬件要求
CPU部分:
grep "model name" /proc/cpuinfo
cat /proc/cpuinfo | grep "processor" | wc -l
cat /proc/cpuinfo | grep "physical id" | sort | uniq | wc -l
内存部分:
grep MemTotal /proc/meminfo(确定服务器上的物理RAM大小)
grep SwapTotal /proc/meminfo(确定配置的交换空间的大小)
free -g(确定系统上的可用RAM和磁盘交换空间量)
磁盘性能:
df -h /tmp(确定/tmp目录中可用的空间量)
如果/tmp目录中的可用空间小于所需的可用空间,请完成以下步骤之一:
• 从/tmp目录中删除不必要的文件以满足磁盘空间要求。
• 设置Oracle用户的环境时,还要将TMP和TMPDIR环境变量设置为要使用的目录而不是/tmp。
df -h /dev/shm(验证共享内存(/dev/shm)是否已正确安装且大小足够)
检查软件要求
uname -m(确定系统体系结构是否可以运行该软件)
验证处理器体系结构是否与要安装的Oracle软件版本匹配。例如,对于x86-64位系统,您应该看到以下内容:
x86_64
uname -r(显示操作系统的发行版号)
uname -a(显示系统名、节点名称、操作系统的发行版号、内核版本等等)
lsb_release(显示当前系统版本信息)
参数[option]
-v,–version
显示系统兼容的LSB规范版本号,如果不带任何参数,默认-v
-d, --description
显示当前系统的版本
-r, --release
显示系统版本号
-c, --codename
显示系统研发代号
-a, --all
上述所有的信息都会显示
-s, --short
以精简格式来显示信息,默认输出精简LSB规范版本号信息
-h, --help
显示帮助信息
- 二、关闭selinux和防火墙
vim /etc/selinux/config
SELINUX=disabled
systemctl stop firewalld
systemctl disable firewalld
- 三、依赖安装
系统所需依赖包:
binutils-2.17.50.0.6
compat-libstdc+±33-3.2.3
compat-libstdc+±33-3.2.3 (32 bit)
gcc-4.1.2
gcc-c+±4.1.2
glibc-2.5-58
glibc-2.5-58 (32 bit)
glibc-devel-2.5-58
glibc-devel-2.5-58 (32 bit)
ksh
libaio-0.3.106
libaio-0.3.106 (32 bit)
libaio-devel-0.3.106
libaio-devel-0.3.106 (32 bit)
libgcc-4.1.2
libgcc-4.1.2 (32 bit)
libstdc+±4.1.2
libstdc+±4.1.2 (32 bit)
libstdc+±devel 4.1.2
libXext-1.0.1
libXext-1.0.1 (32 bit)
libXtst-1.0.1
libXtst-1.0.1 (32 bit)
libX11-1.0.3
libX11-1.0.3 (32 bit)
libXau-1.0.1
libXau-1.0.1 (32 bit)
libXi-1.0.1
libXi-1.0.1 (32 bit)
make-3.81
sysstat-7.0.2
查询依赖包安装情况:
rpm -q binutils compat-libstdc++ gcc gcc-c++ glibc glibc-devel ksh libaio libaio-devel libgcc libstdc++ libstdc++-devel libXext libXtst libX11 libXau libXi make sysstat
依赖包安装
1.yum安装依赖:
yum install -y binutils compat-libcap1 compat-libstdc++-33 compat-libstdc++-33.i686 glibc glibc.i686 glibc-devel glibc-devel.i686 ksh libaio libaio.i686 libaio-devel libaio-devel.i686 libX11 libX11.i686 libXau libXau.i686 libXi libXi.i686 libXtst libXtst.i686 libgcc libgcc.i686 libstdc++ libstdc++.i686 libstdc++-devel libstdc++-devel.i686 libxcb libxcb.i686 make nfs-utils net-tools smartmontools sysstat unixODBC unixODBC-devel gcc gcc-c++ libXext libXext.i686 zlib-devel zlib-devel.i686
2.rpm安装(以compat-libstdc+±33为例)
[root@getoraclelnx01 Server]# rpm -ivh compat-libstdc++-33-3.2.3-61.i386.rpm
warning: compat-libstdc++-33-3.2.3-61.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package compat-libstdc++-33-3.2.3-61.i386 is already installed
[root@getoraclelnx01 Server]# rpm -ivh compat-libstdc++-33-3.2.3-61.x86_64.rpm
warning: compat-libstdc++-33-3.2.3-61.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
package compat-libstdc++-33-3.2.3-61.x86_64 is already installed
[root@getoraclelnx01 Server]# ls *libaio-devel*
libaio-devel-0.3.106-5.i386.rpm libaio-devel-0.3.106-5.x86_64.rpm
[root@getoraclelnx01 Server]# rpm -ivh libaio-devel-0.3.106-5.i386.rpm
warning: libaio-devel-0.3.106-5.i386.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:libaio-devel ########################################### [100%]
[root@getoraclelnx01 Server]# rpm -ivh libaio-devel-0.3.106-5.x86_64.rpm
warning: libaio-devel-0.3.106-5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159
Preparing... ########################################### [100%]
1:libaio-devel ########################################### [100%]
- 四、配置相关环境
cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
192.168.1.20 centos7
配置/etc/sysctl.conf(内核参数)
[root@centos7 ~]# vim /etc/sysctl.conf
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
各参数详解:
fs.aio-max-nr:
此参数限制并发未完成的请求,应该设置避免I/O子系统故障。
fs.file-max:
该参数决定了系统中所允许的文件句柄最大数目,文件句柄设置代表linux系统中可以打开的文件的数量。
kernel.shmall:
该参数控制可以使用的共享内存的总页数。Linux共享内存页大小为4KB,共享内存段的大小都是共享内存页大小的整数倍。一个共享内存段的最大大小是16G,那么需要共享内存页数是16GB/4KB=16777216KB /4KB=4194304(页),也就是64Bit系统下16GB物理内存,设置kernel.shmall = 4194304才符合要求.
kernel.shmmax:
是核心参数中最重要的参数之一,用于定义单个共享内存段的最大值。设置应该足够大,设置的过低可能会导致需要创建多个共享内存段,这样可能导致系统性能的下降。至于导致系统下降的主要原因为在实例启动以及ServerProcess创建的时候,多个小的共享内存段可能会导致当时轻微的系统性能的降低(在启动的时候需要去创建多个虚拟地址段,在进程创建的时候要让进程对多个段进行“识别”,会有一些影响),但是其他时候都不会有影响。
官方建议值:
32位linux系统:可取最大值为4GB(4294967296bytes)-1byte,即4294967295。建议值为多于内存的一半,所以如果是32为系统,一般可取值为4294967295。
64位linux系统:可取的最大值为物理内存值-1byte,建议值为多于物理内存的一半,例如,如果为12GB物理内存,可取1210241024*1024-1=12884901887。
kernel.shmmni:
该参数是共享内存段的最大数量。shmmni缺省值4096,一般肯定是够用了。
kernel.sem:
以kernel.sem = 250 32000 100 128为例:
250是参数semmsl的值,表示一个信号量集合中能够包含的信号量最大数目。
32000是参数semmns的值,表示系统内可允许的信号量最大数目。
100是参数semopm的值,表示单个semopm()调用在一个信号量集合上可以执行的操作数量。
128是参数semmni的值,表示系统信号量集合总数。
net.ipv4.ip_local_port_range:
表示应用程序可使用的IPv4端口范围。
net.core.rmem_default:
表示套接字接收缓冲区大小的缺省值。
net.core.rmem_max:
表示套接字接收缓冲区大小的最大值。
net.core.wmem_default:
表示套接字发送缓冲区大小的缺省值。
net.core.wmem_max:
表示套接字发送缓冲区大小的最大值。
·使配置生效
/sbin/sysctl -p
- 五、配置/etc/security/limits.d/20-nproc.conf(修改内核限制参数)
vim /etc/security/limits.d/20-nproc.conf
Default limit for number of user's processes to prevent
accidental fork bombs.
See rhbz #432903 for reasoning.
* soft nproc 4096
root soft nproc unlimited
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
- 六、创建用户和组
unzip linuxx64_12201_database.zip ^C
groupadd -g 54321 oinstall
groupadd -g 54322 dba
groupadd -g 54323 oper
useradd -u 54321 -g oinstall -G dba,oper oracle
passwd oracle
- 七、创建安装目录
mkdir /u01
mkdir /u01/app
mkdir -p /u01/app/oracle/oradata //存放数据库的数据目录
mkdir -p /u01/app/oracle/oradata_back //存放数据库备份文件
chmod -R 775 /u01/app //权限
chown -R oracle:oinstall /u01 //属主属组
- 八、配置环境变量
vim /etc/profile (文件最后加入)
#.bash_profile
#Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
#User specific environment and startup programs
PATH=$PATH:$HOME/.local/bin:$HOME/bin
export PATH
#Oracle Settings
export TMP=/tmp #日志存放位置
export TMPDIR=$TMP
export ORACLE_HOSTNAME=Oracle #主机名
export ORACLE_UNQNAME=cdb1 #库名称
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/12.2.0.1/db_1
export ORACLE_SID=cdb1 #库名称
export PATH=/usr/sbin:$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
export PATH=/usr/sbin:$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
- 九、安装
解压安装包:
unzip linuxx64_12201_database.zip /u01
编辑应答文件:
vim /u01/database/response/db_install.rsp
oracle.install.responseFileVersion=/oracle/install/rspfmt_dbinstall_response_schema_v12.2.0
oracle.install.option=INSTALL_DB_SWONLY
//30行安装类型,只装数据库软件
UNIX_GROUP_NAME=oinstall //35行主机名称(hostname查询)
INVENTORY_LOCATION=/u01/app/oracle/oraInventory
//42行INVENTORY目录(不填就是默认值)
ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1
//46行oracle目录
ORACLE_BASE=/u01/app/oracle //51行
oracle.install.db.InstallEdition=EE //63行oracle版本
oracle.install.db.OSDBA_GROUP=dba //80行
oracle.install.db.OSOPER_GROUP=oper //86行 自定义安装,否,使用默认组件
oracle.install.db.OSBACKUPDBA_GROUP=dba //91行
oracle.install.db.OSDGDBA_GROUP=dba //96行
oracle.install.db.OSKMDBA_GROUP=dba //101行
oracle.install.db.OSRACDBA_GROUP=dba //106行
oracle.install.db.config.starterdb.type=GENERAL_PURPOSE
//180行数据库类型
oracle.install.db.config.starterdb.globalDBName=cdb1 //185行
oracle.install.db.config.starterdb.SID=cdb1 //190行
oracle.install.db.config.starterdb.characterSet=AL32UTF8 //216行
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false //384行
DECLINE_SECURITY_UPDATES=true //398行,设置安全更新(貌似是有bug,这个一定要选true,否则会无限提醒邮件地址有问题,终止安装。PS:不管地址对不对)
开始安装:用oracle用户执行
[oracle@centos7 database]$ ./runInstaller -force -silent -noconfig -responseFile /u01/database/response/db_install.rsp
- Starting Oracle Universal Installer...
- Checking Temp space: must be greater than 500 MB. Actual 11715 MB Passed
- Checking swap space: must be greater than 150 MB. Actual 2047 MB Passed
- Preparing to launch Oracle Universal Installer from /tmp/OraInstall2017-04-15_08-36-48PM. P[oracle@centos7 database]$ [WARNING] [INS-32055] The Central Inventory is located in the Oracle base.
- ACTION: Oracle recommends placing this Central Inventory in a location outside the Oracle base directory.
- You can find the log of this install session at:
- /u01/app/oracle/oraInventory/logs/installActions2017-04-15_08-36-48PM.log
- The installation of Oracle Database 12c was successful.
- Please check '/u01/app/oracle/oraInventory/logs/silentInstall2017-04-15_08-36-48PM.log' for more details.
-
- As a root user, execute the following script(s):
- 1. /u01/app/oracle/oraInventory/orainstRoot.sh
- 2. /u01/app/oracle/product/12.2.0.1/db_1/root.sh
-
-
-
- Successfully Setup Software.
查看日志,可与安装同时看日志
tail –f /u01/app/oracle/oraInventory/logs/installActions2017-04-15_08-36-48PM.log
执行两个脚本: root用户执行
[root@Oracle ~]# /u01/app/oracle/oraInventory/orainstRoot.sh
Changing permissions of /u01/app/oracle/oraInventory.
Adding read,write permissions for group.
Removing read,write,execute permissions for world.
Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete.
[root@Oracle ~]# /u01/app/oracle/product/12.2.0.1/db_1/root.sh
Check /u01/app/oracle/product/12.2.0.1/db_1/install/root_Oracle_2017-04-15_20-56-27-813321685.log for the output of root script
- 十、配置,添加监听
cat netca.rsp | grep -Ev "^#|^$"
- [GENERAL]
- RESPONSEFILE_VERSION="12.2"
- CREATE_TYPE="CUSTOM"
- [oracle.net.ca]
- INSTALLED_COMPONENTS={"server","net8","javavm"}
- INSTALL_TYPE=""typical""
- LISTENER_NUMBER=1
- LISTENER_NAMES={"LISTENER"}
- LISTENER_PROTOCOLS={"TCP;1521"}
- LISTENER_START=""LISTENER""
- NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
- NSN_NUMBER=1
- NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
- NSN_SERVICE={"PLSExtProc"}
- NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}
[oracle@centos7 response]$ netca -silent -responsefile /u01/database/response/netca.rsp
Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /u01/database/response/netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Profile configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/12.2.0.1/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Listener configuration complete.
Oracle Net Services configuration successful. The exit code is 0
lsnrctl status
LSNRCTL for Linux: Version 12.2.0.1.0 - Production on 15-APR-2017 21:05:32
Copyright (c) 1991, 2016, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=centos7)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.2.0.1.0 - Production
Start Date 15-APR-2017 21:05:24
Uptime 0 days 0 hr. 0 min. 8 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.2.0.1/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/centos7/listener/alert/log.xml
Listening Endpoints Summary... (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=centos7)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully
通过netstat -tlnp 命令查看监听地址
提醒:切换至oracle用户
tcp 0 0 :::1521 :::* LISTEN 5477/tnslsnr
- 十一、静默建立新库
配置文件编辑
Vim /u01/database/response/dbca.rsp
responseFileVersion=/oracle/assistants/rspfmt_dbca_response_schema_v12.2.0
gdbName=cdb1
sid=cdb1
databaseConfigType=SI
RACOneNodeServiceName=
policyManaged=FALSE
createServerPool=FALSE
serverPoolName=
cardinality=
force=FALSE
pqPoolName=
pqCardinality=
createAsContainerDatabase=true
numberOfPDBs=1
pdbName=cdb1pdb
useLocalUndoForPDBs=TRUE
pdbAdminPassword=
nodelist=
templateName=/u01/app/oracle/product/12.2.0.1/db_1/assistants/dbca/templates/General_Purpose.dbc
sysPassword=
systemPassword=
oracleHomeUserPassword=
emConfiguration=
emExpressPort=5500
runCVUChecks=FALSE
dbsnmpPassword=
omsHost=
omsPort=0
emUser=
emPassword=
dvConfiguration=False
dvUserName=
dvUserPassword=
dvAccountManagerName=
dvAccountManagerPassword=
olsConfiguration=false
datafileJarLocation={ORACLE_HOME}/assistants/dbca/templates/
datafileDestination={ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/
recoveryAreaDestination={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}
storageType=FS
diskGroupName=
asmsnmpPassword=
recoveryGroupName=
characterSet=AL32UTF8
nationalCharacterSet=AL16UTF16
registerWithDirService=false
dirServiceUserName=
dirServicePassword=
walletPassword=
listeners=LISTENER
variablesFile=
variables=DB_UNIQUE_NAME=cdb1,ORACLE_BASE=/u01/app/oracle,PDB_NAME=,DB_NAME=cdb1,ORACLE_HOME=/u01/app/oracle/product/12.2.0.1/db_1,SID=cdb1
initParams=undo_tablespace=UNDOTBS1,memory_target=0MB,sga_target=4096MB,pga_aggregate_target=1024MB,processes=300,db_recovery_file_dest_size=8780MB,nls_language=AMERICAN,dispatchers=(PROTOCOL=TCP) (SERVICE=cdb1XDB),db_recovery_file_dest={ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME},db_block_size=8192BYTES,diagnostic_dest={ORACLE_BASE},audit_file_dest={ORACLE_BASE}/admin/{DB_UNIQUE_NAME}/adump,nls_territory=AMERICA,local_listener=LISTENER_CDB1,compatible=12.2.0,control_files=("{ORACLE_BASE}/oradata/{DB_UNIQUE_NAME}/control01.ctl", "{ORACLE_BASE}/fast_recovery_area/{DB_UNIQUE_NAME}/control02.ctl"),db_name=cdb1,audit_trail=db,remote_login_passwordfile=EXCLUSIVE,open_cursors=300
sampleSchema=FALSE
memoryPercentage=70
databaseType=MULTIPURPOSE
automaticMemoryManagement=FALSE
totalMemory=0
静默建库命令如下
(dbca是oracle命令,如果提示命令找不到,检查环境变量)
cd /u01/database
dbca -silent -createDatabase -responseFile /u01/database/response/dbca.rsp
[WARNING] [DBT-06801] Specified Fast Recovery Area size (2,780 MB) is less than the recommended value.
CAUSE: Fast Recovery Area size should at least be three times the database size (2,730 MB).
ACTION: Specify Fast Recovery Area Size to be at least three times the database size.
[WARNING] [DBT-11209] Current available physical memory is less than the required physical memory (796MB) for creating the database.
Enter SYS user password: #超级管理员密码
Enter SYSTEM user password: #管理员密码
Enter PDBADMIN User Password: #库密码
[WARNING] [DBT-06208] The 'SYS' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'SYSTEM' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06208] The 'PDBADMIN' password entered does not conform to the Oracle recommended standards.
CAUSE:
a. Oracle recommends that the password entered should be at least 8 characters in length, contain at least 1 uppercase character, 1 lower case character and 1 digit [0-9].
b.The password entered is a keyword that Oracle does not recommend to be used as password
ACTION: Specify a strong password. If required refer Oracle documentation for guidelines.
[WARNING] [DBT-06801] Specified Fast Recovery Area size (2,780 MB) is less than the recommended value.
CAUSE: Fast Recovery Area size should at least be three times the database size (3,571 MB).
ACTION: Specify Fast Recovery Area Size to be at least three times the database size.
Copying database files
1% complete
13% complete
25% complete
Creating and starting Oracle instance
26% complete
30% complete
31% complete
35% complete
38% complete
39% complete
41% complete
Completing Database Creation
42% complete
43% complete
44% complete
46% complete
49% complete
50% complete
Creating Pluggable Databases
55% complete
75% complete
Executing Post Configuration Actions
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb1/cdb1.log" for further details.
- 十二、检查oracle进程状态
ps -ef | grep ora_ | grep -v grep
lsnrctl status (lsnrctl是oracle命令)
- 十三、登录数据库 ,oracle用户启动
1.登录服务器,切换到oracle用户,或者以oracle用户登录
[admin@dataserver ~]$ su - oracle
密码:
[oracle@dataserver ~]$
2.打开监听服务
[oracle@localhost ~]$ lsnrctl start
可以通过lsnrctl status命令查看Oracle监听器运行状况
[oracle@localhost ~]$ lsnrctl status
3.以SYS用户身份登录Oracle
[oracle@localhost ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.1.0 Production on Fri Dec 1 23:29:19 2017
Copyright (c) 1982, 2009, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected to an idle instance.
切换用户:
CONN 用户名/密码 [AS SYSDBA],如果是sys用户一定要写上AS SYSDBA
Oracle库操作
sqlplus / as sysdba // 登录数据库
alter user sys identified by oracle; //改sys超级管理员密码
alter user system identified by oracle; //改system管理员密码
exit // 退出数据库
sqlplus sys/oracle as sysdba //使用sys超级管理员登录数据库
startup // 启动数据库
Select name from v$database; //查看数据库
Shutdown abort //关闭数据库
Conn system/oracle //切换用户conn后面直接跟用户名和密码就可以
- 十四、修改oracle启动配置文件(设置开机自启)
1.用oracle用户编辑dbstart文件
切换到$ORACLE_HOME/bin目录下,修改文件dbstart。
vi /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart
修改:看下面注释部分进行修改。
ORACLE_HOME_LISTNER=$ORACLE_HOME --这里原本是$1,这里改成$ORACLE_HOME即可。
2.用root用户编辑文件oratab和rc.local
vi /etc/rc.d/rc.local
在空白处添加下面两句话。
su oracle -lc "/u01/app/oracle/product/11.2.0/dbhome_1/bin/lsnrctl start"
su oracle -lc /u01/app/oracle/product/11.2.0/dbhome_1/bin/dbstart