ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 11g Data Guard Setup

11g Data Guard Setup

原创 Linux操作系统 作者:duyiwei 时间:2009-12-15 18:19:43 0 删除 编辑
oracle_home/bin/emca

cfgtoollogs/dbca/orcl/emConfig.log

/u01/oradata/orcl/orcl/redo01.log

ALTER DATABASE FORCE LOGGING;


ALTER DATABASE ADD STANDBY LOGFILE
   ('/u01/oradata/orcl/orcl/redo1.rdo') SIZE 52428800;

ALTER DATABASE ADD STANDBY LOGFILE
   ('/u01/oradata/orcl/orcl/redo2.rdo') SIZE 52428800;

ALTER DATABASE ADD STANDBY LOGFILE
   ('/u01/oradata/orcl/orcl/redo3.rdo') SIZE 52428800;

ALTER DATABASE ADD STANDBY LOGFILE
   ('/u01/oradata/orcl/orcl/redo4.rdo') SIZE 52428800;

alter system switch logfile;



NAME                                 TYPE        VALUE
------------------------------------ ----------- ---------
db_name                              string      orcl


NAME                                 TYPE        VALUE
------------------------------------ ----------- ---------
db_unique_name                       string      orcl


alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,orclby)';

alter system set LOG_ARCHIVE_DEST_1=
 'LOCATION=USE_DB_RECOVERY_FILE_DEST
  VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
  DB_UNIQUE_NAME=orcl';
alter system set LOG_ARCHIVE_DEST_2=
 'SERVICE=orclby ASYNC
  VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
  DB_UNIQUE_NAME=orclby';

alter system set FAL_SERVER=orclby;
alter system set FAL_CLIENT=orcl;
alter system set DB_FILE_NAME_CONVERT='orclby','orcl' scope=spfile;
alter system set STANDBY_FILE_MANAGEMENT=AUTO;


alter system set LOG_FILE_NAME_CONVERT=
 '/u01/oradata/orclby/orclby/','/u01/oradata/orcl/orcl/' scope=spfile;




ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1.home.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.home.com)
    )
  )


ORCLBY =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2.home.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orclby.home.com)
    )
  )

*.db_name='orcl'
*.control_files='/u01/oradata/orclby/orclby/control01.ctl','/u01/oradata/orclby/orclby/control02.ctl','/u01/oradata/orclby/orclby/control03.ctl'

ALTER DATABASE CREATE STANDBY CONTROLFILE AS '/tmp/control01.ctl';

scp controlfiles

SQL> startup nomount pfile=/u01/app/oracle/product/11g/db_1/dbs/initorclby.ora
ORACLE instance started.

Total System Global Area  146472960 bytes
Fixed Size                  1298472 bytes
Variable Size              92278744 bytes
Database Buffers           50331648 bytes
Redo Buffers                2564096 bytes
SQL>


rman target sys/sys@orcl auxiliary sys/sys@orclby

connected to target database: ORCL (DBID=1211087052)


RMAN> connect auxiliary sys/sys@orclby



DUPLICATE TARGET DATABASE 
FOR STANDBY 
FROM ACTIVE DATABASE 
DORECOVER
  SPFILE
    SET "db_unique_name"="orclby"
    SET LOG_ARCHIVE_DEST_2="service=rac2 ASYNC REGISTER
     VALID_FOR=(online_logfile,primary_role)"
    SET FAL_CLIENT="rac2"
    SET FAL_SERVER="rac1"
    set control_files='/u01/oradata/orcl/orcl/crl03.ctl','/u01/oradata/orcl/orcl/crl02.ctl','/u01/oradata/orcl/orcl/crl01.ctl'
  NOFILENAMECHECK;


DUPLICATE TARGET DATABASE 
FOR STANDBY 
FROM ACTIVE DATABASE 
DORECOVER
  SPFILE
    SET "db_unique_name"="orclby"
    SET LOG_ARCHIVE_DEST_2="service=rac2 ASYNC REGISTER
     VALID_FOR=(online_logfile,primary_role)"
    SET FAL_CLIENT="rac2"
    SET FAL_SERVER="rac1"
    set control_files='..'
  DB_FILE_NAME_CONVERT 'I:\app\apadhi\oradata\amar','E:\oracle\oradata\test';



