步骤:
1、上传oracle安装包
linux.x64_11gR2_database_1of2.zip
linux.x64_11gR2_database_2of2.zip
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
rpm -q binutils | grep "not installed"
rpm -q compat-libstdc++-33 | grep "not installed"
rpm -q elfutils-libelf | grep "not installed"
rpm -q elfutils-libelf-devel | grep "not installed"
rpm -q expat | grep "not installed"
rpm -q gcc | grep "not installed"
rpm -q gcc -c++ | grep "not installed"
rpm -q binutils | grep "not installed"
rpm -q glibc | grep "not installed"
rpm -q glibc-common | grep "not installed"
rpm -q glibc-devel | grep "not installed"
rpm -q glibc-headers | grep "not installed"
rpm -q libaio | grep "not installed"
rpm -q libaio-devel | grep "not installed"
rpm -q libgcc | grep "not installed"
rpm -q libstdc++ | grep "not installed"
rpm -q libstdc++-devel | grep "not installed"
rpm -q make | grep "not installed"
rpm -q pdksh | grep "not installed"
rpm -q sysstat | grep "not installed"
rpm -q binutils | grep "not installed"
rpm -q unixODBC | grep "not installed"
rpm -q unixODBC-devel | grep "not installed"
|
若出现哪些依赖库没有安装,使用”yum install [依赖库]“进行安装
一般缺少依赖包:?
? ? compat-libstdc++-33
? ? elfutils-libelf-devel
? ? libaio-devel
? ? pdksh
? ? unixODBC
? ? unixODBC-devel
? ? pdksh可能安装不了,需另外单独下载,传到服务器上,加上执行权限,进行安装
?
?
?
? ?下载pdksh,地址:http://vdisk.weibo.com/s/uqs9yi2YuoqLL?from=page_100505_profile&wvr=6
?
?
3、创建用户和用户组
1
2
3
4
5
6
|
groupadd oinstall groupadd dba groupadd asmadmin groupadd asmdba useradd -g oinstall -G dba,asmdba oracle -d /home/oracle
passwd oracle
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
vi /etc/sysctl .conf
?
# 在底部追加以下内容 net.ipv4.icmp_echo_ignore_broadcasts = 1 net.ipv4.conf.all.rp_filter = 1 fs. file -max = 6815744
fs.aio-max-nr = 1048576 kernel.shmall = 2097152 kernel.shmmax = 2147483648 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 # 使配置立即生效 sysctl -p |
1
2
3
4
5
6
|
vi /etc/security/limits .conf
# 在底部追加以下内容 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft nofile 1024 oracle hard nofile 65536 |
1
2
3
|
mkdir -p /u01/app/oracle/
chown -R oracle:oinstall /home/oracle
chown -R oracle:oinstall /u01
|
1
2
3
4
5
6
7
8
9
10
11
12
|
vi .bash_profile
export PATHTH=$PATH:HOME /bin
export ORACLE_BASE= /u01
export ORACLE_HOME=$ORACLE_BASE /oracle
export ORACLE_SID=LED
export PATH=$PATH:$ORACLE_HOME /bin :$ORACLE_HOME /Apache/Apache/bin
# export TNS_ADMIN=$ORACLE_HOME/network/admin # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:ORACLE_HOME/lib export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
# export ORA_NLS10=$ORACLE_HOME/nls/data unset USERNAME
umask 022
|
1
2
3
4
5
6
7
8
9
10
|
su - root
mv linux.x64_11gR2_database_1of2.zip /home/oracle/linux .x64_11gR2_database_1of2.zip
mv linux.x64_11gR2_database_2of2.zip /home/oracle/linux .x64_11gR2_database_2of2.zip
cd /home/oracle
chmod 777 *.zip
su - oracle
unzip linux.x64_11gR2_database_1of2.zip -d /u01
unzip linux.x64_11gR2_database_2of2.zip -d /u01
cd /u01/database
export DISTRIB=` pwd `
|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
cd /u01/database/response
vi db_install.rsp
?
# 需要更改的参数,其他尽量不要更改,若非要更改请了解参数含义 UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION= /u01/app/oracle/oraInventory
SELECTED_LANGUAGES=en,zh_CN,zh_TW ORACLE_HOME= /u01/app/oracle/product/11 .2.0 /dbhome_1
ORACLE_BASE= /u01/app/oracle
oracle. install .db.InstallEdition=EE
oracle. install .db.isCustomInstall= true
oracle. install .db.DBA_GROUP=dba
oracle. install .db.OPER_GROUP=oinstall
|
1
2
3
4
5
6
7
8
9
10
11
|
su - root
# 查看swap大小 free -m
# 增加交换分区文件及大小,如果要增加2G大小的交换分区,则命令写法如下,其中的 count 等于想要的块大小。 dd if = /dev/zero of= /home/swap bs=1024 count=2048000
# 设置交换文件 mkswap /home/swap
# 立即启用交换分区文件 swapon /home/swap
# 如果要在引导时自动启用,则编辑 /etc/fstab 文件,添加行 /home/swap swap swap defaults 0 0
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
su - oracle
cd /u01/database
. /runInstaller -silent -force -responseFile /u01/database/response/db_install .rsp
?
# 安装成功会出现 [oracle@iZ94dzd0zvxZ database]$ The following configuration scripts need to be executed as the "root" user.
#!/bin/sh #Root scripts to run /u01/oraInventory/orainstRoot .sh
/u01/oracle/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. |
这一步操作最容易出错,在执行安装脚本时就会报错,经反复测试,只要保证以下规律就能出现”Successfully Setup Software“,
在执行此步操作时,最好再次执行下以下命令:
1
2
|
cd /u01/database
export DISTRIB=` pwd `
|
oracle静默安装时会需找此变量,另外附加个安装成功的db_install.rsp的响应文件,点击下载
1
2
3
4
|
cd /u01/oraInventory/
. /orainstRoot .sh
cd /u01/oracle/
. /root .sh
|
1
2
3
4
5
6
7
8
|
# 切换到oracle用户 su - oracle
# 执行监听的响应文件安装 $ORACLE_HOME /bin/netca /silent /responsefile /u01/database/response/netca .rsp
# 查看是否已经生成listener.ora和sqlnet.ora监听文件 ll $ORACLE_HOME /network/admin/ *.ora
# 检查监听启动状态 lsnrctl status |
1
2
3
4
5
6
7
8
9
|
vi /u01/database/response/dbca .rsp
?
#以下参数必须设置 [CREATEDATABASE] GDBNAME = "ORCL.LK"
TEMPLATENAME = "General_Purpose.dbc"
#以下参数不设置则使用默认值,建议设置 CHARACTERSET = "utf8"
TOTALMEMORY = "1024"
|
执行静默安装
1
2
3
|
$ORACLE_HOME /bin/dbca -silent -responseFile /u01/database/response/dbca .rsp
Enter SYS user password: Enter SYSTEM user password: |
由于没有更改dbca.rsp文件中的SYS和SYSTEM的密码,所以oracle缺省密码分别为chang_on_install和manager
1
2
|
ps -ef | grep ora_ | grep - v grep | wc -l
ps -ef | grep ora_ | grep - v grep
|
监听、进程正常,启动成功。关于创建用户、表空间和分配权限,请点击。
创建Oracle表空间,临时表空间,用户名
?
?
?
?
FAQ:
FAQ1:[FATAL] [INS-13013] Target environment do not meet some mandatory requirements
解决安装是:安装命令中加入选项-ignorePrereq
?
FAQ2: LRM-00109: could not open parameter file ‘/home/oracle/oracle10g/dbs/initoms
今天连接Oracle数据库的时候,发现数据没启动,利用startup命令,出现错误提示如下:
SQL> startup
ORA-01078: failure in processing system ? parameters
LRM-00109: could not open parameter file ? ‘/oracle/10g/dbs/init10g.ora‘
?
按提示查找相关目录的文件,果然不存在。
到网上查了一下资料。得到如果有用信息:是因为在oracle10g中,oracle默认将使用spfile启动数据库,如果spfile不存在,则就会出现上述错误。
解决方法:
将$ORACLE_BASE/admin/你的数据库名称/pfile/init.ora.628201264542(这串数字未必一样)
copy到$ORACLE_HOME/dbs目录下,并改名为你的数据库实例名即可。
例如:上面提示找不到init10g.ora这个文件,就改成 init10g.ora
参考命令:
export $ORACLE_HOME --输出使用中的环境变量Home
cat /home/oracle/.bash_profile --或.bashrc文件,务必确定$ORACLE_HOME的值与当前使用的一致
(我就遇到过不一致的)
mv $ORACLE_BASE/admin/orcl/pfile/init.ora.628201264542 /oracle/10g/dbs/init10g.ora ?
--复制文件到指定目录
sqlplus "/as sysdba"
startup
?搞定!
?
FAQ3:?SQL> shutdown immediate;
? ? ? ? ? ?ORA-01507: database not mounted
原文:http://jatter.iteye.com/blog/2296041