【dataguard】使用deplicate创建异机的dataguard

版本:11gr2  环境:linux

实施dg的方法有很多种,这里介绍使用oracle提供的deplicate复制功能建立异机的dg的方法。对于备库安装和主库一样路径的软件和数据存放结构。配置参数文件,监听文件,启动到nomount状态后,就可以在主库上使用rman进行建立dg!

一前期准备工作
---对于主库:
1 开启归档功能
shutdown normal
shutdown immediate
startup mount
alter database archivelog;
alter database open;
--设置归档路径
alter system set log_archive_format = "archive_%t_%s_%r.log" scope=spfile;
alter system set log_archive_dest_1='LOCATION=/home/opt/oracle/archive_log';
alter database force logging;
2 拷贝源库的密码文件到备库主机和主机的一样的路径。
3 修改spfile参数文件。

db_name=yangql
alter system set db_unique_name=yangql scope=spfile;
alter system set log_archive_config='dg_config=(yangql,yangqldg)' scope=both;
alter system set log_archive_dest_1='LOCATION=/home/opt/oracle/archive_log' scope=both;
alter system set log_archive_dest_2='SERVICE=yangqldg LGWR ASYN VALID_FOR=(ALL_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=yangqldg' scope=both;
alter system set log_archive_dest_state_1=enable scope=both;
alter system set log_archive_dest_state_2=enable scope=both;
alter system set remote_login_passwordfile=exclusive scope=spfile;
alter system set log_archive_format=%t_%s_%r.arc scope=spfile;
alter system set log_archive_max_processes=30 scope=spfile;
alter system set FAL_SERVER=yangqldg scope=both;
alter system set FAL_CLIENT=yangql scope=both;
ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT =AUTO SCOPE=both;
4 修改listener.ora  tnames.ora文件
---listener.ora
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = pre_publish)(PORT = 1521))
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = yangql)
      (ORACLE_HOME = /home/opt/oracle/products/11.2.0)
      (SID_NAME = yangql)
    )
  )

----tnsnames.ora-----
yangql =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.112.230)(PORT = 1521))
    )
    (CONNECT_DATA =
      (server = dedicated)
      (service_name = yangql)
    )
  )


yangqldg =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.87.199)(PORT = 1521))
    )
    (CONNECT_DATA =
      (server = dedicated)
      (service_name = yangql)
    )
  )
----备库操作

---备库的参数文件yangqldg.ora中关于dg的部分内容----
db_name=yangql
db_unique_name=yangqldg
log_archive_config='db_config=(yangqldg,yangql)'
log_archive_dest_1='LOCATION=/home/opt/oracle/archive_log'
log_archive_dest_2='SERVICE=yangql LGWR ASYN VALID_FOR=(ALL_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=yangql'
log_archive_dest_state_1=enable
log_archive_dest_state_2=enable/defer
remote_login_passwordfile=exclusive
log_archive_format=%t_%s_%r.arc
log_archive_max_processes=30
FAL_SERVER=yangqldg
FAL_CLIENT=yangql


-----listener.ora
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = alibank_pre_publish)(PORT = 1521))
    )
  )
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = yangql)
      (ORACLE_HOME = /home/opt/oracle/products/11.2.0)
      (SID_NAME = yangql)
    )
  )

----tnsnames.ora-----
yangql =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.112.230)(PORT = 1521))
    )
    (CONNECT_DATA =
      (server = dedicated)
      (service_name = yangql)
    )
  )
 
yangqldg =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 172.18.87.199)(PORT = 1521))
    )
    (CONNECT_DATA =
      (server = dedicated)
      (service_name = yangql)
    )
  )
--rman 复制
--启动备库到nomount状态
sqlplus "/as sysdba"
startup nomount pfile='/yangqldg.ora'

--执行duplicate standby 库
主库登陆rman,并auxiliary连接备库

