Hi-Fi優質I.T網:技術文章...
您尚未登入...
帳號:
密碼:

忘記密碼 
 
  訂閱電子報

取消   訂閱
 
2004/9/30-17:15:39
 使用 Command Line 建立 Oracle 資料庫│作者:站長│分數:0

 

一、建立 PFILE
 
# 設定資料庫區塊大小與資料庫快取大小

DB_BLOCK_SIZE=4096
DB_CACHE_SIZE=20971520

# 設定游標形式和函式庫快取

CURSOR_SHARING=SIMILAR
OPEN_CURSORS=300


# 設定追蹤、診斷、統計路徑

BACKGROUND_DUMP_DEST=/vobs/oracle/admin/mynewdb/bdump
CORE_DUMP_DEST=/oracle/admin/db_name/cdump
TIMED_STATISTICS=TRUE
USER_DUMP_DEST=/oracle/admin/db_name/udump


# 設定控制檔位置

CONTROL_FILES="/oracle/oradata/db_name/control01.ctl",
"/oracle/oradata/db_name/control02.ctl",
"/oracle/oradata/db_name/control03.ctl

# 設定存檔日誌位置與檔名格式

LOG_ARCHIVE_DEST_1='LOCATION=/oracle/oradata/db_name/archive'
LOG_ARCHIVE_FORMAT=%t_%s.dbf
LOG_ARCHIVE_START=TRUE

# 設定資料庫執行模式(專屬/分享)
# Shared Server
# Uncomment and use first DISPATCHES parameter below when your listener is
# configured for SSL
# (listener.ora and sqlnet.ora)
# DISPATCHERS = "(PROTOCOL=TCPS)(SER=MODOSE)",
# "(PROTOCOL=TCPS)(PRE=oracle.aurora.server.SGiopServer)"

DISPATCHERS="(PROTOCOL=TCP)(SER=MODOSE)",
"(PROTOCOL=TCP)(PRE=oracle.aurora.server.SGiopServer)",
(PROTOCOL=TCP)

# 設定資料庫名稱與 Oracle 版本

COMPATIBLE=9.2.0
DB_NAME=db_name

# 設定資料庫DOMAIN_NAME與遠端登入驗證方式

DB_DOMAIN=us.oracle.com
REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE

# 設定執行項次名稱

INSTANCE_NAME=db_name

# 設定JAVA快取、大型快取、分享快取大小

JAVA_POOL_SIZE=31457280
LARGE_POOL_SIZE=1048576
SHARED_POOL_SIZE=52428800

# 設定處理作業和階段作業最大值

PROCESSES=150

# 設定重作日誌、復原時間(秒)

FAST_START_MTTR_TARGET=300

# 設定資源管理員

RESOURCE_MANAGER_PLAN=SYSTEM_PLAN

# 設定排序、雜湊、位元對照索引值

SORT_AREA_SIZE=524288

# 設定是否為自動管理還原倒回區段

UNDO_MANAGEMENT=AUTO
UNDO_TABLESPACE=undotbs

 
 二、建立 DataBase 
 
$ sqlplus "/ AS SYSDBA"


SQL> STARTUP NOMOUNT

SQL> CREATE DATABASE db_name
USER SYS IDENTIFIED BY password
USER SYSTEM IDENTIFIED BY password
CONTROLFILE REUSE
LOGFILE GROUP 1 ('/oracle/oradata/db_name/redo01.log') SIZE 100M,
GROUP 2 ('/oracle/oradata/db_name/redo02.log') SIZE 100M,
GROUP 3 ('/oracle/oradata/db_name/redo03.log') SIZE 100M
MAXLOGFILES 5 MAXLOGMEMBERS 5 MAXLOGHISTORY 1 MAXDATAFILES 1
00 MAXINSTANCES 1 ARCHIVELOG
CHARACTER SET ZHT16MSWIN950
NATIONAL CHARACTER SET AL16UTF16
DATAFILE '/oracle/oradata/db_name/system01.dbf' SIZE 325M REUSE
EXTENT MANAGEMENT LOCAL
DEFAULT TEMPORARY TABLESPACE tempts1
DATAFILE '/oracle/oradata/db_name/temp01.dbf'
SIZE 20M REUSE
UNDO TABLESPACE undotbs
DATAFILE '/oracle/oradata/db_name/undotbs01.dbf'
SIZE 200M REUSE AUTOEXTEND ON NEXT 5120K MAXSIZE UNLIMITED;
 
三、建立 Tablespace 
 
$ sqlplus "SYS/password@db_name AS SYSDBA"

建立一個 USERS Tablespace 建立使用者帳號時可指定此 Tablespace

SQL> CREATE TABLESPACE users LOGGING DATAFILE '/oracle/oradata/db_name/users01.dbf' SIZE 25M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED EXTENT MANAGEMENT LOCAL;

建立一個 Index Tablespace 日後可指定給使用者存放索引資料--

SQL> CREATE TABLESPACE indx LOGGING
DATAFILE '/vobs/oracle/oradata/db_name/indx01.dbf'
SIZE 25M REUSE AUTOEXTEND ON NEXT 1280K MAXSIZE UNLIMITED
EXTENT MANAGEMENT LOCAL;


------------------------------------------------------------------------------
產生 Data Dictionary View

@/oracle/rdbms/admin/catalog.sql
@/oracle/rdbms/admin/catproc.sql


重新啟動資料庫:

SQL> STARTUP FORCE;


*****完成*****

SQL> EXIT


請評分: -3 -2 -1 +1 +2 +3
  
   

Hi-Fi優質I.T網”站內所有文章、圖片除特別加註外均屬本站所有,如有任何問題請來信告知
請支持言論自由,討論區所發表之言論不代表本站立場
Hi-Fi優質I.T網”版權所有2004©
---最佳顯示效果1024*768---