12c 應答方式安裝 (二) 建立cdb+pdb+netca

snowdba發表於2015-03-02
上一篇已經用應答檔案安裝了資料庫軟體,這一篇部落格接著安裝12c新推出的CDB和PDB。

一,配置netca
1. 複製並修改netca配置檔案
[oracle@snow response]$ cp -rp netca.rsp cdb_pdb_netca.rsp

[oracle@snow response]$ vi cdb_pdb_netca.rsp
[GENERAL]
RESPONSEFILE_VERSION="12.1"
CREATE_TYPE="CUSTOM"
[oracle.net.ca]
INSTALLED_COMPONENTS={"server","net8","javavm"}
INSTALL_TYPE=""custom""
LISTENER_NUMBER=1
LISTENER_NAMES={"LISTENER"}
LISTENER_PROTOCOLS={"TCP;1521"}
LISTENER_START=""LISTENER""
NAMING_METHODS={"TNSNAMES","ONAMES","HOSTNAME"}
NSN_NUMBER=1
NSN_NAMES={"EXTPROC_CONNECTION_DATA"}
NSN_SERVICE={"PLSExtProc"}
NSN_PROTOCOLS={"TCP;HOSTNAME;1521"}

2. 確認ORACLE_HOME環境變數已經設定,以便於直接輸入netca -silent ...
oracle@snow response]$ echo $ORACLE_HOME
/u01/app/oracle/product/12.1.0.1/db_1

3. 採用應答檔案配置netca
[oracle@snow response]$ netca -silent -responseFile /home/oracle/orainst/12.1.0.1/database/response/cdb_pdb_netca.rsp

Parsing command line arguments:
Parameter "silent" = true
Parameter "responsefile" = /home/oracle/orainst/12.1.0.1/database/response/cdb_pdb_netca.rsp
Done parsing command line arguments.
Oracle Net Services Configuration:
Configuring Listener:LISTENER
Listener configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/u01/app/oracle/product/12.1.0.1/db_1/bin/lsnrctl start LISTENER
Listener Control complete.
Listener started successfully.
Profile configuration complete.
Oracle Net Services configuration successful. The exit code is 0

4. netca配置完畢,測試一下效果
[oracle@snow response]$ lsnrctl status

LSNRCTL for Linux: Version 12.1.0.1.0 - Production on 02-MAR-2015 07:33:33

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=snow.oracle.com)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 12.1.0.1.0 - Production
Start Date 02-MAR-2015 07:32:28
Uptime 0 days 0 hr. 1 min. 4 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/12.1.0.1/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/snow/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=snow.oracle.com)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
The listener supports no services
The command completed successfully


二,建立cdb+pdb
1. 建立cdb+pdb的應答檔案如下:
[oracle@snow response]$ cat cdb_pdb.rsp
[GENERAL]
RESPONSEFILE_VERSION = "12.1.0"
OPERATION_TYPE = "createDatabase"
[CREATEDATABASE]
GDBNAME = "cdb"
SID = "cdb"
CREATEASCONTAINERDATABASE =true
NUMBEROFPDBS =1
PDBNAME =pdb1
TEMPLATENAME = "General_Purpose.dbc"
STORAGETYPE=FS
CHARACTERSET = "AL32UTF8"
NATIONALCHARACTERSET= "UTF8"
SAMPLESCHEMA=TRUE
[CONFIGUREDATABASE]
SYSDBAUSERNAME = "sys"
SYSMANPASSWORD = "oracle"
DBSNMPPASSWORD = "oracle"
[ADDINSTANCE]
DB_UNIQUE_NAME = "cdb"
NODELIST=
SYSDBAUSERNAME = "sys"
[CREATEPLUGGABLEDATABASE]
SOURCEDB = "cdb"
PDBNAME = "pdb1"

2. 使用應答檔案建立資料庫
這裡有些不足的地方是密碼沒有配置到reponse檔案中,在執行過程中需要手工輸入密碼。
[oracle@snow response]$ dbca -silent -createDatabase -responseFile /home/oracle/orainst/12.1.0.1/database/response/cdb_pdb.rsp
Enter SYS user password:oracle

