Oracle學習系列—Window作業系統下Oracle資料庫的手工建立

bq_wang發表於2008-02-13

系統環境:
1、作業系統:2003 Server
2、資料庫: 
Oracle9i Database 9.2.0.1.0 for Windows 企業版
3、安裝路徑:C/:ORACLE

步驟:
1、手工建立相關目錄
2、手工建立初始化引數檔案
3、透過oradim建立一個ORACLE服務
4、建立資料庫
5、建立資料庫資料檔案,執行指令碼
6、建立資料字典,執行

安裝中的注意事項

ORACLE_SID最好採用標準英文字母,_下劃線名稱將會導致Ora-12560錯誤!



安裝前的準備工作

1. 確定Oracle例項的名稱為wbq

2. 參照相關文件命名Oracle資料庫的資料夾名稱,最好以例項名稱命名

3. 根據應用情況,對初始化引數中的各個引數值進行明確,例如datablocksize,歸檔模式等等

4. 按照相關文件和實際情況,對資料庫的系統表空間、回滾段表空間、臨時表空間進行設定。

安裝詳細步驟

1. 手工建立Oracle資料庫相關目錄

Microsoft Windows [Version 5.2.3790]

(C) Copyright 1985-2003 Microsoft Corp.

C:/>cd Oracle

C:/oracle>md admin

C:/oracle>cd admin

C:/oracle/admin>md wbq

C:/oracle/admin>cd wbq

C:/oracle/admin/wbq>md bdump

C:/oracle/admin/wbq>md udump

C:/oracle/admin/wbq>md cdump

C:/oracle/admin/wbq>md pfile

C:/oracle/admin/wbq>md create

C:/oracle/admin/wbq>cd ../..

C:/oracle>md oradata

C:/oracle>cd oradata

C:/oracle/oradata>md wbq

C:/oracle/oradata>cd wbq

C:/oracle/oradata/wbq>md archive

2. 手工建立初始化引數檔案,並複製到預設的資料夾C:/oracle/ora92/database目錄下

###################################################

# Copyright (c) 1991, 2001, 2002 by Oracle Corp

###################################################

###########################################

# Cache and I/O

###########################################

db_block_size=8192

db_cache_size=25165824

db_file_multiblock_read_count=16

###########################################

# Cursors and Library Cache

###########################################

open_cursors=300

###########################################

# Database Identification

###########################################

db_domain=""

db_name=wbq

###########################################

# Diagnostics and Statistics

###########################################

background_dump_dest=C:/oracle/admin/wbq/bdump

core_dump_dest=C:/oracle/admin/wbq/cdump

timed_statistics=TRUE

user_dump_dest=C:/oracle/admin/wbq/udump

###########################################

# File Configuration

###########################################

control_files=(
"C:/oracle/oradata/wbq/CONTROL01.CTL", "C:/oracle/oradata/wbq/CONTROL02.CTL",
"C:/oracle/oradata/wbq/CONTROL03.CTL")

###########################################

# Instance Identification

###########################################

instance_name=wbq

###########################################

# Job Queues

###########################################

job_queue_processes=10

###########################################

# MTS

###########################################

# dispatchers="(PROTOCOL=TCP) (SERVICE=wbqXDB)"

###########################################

# Miscellaneous

###########################################

aq_tm_processes=1

compatible=9.2.0.0.0

###########################################

# Optimizer

###########################################

hash_join_enabled=TRUE

query_rewrite_enabled=FALSE

star_transformation_enabled=FALSE

###########################################

# Pools

###########################################

java_pool_size=3355443

large_pool_size=8388608

shared_pool_size=50331648

###########################################

# Processes and Sessions

###########################################

processes=150

###########################################

# Redo Log and Recovery

###########################################

fast_start_mttr_target=300

###########################################

# Security and Auditing

###########################################

remote_login_passwordfile=EXCLUSIVE

###########################################

# Sort, Hash Joins, Bitmap Indexes

###########################################

pga_aggregate_target=25165824

sort_area_size=524288

###########################################

# System Managed Undo and Rollback Segments

###########################################

undo_management=AUTO

undo_retention=10800

undo_tablespace=UNDOTBS1

3. 建立密碼檔案

C:/>orapwd help

Usage: orapwd file= password= entries=

where

