在 SLES-10-x86 上安裝 Oracle 資料庫 10g

tonykorn97發表於2007-06-07
第一部分:安裝linux
1,安裝 suse 10 x86 企業版.

光碟啟動後選擇語言為:簡體中文
安裝方式為: ftp
安裝選項為:hostip=172.25.1.100 netmask=255.255.0.0

分割槽方式為:
/boot:100M
swap :2G
建立一個lv system ,把/分割槽建立到這裡,這樣的話以後/分割槽不夠的話也可以透過lvm的方式動態加空間。

語言選擇"簡體中文"
軟體選擇和系統服務,按照預設的設定新增"c/c++編譯器和工具"
去掉"列印伺服器",新增sar和telnet工具.

最後設定:
禁用防火牆
啟用vnc遠端管理

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
:~> 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.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
EOF
/sbin/sysctl -p

例如:
oracle:~ # cat >> /etc/sysctl.conf <> 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
> 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 soft nproc 2047
oracle hard nproc 16384
oracle soft nofile 1024
oracle hard nofile 65536
EOF

cat >> /etc/pam.d/login <session required /lib/security/pam_limits.so
EOF

例如:
oracle:~ # cat >> /etc/security/limits.conf <> oracle soft nproc 2047
> oracle hard nproc 16384
> oracle soft nofile 1024
> oracle hard nofile 65536
> EOF
oracle:~ # cat >> /etc/pam.d/login <> session required /lib/security/pam_limits.so
> EOF

例如:
oracle:~ # tail -n 10 /etc/security/limits.conf
#@faculty soft nproc 20
#@faculty hard nproc 50
#ftp hard nproc 0
- 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,下載解壓:
:~> ls
10201_database_linux32.zip bin Documents public_html
:~> unzip 10201_database_linux32.zip
Archive: 10201_database_linux32.zip
......

2,安裝
:~> ls
10201_database_linux32.zip bin database Documents public_html
:~> cd database/
> ls
doc install response runInstaller stage welcome.html
> ./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
>

一致性檢查沒有過。
解決辦法:

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

iSQL*Plus DBA URL

Enterprise Manager 10g Database Control URL

常用工具:
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
:~> 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。

例如: (如果伺服器不在 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。

例如:
(如果資料庫伺服器不在 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,如下所示:

關閉:
:~> 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

啟動:
:~> 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>

參考文件:

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/312079/viewspace-245681/,如需轉載,請註明出處,否則將追究法律責任。

相關文章