【DBCA -SILENT】靜默安裝之rac資料庫安裝

Appleses發表於2016-01-30

DBCA -SILENT】靜默安裝之rac資料庫安裝

 

BLOG文件結構圖

 

wps46BC.tmp 

 

 

之前的相關文章連線:

 

 

之前的文章中介紹了單例項的資料庫靜默安裝方式,今天我們來看看rac資料庫的靜默安裝方式。

 

 

檢視叢集環境是否準備好:

[root@node2 ~]# crsctl check cluster -all

**************************************************************

node1:

CRS-4537: Cluster Ready Services is online

CRS-4529: Cluster Synchronization Services is online

CRS-4533: Event Manager is online

**************************************************************

node2:

CRS-4537: Cluster Ready Services is online

CRS-4529: Cluster Synchronization Services is online

CRS-4533: Event Manager is online

**************************************************************

[root@node2 ~]#

 

 

檢視磁碟組空間:

SQL> select name,state,free_mb,required_mirror_free_mb,usable_file_mb,a.group_number  from v$asm_diskgroup a;

 

NAME                           STATE          FREE_MB REQUIRED_MIRROR_FREE_MB USABLE_FILE_MB GROUP_NUMBER

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

ARCH                           MOUNTED           9142                       0           9142            1

DATA                           MOUNTED          18242                       0          18242            2

OVDISK                         MOUNTED           2703                       0           2703            3

TEST                           MOUNTED            929                       0            929            4

 

檢視節點列表:

 

[root@node2 ~]# olsnodes

node1

node2

[root@node2 ~]#

 

 

修改General_Purpose.dbc 檔案,讓生成的rac庫在歸檔模式:

[oracle@node1 dbca]$ strings $ORACLE_HOME/assistants/dbca/templates/General_Purpose.dbc | grep -i arch

         <archiveLogMode>true</archiveLogMode>

[oracle@node1 dbca]$

 

 

確保以上叢集環境已經搭建好後,開始建立rac資料庫,當然有2種方式可以搭建,個人覺得2種方式都挺方便的,下邊我們分別介紹:

一、 方法一:利用模板檔案來建立

sid:jmrac

檔案磁碟組:data

閃回恢復區:arch

節點:node1node2

 

 

 

[oracle@node1 dbca]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname jmrac  -sid jmrac -sysPassword lhr -systemPassword lhr -datafileDestination 'DATA/' -redoLogFileSize 50 -recoveryAreaDestination 'ARCH/' -storageType ASM -asmsnmpPassword lhr  -diskGroupName 'DATA' -responseFile NO_VALUE -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -automaticMemoryManagement true -totalMemory 500  -nodeinfo node1,node2

 

Copying database files

1% complete

3% complete

9% complete

15% complete

21% complete

27% complete

30% complete

Creating and starting Oracle instance

32% complete

36% complete

40% complete

44% complete

45% complete

48% complete

50% complete

Creating cluster database views

52% complete

70% complete

Completing Database Creation

73% complete

76% complete

85% complete

94% complete

100% complete

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

[oracle@node1 jmrac]$ more /u01/app/oracle/cfgtoollogs/dbca/jmrac/jmrac.log

Copying database files

DBCA_PROGRESS : 1%

DBCA_PROGRESS : 3%

DBCA_PROGRESS : 9%

DBCA_PROGRESS : 15%

DBCA_PROGRESS : 21%

DBCA_PROGRESS : 27%

DBCA_PROGRESS : 30%

Creating and starting Oracle instance

DBCA_PROGRESS : 32%

DBCA_PROGRESS : 36%

DBCA_PROGRESS : 40%

DBCA_PROGRESS : 44%

DBCA_PROGRESS : 45%

DBCA_PROGRESS : 48%

DBCA_PROGRESS : 50%

Creating cluster database views

DBCA_PROGRESS : 52%

DBCA_PROGRESS : 70%

Completing Database Creation

DBCA_PROGRESS : 73%

DBCA_PROGRESS : 76%

DBCA_PROGRESS : 85%

DBCA_PROGRESS : 94%

DBCA_PROGRESS : 100%

Database creation complete. For details check the logfiles at:

/u01/app/oracle/cfgtoollogs/dbca/jmrac.

Database Information:

Global Database Name:jmrac

System Identifier(SID) Prefix:jmrac

[oracle@node1 jmrac]$

 

[oracle@node1 jmrac]$ ORACLE_SID=jmrac1

[oracle@node1 jmrac]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 19 22:00:18 2015

 

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

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

 

SQL> archive log list;

Database log mode             Archive Mode

Automatic archival             Enabled

Archive destination            USE_DB_RECOVERY_FILE_DEST

Oldest online log sequence     4

Next log sequence to archive   5

Current log sequence           5

SQL>

 

SQL> set line 9999

SQL> col HOST_NAME format a10

SQL> select INSTANCE_NAME,HOST_NAME,VERSION,STARTUP_TIME,STATUS,ACTIVE_STATE,INSTANCE_ROLE,DATABASE_STATUS from gv$INSTANCE;

 

INSTANCE_NAME    HOST_NAME  VERSION           STARTUP_T STATUS       ACTIVE_ST INSTANCE_ROLE      DATABASE_STATUS

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

jmrac1           node1      11.2.0.1.0        19-APR-15 OPEN         NORMAL    PRIMARY_INSTANCE   ACTIVE

jmrac2           node2      11.2.0.1.0        19-APR-15 OPEN         NORMAL    PRIMARY_INSTANCE   ACTIVE

 

SQL> select INST_ID,name , open_mode, log_mode,force_logging from gv$database;

 

   INST_ID NAME      OPEN_MODE            LOG_MODE     FOR

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

         1 JMRAC     READ WRITE           ARCHIVELOG   NO

         2 JMRAC     READ WRITE           ARCHIVELOG   NO

 

SQL> show parameter DB_RECOVERY_FILE_DEST

 

NAME                                 TYPE        VALUE

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

db_recovery_file_dest                string      +ARCH

db_recovery_file_dest_size           big integer 3882M

SQL>

 

 

 

---檢視tnslistener資訊

[oracle@node1 dbca]$ cd /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/

[oracle@node1 admin]$ ll

total 12

drwxr-xr-x 2 oracle oinstall 4096 Feb 27  2012 samples

-rw-r--r-- 1 oracle oinstall  187 May  7  2007 shrept.lst

-rw-r----- 1 oracle oinstall  685 Apr 19 22:13 tnsnames.ora

[oracle@node1 admin]$ more tnsnames.ora

# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora

# Generated by Oracle configuration tools.

 

JMRAC =

  (DESCRIPTION =

    (ADDRESS = (PROTOCOL = TCP)(HOST = cluster-SCAN)(PORT = 1521))

    (CONNECT_DATA =

      (SERVER = DEDICATED)

      (SERVICE_NAME = jmrac)

    )

  )

 

[oracle@node1 dbca]$ srvctl status listener

Listener LISTENER is enabled

Listener LISTENER is running on node(s): node1,node2

[oracle@node1 dbca]$

 

說明tns已經自動新增,監聽也已經啟動

 

檢視rac服務:

[root@node2 ~]#  crsctl status resource -t

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

NAME           TARGET  STATE        SERVER                   STATE_DETAILS      

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

Local Resources

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

ora.ARCH.dg

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.DATA.dg

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.LISTENER.lsnr

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.OVDISK.dg

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.TEST.dg

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.asm

               ONLINE  ONLINE       node1                    Started            

               ONLINE  ONLINE       node2                    Started            

ora.eons

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.gsd

               OFFLINE OFFLINE      node1                                       

               OFFLINE OFFLINE      node2                                       

ora.net1.network

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.ons

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

ora.registry.acfs

               ONLINE  ONLINE       node1                                       

               ONLINE  ONLINE       node2                                       

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

Cluster Resources

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

ora.LISTENER_SCAN1.lsnr

      1        ONLINE  ONLINE       node1                                       

ora.db.db

      1        OFFLINE OFFLINE                               Instance Shutdown  

      2        OFFLINE OFFLINE                               Instance Shutdown  

ora.jmrac.db

      1        ONLINE  ONLINE       node1                    Open               

      2        ONLINE  ONLINE       node2                    Open               