file - name of password file (mand),

password - password for SYS (mand),

entries - maximum number of distinct DBA and OPERs (opt),

There are no spaces around the equal-to (=) character.

C:/>orapwd file=C:/oracle/ora92/database/pwdwbq.ora password=wbq entries=5

4. 建立Oracle服務

C:/oracle/oradata/wbq>set ORACLE_SID=wbq

C:/oracle/oradata/wbq>cd ../../ora92/bin

C:/oracle/ora92/bin>REM 只需要制定例項名稱即可

C:/oracle/ora92/bin>oradim -new -sid wbq

5. 建立資料庫資料檔案、控制檔案、日誌檔案,並根據需要產生undo表空間和臨時表空間。

SQL>sqlplus /nolog
SQL>connect SYS/change_on_install as sysdba

SQL>startup nomount

SQL>create database wbq

maxinstances 1

maxloghistory 1

maxlogfiles 5

maxlogmembers 5

maxdatafiles 100

datafile 'C:/Oracle/oradata/wbq/system01.dbf' size 200M reuse autoextend on next 10240K maxsize 32767M extent management local default temporary tablespace

temp tempfile 'C:/Oracle/oradata/wbq/temp01.dbf' size 40M reuse autoextend on next 640K maxsize 32767M undo tablespace "undotbs1"

datafile 'C:/Oracle/oradata/wbq/undotbs01.dbf' size 200M reuse autoextend on next 5129K maxsize 32767M

character set ZHS16GBK

logfile group 1 ('C:/Oracle/oradata/wbq/redo01.log') size 10240K,

group 2 ('C:/Oracle/oradata/wbq/redo02.log') size 10240K,

group 3 ('C:/Oracle/oradata/wbq/redo03.log') size 10240K;

6. 建立資料字典

SQL>@C:/Oracle/ora92/Rdbms/admin/catalog.sql;

SQL>@C:/Oracle/ora92/Rdbms/admin/catexp7.sql

SQL>@C:/Oracle/ora92/Rdbms/admin/catproc.sql

SQL>@C:/Oracle/ora92/Rdbms/admin/caths.sql

7. 更改登錄檔

[HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE/HOME0]

"ORACLE_SID"="wbq"

8. 更改Oracle服務啟動方式,並啟動資料庫

Microsoft Windows [Version 5.2.3790]

(C) Copyright 1985-2003 Microsoft Corp.

C:/>oradim -edit -sid wbq -startmode a

C:/ >net start oracleservicewbq

The OracleServicewbq service is starting.

The OracleServicewbq service was started successfully.

C:/ >lsnrctl start

LSNRCTL for 32-bit Windows: Version 9.2.0.1.0 - Production on 18-MAR-2007 07:43:

22

Copyright (c) 1991, 2002, Oracle Corporation. All rights reserved.

Starting tnslsnr: please wait...

TNSLSNR for 32-bit Windows: Version 9.2.0.1.0 - Production

Log messages written to C:/oracle/ora92/network/log/listener.log

Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bq_wang)(PORT=1521)))

Connecting to (ADDRESS=(PROTOCOL=tcp)(PORT=1521))

STATUS of the LISTENER

------------------------

Alias LISTENER

Version TNSLSNR for 32-bit Windows: Version 9.2.0.1.0 - Produc

tion

Start Date 18-MAR-2007 07:43:24

Uptime 0 days 0 hr. 0 min. 2 sec

Trace Level off

Security OFF

SNMP OFF

Listener Log File C:/oracle/ora92/network/log/listener.log

Listening Endpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=bq_wang)(PORT=1521)))

The listener supports no services

The command completed successfully

C:/ >sqlplus /nolog

SQL*Plus: Release 9.2.0.1.0 - Production on Sun Mar 18 07:44:06 2007

Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.

SQL> connect sys/change_on_install as sysdba

Connected to an idle instance.

SQL> startup

ORACLE instance started.

Total System Global Area 105978600 bytes

Fixed Size 453352 bytes

Variable Size 79691776 bytes

Database Buffers 25165824 bytes

Redo Buffers 667648 bytes

Database mounted.

Database opened.

SQL> quit

Disconnected from Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production

With the Partitioning, OLAP and Oracle Data Mining options

JServer Release 9.2.0.1.0 - Production


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

相關文章