天天看點

在 Linux x86 上安裝 Oracle 資料庫 10g_3

啟動 Oracle 通用安裝程式。

$ ./runInstaller

1.      歡迎

o        單擊 Next。

2.      指定清單目錄和證書

o        如果您一直在依循本指南中的步驟,則使用預設值即可。否則,編輯清單目錄的路徑,以指向正确目錄。

o        作業系統組名稱應為 oinstall。

3.      如果這是首次在此機器上安裝 Oracle,則您将收到一個彈出視窗,提示需要以 root 使用者身份運作 orainstRoot.sh 腳本。以 root 使用者身份登入,更改到視窗中指定的目錄,執行該腳本,然後繼續操作。

4.      指定檔案位置

o        如果您一直在依循本指南中的步驟,則使用預設值即可。否則,在繼續操作前確定源路徑和目标路徑正确。

5.      選擇安裝類型

o        接受預設值 Enterprise Edition。

6.      與特定産品相關的先決條件的檢查

o        如果您一直在依循本指南中的步驟,則所有檢查都應順利通過。如果一個或多個檢查失敗,則在繼續操作前糾正該問題。

7.      選擇資料庫配置

o        接受預設值 Create a starter database 和 General Purpose。

8.      指定資料庫配置選項

o        輸入資料庫的全局資料庫名稱。該名稱應包含 ORACLE_SID 和伺服器域名(例如,demo1.orademo.org,其中 demo1 是 ORACLE_SID,orademo.org 是域名)。

o        輸入全局資料庫名稱時,SID 框将自動填充。

o        接受預設的資料庫字元集。

o        選擇 Create database with sample schemas。

9.      選擇資料庫管理選項

o        選擇 Use Database Control for Database Management。

10.   指定資料庫檔案存儲選項

o        選擇 File System,然後輸入資料庫檔案要使用的路徑名(在本例中為 /u02/oradata)。

11.   指定備份和恢複選項

o        選擇 Do not enable Automated backups。

12.   指定資料庫模式密碼

o        選擇 Use the same password for all the accounts。

o        選擇一個密碼,然後輸入兩次進行确認。

13.   摘要

o        顯示已安裝産品的摘要。

o        單擊 Install。

14.   安裝

o        此螢幕曆經安裝和連結 Oracle 軟體的幾個階段。

o        安裝過程結束時彈出一個視窗顯示配置資訊。記下 Enterprise Manager URL,然後單擊 OK 關閉該視窗。

o        彈出一個“Setup Privileges”視窗,提示需要以 root 使用者身份運作配置腳本。以 root 使用者身份登入,切換到該視窗中訓示的目錄,然後執行 root.sh 腳本。該腳本提示輸入本地 bin 目錄的位置。按 Enter 鍵接受預設值。當腳本完成時,傳回到 Setup Privileges 視窗并單擊 OK。(如下所示。)

15.   安裝結束

o        記下摘要中顯示的 URL,并在準備好時單擊 Exit。

16.   恭喜!您的新 Oracle 10g 資料庫已經啟動并可以使用。

我們在第 3 部分中建立的資料庫使用單一檔案系統 (/u02/oradata) 進行磁盤存儲。但為 Oracle 資料庫配置存儲的方式有多種。

第 4 部分介紹了為此資料庫配置磁盤存儲的其他方法。尤其是,它描述了如何建立其他檔案系統以及如何使用自動存儲管理 (ASM)。如何使用原始裝置和 Oracle 叢集檔案系統 (OCFS) 将在本系列的另一篇文章中介紹,該篇文章介紹了如何使用 Oracle 真正應用叢集 (RAC) 建立叢集資料庫。

檔案系統是為 Oracle 資料庫存儲資料檔案、重做日志和控制檔案最常用的方法。檔案系統易于實施,并且無需第三方軟體來管理。

大多數情況下,檔案系統在 Linux 的初始安裝過程中建立。但有時必須在初始安裝後(如安裝新磁盤驅動器後)建立新檔案系統。

本部分介紹了如何建構新檔案系統以及如何在 Oracle 資料庫中使用它。除非另有說明,否則必須以 root 使用者身份運作所有指令。

對磁盤進行分區

必須使用空磁盤分區來建立檔案系統。如果已經有一個空的可用磁盤分區,則跳到下一步。

以下是一個為 Linux 檔案系統建立新分區的示例。(警告:對磁盤進行錯誤分區是删除硬碟上所有内容的最可靠、最快捷的方法之一。如果不确定如何分區,請先停下來,找人幫幫您,否則您将冒丢失資料的危險。)

