2,验证安装
如果完成了以上步骤,您应该具备 Oracle 10g 所需的所有程序包和更新。您可以执行以下步骤验证您的安装。
所需内核版本:2.4.21-138(或更高版本)
通过运行以下命令检查内核版本:
uname -r
例如:
oracle:~ # uname -r
2.6.16.21-0.8-default
其他所需程序包的版本(或更高版本):
gcc-3.2.2-38
make-3.79
binutils-2.12
openmotif-2.2.2-124
要查看系统上安装了这些程序包的哪些版本,以 root 用户身份运行以下命令:
rpm -q gcc make binutils openmotif
例如:
oracle:~ # rpm -q gcc make binutils openmotif
gcc-4.1.0-28.4
make-3.80-202.2
binutils-2.16.91.0.5-23.4
package openmotif is not installed
安装openmotif
yast--Software--Software Management
然后搜索openmotif安装。
oracle:~ # rpm -q gcc make binutils openmotif
gcc-4.1.0-28.4
make-3.80-202.2
binutils-2.16.91.0.5-23.4
openmotif-2.2.4-21.2
第二部分:针对 Oracle 配置 Linux
1,验证系统要求
要验证系统是否满足 Oracle 10g 数据库的最低要求,以 root 用户身份登录并运行以下命令。
要查看可用 RAM 和交换空间大小,运行以下命令:
grep MemTotal /proc/meminfo
grep SwapTotal /proc/meminfo
例如:
oracle:~ # grep MemTotal /proc/meminfo
MemTotal: 516464 kB
oracle:~ # grep SwapTotal /proc/meminfo
SwapTotal: 2104504 kB
所需最小 RAM 为 512MB,而所需最小交换空间为 1GB。对于 RAM 小于或等于 2GB 的系统,交换空间应为 RAM 数量的两倍;对于 RAM 大于 2GB 的系统,交换空间应为 RAM 数量的一到两倍。
Oracle 10g 软件还需要 2.5GB 的可用磁盘空间,而数据库则另需 1.2GB 的可用磁盘空间。/tmp 目录至少需要 400MB 的可用空间。要检查系统上的可用磁盘空间,运行以下命令:
df -h
例如:
oracle:~ # df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/system-home
10G 1.9G 8.2G 19% /
udev 253M 104K 253M 1% /dev
/dev/sda1 102M 40M 63M 39% /boot
2,创建 Oracle 组和用户帐户
接下来,创建用于安装和维护 Oracle 10g 软件的 Linux 组和用户帐户。用户帐户将称为 oracle,而组将称为 oinstall 和 dba。以 root 用户身份执行以下命令:
/usr/sbin/groupadd oinstall
/usr/sbin/groupadd dba
/usr/sbin/useradd -m -g oinstall -G dba oracle
id oracle
例如:
oracle:~ # groupadd oinstall
oracle:~ # groupadd dba
oracle:~ # useradd -m -g oinstall -G dba oracle
oracle:~ # id oracle
uid=1000(oracle) gid=1000(oinstall) groups=1000(oinstall),1001(dba)
oracle:~ # su - oracle
oracle@oracle:~> pwd
/home/oracle
3,创建目录
例如:
mkdir -p /u01/app/oracle
mkdir -p /u02/oradata
chown -R oracle:oinstall /u01/app/oracle /u02/oradata
chmod -R 775 /u01/app/oracle /u02/oradata
4,配置 Linux 内核参数
cat >> /etc/sysctl.conf <
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
EOF
/sbin/sysctl -p
例如:
oracle:~ # cat >> /etc/sysctl.conf <
> kernel.shmmax = 2147483648
> kernel.shmmni = 4096
> kernel.sem = 250 32000 100 128
> fs.file-max = 65536
> net.ipv4.ip_local_port_range = 1024 65000
> EOF
/sbin/sysctl -poracle:~ # /sbin/sysctl -p
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.rp_filter = 1
kernel.shmall = 2097152
kernel.shmmax = 2147483648
kernel.shmmni = 4096
kernel.sem = 250 32000 100 128
fs.file-max = 65536
net.ipv4.ip_local_port_range = 1024 65000
oracle:~ #
对于 SLES 8 ,在完成以上步骤后运行以下命令。
/sbin/chkconfig boot.sysctl on
SLES 10 用chkconfig --list没有找到boot.sysctl服务
5,为 oracle 用户设置 Shell 限制
Oracle 建议对每个 Linux 帐户可以使用的进程数和打开的文件数设置限制。要进行这些更改,以 root 用户的身份执行下列命令:
cat >> /etc/security/limits.conf <
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF
cat >> /etc/pam.d/login <
EOF
例如:
oracle:~ # cat >> /etc/security/limits.conf <
> oracle hard nproc 16384
> oracle soft nofile 1024
> oracle hard nofile 65536
> EOF
oracle:~ # cat >> /etc/pam.d/login <
> EOF
例如:
oracle:~ # tail -n 10 /etc/security/limits.conf
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
#@student - maxlogins 4
# End of file
oracle soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
oracle:~ # tail -n 10 /etc/pam.d/login
auth required pam_securetty.so
auth include common-auth
auth required pam_nologin.so
account include common-account
password include common-password
session include common-session
session required pam_lastlog.so nowtmp
session required pam_resmgr.so
session optional pam_mail.so standard
session required /lib/security/pam_limits.so
6,oracle 用户的环境变量
要使用 Oracle 产品,应该或必须设置几个环境变量。对于数据库服务器,建议设置以下环境变量:
ORACLE_BASE
ORACLE_HOME
ORACLE_SID
PATH
例如:
修改.bashrc文件
export ORACLE_BASE==/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0
export PATH=$PATH:$HOME/bin:${ORACLE_HOME}/bin:.
export ORACLE_SID=orcl
export LANG=en_US.UTF-8
第三部分:安装 Oracle
因为上面修改系统核心,所以安装以前先重启服务器。
1,下载解压:
oracle@oracle:~> ls
10201_database_linux32.zip bin Documents public_html
oracle@oracle:~> unzip 10201_database_linux32.zip
Archive: 10201_database_linux32.zip
......
2,安装
oracle@oracle:~> ls
10201_database_linux32.zip bin database Documents public_html
oracle@oracle:~> cd database/
oracle@oracle:~/database> ls
doc install response runInstaller stage welcome.html
oracle@oracle:~/database> ./runInstaller
Starting Oracle Universal Installer...
Checking installer requirements...
Checking operating system version: must be redhat-3, SuSE-9, redhat-4, UnitedLinux-1.0, asianux-1 or asianux-2
Failed <<<<
Exiting Oracle Universal Installer, log for this session can be found at /tmp/OraInstall2007-07-07_04-11-30PM/installActions2007-07-07_04-11-30PM.log
oracle@oracle:~/database>
一致性检查没有过。
解决办法:
1,修改安装源目录的install/oraparam.ini,加入SuSE-10
2,启动的时候加参数
./runInstaller -ignoreSysPreReqs
可以让runInstaller忽略系统检查
当时的操作修改安装源目录的install/oraparam.ini,加入SuSE-10,继续安装。
1, 选择安装方式
选择Advanced Installation,单击 Next。
2, 指定清单目录和证书
如果您一直在依循本指南中的步骤,则使用默认值即可。否则,编辑清单目录的路径,以指向正确目录。
操作系统组名称应为 oinstall。
3, 选择安装类型
接受默认值 Enterprise Edition。
4, 指定文件位置
如果您一直在依循本指南中的步骤,则使用默认值即可。否则,在继续操作前确保源路径和目标路径正确。
5, 与特定产品相关的先决条件的检查
如果您一直在依循本指南中的步骤,则所有检查都应顺利通过。如果一个或多个检查失败,则在继续操作前纠正该问题。
因为操作系统的版本区别,检查结果为: 2 warnings,4 requirements to be verified.
6, 单击 Next,弹出
Some recommended prerequisite checks have failed You might get errors during installation.Do you want to proceed?
单击 Yes
7, 选择配置选项
接受create a database
8, 选择数据库配置
接受默认值 General Purpose。
9, 指定数据库配置选项
输入数据库的全局数据库名称。该名称应包含 ORACLE_SID 和服务器域名(例如,demo1.orademo.org,其中 demo1 是 ORACLE_SID,orademo.org 是域名)。
输入全局数据库名称时,SID 框将自动填充。
本例都为orcl
选择数据库字符集为:Simplified Chinese ZHS16CGB231280
选择 Create database with sample schemas。
10,选择数据库管理选项
选择 Use Database Control for Database Management。
11,指定数据库文件存储选项
选择 File System,然后输入数据库文件要使用的路径名(在本例中为 /u01/app/oracle/oradata)。
12,指定备份和恢复选项
选择 Enable Automated Backups
recovery Area Storage 选择 file system
Recovery Area Location 选择 /u01/app/oracle/flash_recovery_area/
backup job credentials中用户名输入:system 输入对应于用户名的密码.
13,指定数据库模式口令
选择 Use the same password for all the accounts。
选择一个口令,然后输入两次进行确认。
14,显示已安装产品的摘要。
单击 Install。
15,安装
此屏幕历经安装和链接 Oracle 软件的几个阶段。
安装过程结束时弹出一个窗口显示配置信息。记下 Enterprise Manager URL,然后单击 OK 关闭该窗口。
弹出一个“Setup Privileges”窗口,提示需要以 root 用户身份运行配置脚本。以 root 用户身份登录,切换到该窗口中指示的目录,然后执行 root.sh 脚本。该脚本提示输入本地 bin 目录的位置。按 Enter 键接受默认值。当脚本完成时,返回到 Setup Privileges 窗口并单击 OK。
运行信息如下:
oracle:~ # cd /u01/app/oracle/oraInventory/
oracle:/u01/app/oracle/oraInventory # ls
Contents ContentsXML install.platform logs oraInst.loc oraInstaller.properties orainstRoot.sh oui sessionContext.ser
oracle:/u01/app/oracle/oraInventory # ./orainstRoot.sh
Changing permissions of /u01/app/oracle/oraInventory to 770.
Changing groupname of /u01/app/oracle/oraInventory to oinstall.
The execution of the script is complete
oracle:/u01/app/oracle/oraInventory # cd /u01/app/oracle/product/10.2.0/
oracle:/u01/app/oracle/product/10.2.0 # ./root.sh
Running Oracle10 root.sh script...
The following environment variables are set as:
ORACLE_OWNER= oracle
ORACLE_HOME= /u01/app/oracle/product/10.2.0
Enter the full pathname of the local bin directory: [/usr/local/bin]:/usr/local/bin
Copying dbhome to /usr/local/bin ...
Copying oraenv to /usr/local/bin ...
Copying coraenv to /usr/local/bin ...
Creating /etc/oratab file...
Entries will be added to the /etc/oratab file as needed by
Database Configuration Assistant when a database is created
Finished running generic part of root.sh script.
Now product-specific root actions will be performed.
oracle:/u01/app/oracle/product/10.2.0 #
16, 安装结束
记下摘要中显示的 URL,并在准备好时单击 Exit。
iSQL*Plus URL
http://oracle:5560/isqlplus
iSQL*Plus DBA URL
http://oracle:5560/isqlplus/dba
Enterprise Manager 10g Database Control URL
http://oracle:1158/em
常用工具:
1, 使用 SQL*Plus 访问数据库
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=/u01/app/oracle/product/10.2.0
export PATH=$PATH:$HOME/bin:${ORACLE_HOME}/bin:.
export ORACLE_SID=orcl
export LANG=en_US.UTF-8
oracle@oracle:~> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 7 17:35:04 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL>
2, 使用 Oracle Enterprise Manager 10g 数据库控制
在 Web 浏览器中,连接到安装过程中提供的 URL。
例如:http://oracle:1158/em (如果服务器不在 DNS 中,则必须使用 IP 地址代替主机名。)
用户名:SYS
口令:<安装过程中选择的口令>
连接为:SYSDBA
3, 启动和停止 Oracle Enterprise Manager 数据库控制:
$ emctl start dbconsole
$ emctl stop dbconsole
4, 使用 iSQL*Plus 访问数据库
iSQL*Plus 是历史悠久的 SQL*Plus 交互式工具的基于 Web 的版本,用于访问数据库。要使用 iSQL*Plus,请单击 OEM 控制台 Related Links 部分中的 iSQL*Plus 链接,或将浏览器指向安装过程中提供的 iSQL*Plus URL。
例如:
http://oracle:5560/isqlplus(如果数据库服务器不在 DNS 中,则必须使用 IP 地址代替主机名。)
用户名:SYSTEM
口令:<安装过程中选择的口令>
单击
在 Workspace 框中输入 SQL 命令,然后单击 Execute。
5, 启动和停止 iSQL*Plus:
$ isqlplusctl start
$ isqlplusctl stop
6, 启动和停止监听器:
监听器接受客户端的连接请求,并在验证证书后创建数据库连接。要使用 OEM 或 iSQL*Plus,必须先启动监听器。
$ lsnrctl start
$ lsnrctl stop
7, 启动和停止数据库:
启动和停止数据库的最简单方法是从 OEM 控制台启动和停止。要从命令行执行此操作,请在以 oracle 身份登录后使用 SQL*Plus,如下所示:
关闭:
oracle@oracle:~> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 7 17:35:04 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
启动:
oracle@oracle:~> sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 7 17:43:13 2007
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 83888372 bytes
Database Buffers 79691776 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
SQL>
参考文档:
http://www.oracle.com/technology/global/cn/pub/articles/smiley_10gdb_install.html
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/312079/viewspace-245681/ ,如需转载,请注明出处,否则将追究法律责任。