dbca -silent建立rac資料庫

eric0435發表於2015-04-17

剛好有一個網友問我,dbca -silent是否能建立rac資料庫,是否能啟用歸檔,下面是測試過程
一.先刪除已經存在的rac資料庫jyrac

ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      5120     4892                0            4892              0             N  BACKUPDG/
MOUNTED  EXTERN  N         512   4096  1048576      5120     4724                0            4724              0             Y  CRSDG/
MOUNTED  EXTERN  N         512   4096  1048576     10240        2                0               2              0             N  DATADG/
ASMCMD> ls -lt
Type           Redund  Striped  Time             Sys  Name
                                                 Y    TEMPFILE/
                                                 Y    PARAMETERFILE/
                                                 Y    ONLINELOG/
                                                 Y    DATAFILE/
                                                 Y    CONTROLFILE/
                                                 N    spfilejyrac.ora => +DATADG/JYRAC/PARAMETERFILE/spfile.268.864825131

[oracle@jyrac1 ~]$ dbca -silent -deleteDatabase -sourceDB jyrac -sysDBAUserName sys -sysDBAPassword system
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/jyrac.log" for further details.
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      5120     4892                0            4892              0             N  BACKUPDG/
MOUNTED  EXTERN  N         512   4096  1048576      5120     4724                0            4724              0             Y  CRSDG/
MOUNTED  EXTERN  N         512   4096  1048576     10240    10138                0           10138              0             N  DATADG/
[root@jyrac1 jyrac]# ps -ef | grep pmon
grid      4185     1  0 Jan26 ?        00:01:59 asm_pmon_+ASM1
root     32023 26194  0 16:57 pts/3    00:00:00 grep pmon

[grid@jyrac2 ~]$ ps -ef | grep pmon
grid      4144     1  0 Jan26 ?        00:02:03 asm_pmon_+ASM2
grid     30617 22435  0 16:57 pts/1    00:00:00 grep pmon

說明rac資料庫jyrac確實已經刪除了,下面以dbca -silent模式來建立rac資料庫jyrac

二.使用dbca -silent來建立rac資料庫jyrac,並使用-initParams引數設定歸檔目錄,使用-nodeinfo來指定rac節點,但-nodeinfo引數在dbca的幫助資訊中並沒有顯示。

[oracle11@oracle11g ~]$ 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 
                        -dbsnmpPassword 
                        -sysmanPassword 
                        [-hostUserName 
                         -hostUserPassword 
                         -backupSchedule ]
                        [-centralAgent ]]
                [-disableSecurityConfiguration 
                [-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 ]]