ora.node1.vip

      1        ONLINE  ONLINE       node1                                       

ora.node2.vip

      1        ONLINE  ONLINE       node2                                       

ora.oc4j

      1        OFFLINE OFFLINE                                                  

ora.scan1.vip

      1        ONLINE  ONLINE       node1                                       

[root@node2 ~]# crs_stat -t

Name           Type           Target    State     Host       

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

ora.ARCH.dg    ora....up.type ONLINE    ONLINE    node1      

ora.DATA.dg    ora....up.type ONLINE    ONLINE    node1      

ora....ER.lsnr ora....er.type ONLINE    ONLINE    node1      

ora....N1.lsnr ora....er.type ONLINE    ONLINE    node1      

ora.OVDISK.dg  ora....up.type ONLINE    ONLINE    node1      

ora.TEST.dg    ora....up.type ONLINE    ONLINE    node1      

ora.asm        ora.asm.type   ONLINE    ONLINE    node1      

ora.db.db      ora....se.type OFFLINE   OFFLINE              

ora.eons       ora.eons.type  ONLINE    ONLINE    node1      

ora.gsd        ora.gsd.type   OFFLINE   OFFLINE              

ora.jmrac.db   ora....se.type ONLINE    ONLINE    node1      

ora....network ora....rk.type ONLINE    ONLINE    node1      

ora....SM1.asm application    ONLINE    ONLINE    node1      

ora....E1.lsnr application    ONLINE    ONLINE    node1      

ora.node1.gsd  application    OFFLINE   OFFLINE              

ora.node1.ons  application    ONLINE    ONLINE    node1      

ora.node1.vip  ora....t1.type ONLINE    ONLINE    node1      

ora....SM2.asm application    ONLINE    ONLINE    node2      

ora....E2.lsnr application    ONLINE    ONLINE    node2      

ora.node2.gsd  application    OFFLINE   OFFLINE              

ora.node2.ons  application    ONLINE    ONLINE    node2      

ora.node2.vip  ora....t1.type ONLINE    ONLINE    node2      

ora.oc4j       ora.oc4j.type  OFFLINE   OFFLINE              

ora.ons        ora.ons.type   ONLINE    ONLINE    node1      

ora....ry.acfs ora....fs.type ONLINE    ONLINE    node1      

ora.scan1.vip  ora....ip.type ONLINE    ONLINE    node1 

 

[root@node2 ~]# srvctl  status database -d jmrac

Instance jmrac1 is running on node node1

Instance jmrac2 is running on node node2

 

[root@node2 ~]# srvctl config database -d jmrac

Database unique name: jmrac

Database name: jmrac

Oracle home: /u01/app/oracle/product/11.2.0/dbhome_1

Oracle user: oracle

Spfile: +DATA/jmrac/spfilejmrac.ora

Domain:

Start options: open

Stop options: immediate

Database role: PRIMARY

Management policy: AUTOMATIC

Server pools: jmrac

Database instances: jmrac1,jmrac2

Disk Groups: DATA

Services:

Database is administrator managed

[root@node2 ~]#     

 

 

 

二、 方法二:編輯響應檔案

新增檔案$ORACLE_HOME/assistants/dbca/dbca_rac.rsp,內容如下:

[oracle@node1 dbca]$ more $ORACLE_HOME/assistants/dbca/dbca_rac.rsp

[GENERAL]

RESPONSEFILE_VERSION = "11.2.0"

OPERATION_TYPE = "createDatabase"

[CREATEDATABASE]

GDBNAME = "myrac"

SID = "myrac"

NODELIST=node1,node2

TEMPLATENAME = "General_Purpose.dbc"

SYSPASSWORD = "lhr"

SYSTEMPASSWORD = "lhr"

SYSMANPASSWORD = "lhr"

DBSNMPPASSWORD = "lhr"

STORAGETYPE=ASM

DISKGROUPNAME=DATA

ASMSNMP_PASSWORD="lhr"

RECOVERYGROUPNAME=ARCH

CHARACTERSET = "ZHS16GBK"

NATIONALCHARACTERSET= "UTF8"

 