oracle>rman target /
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Apr 26 14:42:24 2011
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database: yangql (DBID=3584031961)
RMAN> connect auxiliary
sys/yangql@yangqldg
connected to auxiliary database: yangql (not mounted)
RMAN> run {
2>  allocate channel c1 type disk;
3>   allocate auxiliary channel s1 type disk;
4>    allocate auxiliary channel s2 type disk;
5>    sql channel c1 "alter system archive log current";
6>    duplicate target database for standby 
7>         from active database
8>         spfile
9>         set db_name='yangql'
10>         set db_unique_name='yangqldg'
11>         set instance_name='yangql'
12>         set audit_file_dest='/home/opt/oracle/admin/yangql/adump'
13>         set log_archive_dest_1='LOCATION=/home/opt/oracle/archive_log'
14>         set control_files='/home/opt/oracle/oradata/yangql/control01.ctl','/home/opt/oracle/oradata/yangql/control02.ctl'
15>         set standby_file_management='AUTO'
16>         set log_archive_config='dg_config=(yangqldg,yangql)'
17>         set log_archive_dest_2='service=yangql LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=yangql'
18>         set log_archive_dest_state_1='enable'
19>         set log_archive_dest_state_2='enable'
20>         set log_archive_format='%t_%s_%r.dbf'
21>         set undo_tablespace='UNDOTBS1'
22>         set LOG_FILE_NAME_CONVERT='/home/opt/oracle/oradata/yangql','/home/opt/oracle/oradata/yangql'
23>         set fal_client='yangqldg'
24>         set fal_server='yangql'
25>         NOFILENAMECHECK; 
26>    sql channel c1 "alter system archive log current";
27> }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=838 device type=DISK

allocated channel: s1
channel s1: SID=91 device type=DISK

allocated channel: s2
channel s2: SID=113 device type=DISK

sql statement: alter system archive log current

Starting Duplicate Db at 26-APR-11

contents of Memory Script.:
{
   backup as copy reuse
   targetfile  '/home/opt/oracle/products/11.2.0/dbs/orapwyangql' auxiliary format
 '/home/opt/oracle/products/11.2.0/dbs/orapwyangql'   targetfile
 '/home/opt/oracle/products/11.2.0/dbs/spfileyangql.ora' auxiliary format
 '/home/opt/oracle/products/11.2.0/dbs/spfileyangql.ora'   ;
   sql clone "alter system set spfile= ''/home/opt/oracle/products/11.2.0/dbs/spfileyangql.ora''";
}
executing Memory Script
Starting backup at 26-APR-11
Finished backup at 26-APR-11
sql statement: alter system set spfile= ''/home/opt/oracle/products/11.2.0/dbs/spfileyangql.ora''
contents of Memory Script.:
{
   sql clone "alter system set  db_name =  ''yangql'' comment= '''' scope=spfile";
   sql clone "alter system set  db_unique_name =  ''yangqldg'' comment= '''' scope=spfile";
   sql clone "alter system set  instance_name =  ''yangql'' comment= '''' scope=spfile";
   sql clone "alter system set  audit_file_dest =  ''/home/opt/oracle/admin/yangql/adump'' comment= '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_1 =  ''LOCATION=/home/opt/oracle/archive_log'' comment= '''' scope=spfile";
   sql clone "alter system set  control_files =  ''/home/opt/oracle/oradata/yangql/control01.ctl'', ''/home/opt/oracle/oradata/yangql/control02.ctl'' 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=(yangqldg,yangql)'' comment= '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_2 =  ''service=yangql LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=yangql'' comment= '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_state_1 =  ''enable'' comment= '''' scope=spfile";
   sql clone "alter system set  log_archive_dest_state_2 =  ''enable'' comment= '''' scope=spfile";
   sql clone "alter system set  log_archive_format =  ''%t_%s_%r.dbf'' comment= '''' scope=spfile";
   sql clone "alter system set  undo_tablespace =  ''UNDOTBS1'' comment= '''' scope=spfile";
   sql clone "alter system set  LOG_FILE_NAME_CONVERT =  ''/home/opt/oracle/oradata/yangql'', ''/home/opt/oracle/oradata/yangql'' comment= '''' scope=spfile";
   sql clone "alter system set  fal_client =  ''yangqldg'' comment= '''' scope=spfile";
   sql clone "alter system set  fal_server =  ''yangql'' comment= '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount;
}
executing Memory Script
sql statement: alter system set  db_name =  ''yangql'' comment= '''' scope=spfile
sql statement: alter system set  db_unique_name =  ''yangqldg'' comment= '''' scope=spfile
sql statement: alter system set  instance_name =  ''yangql'' comment= '''' scope=spfile
sql statement: alter system set  audit_file_dest =  ''/home/opt/oracle/admin/yangql/adump'' comment= '''' scope=spfile
sql statement: alter system set  log_archive_dest_1 =  ''LOCATION=/home/opt/oracle/archive_log'' comment= '''' scope=spfile
sql statement: alter system set  control_files =  ''/home/opt/oracle/oradata/yangql/control01.ctl'', ''/home/opt/oracle/oradata/yangql/control02.ctl'' 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=(yangqldg,yangql)'' comment= '''' scope=spfile
sql statement: alter system set  log_archive_dest_2 =  ''service=yangql LGWR ASYNC valid_for=(ONLINE_LOGFILES,PRIMARY_ROLE) db_unique_name=yangql'' comment= '''' scope=spfile
sql statement: alter system set  log_archive_dest_state_1 =  ''enable'' comment= '''' scope=spfile
sql statement: alter system set  log_archive_dest_state_2 =  ''enable'' comment= '''' scope=spfile
sql statement: alter system set  log_archive_format =  ''%t_%s_%r.dbf'' comment= '''' scope=spfile
sql statement: alter system set  undo_tablespace =  ''UNDOTBS1'' comment= '''' scope=spfile
sql statement: alter system set  LOG_FILE_NAME_CONVERT =  ''/home/opt/oracle/oradata/yangql'', ''/home/opt/oracle/oradata/yangql'' comment= '''' scope=spfile
sql statement: alter system set  fal_client =  ''yangqldg'' comment= '''' scope=spfile
sql statement: alter system set  fal_server =  ''yangql'' comment= '''' scope=spfile
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area    1653518336 bytes
Fixed Size                     2213896 bytes
Variable Size                939526136 bytes
Database Buffers             704643072 bytes
Redo Buffers                   7135232 bytes
allocated channel: s1
channel s1: SID=958 device type=DISK
allocated channel: s2
channel s2: SID=1149 device type=DISK
contents of Memory Script.:
{
   backup as copy current controlfile for standby auxiliary format  '/home/opt/oracle/oradata/yangql/control01.ctl';
   restore clone controlfile to  '/home/opt/oracle/oradata/yangql/control02.ctl' from
 '/home/opt/oracle/oradata/yangql/control01.ctl';
}
executing Memory Script

