拋開dbca,手動建庫步驟

zhcunique發表於2021-02-25
  1. 建立相關目錄

    cd $ORACLE_BASE

    mkdir -p admin/SID_NAME/adump

    mkdir -p oradata/SID_NAME

  2. 建立口令檔案

    cd $ORACLE_HOME/dbs

    orapwd file=orapwSID_NAME password=oracle entries=30

  3. 複用及修改引數檔案

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

    vi initSID_NAME.ora修改相應配置資訊,最終效果如下:

    ======================================================================

    db_name='SID_NAME'

    memory_target=2048m

    processes=1500

    audit_file_dest='$ORACLE_BASE/admin/SID_NAME/adump'

    audit_trail='db'

    db_block_size=8192

    db_domain=''

    db_recovery_file_dest='$ORACLE_BASE/fast_recovery_area'

    db_recovery_file_dest_size=5G

    diagnostic_dest='$ORACLE_BASE'

    dispatchers='(PROTOCOL=TCP)(SERVICE=ORCLXDB)'

    open_cursors=500

    remote_login_passwordfile='EXCLUSIVE'

    undo_tablespace='UNDOTBS1'

    control_files=($ORACLE_BASE/oradata/SID_NAME/control01.ctl,$ORACLE_BASE/oradata/SID_NAME/control02.ctl)

    compatible='11.2.0'

    ======================================================================

  4. 建立建庫指令碼(格式敏感,清除多餘空格)vi createmydb.sql

    CREATE DATABASE SID_NAME 

    USER SYS IDENTIFIED BY oracle
    USER SYSTEM IDENTIFIED BY oracle
    LOGFILE GROUP 1 ('/oradata/SID_NAME/redo01.log') SIZE 100M,
               GROUP 2 ('/oradata/SID_NAME/redo02.log') SIZE 100M,
               GROUP 3 ('/oradata/SID_NAME/redo03.log') SIZE 100M
    MAXLOGFILES 50
    MAXLOGMEMBERS 5
    MAXLOGHISTORY 1
    MAXDATAFILES 100
    MAXINSTANCES 1
    CHARACTER SET ZHS16GBK
    NATIONAL CHARACTER SET AL16UTF16
    DATAFILE '/oradata/SID_NAME/system01.dbf' SIZE 2G autoextend on 
    EXTENT MANAGEMENT LOCAL
    SYSAUX DATAFILE '/oradata/SID_NAME/sysaux01.dbf' SIZE 2G autoextend on
    DEFAULT TEMPORARY TABLESPACE tempts1
    TEMPFILE '/oradata/SID_NAME/temp01.dbf'
    SIZE 2G autoextend on
    UNDO TABLESPACE undotbs1
    DATAFILE '/oradata/SID_NAME/undotbs01.dbf'
    SIZE 200M REUSE AUTOEXTEND ON MAXSIZE UNLIMITED

  5. 建立SPFILE,啟動資料庫,執行建庫指令碼

    export ORACLE_SID=SID_NAME

    sqlplus / as sysdba

    create spfile from pfile

    startup nomount

    @$pwd/createmydb.sql

  6. 執行必選預置指令碼

    @?/rdbms/admin/catalog.sql

    @?/rdbms/admin/catproc.sql

    conn system/oracle

    @?/sqlplus/admin/pupbld.sql

  7. 建庫完成

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

相關文章