Configure a database by specifying the following parameters:
        -configureDatabase
                -sourceDB    
                [-sysDBAUserName     
                 -sysDBAPassword     ]
                [-registerWithDirService|-unregisterWithDirService|-regenerateDBPassword 
                        -dirServiceUserName    
                        -dirServicePassword    
                        -walletPassword    ]
                [-disableSecurityConfiguration 
                [-enableSecurityConfiguration 
                [-emConfiguration 
                        -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

下面建立rac資料庫jyrac,使用-initParams引數設定了歸檔目錄為+backupdg/,節點為jyrac1,jyrac2

[oracle@jyrac1 ~]$ dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbname jyrac  -sid jyrac -datafileDestination 'datadg/' -redoLogFileSize 50 -recoveryAreaDestination 'datadg/' -storageType ASM -asmsnmpPassword system  -diskGroupName 'datadg' -responseFile NO_VALUE -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -automaticMemoryManagement true -totalMemory 500 -initParams log_archive_dest_1='location=+backupdg/' -nodeinfo jyrac1,jyrac2
Enter SYS user password:

Enter SYSTEM user password:

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/jyrac/jyrac.log" for further details.

三.檢查資料庫狀態

[root@jyrac1 ~]# ps -ef | grep pmon
grid      4185     1  0 Jan26 ?        00:01:59 asm_pmon_+ASM1
oracle    6545     1  0 17:33 ?        00:00:00 ora_pmon_jyrac1
root      7059  6061  0 17:36 pts/4    00:00:00 grep pmon
[grid@jyrac2 ~]$  ps -ef | grep pmon
grid      4144     1  0 Jan26 ?        00:02:03 asm_pmon_+ASM2
oracle    6320     1  0 17:34 ?        00:00:00 ora_pmon_jyrac2
grid      6756 22435  0 17:36 pts/1    00:00:00 grep pmon

[grid@jyrac2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.BACKUPDG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.CRSDG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.DATADG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.asm
               ONLINE  ONLINE       jyrac1                   Started
               ONLINE  ONLINE       jyrac2                   Started
ora.gsd
               OFFLINE OFFLINE      jyrac1
               OFFLINE OFFLINE      jyrac2
ora.net1.network
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.ons
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.registry.acfs
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac2
ora.cvu
      1        ONLINE  ONLINE       jyrac2
ora.jyrac.db
      1        ONLINE  ONLINE       jyrac1                   Open
      2        ONLINE  ONLINE       jyrac2                   Open
ora.jyrac1.vip
      1        ONLINE  ONLINE       jyrac1
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2
ora.oc4j
      1        ONLINE  ONLINE       jyrac2
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac2


[grid@jyrac2 ~]$ srvctl status database -d jyrac
Instance jyrac1 is running on node jyrac1
Instance jyrac2 is running on node jyrac2

[grid@jyrac2 ~]$ srvctl config database -d jyrac
Database unique name: jyrac
Database name: jyrac
Oracle home: /u01/app/oracle/product/11.2.0/db
Oracle user: oracle
Spfile: +DATADG/jyrac/spfilejyrac.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: jyrac
Database instances: jyrac1,jyrac2
Disk Groups: DATADG
Mount point paths:
Services:
Type: RAC
Database is administrator managed

[grid@jyrac2 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-APR-2015 17:39:01

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:15
Uptime                    81 days 6 hr. 50 min. 46 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/jyrac2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.154)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "jyrac" has 1 instance(s).
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 1 instance(s).
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
The command completed successfully

[grid@jyrac2 ~]$ lsnrctl status listener_scan1

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-APR-2015 17:39:33

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:10
Uptime                    81 days 6 hr. 51 min. 23 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/product/11.2.0/crs/log/diag/tnslsnr/jyrac2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.159)(PORT=1521)))
Services Summary...
Service "jyrac" has 2 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 2 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@jyrac1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 17-APR-2015 17:39:08

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:32
Uptime                    81 days 6 hr. 50 min. 36 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/jyrac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.153)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "DBUA4235414" has 1 instance(s).
  Instance "DBUA4235414", status BLOCKED, has 1 handler(s) for this service...
Service "jyrac" has 1 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 1 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@jyrac1 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 17 17:40:53 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
jyrac1

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            +BACKUPDG
Oldest online log sequence     4
Current log sequence           5

