DBCA靜默方式建庫


本篇blog結構圖:

 

使用DBCA的圖形方式建庫實在有諸多不便,但是使用靜默方式建庫就比較方便了,一個命令即可搞定

 

使用dbca安裝oracle數據庫實例也有差不多兩種方法:

一種就是根據模板文件進行安裝,在上文中提到了在oracle安裝程序的安裝文件夾下的response目錄中有一個dbca.rsp文件就是dbca的模板文件。當然我們也可以通過復制這個模板文件來修改其中的內容來建立定制的數據庫,在這個模板文件中對於各個參數的說明非常詳細,對這個文件的內容在此不做說明。

另外一種就是根據oracle自身的數據庫模板來建立數據庫實例(模板文件位置:$ORACLE_HOME/assistants/dbca/templates/*.dbc

ORACLE為我們提供了幾個dbc模板:

Data Warehouse 數據倉庫

Transaction Processing 事務處理

General Purpose 一般用途

這幾個模板是比較易用的模板,oracle針對不同的數據庫用途做了專門的優化,當然我們也可以創建我們自己的模板(也是使用dbca命令),

 

 

首先說明一點,在安裝之前需要注意的幾個問題:

1、/etc/hosts文件中,本機的hostname必須和lo對應(如果你有改過hostname的話,需要修改該文件)

2、$ORACLE_HOME/network/admin/listener.ora文件必須配置服務器監聽,為了保險起見,將tnsnames和sqlnet文件都配置了吧

3、在dbca命令中出現的文件參數,必須使用全路徑

4、注意在使用dbca命令的時候各個同級別的參數的必要性,有些是必要的,有些是不必要的。具體可參考dbca -help

 

 

根據模版文件創建數據庫:

dbca -silent -cloneTemplate -gdbName orcl -sid orcl -datafileDestination /u01/oradata -responseFile /mnt/hgfs/software/oracle/database/response/dbca.rsp

一些參數的說明:

-silent 指定dbca的靜默安裝方式

-cloneTemplate 指定自模版文件創建

-gdbName Global Database Name

-sid 創建數據庫的sid

-datafileDestination 數據文件存放的目標路徑

-responseFIle 模版文件的路徑

 

 

根據Oracle提供的數據庫模版創建數據庫:

dbca -silent -createDatabase -templateName $ORACLE_HOME/assistants/dbca/template/Transaction_Processing.dbc -gdbName orcl -sid orcl -responseFile NO_VALUE -characterSet ZHS16GBK

 

Silent模式采用命令行方式一次將所有信息提供給DBCA完成數據庫的建立,在建立過程中不存在交互作用,所有的信息、錯誤和告警都寫到日志文件中,只在結束時屏幕上打印出日志文件的位置,除此以外,沒有其他的消息。

 

  1. 12c靜默方式建庫

 

[oracle@test ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname oradb.example.com -sid oradb -responseFile NO_VALUE -characterSet AL32UTF8 -memoryPercentage 30 -emConfiguration LOCAL

Enter SYS user password:

   

Enter SYSTEM user password:

   

Copying database files

1% complete

3% complete

11% complete

18% complete

26% complete

33% complete

37% complete

Creating and starting Oracle instance

40% complete

45% complete

50% complete

55% complete

56% complete

60% complete

62% complete

Completing Database Creation

66% complete

70% complete

73% complete

85% complete

96% complete

100% complete

Look at the log file "/12c/app/oracle/cfgtoollogs/dbca/oradb/oradb.log" for further details.

 

 

[oracle@test ~]$ export ORACLE_SID=oradb

[oracle@test ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 12.1.0.1.0 Production on Fri Jan 30 17:02:50 2015

 

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

 

 

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.1.0 - 64bit Production

With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options

 

SYS@oradb >show parameter name

 

NAME                                 TYPE        VALUE

------------------------------------ ----------- ------------------------------

cell_offloadgroup_name               string

db_file_name_convert                 string

db_name                              string      oradb

db_unique_name                       string      oradb

global_names                         boolean     FALSE

instance_name                        string      oradb

lock_name_space                      string

log_file_name_convert                string

pdb_file_name_convert                string

processor_group_name                 string

service_names                        string      oradb.example.com

SYS@oradb >

SYS@oradb >select name from v$datafile;

 

NAME

--------------------------------------------------------------------------------

/12c/app/oracle/oradata/oradb/system01.dbf

/12c/app/oracle/oradata/oradb/sysaux01.dbf

/12c/app/oracle/oradata/oradb/undotbs01.dbf

/12c/app/oracle/oradata/oradb/users01.dbf

  1. 11g靜默方式建庫

[oracle@testdb ora11g]$ dbca -help

dbca [-silent | -progressOnly | -customCreate] { } | { [ [options] ] -responseFile } [-continueOnNonFatalErrors ]

Please refer to the manual for details.

You can enter one of the following command:

 

Create a database by specifying the following parameters:

    -createDatabase

        -templateName

        [-cloneTemplate]

        -gdbName

        [-sid ]

        [-sysPassword ]

        [-systemPassword ]

        [-emConfiguration<central|local|all|none>

            -dbsnmpPassword

            -sysmanPassword

            [-hostUserName

             -hostUserPassword

             -backupSchedule ]

            [-centralAgent ]]

        [-disableSecurityConfiguration<all|audit|password_profile|none>

        [-datafileDestination | -datafileNames ]

        [-redoLogFileSize ]

        [-recoveryAreaDestination ]

        [-datafileJarLocation ]

        [-storageType < FS | ASM >

            [-asmsnmpPassword ]

             -diskGroupName

             -recoveryGroupName

        [-characterSet ]

        [-nationalCharacterSet ]

        [-registerWithDirService

            -dirServiceUserName

            -dirServicePassword

            -walletPassword ]

        [-listeners ]

        [-variablesFile ]]

        [-variables ]

        [-initParams ]

        [-sampleSchema ]

        [-memoryPercentage ]

        [-automaticMemoryManagement ]

        [-totalMemory ]

        [-databaseType <multipurpose|data_warehousing|oltp>]]

 

Configure a database by specifying the following parameters:

    -configureDatabase

        -sourceDB

        [-sysDBAUserName

         -sysDBAPassword ]

        [-registerWithDirService|-unregisterWithDirService|-regenerateDBPassword

            -dirServiceUserName

            -dirServicePassword

            -walletPassword ]

        [-disableSecurityConfiguration<all|audit|password_profile|none>

        [-enableSecurityConfiguration<true|false>

        [-emConfiguration<central|local|all|none>

            -dbsnmpPassword

            -sysmanPassword

            [-hostUserName

             -hostUserPassword

             -backupSchedule ]

            [-centralAgent ]]

 

 

Create a template from an existing database by specifying the following parameters:

    -createTemplateFromDB

        -sourceDB ::>

        -templateName

        -sysDBAUserName

        -sysDBAPassword

        [-maintainFileLocations ]

 

 

Create a clone template from an existing database by specifying the following parameters:

    -createCloneTemplate

        -sourceSID

        -templateName

        [-sysDBAUserName

         -sysDBAPassword ]

        [-maintainFileLocations ]

        [-datafileJarLocation ]

 

Generate scripts to create database by specifying the following parameters:

    -generateScripts

        -templateName

        -gdbName

        [-scriptDest ]

 

Delete a database by specifying the following parameters:

    -deleteDatabase

        -sourceDB

        [-sysDBAUserName

         -sysDBAPassword ]

Query for help by specifying the following options: -h | -help

[oracle@testdb ora11g]$

 

 

 

[oracle@testdb oracle]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname ora11g -sid ora11g -sysPassword lhr -systemPassword lhr -responseFile NO_VALUE -datafileDestination /u01/app/oracle/oradata/ -redoLogFileSize 50 -recoveryAreaDestination /u01/app/oracle/flash_recovery_area -storageType FS -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -memoryPercentage 30 -totalMemory 200 -databaseType OLTP -emConfiguration NONE

Copying database files

1% complete

3% complete

11% complete

18% complete

26% complete

37% complete

Creating and starting Oracle instance

40% complete

45% complete

50% complete

55% complete

56% complete

57% complete

60% complete

62% complete

Completing Database Creation

66% complete

70% complete

73% complete

85% complete

96% complete

100% complete

Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/ora11g/ora11g.log" for further details.

 

  1. 10g靜默建庫

 

給出命令,結果略去:

 

dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname ora11g -sid ora11g -sysPassword lhr -systemPassword lhr -responseFile NO_VALUE -datafileDestination /u01/app/oracle/oradata/ -recoveryAreaDestination /u01/app/oracle/flash_recovery_area -storageType FS -characterSet ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -memoryPercentage 30 -databaseType OLTP -emConfiguration NONE

 

 本文轉自:http://blog.itpub.net/26736162/viewspace-1448220/


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM