【rac】實驗二:增加控制檔案

不一樣的天空w發表於2016-11-09

1. 準備工作
1.1. 檢視當前控制檔案數量及位置、名稱
1) 方法一:

[oracle@node2 ~]$ sqlplus  / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 07:53:57 2016

 

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

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

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

Data Mining and Real Application Testing options

 

SYS@PROD1>show parameter control_files

 

NAME                                 TYPE        VALUE

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

control_files       string      +DATA/prod/controlfile/current

                                    .256.926241707, +FRA/prod/cont                                                 rolfile/current.256.926241707

2)方法二:

[grid@node2 ~]$ asmcmd

ASMCMD>

ASMCMD> cd data/prod/controlfile

ASMCMD> ls

Current.256.926241707

 

1.2. 關閉資料庫並將一個節點啟動到 nomount

[grid@node2 ~]$ srvctl stop database -d prod -o immediate;

[grid@node2 ~]$

[oracle@node2 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 08:09:57 2016

 

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

 

Connected to an idle instance.

 

SYS@PROD1>startup nomount;

ORACLE instance started.

 

Total System Global Area  849530880 bytes

Fixed Size                  1339824 bytes

Variable Size             562040400 bytes

Database Buffers          281018368 bytes

Redo Buffers                5132288 bytes

SYS@PROD1>

 

1.3. 備份引數檔案( 可選
在做引數調整的時候,最好備份一下引數檔案,如果出現問題便於回退。在其中一個節點做備份即可。

[oracle@node2 dbs]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 08:13:51 2016

 

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

 

Connected to an idle instance.

 

SYS@PROD1>create pfile='/home/oracle/initPROD1.ora' from spfile;

 

File created.

 

2. 建立控制檔案
2.1. 利用 RMAN 完成建立
在一個節點完成操作即可。 另:控制檔案的名稱要以實驗環境實際的名稱為準

[oracle@node2 dbs]$ rman target /

 

Recovery Manager: Release 11.2.0.1.0 - Production on Thu Oct 27 08:16:33 2016

 

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

 

connected to target database: PROD (not mounted)

 

RMAN>  restore controlfile to '+DATA' from '+DATA/PROD/controlfile/current.256.926241707';

 

Starting restore at 27-OCT-16

using target database control file instead of recovery catalog

allocated channel: ORA_DISK_1

channel ORA_DISK_1: SID=33 instance=PROD1 device type=DISK

 

channel ORA_DISK_1: copied control file copy

Finished restore at 27-OCT-16

 

2.2. 確認已生成的控制檔案

[grid@node2 ~]$ asmcmd

ASMCMD> cd data/prod/controlfile

ASMCMD> pwd

+data/prod/controlfile

ASMCMD> ls

Current.256.926241707

current.268.926324431

ASMCMD>

 

3. 修改引數檔案
3.1. 修改引數檔案, 使其新增控制檔案生效
此時 1 節點應該在 nomout 狀態下, 在此節點完成修改即可。

[oracle@node2 dbs]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 08:29:33 2016

 

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

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

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

Data Mining and Real Application Testing options

 

SYS@PROD1>select inst_id,host_name,status from gv$instance;

 

   INST_ID   HOST_NAME      STATUS

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

     1       node2           STARTED

 

SYS@PROD1> alter system set control_files='+DATA/prod/controlfile/current.256.926241707','+FRA/prod/controlfile/current.256.926241707','+DATA/prod/controlfile/current.268.926324431' scope=spfile;

 

System altered.

 

SYS@PROD1>shutdown immediate

Database closed.

Database dismounted.

ORACLE instance shut down.

SYS@PROD1>

 

3.2. 啟動資料庫

[oracle@node2 ~]$ srvctl start database -d prod

[oracle@node2 ~]$

 

3.3. 驗證
一節點:

[oracle@node2 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 09:50:19 2016

 

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

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

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

Data Mining and Real Application Testing options

 

SYS@PROD1>show parameter control_files

 

NAME                                 TYPE        VALUE

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

control_files                        string      +DATA/prod/controlfile/current

                                                 .256.926241707, +FRA/prod/cont

                                                 rolfile/current.256.926241707,

                                                  +DATA/prod/controlfile/curren

                                                 t.268.926324431

SYS@PROD1>

 

二節點:

[oracle@node1 ~]$ sqlplus / as sysdba

 

SQL*Plus: Release 11.2.0.1.0 Production on Thu Oct 27 09:51:16 2016

 

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

 

 

Connected to:

Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production

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

Data Mining and Real Application Testing options

 

SYS@PROD2>show parameter control_files

 

NAME                                 TYPE        VALUE

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

control_files                        string      +DATA/prod/controlfile/current

                                                 .256.926241707, +FRA/prod/cont

                                                 rolfile/current.256.926241707,

                                                  +DATA/prod/controlfile/curren

                                                 t.268.926324431

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

相關文章