[oracle@jyrac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Fri Apr 17 17:40:35 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> select instance_name from v$instance;

INSTANCE_NAME
----------------
jyrac2

SQL> archive log list;
Database log mode              No Archive Mode
Automatic archival             Disabled
Archive destination            +BACKUPDG
Oldest online log sequence     1
Current log sequence           1

資料庫雖然指定了歸檔目錄,但是沒有啟動歸檔。

四.使用dbca -silent方式建立rac資料庫的使用示例,更詳細資訊請閱讀Real Application Clusters Installation Guide

Using DBCA Noninteractive (Silent) Configuration for Oracle RAC

You can perform a noninteractive, or "silent" configuration of Oracle RAC using DBCA. To perform a silent configuration, you must have completed an Oracle Clusterware installation, run the root.sh script from the Oracle Database or Oracle ASM homes, and defined the Oracle home and ASM home directory environment variables.

The following command syntax creates an ASM instance and one disk group:

# su oracle -c "$ORA_ASM_HOME/bin/dbca -silent -configureASM -gdbName NO -sid NO -emConfiguration NONE -diskList ASM_Disks -diskGroupName ASM_Group_Name -datafileJarLocation $ORACLE_HOME/assistants/dbca/templates -nodeinfo $NODE1,$NODE2 -obfuscatedPasswords false -asmSysPassword My_ASM_password -redundancy ASM_redundancy"

In the preceding syntax example:

ASM_Disks represent disk addresses, such as /dev/sda1,/dev/sdb1
ASM_Group_Name represents the name of an ASM disk group
ASM_ Redundancy represents an ASM disk redundancy setting, such as 'NORMAL'.
My_ASM_password represents the ASM SYS user password.
The following command syntax creates an Oracle RAC database on an existing ASM disk group, where the cluster nodes are node1 and node2, and where the disk group name is ASMgrp1, the passwords are my_password, and the ASM SYS password is My_ASM_Password:

# su oracle -c "$ORACLE_HOME/bin/dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName $DBNAME -sid $SID -sysPassword my_password -systemPassword my_password -sysmanPassword my_password -dbsnmpPassword my_password -emConfiguration LOCAL -storageType ASM -diskGroupName ASMgrp1 -datafileJarLocation $ORACLE_HOME/assistants/dbca/templates -nodeinfo node1,node2 -characterset WE8ISO8859P1 -obfuscatedPasswords false -sampleSchema false -asmSysPassword My_ASM_password"

dbca -silent方式可以建立rac資料庫,並指定歸檔目錄,但沒有選項設定歸檔,還是需要執行alter database archivelog來啟動歸檔。網友lhrbest後面透過修改建立資料庫的模板檔案(建立資料庫的模板檔案儲存在$ORACLE_HOME/assistants/dbca/templates目錄中)中的引數 false,將false修改為true就可以完成歸檔,下面是通用目的資料庫模板檔案
[oracle@jyrac1 templates]$ cat General_Purpose.dbc
...省略...
false ...省略...

下面對General_Purpose.dbc檔案建立一份副本並啟用歸檔

[oracle@jyrac1 templates]$ cp General_Purpose.dbc General_Purpose_archivelog.dbc
[oracle@jyrac1 templates]$ vi General_Purpose_archivelog.dbc
...省略...
true ...省略...

再次刪除rac資料庫jyrac

[oracle@jyrac2 ~]$ dbca -silent -deleteDatabase -sourceDB jyrac -sysDBAUserName sys -sysDBAPassword system
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/jyrac.log" for further details.
ASMCMD> lsdg
State    Type    Rebal  Sector  Block       AU  Total_MB  Free_MB  Req_mir_free_MB  Usable_file_MB  Offline_disks  Voting_files  Name
MOUNTED  EXTERN  N         512   4096  1048576      5120     4892                0            4892              0             N  BACKUPDG/
MOUNTED  EXTERN  N         512   4096  1048576      5120     4724                0            4724              0             Y  CRSDG/
MOUNTED  EXTERN  N         512   4096  1048576     10240    10138                0           10138              0             N  DATADG/

[root@jyrac1 jyrac]# ps -ef | grep pmon
grid      4185     1  0 Jan26 ?        00:01:59 asm_pmon_+ASM1
root     32023 26194  0 16:57 pts/3    00:00:00 grep pmon

[grid@jyrac2 ~]$ ps -ef | grep pmon
grid      4144     1  0 Jan26 ?        00:02:03 asm_pmon_+ASM2
grid     30617 22435  0 16:57 pts/1    00:00:00 grep pmon

使用新建立的模板檔案來建立資料庫:

[oracle@jyrac1 templates]$ dbca -silent -createDatabase -templateName General_Purpose_archivelog.dbc -gdbname jyrac  -sid jyrac -datafileDestination 'datadg/' -redoLogFileSize 50 -recoveryAreaDestination 'datadg/' -storageType ASM -asmsnmpPassword system  -diskGroupName 'datadg' -responseFile NO_VALUE -characterset ZHS16GBK -nationalCharacterSet AL16UTF16 -sampleSchema true -automaticMemoryManagement true -totalMemory 500 -initParams log_archive_dest_1='location=+backupdg/' -nodeinfo jyrac1,jyrac2
Enter SYS user password:

Enter SYSTEM user password:

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/jyrac/jyrac0.log" for further details.

檢查資料庫狀態:

[grid@jyrac1 ~]$ ps -ef | grep pmon
grid      4185     1  0 Jan26 ?        00:02:02 asm_pmon_+ASM1
oracle   18015     1  0 18:06 ?        00:00:00 ora_pmon_jyrac1
grid     18377 18077  0 18:08 pts/4    00:00:00 grep pmon

[grid@jyrac2 ~]$ ps -ef | grep pmon
grid      4144     1  0 Jan26 ?        00:02:06 asm_pmon_+ASM2
oracle    8184     1  0 18:07 ?        00:00:00 ora_pmon_jyrac2
grid      8398  7717  0 18:08 pts/2    00:00:00 grep pmon
[grid@jyrac2 ~]$ crsctl stat res -t
--------------------------------------------------------------------------------
NAME           TARGET  STATE        SERVER                   STATE_DETAILS
--------------------------------------------------------------------------------
Local Resources
--------------------------------------------------------------------------------
ora.BACKUPDG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.CRSDG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.DATADG.dg
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.LISTENER.lsnr
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.asm
               ONLINE  ONLINE       jyrac1                   Started
               ONLINE  ONLINE       jyrac2                   Started
ora.gsd
               OFFLINE OFFLINE      jyrac1
               OFFLINE OFFLINE      jyrac2
ora.net1.network
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.ons
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
ora.registry.acfs
               ONLINE  ONLINE       jyrac1
               ONLINE  ONLINE       jyrac2
--------------------------------------------------------------------------------
Cluster Resources
--------------------------------------------------------------------------------
ora.LISTENER_SCAN1.lsnr
      1        ONLINE  ONLINE       jyrac2
ora.cvu
      1        ONLINE  ONLINE       jyrac2
ora.jyrac.db
      1        ONLINE  ONLINE       jyrac1                   Open
      2        ONLINE  ONLINE       jyrac2                   Open
ora.jyrac1.vip
      1        ONLINE  ONLINE       jyrac1
ora.jyrac2.vip
      1        ONLINE  ONLINE       jyrac2
ora.oc4j
      1        ONLINE  ONLINE       jyrac2
ora.scan1.vip
      1        ONLINE  ONLINE       jyrac2
[grid@jyrac2 ~]$ srvctl status database -d jyrac
Instance jyrac1 is running on node jyrac1
Instance jyrac2 is running on node jyrac2

[grid@jyrac2 ~]$ srvctl config database -d jyrac
Database unique name: jyrac
Database name: jyrac
Oracle home: /u01/app/oracle/product/11.2.0/db
Oracle user: oracle
Spfile: +DATADG/jyrac/spfilejyrac.ora
Domain:
Start options: open
Stop options: immediate
Database role: PRIMARY
Management policy: AUTOMATIC
Server pools: jyrac
Database instances: jyrac1,jyrac2
Disk Groups: DATADG
Mount point paths:
Services:
Type: RAC
Database is administrator managed
[grid@jyrac1 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-APR-2015 18:09:58

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:32
Uptime                    83 days 7 hr. 21 min. 25 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/jyrac1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.153)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "DBUA4235414" has 1 instance(s).
  Instance "DBUA4235414", status BLOCKED, has 1 handler(s) for this service...
Service "jyrac" has 1 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 1 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
The command completed successfully

Database is administrator managed

[grid@jyrac2 ~]$ lsnrctl status

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-APR-2015 18:09:54

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:15
Uptime                    83 days 7 hr. 21 min. 40 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/jyrac2/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=127.0.0.1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.154)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM2", status READY, has 1 handler(s) for this service...
Service "jyrac" has 1 instance(s).
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 1 instance(s).
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
The command completed successfully
[grid@jyrac2 ~]$ lsnrctl status listener_scan1

LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 19-APR-2015 18:10:43

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

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=LISTENER_SCAN1)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER_SCAN1
Version                   TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date                26-JAN-2015 10:48:10
Uptime                    83 days 7 hr. 22 min. 33 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/product/11.2.0/crs/network/admin/listener.ora
Listener Log File         /u01/app/product/11.2.0/crs/log/diag/tnslsnr/jyrac2/listener_scan1/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER_SCAN1)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=10.138.130.159)(PORT=1521)))
Services Summary...
Service "jyrac" has 2 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
Service "jyracXDB" has 2 instance(s).
  Instance "jyrac1", status READY, has 1 handler(s) for this service...
  Instance "jyrac2", status READY, has 1 handler(s) for this service...
The command completed successfully

檢查歸檔設定:

[oracle@jyrac1 templates]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Apr 19 18:11:17 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 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            +BACKUPDG
Oldest online log sequence     4
Next log sequence to archive   5
Current log sequence           5

SQL> alter system switch logfile;

System altered.

[oracle@jyrac2 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.4.0 Production on Sun Apr 19 18:11:51 2015

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 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            +BACKUPDG
Oldest online log sequence     1
Next log sequence to archive   2
Current log sequence           2
SQL> alter system switch logfile;

System altered.
ASMCMD> pwd
+backupdg/jyrac/archivelog/2015_04_19
ASMCMD> ls -lt
Type        Redund  Striped  Time             Sys  Name
ARCHIVELOG  UNPROT  COARSE   APR 19 18:00:00  Y    thread_2_seq_2.306.877457527
ARCHIVELOG  UNPROT  COARSE   APR 19 18:00:00  Y    thread_2_seq_1.307.877457191
ARCHIVELOG  UNPROT  COARSE   APR 19 18:00:00  Y    thread_1_seq_5.312.877457503

可以看到確實啟用了歸檔,在執行alter system switch logfile命令後兩個例項都生成了歸檔重做日誌,使用模板來建立資料庫,還是需要仔細閱讀模板檔案中的引數,這裡謝謝網友lhrbest,dbca- silent是可以建立rac資料庫,可以透過-initParams引數設定歸檔目錄,透過修改建立資料庫的模板檔案中archivelogmode引數啟用歸檔。

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

相關文章