Oracle 11.2命令列手工最簡建立資料庫的過程

來源:互聯網
上載者:User

Oracle 11.2命令列手工最簡建立資料庫的過程

命令列手工最簡建立資料庫的過程
環境:RHEL 5.4 x86 , oracle 11.2

1.設定環境變數
在/home/oracle編輯
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

# 11g R2
export ORACLE_HOME=/app/oracle/product/11.2.0/dbhome_1
export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export NLS_LANG=AMERICAN_AMERICA.UTF8
export ORACLE_SID=orcl
umask 022

2.禁用SELinux
如果在安裝RHEL的時候啟用了SELinux,需要
以root使用者setenforce 0
否則會出現:sqlplus: error while loading shared libraries

3.以oracle使用者登入編輯init.ora
只要1行
db_name=orcl

4.登入sqlplus / as sysdba
create spfile='spfileorcl.ora' from pfile='/home/oracle/init.ora'
startup nomount
create database orcl;
等候建立資料庫成功。
select sysdate from dual;
已經可以查出日期。

5.執行指令碼建立系統檢視表和包
@?/rdbms/admin/catalog
@?/rdbms/admin/catproc
以system使用者執行
@?/sqlplus/admin/pupbld
此時可以看到v$datafile和v$controlfile
位於$ORACLE_HOME/dbs,檔案名稱分別是dbs1orcl dbx1orcl dbu1orcl cntrlorcl

幾點疑問:
1.文檔上說至少pfile需要3個參數,其他都有預設值,而我唯寫了1個,也可以。

2.建立資料庫的資料表空間只有system sysaux sys_undots,沒有暫存資料表空間,資料庫運行也不出錯
不知道是否這也是oracle 11.2的新特性?

3.曾經在一個.sql檔案中寫了如下的語句,但沒有執行成功
create database orcl
user sys identified by sys
user system identified by sys
extent management local
default temporary tablespace temp
undo tablespace undotbs1
default tablespace users;

4.文檔中沒有說需要system使用者執行pupbld,我用sys使用者執行
結果在建立使用者oo登入時提示error accessing PRODUCT_USER_PROFILE

參考資料http://download.oracle.com/docs/ ... 10595/create003.htm

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.