虚拟化容器,大数据,DBA,中间件,监控。

在线搭建oracle11g R2 rac+dg

24 03月
作者:admin|分类:DBA运维

在线搭建oracle11g R2 rac+dg

rac1和rac2是现有的rac环境,版本11.2.0.3,rac3为新加来做物理dg的机器(以下称备机)
rac3数据库版本为也11.2.0.3
原rac节点采用asm管理,准备做dg的节点采用文件系统管理
rac1和rac2      db_unique_name=rac
dg节点rac3     db_unique_name=rac_dg

1.查看hosts文件

[oracle@rac3]$ cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.2.9.20  rac1
172.2.9.30  rac2
172.2.9.40  rac3
172.2.9.21  rac1-vip
172.2.9.31  rac2-vip

1.1.1.20    rac1-priv
1.1.1.30    rac2-priv
172.2.9.25  rac-scan

2.在备机上建立一些必须的文件夹

[oracle@rac3 ~]$ mkdir -p $ORACLE_BASE/oradata/rac_dg/datafile
[oracle@rac3 ~]$ mkdir -p $ORACLE_BASE/oradata/rac_dg/tempfile
[oracle@rac3 ~]$ mkdir -p $ORACLE_BASE/oradata/rac_dg/controlfile
[oracle@rac3 ~]$ mkdir -p $ORACLE_BASE/oradata/rac_dg/onlinelog
[oracle@rac3 ~]$ mkdir -p /oracle/product/admin/rac_db/adump
[oracle@rac3 ~]$ mkdir /oracle/archivelog

3.简单起见,每个节点设置一样的tns

[oracle@rac3 admin]$ cat tnsnames.ora
RAC2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac)
      (INSTANCE_NAME = rac2)
    )
  )

RAC1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac)
      (INSTANCE_NAME = rac1)
    )
  )

RAC_DG =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.2.9.40 )(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SID = rac)
    )
  )
RAC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac-scan)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac)
    )
  )

4.在备机建立静态监听

[oracle@rac3 admin]$ cat listener.ora
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = rac)
      (ORACLE_HOME = /oracle/product/11.2.0/db_1)
      (SID_NAME = rac)
    )
  )

LISTENER =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.2.9.40)(PORT = 1521))
  )

ADR_BASE_LISTENER = /oracle/product

5.复制rac节点的密码文件到备机并改名

[oracle@rac1 ~]$ scp /oracle/product/11.2.0/db_1/dbs/orapwrac1 172.2.9.40:/oracle/product/11.2.0/db_1/dbs/.
orapwrac1                                                                                   100% 1536     1.5KB/s   00:00
[oracle@rac1 ~]$

[oracle@rac3 dbs]$ mv orapwrac1 orapwrac_dg
[oracle@rac3 dbs]$ ls -l orapwrac_dg
-rw-r----- 1 oracle dba 1536 Jan 10 01:50 orapwrac_dg
[oracle@rac3 dbs]$

6.更改主库force logging模式

SQL> alter database force logging;

Database altered.

SQL> select force_logging from v$database;

FOR
---
YES

SQL>

7.在主库添加stadnby log,两个线程,每个线程3组日志

SQL> alter database add standby logfile thread 1 group 7  ('+DATA') size 50M;

Database altered.

SQL> alter database add standby logfile thread 1 group 8  ('+DATA') size 50M;

Database altered.

SQL> alter database add standby logfile thread 1 group 9  ('+DATA') size 50M;

Database altered.

SQL> alter database add standby logfile thread 2 group 10  ('+DATA') size 50M;

Database altered.

SQL> alter database add standby logfile thread 2 group 11  ('+DATA') size 50M;

Database altered.

SQL> alter database add standby logfile thread 2 group 12  ('+DATA') size 50M;

Database altered.

SQL>

8.在主库添加dg需要的参数,11g中不需要再添加fal_client参数

SQL> alter system set log_archive_config='dg_config=(rac,rac_dg)';

System altered.

