oracle 10g手工建庫全過程

2022-05-09 20:54:53 字數 3882 閱讀 7332

在平時的oracle建庫中我們一般都是採用gui建庫方式,所以手工建庫相對來說比較有些難度,這個也是ocm考試中需要關注的地方,特別做了測試,主要是版本是9i, 10g

1.修改/etc/oratab

oral:/opt/oracle/database:n

2.建立sys口令認證檔案

orapwd file=$oracle_home/dbs/orapworal password=system entries=5

3.設定oracle使用者環境變數例項名

vi .bash_profile

export oracle_sid=oral

export oracle_base=/opt/oracle

export oracle_home=/opt/oracle/database

export path=$path:$oralce_home/bin:.

4.建立目錄

oracle@marvelyu:~/> mkdir

-p /opt/oracle/admin/oral/bdump

oracle@marvelyu:~/> mkdir

-p /opt/oracle/admin/oral/udump

oracle@marvelyu:~/> mkdir

-p /opt/oracle/admin/oral/cdump

oracle@marvelyu:~/> mkdir

-p /opt/oracle/admin/oral/adump

5.建立pfile

cd $oracle_home/dbs

cat init.ora |grep -v ^# |grep -v ^$>initoral.ora

修改引數檔案內容,一些關鍵引數修改

*.audit_file_dest=』/opt/oracle/admin/oral/adump』

*.background_dump_dest=』/opt/oracle/admin/oral/bdump』

*.compatible=』9.2.0.2′

*.control_files=』/opt/oracle/oradata/control01.ctl』,'/opt/oracle/oradata/control02.ctl』

*.core_dump_dest=』/opt/oracle/admin/oral/cdump』

*.db_cache_size=80m

*.db_name=』oral』

*.global_names=true

*.log_buffer=32768

*.shared_pool_size=3500000

*.undo_management=』auto』

*.user_dump_dest=』/opt/oracle/admin/oral/udump』

完成後記得create spfile from pfile;來建立spfile檔案。

6.執行建庫指令碼

啟動資料庫到nomount

>sqlplus 「/as sysdba」

>stratup nomount pfile=』$oracle_home/dbs/initoral.ora』

create database  oral

user sys identified by system

user system identified by system

logfile

group 1 (『/opt/oracle/oradata/redo01.log』) size 100m,

group 2 (『/opt/oracle/oradata/redo02.log』) size 100m,

group 3 (『/opt/oracle/oradata/redo03.log』) size 100m

maxlogfiles 5

maxlogmembers 5

maxloghistory 1

maxdatafiles 100

maxinstances 1

character set zhs16gbk

national character set al16utf16

datafile 『/opt/oracle/oradata/system01.dbf』 size 325m

extent management local

default temporary tablespace temp

tempfile 『/opt/oracle/oradata/temp01.dbf』

size 20m

undo tablespace undotbs

datafile 『/opt/oracle/oradata/undotbs01.dbf』

size 200m  autoextend on maxsize unlimited;

7.建立其他系統表空間

create tablespace users logging

datafile 『/opt/oracle/oradata/users01.dbf』

size 25m reuse autoextend on next  1280k maxsize unlimited

extent management local;

create tablespace indx logging

datafile 『/opt/oracle/oradata/indx01.dbf』

size 25m reuse autoextend on next  1280k maxsize unlimited

extent management local;

8.執行建立資料字典指令碼

$oracle_home/rdbms/admin/catalog.sql

$oracle_home/rdbms/admin/catproc.sql

對於10g,也僅僅是多了個sysaux的檔案:

create database mynewdb

user sys identified by system

user system identified by system

logfile group 1 (『/opt/oracle/oradata/redo01.log』) size 100m,

group 2 (『/opt/oracle/oradata/redo02.log』) size 100m,

group 3 (『/opt/oracle/oradata/redo03.log』) size 100m

maxlogfiles 5

maxlogmembers 5

maxloghistory 1

maxdatafiles 100

maxinstances 1

character set zhs16gbk

national character set al16utf16

datafile 『/opt/oracle/oradata/system01.dbf』 size 325m reuse

extent management local

sysaux datafile 『/opt/oracle/oradata/oral/sysaux01.dbf』 size 325m reuse

default tablespace user

default temporary tablespace tempts1

datafile 『/opt/oracle/oradata/temp01.dbf』

size 20m reuse

undo tablespace undotbs

datafile 『/opt/oracle/oradata/undotbs01.dbf』

size 200m reuse autoextend on next 5120k maxsize unlimited;

ORACLE 10G 手工建庫

深藍的blog 資料庫檔案目錄 cd oracle base oradata ls 看到已經存在庫的 sid prod pwd 檢視一下絕對路徑 mkdir hyl ls l 產看一下目錄及許可權 規劃資料檔案存放的不同磁碟目錄,這裡的規劃依據實際情況而定 cd hyl mkdir dump dis...

ORACLE10G手工建庫

資料庫檔案目錄 cd oracle base oradata ls 看到已經存在庫的sid prod pwd 檢視一下絕對路徑 u01 app oracle oradata mkdir hyl ls l 產看一下目錄及許可權 規劃資料檔案存放的不同磁碟目錄,這裡的規劃依據實際情況而定 cd hyl ...

手工建立Oracle10g 資料庫

剛剛見好庫,參考了好多文章,都是比較凌亂的,版本各異,自己總結如下。redhat ws3 oracle10g release 2 oracle10gr2下手動建立資料庫 su oracle 1 設定系統環境變數 oracle home home oracle product 10.2.0 oracl...