rac2-> rman target sys/sys@orcl auxiliary sys/sys@orclby

Recovery Manager: Release 11.1.0.6.0 - Production on Mon Apr 6 22:04:55 2009

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

connected to target database: ORCL (DBID=1211087052)
connected to auxiliary database: ORCLBY (not mounted)

RMAN> DUPLICATE TARGET DATABASE
2> FOR STANDBY
3> FROM ACTIVE DATABASE
4> DORECOVER
5>   SPFILE
6>     SET "db_unique_name"="orclby"
7>     SET LOG_ARCHIVE_DEST_2="service=rac2 ASYNC REGISTER
8>      VALID_FOR=(online_logfile,primary_role)"
9>     SET FAL_CLIENT="rac2"
10>     SET FAL_SERVER="rac1"
11>     set control_files='/u01/oradata/orcl/orcl/crl03.ctl','/u01/oradata/orcl/orcl/crl02.ctl','/u01/oradata/orcl/orcl/crl01.
ctl'
12>   NOFILENAMECHECK;

Starting Duplicate Db at 06-APR-09
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=97 device type=DISK

contents of Memory Script.:
{
   backup as copy reuse
   file  '/u01/app/oracle/product/11g/db_1/dbs/orapworcl' auxiliary format
 '/u01/app/oracle/product/11g/db_1/dbs/orapworclby'   file
 '/u01/app/oracle/product/11g/db_1/dbs/spfileorcl.ora' auxiliary format
 '/u01/app/oracle/product/11g/db_1/dbs/spfileorclby.ora'   ;
   sql clone "alter system set spfile= ''/u01/app/oracle/product/11g/db_1/dbs/spfileorclby.ora''";
}
executing Memory Script

Starting backup at 06-APR-09
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=129 device type=DISK
Finished backup at 06-APR-09

sql statement: alter system set spfile= ''/u01/app/oracle/product/11g/db_1/dbs/spfileorclby.ora''