SQL> alter system set log_archive_dest_1='LOCATION=+DATA/rac  valid_for=(all_logfiles,all_roles) db_unique_name=rac';

System altered.

SQL>
SQL> alter system set log_archive_dest_2='SERVICE=RAC_DG LGWR ASYNC NOAFFIRM valid_for=(online_logfiles,primary_role) db_unique_name=rac_dg';

System altered.

SQL>
SQL> alter system set log_archive_dest_state_1='enable' ;

System altered.

SQL> alter system set log_archive_dest_state_2='enable';

System altered.

SQL> alter system set fal_server='rac_dg';

System altered.

9.在备库启动监听

[oracle@rac3 dbs]$ lsnrctl start

LSNRCTL for Linux: Version 11.2.0.3.0 - Production on 10-JAN-2014 09:09:07

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

Starting /oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 11.2.0.3.0 - Production
System parameter file is /oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /oracle/product/diag/tnslsnr/rac3/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.2.9.40)(PORT=1521)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=172.2.9.40)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 11.2.0.3.0 - Production
Start Date                10-JAN-2014 09:09:07
Uptime                    0 days 0 hr. 0 min. 1 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File         /oracle/product/diag/tnslsnr/rac3/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=172.2.9.40)(PORT=1521)))
Services Summary...
Service "rac_dg" has 1 instance(s).
  Instance "rac_dg", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@rac3 dbs]$

10.主库上tnsping测试

[oracle@rac1 ~]$ tnsping rac_dg

TNS Ping Utility for Linux: Version 11.2.0.3.0 - Production on 06-JAN-2014 20:08:49

Copyright (c) 1997, 2011, Oracle.  All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.2.9.40)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SID = rac_dg)))
OK (10 msec)
[oracle@rac1 ~]$

11.启动备库到nomount模式,手动新建pfile,里面就写一行db_name

[oracle@rac3 dbs]$ cat initrac_dg.ora
db_name=rac_dg
[oracle@rac3 dbs]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 10 09:07:32 2014

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

Connected to an idle instance.

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  250560512 bytes
Fixed Size                  2227256 bytes
Variable Size             192938952 bytes
Database Buffers           50331648 bytes
Redo Buffers                5062656 bytes
SQL>

12. 11g中使用duplicate 来建立备库,配置如下:

[oracle@rac1 ~]$ cat duplicate.rman
duplicate target database for standby from active database nofilenamecheck
spfile
parameter_value_convert 'rac','rac_dg','RAC','RAC_DG'
set db_unique_name='rac_dg'
set db_file_name_convert='+DATA/rac','/oracle/product/oradata/rac_dg','+DATA/rac/tempfile','/oracle/product/oradata/rac_dg'
set log_file_name_convert='+DATA/rac','/oracle/product/oradata/rac_dg'
set control_files='/oracle/product/oradata/rac_dg/controlfile/control01.ctl','/oracle/product/oradata/rac_dg/controlfile/control02.ctl'
set db_create_online_log_dest_1='/oracle/product/oradata/rac_dg'
set log_archive_max_processes='5'
set LOG_ARCHIVE_FORMAT='log%t_%s_%r.arc'
set REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'
set fal_server='rac'
set cluster_database='false'
set db_create_file_dest='/oracle/product/oradata/rac_dg'
set standby_file_management='AUTO'
set log_archive_config='dg_config=(rac,rac_dg)'
set log_archive_dest_2='service=RAC  LGWR ASYNC NOAFFIRM valid_for=(online_logfiles,primary_role) db_unique_name=rac'
set log_archive_dest_1='LOCATION=/oracle/archivelog  valid_for=(all_logfiles,all_roles) db_unique_name=rac_dg'
set audit_file_dest ='/oracle/product/admin/rac_db/adump'
set diagnostic_dest='/oracle/product'
reset REMOTE_LISTENER
reset local_listener
;
[oracle@rac1 ~]$

13.开始创建备库:

[oracle@rac1 ~]$ rman target / auxiliary sys/oracle@rac_dg

Recovery Manager: Release 11.2.0.3.0 - Production on Mon Jan 6 17:23:56 2014

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