Starting backup at 26-APR-11
channel c1: starting datafile copy
copying standby control file
output file name=/home/opt/oracle/products/11.2.0/dbs/snapcf_yangql.f tag=TAG20110426T144453 RECID=3 STAMP=749486694
channel c1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 26-APR-11
Starting restore at 26-APR-11
channel s2: skipped, AUTOBACKUP already found
channel s1: copied control file copy
Finished restore at 26-APR-11
contents of Memory Script.:
{
   sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
RMAN-05538: WARNING: implicitly using DB_FILE_NAME_CONVERT

contents of Memory Script.:
{
   set newname for tempfile  1 to  "/home/opt/oracle/oradata/yangql/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to  "/home/opt/oracle/oradata/yangql/system01.dbf";
   set newname for datafile  2 to  "/home/opt/oracle/oradata/yangql/sysaux01.dbf";
   set newname for datafile  3 to  "/home/opt/oracle/oradata/yangql/undotbs01.dbf";
   set newname for datafile  4 to  "/home/opt/oracle/oradata/yangql/users01.dbf";
   set newname for datafile  5 to  "/home/opt/oracle/oradata/yangql/alijr01.dbf";
   set newname for datafile  6 to  "/home/opt/oracle/oradata/yangql/alijr02.dbf";
   set newname for datafile  7 to  "/home/opt/oracle/oradata/yangql/alijr03.dbf";
   set newname for datafile  8 to  "/home/opt/oracle/oradata/yangql/alijr04.dbf";
   set newname for datafile  9 to  "/home/opt/oracle/oradata/yangql/alijr05.dbf";
   set newname for datafile  10 to  "/home/opt/oracle/oradata/yangql/alijr06.dbf";
   set newname for datafile  11 to  "/home/opt/oracle/oradata/yangql/alijr07.dbf";
   set newname for datafile  12 to  "/home/opt/oracle/oradata/yangql/alijr08.dbf";
   set newname for datafile  13 to  "/home/opt/oracle/oradata/yangql/alijr09.dbf";
   set newname for datafile  14 to  "/home/opt/oracle/oradata/yangql/alijr10.dbf";
   set newname for datafile  15 to  "/home/opt/oracle/oradata/yangql/alijr11.dbf";
   set newname for datafile  16 to  "/home/opt/oracle/oradata/yangql/alijr12.dbf";
   set newname for datafile  17 to  "/home/opt/oracle/oradata/yangql/alijr13.dbf";
   set newname for datafile  18 to  "/home/opt/oracle/oradata/yangql/alijr14.dbf";
   set newname for datafile  19 to  "/home/opt/oracle/oradata/yangql/alijr15.dbf";
   set newname for datafile  20 to  "/home/opt/oracle/oradata/yangql/alijr16.dbf";
   set newname for datafile  21 to  "/home/opt/oracle/oradata/yangql/alijr17.dbf";
   set newname for datafile  22 to  "/home/opt/oracle/oradata/yangql/alijr18.dbf";
   set newname for datafile  23 to  "/home/opt/oracle/oradata/yangql/alijr19.dbf";
   backup as copy reuse
   datafile
    1 auxiliary format  "/home/opt/oracle/oradata/yangql/system01.dbf"   datafile
 2 auxiliary format  "/home/opt/oracle/oradata/yangql/sysaux01.dbf"   datafile
 3 auxiliary format  "/home/opt/oracle/oradata/yangql/undotbs01.dbf"   datafile
 4 auxiliary format  "/home/opt/oracle/oradata/yangql/users01.dbf"   datafile
 5 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr01.dbf"   datafile
 6 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr02.dbf"   datafile
 7 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr03.dbf"   datafile
 8 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr04.dbf"   datafile
 9 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr05.dbf"   datafile
 10 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr06.dbf"   datafile
 11 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr07.dbf"   datafile
 12 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr08.dbf"   datafile
 13 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr09.dbf"   datafile
 14 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr10.dbf"   datafile
 15 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr11.dbf"   datafile
 16 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr12.dbf"   datafile
 17 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr13.dbf"   datafile
 18 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr14.dbf"   datafile
 19 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr15.dbf"   datafile
 20 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr16.dbf"   datafile
 21 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr17.dbf"   datafile
 22 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr18.dbf"   datafile
 23 auxiliary format  "/home/opt/oracle/oradata/yangql/alijr19.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /home/opt/oracle/oradata/yangql/temp01.dbf 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
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
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 26-APR-11
channel c1: starting datafile copy
input datafile file number=00005 name=/home/opt/oracle/oradata/yangql/alijr01.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr01.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:55
channel c1: starting datafile copy
input datafile file number=00006 name=/home/opt/oracle/oradata/yangql/alijr02.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr02.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:02:05
channel c1: starting datafile copy
input datafile file number=00007 name=/home/opt/oracle/oradata/yangql/alijr03.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr03.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:45
channel c1: starting datafile copy
input datafile file number=00008 name=/home/opt/oracle/oradata/yangql/alijr04.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr04.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:35
channel c1: starting datafile copy
input datafile file number=00009 name=/home/opt/oracle/oradata/yangql/alijr05.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr05.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:35
channel c1: starting datafile copy
input datafile file number=00010 name=/home/opt/oracle/oradata/yangql/alijr06.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr06.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:35
channel c1: starting datafile copy
input datafile file number=00011 name=/home/opt/oracle/oradata/yangql/alijr07.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr07.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:35
channel c1: starting datafile copy
input datafile file number=00012 name=/home/opt/oracle/oradata/yangql/alijr08.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr08.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:35
channel c1: starting datafile copy
input datafile file number=00013 name=/home/opt/oracle/oradata/yangql/alijr09.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr09.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:55
channel c1: starting datafile copy
input datafile file number=00014 name=/home/opt/oracle/oradata/yangql/alijr10.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr10.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:35
channel c1: starting datafile copy
input datafile file number=00015 name=/home/opt/oracle/oradata/yangql/alijr11.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr11.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:35
channel c1: starting datafile copy
input datafile file number=00016 name=/home/opt/oracle/oradata/yangql/alijr12.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr12.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:45
channel c1: starting datafile copy
input datafile file number=00017 name=/home/opt/oracle/oradata/yangql/alijr13.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr13.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:35
channel c1: starting datafile copy
input datafile file number=00018 name=/home/opt/oracle/oradata/yangql/alijr14.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr14.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:41
channel c1: starting datafile copy
input datafile file number=00019 name=/home/opt/oracle/oradata/yangql/alijr15.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr15.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:02:35
channel c1: starting datafile copy
input datafile file number=00020 name=/home/opt/oracle/oradata/yangql/alijr16.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr16.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:55
channel c1: starting datafile copy
input datafile file number=00021 name=/home/opt/oracle/oradata/yangql/alijr17.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr17.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:02:00
channel c1: starting datafile copy
input datafile file number=00022 name=/home/opt/oracle/oradata/yangql/alijr18.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr18.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:44
channel c1: starting datafile copy
input datafile file number=00023 name=/home/opt/oracle/oradata/yangql/alijr19.dbf
output file name=/home/opt/oracle/oradata/yangql/alijr19.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:45
channel c1: starting datafile copy
input datafile file number=00003 name=/home/opt/oracle/oradata/yangql/undotbs01.dbf
output file name=/home/opt/oracle/oradata/yangql/undotbs01.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:01:36
channel c1: starting datafile copy
input datafile file number=00001 name=/home/opt/oracle/oradata/yangql/system01.dbf
output file name=/home/opt/oracle/oradata/yangql/system01.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:00:35
channel c1: starting datafile copy
input datafile file number=00002 name=/home/opt/oracle/oradata/yangql/sysaux01.dbf
output file name=/home/opt/oracle/oradata/yangql/sysaux01.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:00:15
channel c1: starting datafile copy
input datafile file number=00004 name=/home/opt/oracle/oradata/yangql/users01.dbf
output file name=/home/opt/oracle/oradata/yangql/users01.dbf tag=TAG20110426T144511
channel c1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 26-APR-11
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=3 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=4 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=5 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=6 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=7 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr01.dbf
datafile 6 switched to datafile copy
input datafile copy RECID=8 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr02.dbf
datafile 7 switched to datafile copy
input datafile copy RECID=9 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr03.dbf
datafile 8 switched to datafile copy
input datafile copy RECID=10 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr04.dbf
datafile 9 switched to datafile copy
input datafile copy RECID=11 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr05.dbf
datafile 10 switched to datafile copy
input datafile copy RECID=12 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr06.dbf
datafile 11 switched to datafile copy
input datafile copy RECID=13 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr07.dbf
datafile 12 switched to datafile copy
input datafile copy RECID=14 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr08.dbf
datafile 13 switched to datafile copy
input datafile copy RECID=15 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr09.dbf
datafile 14 switched to datafile copy
input datafile copy RECID=16 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr10.dbf
datafile 15 switched to datafile copy
input datafile copy RECID=17 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr11.dbf
datafile 16 switched to datafile copy
input datafile copy RECID=18 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr12.dbf
datafile 17 switched to datafile copy
input datafile copy RECID=19 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr13.dbf
datafile 18 switched to datafile copy
input datafile copy RECID=20 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr14.dbf
datafile 19 switched to datafile copy
input datafile copy RECID=21 STAMP=749488890 file name=/home/opt/oracle/oradata/yangql/alijr15.dbf
datafile 20 switched to datafile copy
input datafile copy RECID=22 STAMP=749488891 file name=/home/opt/oracle/oradata/yangql/alijr16.dbf
datafile 21 switched to datafile copy
input datafile copy RECID=23 STAMP=749488891 file name=/home/opt/oracle/oradata/yangql/alijr17.dbf
datafile 22 switched to datafile copy
input datafile copy RECID=24 STAMP=749488891 file name=/home/opt/oracle/oradata/yangql/alijr18.dbf
datafile 23 switched to datafile copy
input datafile copy RECID=25 STAMP=749488891 file name=/home/opt/oracle/oradata/yangql/alijr19.dbf
Finished Duplicate Db at 26-APR-11
sql statement: alter system archive log current
released channel: c1
released channel: s1
released channel: s2
RMAN> exit
Recovery Manager complete.
======================备库的操作================

检查备库上的数据文件。
oracle>sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 26 13:07:48 2011
Copyright (c) 1982, 2009, Oracle.  All rights reserved.
Connected to an idle instance.
@>startup nomount pfile='/home/opt/oracle/products/11.2.0/dbs/yangql.ora'
ORACLE instance started.
Total System Global Area 1653518336 bytes
Fixed Size                  2213896 bytes
Variable Size            1006635000 bytes
Database Buffers          637534208 bytes
Redo Buffers                7135232 bytes
@>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning option
oracle>sqlplus "/as sysdba"
SQL*Plus: Release 11.2.0.1.0 Production on Tue Apr 26 14:04:43 2011

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 option

@>select * from v$logfile;
GROUP# STATUS  TYPE   MEMBER   IS_
------ ------- ----------------------------------------------------------------------
 3     ONLINE      /home/opt/oracle/oradata/yangql/redo03.log NO
2      ONLINE      /home/opt/oracle/oradata/yangql/redo02.log NO
1      ONLINE      /home/opt/oracle/oradata/yangql/redo01.log NO

@>col member for a45
@>select * from v$logfile;
    GROUP# STATUS  TYPE    MEMBER                                        IS_
---------- ------- ------- --------------------------------------------- ---
         3         ONLINE  /home/opt/oracle/oradata/yangql/redo03.log   NO
         2         ONLINE  /home/opt/oracle/oradata/yangql/redo02.log   NO
         1         ONLINE  /home/opt/oracle/oradata/yangql/redo01.log   NO
@>col ts#        format 9999
@>col tablespace format a20
@>col file       format a52
@>select t.ts#, t.name "tablespace", d.file#, d.name "file", d.status, d.enabled
  2  from v$tablespace t, v$datafile d
  3  where t.ts#=d.ts#
  4  union all
  5  select t.ts#, t.name "tablespace", d.file#, d.name "file", d.status, d.enabled
  6  from v$tablespace t, v$tempfile d
  7  where t.ts#=d.ts#  order by 1, 4;
  TS# tablespace                FILE# file                                                 STATUS  ENABLED
----- -------------------- ---------- ---------------------------------------------------- ------- ----------
    0 SYSTEM                        1 /home/opt/oracle/oradata/yangql/system01.dbf        SYSTEM  READ WRITE
    1 SYSAUX                        2 /home/opt/oracle/oradata/yangql/sysaux01.dbf        ONLINE  READ WRITE
    2 UNDOTBS1                      3 /home/opt/oracle/oradata/yangql/undotbs01.dbf       ONLINE  READ WRITE
    3 TEMP                          1 /home/opt/oracle/oradata/yangql/temp01.dbf          ONLINE  READ WRITE
    4 USERS                         4 /home/opt/oracle/oradata/yangql/users01.dbf         ONLINE  READ WRITE
    6 AJR                         5 /home/opt/oracle/oradata/yangql/alijr01.dbf         ONLINE  READ WRITE
    6 AJR                         6 /home/opt/oracle/oradata/yangql/alijr02.dbf         ONLINE  READ WRITE
    6 AJR                         7 /home/opt/oracle/oradata/yangql/alijr03.dbf         ONLINE  READ WRITE
    6 AJR                         8 /home/opt/oracle/oradata/yangql/alijr04.dbf         ONLINE  READ WRITE
    6 AJR                         9 /home/opt/oracle/oradata/yangql/alijr05.dbf         ONLINE  READ WRITE
    6 AJR                        10 /home/opt/oracle/oradata/yangql/alijr06.dbf         ONLINE  READ WRITE
    6 AJR                        11 /home/opt/oracle/oradata/yangql/alijr07.dbf         ONLINE  READ WRITE
    6 AJR                        12 /home/opt/oracle/oradata/yangql/alijr08.dbf         ONLINE  READ WRITE
    6 AJR                        13 /home/opt/oracle/oradata/yangql/alijr09.dbf         ONLINE  READ WRITE
    6 AJR                        14 /home/opt/oracle/oradata/yangql/alijr10.dbf         ONLINE  READ WRITE
    6 AJR                        15 /home/opt/oracle/oradata/yangql/alijr11.dbf         ONLINE  READ WRITE
    6 AJR                        16 /home/opt/oracle/oradata/yangql/alijr12.dbf         ONLINE  READ WRITE
    6 AJR                        17 /home/opt/oracle/oradata/yangql/alijr13.dbf         ONLINE  READ WRITE
    6 AJR                        18 /home/opt/oracle/oradata/yangql/alijr14.dbf         ONLINE  READ WRITE
    6 AJR                        19 /home/opt/oracle/oradata/yangql/alijr15.dbf         ONLINE  READ WRITE
    6 AJR                        20 /home/opt/oracle/oradata/yangql/alijr16.dbf         ONLINE  READ WRITE
    6 AJR                        21 /home/opt/oracle/oradata/yangql/alijr17.dbf         ONLINE  READ WRITE
    6 AJR                        22 /home/opt/oracle/oradata/yangql/alijr18.dbf         ONLINE  READ WRITE
    6 AJR                        23 /home/opt/oracle/oradata/yangql/alijr19.dbf         ONLINE  READ WRITE

24 rows selected.

@>exit             
剩下的就是进行切换日志检查dg的功能了~!

上一篇:Oracle 热备份


下一篇:SQL Server 通过发布订阅 实现数据库同步