Enter SYSTEM user password:oracle

Enter PDBADMIN User Password:oracle

Copying database files
1% complete
2% complete
8% complete
13% complete
19% complete
27% complete
Creating and starting Oracle instance
29% complete
32% complete
33% complete
34% complete
38% complete
42% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb/cdb8.log" for further details.


從進度中看出任務並沒有完成,沒有任何關於pdb的輸出,檢視/u01/app/oracle/cfgtoollogs/dbca/cdb/cdb8.log發現一個經典錯誤
[oracle@snow response]$ more /u01/app/oracle/cfgtoollogs/dbca/cdb/cdb8.log

Unique database identifier check passed.

/ has enough space. Required space is 8260 MB , available space is 25210 MB.
File Validations Successful.
Copying database files
DBCA_PROGRESS : 1%
DBCA_PROGRESS : 2%
DBCA_PROGRESS : 8%
DBCA_PROGRESS : 13%
DBCA_PROGRESS : 19%
DBCA_PROGRESS : 27%
Creating and starting Oracle instance
DBCA_PROGRESS : 29%
DBCA_PROGRESS : 32%
DBCA_PROGRESS : 33%
DBCA_PROGRESS : 34%
DBCA_PROGRESS : 38%
DBCA_PROGRESS : 42%
Error in Process: /u01/app/oracle/product/12.1.0.1/db_1/perl/bin/perl
DBCA_PROGRESS : 100%

這個錯誤在圖形安裝cdb時也出現過,是因為perl的問題,採用替換的方式搞定!
該方法我在之前的部落格上有過記錄:http://blog.itpub.net/29047826/viewspace-1434056/
[oracle@snow bin]$ mv perl perl.bak
[oracle@snow bin]$ ln -s /usr/bin/perl .
lrwxrwxrwx 1 oracle oinstall 13 Mar 2 10:28 perl -> /usr/bin/perl

3. 重新執行使用應答檔案建立資料庫
[oracle@snow response]$ dbca -silent -createDatabase -responseFile /home/oracle/orainst/12.1.0.1/database/response/cdb_pdb.rsp
Enter SYS user password:

Enter SYSTEM user password:

Enter PDBADMIN User Password:

Copying database files
1% complete
2% complete
8% complete
13% complete
19% complete
27% complete
Creating and starting Oracle instance
29% complete
32% complete
33% complete
34% complete
38% complete
42% complete
43% complete
45% complete
Completing Database Creation
48% complete
51% complete
53% complete
62% complete
70% complete
72% complete
Creating Pluggable Databases
78% complete
100% complete
Look at the log file "/u01/app/oracle/cfgtoollogs/dbca/cdb/cdb10.log" for further details.

4. 測試一下建立效果
[oracle@snow response]$ sqlplus / as sysdba

SQL*Plus: Release 12.1.0.1.0 Production on Mon Mar 2 10:43:54 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

SQL> show pdbs

CON_ID CON_NAME OPEN MODE RESTRICTED
---------- ------------------------------ ---------- ----------
2 PDB$SEED READ ONLY NO
3 PDB1 READ WRITE NO

到這裡使用應答檔案安裝資料庫軟體、配置netca、建立CDB資料庫和PDB資料庫已經演示完畢。

跟oracle10g相比,12c的response方式複雜了些,而且隨著CDB和PDB的出現,配置安裝更加複雜。想要完全掌握12c的應答方式安裝資料庫需要用些時間多做實驗。因為應答方法不僅可以建立單例項的12c資料庫,也可以建立RAC資料庫。一看到RAC,難度和複雜度就成倍增加了。

生產環境中使用圖形方式DBCA,使用靜默方式呼叫DBCA還是使用CREATE DATABASE方式建立資料庫還是應答方式建立資料庫沒有最好的方法、只有更合適的方法。如果需要快速的部署雲平臺oracle資料庫,應答方式無疑是最佳選擇,簡單快速。只需要互動式配置些引數就可以實現一鍵安裝。

全文完

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

相關文章