contents of Memory Script.:
{
   sql clone "alter system set  db_unique_name =
 ''orclby'' comment=
 '''' scope=spfile";
   sql clone "alter system set  LOG_ARCHIVE_DEST_2 =
 ''service=rac2 ASYNC REGISTER     VALID_FOR=(online_logfile,primary_role)'' comment=
 '''' scope=spfile";
   sql clone "alter system set  FAL_CLIENT =
 ''rac2'' comment=
 '''' scope=spfile";
   sql clone "alter system set  FAL_SERVER =
 ''rac1'' comment=
 '''' scope=spfile";
   sql clone "alter system set  control_files =
 ''/u01/oradata/orcl/orcl/crl03.ctl'', ''/u01/oradata/orcl/orcl/crl02.ctl'', ''/u01/oradata/orcl/orcl/crl01.ctl'' comment=
 '''' scope=spfile";
   shutdown clone immediate;
   startup clone nomount ;
}
executing Memory Script

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

sql statement: alter system set  LOG_ARCHIVE_DEST_2 =  ''service=rac2 ASYNC REGISTER     VALID_FOR=(online_logfile,primary_rol
e)'' comment= '''' scope=spfile

sql statement: alter system set  FAL_CLIENT =  ''rac2'' comment= '''' scope=spfile

sql statement: alter system set  FAL_SERVER =  ''rac1'' comment= '''' scope=spfile

sql statement: alter system set  control_files =  ''/u01/oradata/orcl/orcl/crl03.ctl'', ''/u01/oradata/orcl/orcl/crl02.ctl'',
''/u01/oradata/orcl/orcl/crl01.ctl'' comment= '''' scope=spfile

Oracle instance shut down

connected to auxiliary database (not started)
Oracle instance started

Total System Global Area     313860096 bytes

Fixed Size                     1299624 bytes
Variable Size                192940888 bytes
Database Buffers             113246208 bytes
Redo Buffers                   6373376 bytes

contents of Memory Script.:
{
   backup as copy current controlfile for standby auxiliary format  '/u01/oradata/orcl/orcl/crl03.ctl';
   restore clone controlfile to  '/u01/oradata/orcl/orcl/crl02.ctl' from
 '/u01/oradata/orcl/orcl/crl03.ctl';
   restore clone controlfile to  '/u01/oradata/orcl/orcl/crl01.ctl' from
 '/u01/oradata/orcl/orcl/crl03.ctl';
   sql clone 'alter database mount standby database';
}
executing Memory Script

Starting backup at 06-APR-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11g/db_1/dbs/snapcf_orcl.f tag=TAG20090406T220555 RECID=4 STAMP=683503575
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:12
Finished backup at 06-APR-09

Starting restore at 06-APR-09
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=153 device type=DISK

channel ORA_DISK_1: no AUTOBACKUP in 7 days found
channel ORA_AUX_DISK_1: skipped, AUTOBACKUP already found
channel clone_default: copied control file copy
Finished restore at 06-APR-09

Starting restore at 06-APR-09
using channel ORA_AUX_DISK_1

channel ORA_DISK_1: no AUTOBACKUP in 7 days found
channel ORA_AUX_DISK_1: skipped, AUTOBACKUP already found
channel clone_default: copied control file copy
Finished restore at 06-APR-09

sql statement: alter database mount standby database

contents of Memory Script.:
{
   set newname for tempfile  1 to
 "/u01/oradata/orcl/orcl/temp01.dbf";
   switch clone tempfile all;
   set newname for datafile  1 to
 "/u01/oradata/orcl/orcl/system01.dbf";
   set newname for datafile  2 to
 "/u01/oradata/orcl/orcl/sysaux01.dbf";
   set newname for datafile  3 to
 "/u01/oradata/orcl/orcl/undotbs01.dbf";
   set newname for datafile  4 to
 "/u01/oradata/orcl/orcl/users01.dbf";
   backup as copy reuse
   datafile  1 auxiliary format
 "/u01/oradata/orcl/orcl/system01.dbf"   datafile
 2 auxiliary format
 "/u01/oradata/orcl/orcl/sysaux01.dbf"   datafile
 3 auxiliary format
 "/u01/oradata/orcl/orcl/undotbs01.dbf"   datafile
 4 auxiliary format
 "/u01/oradata/orcl/orcl/users01.dbf"   ;
   sql 'alter system archive log current';
}
executing Memory Script

executing command: SET NEWNAME

renamed tempfile 1 to /u01/oradata/orcl/orcl/temp01.dbf in control file

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

executing command: SET NEWNAME

Starting backup at 06-APR-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/u01/oradata/orcl/orcl/sysaux01.dbf
output file name=/u01/oradata/orcl/orcl/sysaux01.dbf tag=TAG20090406T220656 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:06:42
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/u01/oradata/orcl/orcl/system01.dbf
output file name=/u01/oradata/orcl/orcl/system01.dbf tag=TAG20090406T220656 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:01:23
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/u01/oradata/orcl/orcl/undotbs01.dbf
output file name=/u01/oradata/orcl/orcl/undotbs01.dbf tag=TAG20090406T220656 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:47
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/u01/oradata/orcl/orcl/users01.dbf
output file name=/u01/oradata/orcl/orcl/users01.dbf tag=TAG20090406T220656 RECID=0 STAMP=0
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:02
Finished backup at 06-APR-09

sql statement: alter system archive log current

contents of Memory Script.:
{
   backup as copy reuse
   archivelog like  "/u01/app/oracle/flash_recovery_area/ORCL/archivelog/2009_04_06/o1_mf_1_37_4xmwncj3_.arc" auxiliary format

 "/u01/app/oracle/product/11g/db_1/dbs/arch1_37_683306316.dbf"   ;
   catalog clone archivelog  "/u01/app/oracle/product/11g/db_1/dbs/arch1_37_683306316.dbf";
   switch clone datafile all;
}
executing Memory Script

Starting backup at 06-APR-09
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=37 RECID=9 STAMP=683504172
output file name=/u01/app/oracle/product/11g/db_1/dbs/arch1_37_683306316.dbf RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:04
Finished backup at 06-APR-09

cataloged archived log
archived log file name=/u01/app/oracle/product/11g/db_1/dbs/arch1_37_683306316.dbf RECID=1 STAMP=683504179

datafile 1 switched to datafile copy
input datafile copy RECID=4 STAMP=683504180 file name=/u01/oradata/orcl/orcl/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=5 STAMP=683504180 file name=/u01/oradata/orcl/orcl/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=6 STAMP=683504180 file name=/u01/oradata/orcl/orcl/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=7 STAMP=683504180 file name=/u01/oradata/orcl/orcl/users01.dbf

contents of Memory Script.:
{
   set until scn  448084;
   recover
   standby
   clone database
    delete archivelog
   ;
}
executing Memory Script

executing command: SET until clause

Starting recover at 06-APR-09
using channel ORA_AUX_DISK_1

starting media recovery

archived log for thread 1 with sequence 37 is already on disk as file /u01/app/oracle/product/11g/db_1/dbs/arch1_37_683306316.
dbf
archived log file name=/u01/app/oracle/product/11g/db_1/dbs/arch1_37_683306316.dbf thread=1 sequence=37
media recovery complete, elapsed time: 00:00:09
Finished recover at 06-APR-09
Finished Duplicate Db at 06-APR-09

RMAN>


rac1-> dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production

Copyright (c) 2000, 2005, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> connect sys/sys
Connected.

DGMGRL> create configuration 'DGConfig' as
> primary database is 'orcl'
> connect identifier is orcl;
Configuration "DGConfig" created with primary database "orcl"
DGMGRL> show configuration

Configuration
  Name:                DGConfig
  Enabled:             NO
  Protection Mode:     MaxPerformance
  Databases:
    orcl - Primary database

Fast-Start Failover: DISABLED

Current status for "DGConfig":
DISABLED

DGMGRL> add database 'orclby' as connect identifier is orclby;
Database "orclby" added
DGMGRL> show configuration

Configuration
  Name:                DGConfig
  Enabled:             NO
  Protection Mode:     MaxPerformance
  Databases:
    orcl   - Primary database
    orclby - Physical standby database

Fast-Start Failover: DISABLED

Current status for "DGConfig":
DISABLED

DGMGRL> enable configuration
Enabled.
DGMGRL> show configuration

Configuration
  Name:                DGConfig
  Enabled:             YES
  Protection Mode:     MaxPerformance
  Databases:
    orcl   - Primary database
    orclby - Physical standby database

Fast-Start Failover: DISABLED

Current status for "DGConfig":
Warning: ORA-16610: command "EDIT DATABASE orclby SET PROPERTY" in progress


DGMGRL> exit
rac1-> dgmgrl
DGMGRL for Linux: Version 11.1.0.6.0 - Production

Copyright (c) 2000, 2005, Oracle. All rights reserved.

Welcome to DGMGRL, type "help" for information.
DGMGRL> show configuration
not logged on
DGMGRL> connect sys/sys
Connected.
DGMGRL> show configuration

Configuration
  Name:                DGConfig
  Enabled:             YES
  Protection Mode:     MaxPerformance
  Databases:
    orcl   - Primary database
    orclby - Physical standby database

Fast-Start Failover: DISABLED

Current status for "DGConfig":
SUCCESS

DGMGRL>


来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/54666/viewspace-622506/,如需转载,请注明出处,否则将追究法律责任。

下一篇: 没有了~
请登录后发表评论 登录
全部评论

注册时间:2007-12-10

  • 博文量
    27
  • 访问量
    96281