此示例使用 /dev/sdb(一個沒有分區的空 SCSI 磁盤)為整個磁盤 (36 GB) 建立單個分區。

例如:

# fdisk /dev/sdb

Device contains neither a valid DOS partition table, nor Sun, SGI or OSF disklabel

Building a new DOS disklabel.Changes will remain in memory only,

until you decide to write them.After that, of course, the previous

content won't be recoverable.

The number of cylinders for this disk is set to 4427.

There is nothing wrong with that, but this is larger than 1024,

and could in certain setups cause problems with:

1) software that runs at boot time (e.g., old versions of LILO)

2) booting and partitioning software from other OSs

(e.g., DOS FDISK, OS/2 FDISK)

Command (m for help):p

Disk /dev/sdb:255 heads, 63 sectors, 4427 cylinders

Units = cylinders of 16065 * 512 bytes

Device Boot    Start       End    Blocks   Id System

Command (m for help):n

Command action

e   extended

p   primary partition (1-4)

p

Partition number (1-4): 1

First cylinder (1-4427, default 1):

Using default value 1

Last cylinder or +size or +sizeM or +sizeK (1-4427, default 4427):

Using default value 4427

Command (m for help):w

The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING:If you have created or modified any DOS 6.x

partitions, please see the fdisk manual page for additional

information.

Syncing disks.

現在驗證新分區:

/dev/sdb1             1      4427 35559846   83 Linux

Command (m for help):q

建立檔案系統

使用 ext3 建立這個新的檔案系統。也可以使用其他檔案系統,但 ext3 在系統崩潰時可提供最快的恢複。

# mke2fs -j /dev/sdb1

mke2fs 1.26 (3-Feb-2002)

Filesystem label=

OS type:Linux

Block size=4096 (log=2)

Fragment size=4096 (log=2)

4447744 inodes, 8889961 blocks

444498 blocks (5.00%) reserved for the super user

First data block=0

272 block groups

32768 blocks per group, 32768 fragments per group

16352 inodes per group

Superblock backups stored on blocks:

        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632,

        2654208, 4096000, 7962624

Writing inode tables:done

Creating journal (8192 blocks):done

Writing superblocks and filesystem accounting information:done

This filesystem will be automatically checked every 23 mounts or

180 days, whichever comes first.Use tune2fs -c or -i to override.

建立挂載點

由于您已經在第 1 部分中使用了 /u01 和 /u02 目錄名稱,是以在本示例中使用 /u03。

# mkdir /u03

将新檔案系統添加到 /etc/fstab

是以新檔案系統将在系統啟動時自動挂載,您需要向描述新檔案系統及其安裝位置的 /etc/fstab 檔案中添加一行。使用文本編輯器向 /etc/fstab 中添加如下所示的一行。

/dev/sdb1         /u03           ext3    defaults       1 1

挂載新檔案系統

檔案系統挂載後就可以使用了。隻有挂載了檔案系統,才能在其中存儲檔案。使用以下指令挂載檔案系統并驗證它是否可用。

mount /u03

df -h /u03

# mount /u03

# df -h /u03

Filesystem            Size Used Avail Use% Mounted on

/dev/sdb1             33G   33M 31G   1%   /u03

建立 Oracle 目錄并設定權限

現在,建立一個用于存放 Oracle 檔案的目錄。該示例中使用的目錄名遵循資料庫的 OFA 标準命名慣例,即 ORACLE_SID=demo1。

mkdir -p /u03/oradata/demo1

chown -R oracle:oinstall /u03/oradata

chmod -R 775 /u03/oradata

在新檔案系統中建立一個新表空間

新檔案系統已可以使用。接下來,在檔案系統中建立一個用于存儲資料庫對象的新表空間。以 SYSTEM 使用者身份連接配接到資料庫,然後執行 CREATE TABLESPACE 語句,并在新檔案系統中指定資料檔案。

$ sqlplus

SQL*Plus:Release 10.1.0.2.0 - Production on Sun Jun 13 15:01:08 2004

Copyright (c) 1982, 2004, Oracle.All rights reserved.

Enter user-name:system

Enter password:

Connected to:

Oracle Database 10gEnterprise Edition Release 10.1.0.2.0 - Production

With the Partitioning, OLAP and Data Mining options

SQL> create tablespace data1

2 datafile '/u03/oradata/demo1/data1_01.dbf' size 100M

3 extent management local

4 segment space management auto;

Tablespace created.

現在,可以使用此新表空間存儲資料庫對象,如表和索引。

SQL> create table demotab (id number(5) not null primary key,

2 name varchar2(50) not null,

3 amount number(9,2))

4 tablespace data1;

Table created.