利用響應檔案來建立rac庫:

[oracle@node1 dbca]$ dbca -silent -responseFile $ORACLE_HOME/assistants/dbca/dbca_rac.rsp

Copying database files

1% complete

3% complete

9% complete

15% complete

21% complete

27% complete

30% complete

Creating and starting Oracle instance

32% complete

36% complete

40% complete

44% complete

45% complete

48% complete

50% complete

Creating cluster database views

52% complete

70% complete

Completing Database Creation

73% complete

76% complete

85% complete

94% complete

100% complete

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

[oracle@node1 dbca]$ more /u01/app/oracle/cfgtoollogs/dbca/myrac/myrac.log

Copying database files

DBCA_PROGRESS : 1%

DBCA_PROGRESS : 3%

DBCA_PROGRESS : 9%

DBCA_PROGRESS : 15%

DBCA_PROGRESS : 21%

DBCA_PROGRESS : 27%

DBCA_PROGRESS : 30%

Creating and starting Oracle instance

DBCA_PROGRESS : 32%

DBCA_PROGRESS : 36%

DBCA_PROGRESS : 40%

DBCA_PROGRESS : 44%

DBCA_PROGRESS : 45%

DBCA_PROGRESS : 48%

DBCA_PROGRESS : 50%

Creating cluster database views

DBCA_PROGRESS : 52%

DBCA_PROGRESS : 70%

Completing Database Creation

DBCA_PROGRESS : 73%

DBCA_PROGRESS : 76%

DBCA_PROGRESS : 85%

DBCA_PROGRESS : 94%

DBCA_PROGRESS : 100%

Database creation complete. For details check the logfiles at:

/u01/app/oracle/cfgtoollogs/dbca/myrac.

Database Information:

Global Database Name:myrac

System Identifier(SID) Prefix:myrac

[oracle@node1 dbca]$ ORACLE_SID=myrac1

[oracle@node1 admin]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Sun Apr 19 22:37:08 2015

 

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

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production

With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,

Data Mining and Real Application Testing options

 

SQL> set line 9999

SQL> col HOST_NAME format a10

SQL> select INSTANCE_NAME,HOST_NAME,VERSION,STARTUP_TIME,STATUS,ACTIVE_STATE,INSTANCE_ROLE,DATABASE_STATUS from gv$INSTANCE;

 

INSTANCE_NAME    HOST_NAME  VERSION           STARTUP_T STATUS       ACTIVE_ST INSTANCE_ROLE      DATABASE_STATUS

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

myrac1           node1      11.2.0.1.0        19-APR-15 OPEN         NORMAL    PRIMARY_INSTANCE   ACTIVE

myrac2           node2      11.2.0.1.0        19-APR-15 OPEN         NORMAL    PRIMARY_INSTANCE   ACTIVE

 

SQL> select INST_ID,name , open_mode, log_mode,force_logging from gv$database;

 

   INST_ID NAME      OPEN_MODE            LOG_MODE     FOR

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

         1 MYRAC     READ WRITE           ARCHIVELOG   NO

         2 MYRAC     READ WRITE           ARCHIVELOG   NO

 

SQL>

 

 

 

三、 刪除新建的rac

[oracle@node1 dbca]$ dbca -silent -deleteDatabase -sourceDB  myrac -sysDBAUserName sys -sysDBAPassword lhr

Connecting to database

9% complete

14% complete

19% complete

23% complete

28% complete

33% complete

38% complete

47% complete

Updating network configuration files

48% complete

52% complete

Deleting instances and datafiles

66% complete

80% complete

95% complete

100% complete

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

[oracle@node1 dbca]$

 

 

 

...........................................................................................................................................................................................

本文作者:小麥苗,只專注於資料庫的技術,更注重技術的運用

ITPUB BLOG:http://blog.itpub.net/26736162

本文地址:http://blog.itpub.net/26736162/viewspace-1586352/

本文pdf版:  提取碼:af2d

QQ:642808185 註明:ITPUB的文章標題

<版權所有,文章允許轉載,但須以連結方式註明源地址,否則追究法律責任!>

...........................................................................................................................................................................................

 

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

相關文章