connected to target database: RAC (DBID=2423187070)
connected to auxiliary database: RAC_DG (not mounted)

RMAN> @duplicate.rman

RMAN> duplicate target database for standby from active database nofilenamecheck
2> spfile
3> parameter_value_convert 'rac','rac_dg','RAC','RAC_DG'
4> set db_unique_name='rac_dg'
5> set db_file_name_convert='+DATA/rac','/oracle/product/oradata/rac_dg','+DATA/rac/tempfile','/oracle/product/oradata/rac_dg'
6> set log_file_name_convert='+DATA/rac','/oracle/product/oradata/rac_dg'
7> set control_files='/oracle/product/oradata/rac_dg/controlfile/control01.ctl','/oracle/product/oradata/rac_dg/controlfile/control02.ctl'
8> set db_create_online_log_dest_1='/oracle/product/oradata/rac_dg'
9> set log_archive_max_processes='5'
10> set LOG_ARCHIVE_FORMAT='log%t_%s_%r.arc'
11> set REMOTE_LOGIN_PASSWORDFILE='EXCLUSIVE'
12> set fal_server='rac'
13> set cluster_database='false'
14> set db_create_file_dest='/oracle/product/oradata/rac_dg'
15> set standby_file_management='AUTO'
16> set log_archive_config='dg_config=(rac,rac_dg)'
17> set log_archive_dest_2='service=RAC  LGWR ASYNC NOAFFIRM valid_for=(online_logfiles,primary_role) db_unique_name=rac'
18> set log_archive_dest_1='LOCATION=/oracle/archivelog  valid_for=(all_logfiles,all_roles) db_unique_name=rac_dg'
19> set audit_file_dest ='/oracle/product/admin/rac_db/adump'
20> set diagnostic_dest='/oracle/product'
21> reset REMOTE_LISTENER
22> reset local_listener
23> ;
Starting Duplicate Db at 06-JAN-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=171 device type=DISK

contents of Memory Script:
{
   backup as copy reuse
   targetfile  '/oracle/product/11.2.0/db_1/dbs/orapwrac1' auxiliary format
 '/oracle/product/11.2.0/db_1/dbs/orapwrac_dg'   targetfile
 '+DATA/rac/spfilerac.ora' auxiliary format
 '/oracle/product/11.2.0/db_1/dbs/spfilerac_dg.ora'   ;
   sql clone "alter system set spfile= ''/oracle/product/11.2.0/db_1/dbs/spfilerac_dg.ora''";
}
executing Memory Script

Starting backup at 06-JAN-14
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=154 instance=rac1 device type=DISK
Finished backup at 06-JAN-14

sql statement: alter system set spfile= ''/oracle/product/11.2.0/db_1/dbs/spfilerac_dg.ora''

