手動建立資料庫

不二黑貓發表於2015-01-01

1.安裝了oracle的軟體

2.配置的環境如下

ORACLE_SID=orcl; export ORACLE_SID=ORCL

ORACLE_BASE=/u01/app/oracle; export ORACLE_BASE

ORACLE_HOME=$ORACLE_BASE/product/11.2.0/db_1; export ORACLE_HOME

PATH=$ORACLE_HOME/bin:$PATH; export PATH

NLS_LANG=american_america.al32utf8; export NLS_LANG

3.編寫引數檔案 initORCL.ora

db_name=orcl

instance_name=ORCL

memory_target=600m

undo_management=auto

undo_tablespace=undotbs

diagnostic_dest=/u01/app/oracle

processes=150

control_files='/u01/app/oracle/oradata/ORCL/control01.ctl'

4.建立密碼檔案

orapwdfile='/u01/app/oracle/product/11.2.0/db_1/dbs/orapwORCL' password=oracle

5.建立必要的目錄

mkdir-p /u01/app/oracle/oradata/ORCL

6.啟動資料庫到nomount模式,建立spfile

createspfile from pfile;

7.建立資料庫

createdatabase orcl

logfile

group1 ('/u01/app/oracle/oradata/ORCL/redo01.log') size 512000k, #這裡有個逗號,檔案大小可能要用k

group2 ('/u01/app/oracle/oradata/ORCL/redo02.log') size 512000k

maxinstances8

maxdatafiles200

maxlogfiles32

maxlogmembers5

maxloghistory1000

usersys identified by oracle

usersystem identified by oracle

characterset al32utf8

nationalcharacter set al16utf16

datafile'/u01/app/oracle/oradata/ORCL/system01.dbf' size 512000k autoextendon maxsize unlimited

sysauxdatafile '/u01/app/oracle/oradata/ORCL/sysaux01.dbf' size 512000kautoextend on maxsize unlimited

undotablespace undotbs datafile'/u01/app/oracle/oradata/ORCL/undotbs01.dbf' size 512000k autoextendon maxsize unlimited #一定要和引數檔案中指定的回滾表空間名稱一樣。

defaulttemporary tablespace temp tempfile'/u01/app/oracle/oradata/ORCL/temp01.dbf' size 512000k autoextend onmaxsize unlimited ;

8.建立一個預設的永久表空間

createtablespace users datafile '/u01/app/oracle/oradata/ORCL/users01.dbf'size 100m autoextend on maxsize 1g;

alterdatabase default tablespace users;

9.執行必須的指令碼檔案

sys:

@?/rdbms/admin/catalog //建立資料字典

@?/rdbms/admin/catproc//建立必須的PL/sql

system

@?/sqlplus/admin/pupbld//建立必須的pl/sql

9.配置監聽

建立檔案$ORACLE_HOME/network/admin/listener.ora

LISTENER=

    (DESCRIPTION_LIST =

         (DESCRIPTION =

              (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))

          )

     )

10.編輯TNS檔案

orcl=

    (description=

        (address_list=

            (address=(protocol=tcp)(host=localhost)(port=1521))

        )

        (connect_data=

            (service_name=ORCL)

        )

    )  

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

相關文章