安装数据库
一:用户与权限配置
(1) 建立必要的组
groupadd oinstall
Groupadd dba
(2) 建立必要的用户
Useradd -g oinstall -G dba ora10g
(3) 修改ora10g 的密码
Passwd ora10g
(4) 建立ORACLE_BASE
Mkdir -p /usr/local/ora10g
(5) 建立ORACLE_HOME
mkdir -p /usr/local/ora10g/product/10.2.0/
(6) 建立存放数据文件的路径
cd /usr/local/ora10g/product
mkdir oradata
(7) 授予用户和组的权限 chown -R ora10g:oinstall /usr/local/ora10g
(8) 授予用户执行权限 chmod -R 755 /usr/local/ora10g
二:系统参数配置 用root 权限
1. 修改系统核心参数
vi /etc/sysctl.conf 向其中添加
kernel.sem = 250 32000 100 128
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
fs.file-max = 205162
net.core.rmem_default=262144
net.core.wmem_default=262144
net.core.rmem_max=262144
net.core.wmem_max=262144
net.ipv4.ip_local_port_range = 1024 65000
下面是我系统的实际数值
[root@localhost ~]# /sbin/sysctl -a | grep sem 250 32000 100 128
[root@localhost ~]# /sbin/sysctl -a | grep shm
vm.hugetlb_shm_group = 0
kernel.shmmni = 4096
kernel.shmall = 2097152
kernel.shmmax = 2147483648
[root@localhost ~]# /sbin/sysctl -a | grep file-max
fs.file-max = 205162
[root@localhost ~]# /sbin/sysctl -a | grep ip_local_port_range
net.ipv4.ip_local_port_range = 1024 65000
2. 在 /etc/security/limits.conf 里面添加了
vi /etc/security/limits.conf
Oracle soft nproc 2047
Oracle hard nproc 16384
Oracle soft nofile 1024
Oracle hard nofile 65536
由于我建立的用户是 ora10g 所以,像上面这样设是不行的,要把oracle 改成ora10g
ora10g soft nproc 2047
ora10g hard nproc 16384
ora10g soft nofile 1024
ora10g hard nofile 65535
3. 在 /etc/pam.d/login中添加
vi /etc/pam.d/login
session required /lib/security/pam_limits.so
4. 在ora10g的家目录(/home/ora10g) 修改.bash_profile
cd /home/ora10g
vi .bash_profile 添加
if [ $USER = "ora10g" ]; then
if [ $SHELL = "/bin/ksh" ]; then
ulimit -p 16384
ulimit -n 65535
else
ulimit -u 16384 -n 65535
fi
fi
umask 022
export ORACLE_BASE=/usr/local/ora10g
export ORACLE_SID=oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0
export PATH=$HOME/bin:$ORACLE_HOME/bin:$PATH
export NLS_LANG=american_america.ZHS16GBK
export LD_LIBRARY_PATH=$ORACLE_HOME/lib:$LD_LIBRARY_PATH
三:安装数据库软件 大约5分钟
用ora10g 用户进行安装
gunzip 10201_database_linux_x86_64.cpio.gz
cpio –idmv < 10201_database_linux_x86_64.cpio.gz
su -ora10g
进入存有数据库安装文件的目录 ./runInstaller &
在安装过程中会提示用 root 权限执行两个脚本
sh /home/orasoftware/oracle/oraInventory/orainstRoot.sh
sh /home/orasoftware/oracle/product/10.2.0/root.sh
四:安装数据库 大约5分钟
成功安装后运行 dbca 开始安装 数据库文件
安装过程中 第8步取消 “闪回恢复区”
第10步 character set
Database character setàZHS16GBK -GBK 16-bit Simplified Chinese
National character setàUTF 8 – Unicode 3.0 UTF-8 Universal character set
五:升级数据库 升级oracle 10.2.0.1.0 到 10.2.0.4.0
1.安装前的准备
升级前先备份数据库à冷备
然后关掉数据库
conn / as sysdba
shutdown immediate
关掉监听
lsnrctl stop
关掉dbconsole
emctl stop dbconsole
2. 安装 补丁包 p6810189_10204_Linux-x86-64 大约5分钟
以Oracle 用户登录系统 在解压后的Disk1 中找到 runInstaller
执行 ./runInstaller &
在安装过程中会提示用 root 权限执行1个脚本
3. 执行升级操作(有两种方法)
(1) dbua (图形界面,一直下一步就行.)
(2) startup upgrade 一条命令就搞定了. 大约30分钟
4. 升级后
启动数据库后执行
@?/rdbms/admin/catupgrd.sql; 重建数据字典
执行后,重启数据库.
重新启动后执行
@?/rdbms/admin/utlrp.sql; 检查编译情况
5. 检查安装结果
SELECT COMP_NAME, VERSION, STATUS FROM SYS.DBA_REGISTRY;
select owner,object_type,count(*)
from dba_objects where status='INVALID'
group by owner,object_type;
select * from utl_recomp_errors;
select name from v$database;
select * from v$version;