contents of Memory Script:
{
   sql clone "alter system set  dispatchers =
 ''(PROTOCOL=TCP) (SERVICE=rac_dgXDB)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_unique_name =
 ''rac_dg'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_file_name_convert =
 ''+DATA/rac'', ''/oracle/product/oradata/rac_dg'', ''+DATA/rac/tempfile'', ''/oracle/product/oradata/rac_dg'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_file_name_convert =
 ''+DATA/rac'', ''/oracle/product/oradata/rac_dg'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''/oracle/product/oradata/rac_dg/controlfile/control01.ctl'', ''/oracle/product/oradata/rac_dg/controlfile/control02.ctl'' comment=
 '''' scope=spfile";
   sql clone "alter system set  db_create_online_log_dest_1 =
 ''/oracle/product/oradata/rac_dg'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_max_processes =
 5 comment=
 '''' scope=spfile";
   sql clone "alter system set  LOG_ARCHIVE_FORMAT =
 ''log%t_%s_%r.arc'' comment=
 '''' scope=spfile";
   sql clone "alter system set  REMOTE_LOGIN_PASSWORDFILE =
 ''EXCLUSIVE'' comment=
 '''' scope=spfile";
   sql clone "alter system set  fal_server =
 ''rac'' comment=
 '''' scope=spfile";
   sql clone "alter system set  cluster_database =
 false comment=
 '''' scope=spfile";
   sql clone "alter system set  db_create_file_dest =
 ''/oracle/product/oradata/rac_dg'' comment=
 '''' scope=spfile";
   sql clone "alter system set  standby_file_management =
 ''AUTO'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_config =
 ''dg_config=(rac,rac_dg)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_2 =
 ''service=RAC  LGWR ASYNC NOAFFIRM valid_for=(online_logfiles,primary_role) db_unique_name=rac'' comment=
 '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_1 =
 ''LOCATION=/oracle/archivelog  valid_for=(all_logfiles,all_roles) db_unique_name=rac_dg'' comment=
 '''' scope=spfile";
   sql clone "alter system set  audit_file_dest =
 ''/oracle/product/admin/rac_db/adump'' comment=
 '''' scope=spfile";
   sql clone "alter system set  diagnostic_dest =
 ''/oracle/product'' comment=
 '''' scope=spfile";
   sql clone "alter system reset  REMOTE_LISTENER scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script

sql statement: alter system set  dispatchers =  ''(PROTOCOL=TCP) (SERVICE=rac_dgXDB)'' comment= '''' scope=spfile

sql statement: alter system set  db_unique_name =  ''rac_dg'' comment= '''' scope=spfile

sql statement: alter system set  db_file_name_convert =  ''+DATA/rac'', ''/oracle/product/oradata/rac_dg'', ''+DATA/rac/tempfile'', ''/oracle/product/oradata/rac_dg'' comment= '''' scope=spfile

sql statement: alter system set  log_file_name_convert =  ''+DATA/rac'', ''/oracle/product/oradata/rac_dg'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/oracle/product/oradata/rac_dg/controlfile/control01.ctl'', ''/oracle/product/oradata/rac_dg/controlfile/control02.ctl'' comment= '''' scope=spfile

sql statement: alter system set  db_create_online_log_dest_1 =  ''/oracle/product/oradata/rac_dg'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_max_processes =  5 comment= '''' scope=spfile

sql statement: alter system set  LOG_ARCHIVE_FORMAT =  ''log%t_%s_%r.arc'' comment= '''' scope=spfile

sql statement: alter system set  REMOTE_LOGIN_PASSWORDFILE =  ''EXCLUSIVE'' comment= '''' scope=spfile

sql statement: alter system set  fal_server =  ''rac'' comment= '''' scope=spfile

sql statement: alter system set  cluster_database =  false comment= '''' scope=spfile

sql statement: alter system set  db_create_file_dest =  ''/oracle/product/oradata/rac_dg'' comment= '''' scope=spfile

sql statement: alter system set  standby_file_management =  ''AUTO'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_config =  ''dg_config=(rac,rac_dg)'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_2 =  ''service=RAC  LGWR ASYNC NOAFFIRM valid_for=(online_logfiles,primary_role) db_unique_name=rac'' comment= '''' scope=spfile

sql statement: alter system set  log_archive_dest_1 =  ''LOCATION=/oracle/archivelog  valid_for=(all_logfiles,all_roles) db_unique_name=rac_dg'' comment= '''' scope=spfile

sql statement: alter system set  audit_file_dest =  ''/oracle/product/admin/rac_db/adump'' comment= '''' scope=spfile

sql statement: alter system set  diagnostic_dest =  ''/oracle/product'' comment= '''' scope=spfile

sql statement: alter system reset  REMOTE_LISTENER scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     379965440 bytes

Fixed Size                     2228584 bytes
Variable Size                125832856 bytes
Database Buffers             247463936 bytes
Redo Buffers                   4440064 bytes

contents of Memory Script:
{
   backup as copy current controlfile for standby auxiliary format  '/oracle/product/oradata/rac_dg/controlfile/control01.ctl';
   restore clone controlfile to  '/oracle/product/oradata/rac_dg/controlfile/control02.ctl' from
 '/oracle/product/oradata/rac_dg/controlfile/control01.ctl';
}
executing Memory Script

Starting backup at 06-JAN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/oracle/product/11.2.0/db_1/dbs/snapcf_rac1.f tag=TAG20140106T172431 RECID=10 STAMP=836155474
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 06-JAN-14

Starting restore at 06-JAN-14
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=133 device type=DISK

channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 06-JAN-14

contents of Memory Script:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script

sql statement: alter database mount standby database

contents of Memory Script:
{
   set newname for tempfile  1 to
 "/oracle/product/oradata/rac_dg/tempfile/temp.263.835205191";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/oracle/product/oradata/rac_dg/datafile/system.256.835204783";
   set newname for datafile  2 to
 "/oracle/product/oradata/rac_dg/datafile/sysaux.257.835204787";
   set newname for datafile  3 to
 "/oracle/product/oradata/rac_dg/datafile/undotbs1.258.835204789";
   set newname for datafile  4 to
 "/oracle/product/oradata/rac_dg/datafile/users.259.835204789";
   set newname for datafile  5 to
 "/oracle/product/oradata/rac_dg/datafile/undotbs2.264.835206427";
   set newname for datafile  6 to
 "/oracle/product/oradata/rac_dg/datafile/undotbs3.268.835983745";
   backup as copy reuse
   datafile  1 auxiliary format
 "/oracle/product/oradata/rac_dg/datafile/system.256.835204783"   datafile
 2 auxiliary format
 "/oracle/product/oradata/rac_dg/datafile/sysaux.257.835204787"   datafile
 3 auxiliary format
 "/oracle/product/oradata/rac_dg/datafile/undotbs1.258.835204789"   datafile
 4 auxiliary format
 "/oracle/product/oradata/rac_dg/datafile/users.259.835204789"   datafile
 5 auxiliary format
 "/oracle/product/oradata/rac_dg/datafile/undotbs2.264.835206427"   datafile
 6 auxiliary format
 "/oracle/product/oradata/rac_dg/datafile/undotbs3.268.835983745"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /oracle/product/oradata/rac_dg/tempfile/temp.263.835205191 in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 06-JAN-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/rac/datafile/system.256.835204783
output file name=/oracle/product/oradata/rac_dg/datafile/system.256.835204783 tag=TAG20140106T172450
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:16
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/rac/datafile/sysaux.257.835204787
output file name=/oracle/product/oradata/rac_dg/datafile/sysaux.257.835204787 tag=TAG20140106T172450
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:56
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/rac/datafile/undotbs1.258.835204789
output file name=/oracle/product/oradata/rac_dg/datafile/undotbs1.258.835204789 tag=TAG20140106T172450
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:15
channel ORA_DISK_1: starting datafile copy
input datafile file number=00006 name=+DATA/rac/datafile/undotbs3.268.835983745
output file name=/oracle/product/oradata/rac_dg/datafile/undotbs3.268.835983745 tag=TAG20140106T172450
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/rac/datafile/undotbs2.264.835206427
output file name=/oracle/product/oradata/rac_dg/datafile/undotbs2.264.835206427 tag=TAG20140106T172450
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/rac/datafile/users.259.835204789
output file name=/oracle/product/oradata/rac_dg/datafile/users.259.835204789 tag=TAG20140106T172450
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 06-JAN-14

sql statement: alter system archive log current

contents of Memory Script:
{
   switch clone datafile all;
}
executing Memory Script

datafile 1 switched to datafile copy
input datafile copy RECID=10 STAMP=836475355 file name=/oracle/product/oradata/rac_dg/datafile/system.256.835204783
datafile 2 switched to datafile copy
input datafile copy RECID=11 STAMP=836475355 file name=/oracle/product/oradata/rac_dg/datafile/sysaux.257.835204787
datafile 3 switched to datafile copy
input datafile copy RECID=12 STAMP=836475355 file name=/oracle/product/oradata/rac_dg/datafile/undotbs1.258.835204789
datafile 4 switched to datafile copy
input datafile copy RECID=13 STAMP=836475355 file name=/oracle/product/oradata/rac_dg/datafile/users.259.835204789
datafile 5 switched to datafile copy
input datafile copy RECID=14 STAMP=836475355 file name=/oracle/product/oradata/rac_dg/datafile/undotbs2.264.835206427
datafile 6 switched to datafile copy
input datafile copy RECID=15 STAMP=836475355 file name=/oracle/product/oradata/rac_dg/datafile/undotbs3.268.835983745
Finished Duplicate Db at 06-JAN-14

RMAN> **end-of-file**

RMAN>

13.创建完成,更改备库pfile参数,先创建pfile,然后更改完重新创建spfile

SQL> create pfile from spfile;

File created.

14.去掉原来rac节点的参数,请根据实际需要更改,下面示例如下:

[oracle@rac3 dbs]$ cat initrac_dg.ora
rac_dg.__db_cache_size=247463936
rac_dg.__java_pool_size=4194304
rac_dg.__large_pool_size=4194304
rac_dg.__oracle_base='/oracle/product'#ORACLE_BASE set from environment
rac_dg.__pga_aggregate_target=130023424
rac_dg.__sga_target=381681664
rac_dg.__shared_io_pool_size=0
rac_dg.__shared_pool_size=113246208
rac_dg.__streams_pool_size=0
*.audit_file_dest='/oracle/product/admin/rac_db/adump'
*.audit_trail='db'
*.cluster_database=FALSE
*.compatible='11.2.0.0.0'
*.control_files='/oracle/product/oradata/rac_dg/controlfile/control01.ctl','/oracle/product/oradata/rac_dg/controlfile/control02.ctl'
*.db_block_size=8192
*.db_create_file_dest='/oracle/product/oradata/rac_dg'
*.db_create_online_log_dest_1='/oracle/product/oradata/rac_dg'
*.db_domain=''
*.db_file_name_convert='+DATA/rac','/oracle/product/oradata/rac_dg','+DATA/rac/tempfile','/oracle/product/oradata/rac_dg'
*.db_name='rac'
*.db_unique_name='rac_dg'
*.diagnostic_dest='/oracle/product'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=rac_dgXDB)'
*.fal_server='rac'
*.log_archive_config='dg_config=(rac,rac_dg)'
*.log_archive_dest_1='LOCATION=/oracle/archivelog  valid_for=(all_logfiles,all_roles) db_unique_name=rac_dg'
*.log_archive_dest_2='service=RAC  LGWR ASYNC NOAFFIRM valid_for=(online_logfiles,primary_role) db_unique_name=rac'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='enable'
*.log_archive_format='log%t_%s_%r.arc'
*.log_archive_max_processes=5
*.log_file_name_convert='+DATA/rac','/oracle/product/oradata/rac_dg'
*.open_cursors=300
*.pga_aggregate_target=126877696
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=380633088
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'

15.关闭数据库重新创建spfile再启动

SQL> shutdown immediate;
ORA-01109: database not open

Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile;

File created.

SQL> startup
ORACLE instance started.

Total System Global Area  379965440 bytes
Fixed Size                  2228584 bytes
Variable Size             125832856 bytes
Database Buffers          247463936 bytes
Redo Buffers                4440064 bytes
Database mounted.
Database opened.
SQL>

16.启动Redo实时应用

SQL> alter database recover managed standby database using current logfile disconnect from session;

System altered.

17.简单测试
主库新建表:

[oracle@rac2 admin]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Mon Jan 6 17:46:36 2014

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

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

SQL> create table ty3(id int);

Table created.

备库查看:

[oracle@rac3 ~]$ sqlplus / as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Fri Jan 10 10:36:44 2014

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

Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

SQL> desc ty3;
ERROR:
ORA-04043: object ty3 does not exist

SQL> desc ty3;
 Name                                      Null?    Type
 ----------------------------------------- -------- ----------------------------
 ID                                                 NUMBER(38)
浏览1930 评论0
返回
目录
返回
首页
oracle 10g rac 存储迁移 oracle单个文件误删在线恢复