Oracle 11 g duplicate功能_复制dataguard备库

Qracle 11g duplicate功能

不用备份源库,通过网络复制出standby库

1.在standby上grid用户配置listener

注意是指定oracle用户的家目录:

监听状态:

[[email protected] ~]$lsnrctl

LSNRCTL for Linux:Version 11.2.0.4.0 - Production on 19-MAY-2014 18:46:15

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

Welcome toLSNRCTL, type "help" for information.

LSNRCTL> status

Connecting to(DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1521)))

STATUS of theLISTENER

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

Alias                     LISTENER

Version                   TNSLSNR for Linux: Version11.2.0.4.0 - Production

Start Date                19-MAY-2014 17:24:26

Uptime                    0 days 1 hr. 21 min. 53 sec

Trace Level               off

Security                  ON: Local OS Authentication

SNMP                      OFF

Listener ParameterFile  /u01/app/11.2.0/grid/network/admin/listener.ora

Listener LogFile        /u01/app/grid/diag/tnslsnr/dg/listener/alert/log.xml

ListeningEndpoints Summary...

(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))

(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg.cowell.com)(PORT=1521)))

ServicesSummary...

Service"+ASM" has 1 instance(s).

Instance "+ASM", status READY, has1 handler(s) for this service...

Service"standby" has 2 instance(s).

Instance "standby", status UNKNOWN,has 1 handler(s) for this service...

Instance "standby", status READY,has 1 handler(s) for this service...

The commandcompleted successfully

standby的参数文件:

standby.__db_cache_size=171966464

standby.__java_pool_size=4194304

standby.__large_pool_size=16777216

standby.__oracle_base=‘/u01/app/oracle‘#ORACLE_BASEset from environment

standby.__pga_aggregate_target=289406976

standby.__sga_target=360710144

standby.__shared_io_pool_size=0

standby.__shared_pool_size=163577856

standby.__streams_pool_size=0

*.audit_file_dest=‘/u01/app/oracle/admin/standby/adump‘

*.audit_trail=‘db‘

*.cluster_database=false

*.compatible=‘11.2.0.4.0‘

*.control_files=‘+DGDATA/standby/controlfile/standby.ctl01‘,‘+DGDATA/standby/controlfile/standby.ctl02‘

*.db_block_size=8192

*.db_create_file_dest=‘+DGDATA‘

*.db_domain=‘‘

*.db_name=‘ORCL‘

*.db_recovery_file_dest=‘+DGARCH‘

*.db_recovery_file_dest_size=4622123008

*.diagnostic_dest=‘/u01/app/oracle‘

*.dispatchers=‘(PROTOCOL=TCP)(SERVICE=standbyXDB)‘

*.log_archive_format=‘%t_%s_%r.arc‘

*.memory_target=834666496

*.nls_language=‘SIMPLIFIEDCHINESE‘

*.nls_territory=‘CHINA‘

*.open_cursors=300

*.processes=150

*.remote_login_passwordfile=‘exclusive‘

*.sga_max_size=629145600

*.undo_tablespace=‘UNDOTBS1‘

*.db_unique_name=‘standby‘

#*.db_file_name_convert=‘+DATA/ORCL/DATAFILE‘,‘+DGDATA/standby/datafile/‘,‘+DATA/ORCL/TEMPFILE‘,‘+DGDATA/standby/tempfile/‘

#*.log_file_name_convert=‘+DATA/ORCL/ONLINELOG/‘,‘+DGDATA/standby/onlinelog/‘不用指定转换目录,否则会以下错误:

Starting restore at 2014-05-19 17:53:12

using channel ORA_AUX_DISK_1

DBGSQL:     TARGET> begin :fhdbi :=dbms_rcvcat.getDbid; end;

DBGSQL:        sqlcode = 6550

DBGSQL:         B :fhdbi = 32767

RMAN-00571:===========================================================

RMAN-00569: =============== ERRORMESSAGE STACK FOLLOWS ===============

RMAN-00571:===========================================================

RMAN-03002: failure ofDuplicate Db command at 05/19/2014 17:53:12

RMAN-05501: abortingduplication of target database

RMAN-03015: error occurred instored script Memory Script

ORA-06550: line 1, column 17:

PLS-00201: identifier‘DBMS_RCVCAT.GETDBID‘ must be declared

ORA-06550: line 1, column 7:

PL/SQL: Statement ignored

*.log_archive_config=‘dg_config=(ORCL,standby)‘

*.log_archive_dest_1=‘location=+DGDATA/standby/archivelogvalid_for=(all_logfiles,all_roles) db_unique_name=standby‘

*.log_archive_dest_2=‘service=ORCLlgwr async valid_for=(online_logfiles,primary_role) db_unique_name=ORCL‘

*.log_archive_dest_state_1=enable

*.log_archive_dest_state_2=enable

*.log_archive_max_processes=10

*.fal_server=ORCL

*.fal_client=standby

*.standby_file_management=auto

用参数文件把standby库启到nomount:

SQL> startupnomount;

ORACLE instancestarted.

Total SystemGlobal Area  626327552 bytes

Fixed Size             2255832 bytes

Variable Size            373294120 bytes

Database Buffers    243269632 bytes

Redo Buffers              7507968 bytes

在主库上执行复制:

[[email protected] ~]$rman target / auxiliary sys/[email protected]/standby

Recovery Manager:Release 11.2.0.4.0 - Production on Mon May 19 18:07:03 2014

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

connected totarget database: ORCL (DBID=1375715887)

connected toauxiliary database: ORCL (not mounted)

RMAN> duplicatetarget database for standby from active database nofilenamecheck;

Starting DuplicateDb at 2014-05-19 18:07:10

using targetdatabase control file instead of recovery catalog

allocated channel:ORA_AUX_DISK_1

channelORA_AUX_DISK_1: SID=131 device type=DISK

contents of MemoryScript:

{

backup as copy reuse

targetfile ‘/u01/app/oracle/product/11.2.0/db_1/dbs/orapwORCL2‘ auxiliary format

‘/u01/app/oracle/product/11.2.0/db_1/dbs/orapwstandby‘   ;

}

executing MemoryScript

Starting backup at2014-05-19 18:07:13

allocated channel:ORA_DISK_1

channelORA_DISK_1: SID=203 instance=ORCL2 device type=DISK

Finished backup at2014-05-19 18:07:15

contents of MemoryScript:

{

backup as copy current controlfile forstandby auxiliary format  ‘+DGDATA/standby/controlfile/standby.ctl01‘;

restore clone controlfile to  ‘+DGDATA/standby/controlfile/standby.ctl02‘from

‘+DGDATA/standby/controlfile/standby.ctl01‘;

}

executing MemoryScript

Starting backup at2014-05-19 18:07:16

using channel ORA_DISK_1

channelORA_DISK_1: starting datafile copy

copying standbycontrol file

output filename=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_ORCL2.ftag=TAG20140519T180716 RECID=7 STAMP=847994856

channelORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

Finished backup at2014-05-19 18:07:38

Starting restoreat 2014-05-19 18:07:39

using channelORA_AUX_DISK_1

channelORA_AUX_DISK_1: copied control file copy

Finished restoreat 2014-05-19 18:07:42

contents of MemoryScript:

{

sql clone ‘alter database mount standbydatabase‘;

}

executing MemoryScript

sql statement:alter database mount standby database

contents of MemoryScript:

{

set newname for clone tempfile  1 to new;

switch clone tempfile all;

set newname for clone datafile  1 to new;

set newname for clone datafile  2 to new;

set newname for clone datafile  3 to new;

set newname for clone datafile  4 to new;

set newname for clone datafile  5 to new;

set newname for clone datafile  6 to new;

set newname for clone datafile  7 to new;

backup as copy reuse

datafile 1 auxiliary format new

datafile 2 auxiliary format new

datafile 3 auxiliary format new

datafile 4 auxiliary format new

datafile 5 auxiliary format new

datafile 6 auxiliary format new

datafile 7 auxiliary format new

;

sql ‘alter system archive log current‘;

}

executing MemoryScript

executing command:SET NEWNAME

renamed tempfile 1to +DGDATA 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

Starting backup at2014-05-19 18:07:53

using channelORA_DISK_1

channelORA_DISK_1: starting datafile copy

input datafilefile number=00007 name=+DATA/orcl/datafile/plsql.268.847985273

output filename=+DGDATA/standby/datafile/plsql.346.847994875 tag=TAG20140519T180754

channelORA_DISK_1: datafile copy complete, elapsed time: 00:05:48

channelORA_DISK_1: starting datafile copy

input datafilefile number=00001 name=+DATA/orcl/datafile/system.276.847934873

output filename=+DGDATA/standby/datafile/system.348.847995227 tag=TAG20140519T180754

channelORA_DISK_1: datafile copy complete, elapsed time: 00:01:55

channelORA_DISK_1: starting datafile copy

input datafilefile number=00002 name=+DATA/orcl/datafile/sysaux.277.847934879

output filename=+DGDATA/standby/datafile/sysaux.349.847995341 tag=TAG20140519T180754

channel ORA_DISK_1:datafile copy complete, elapsed time: 00:01:46

channelORA_DISK_1: starting datafile copy

input datafilefile number=00005 name=+DATA/orcl/datafile/example.284.847935325

output filename=+DGDATA/standby/datafile/example.350.847995447 tag=TAG20140519T180754

channelORA_DISK_1: datafile copy complete, elapsed time: 00:01:05

channelORA_DISK_1: starting datafile copy

input datafilefile number=00003 name=+DATA/orcl/datafile/undotbs1.278.847934879

output filename=+DGDATA/standby/datafile/undotbs1.383.847995513 tag=TAG20140519T180754

channelORA_DISK_1: datafile copy complete, elapsed time: 00:00:25

channelORA_DISK_1: starting datafile copy

input datafilefile number=00006 name=+DATA/orcl/datafile/undotbs2.285.847936921

output file name=+DGDATA/standby/datafile/undotbs2.313.847995539tag=TAG20140519T180754

channelORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

channelORA_DISK_1: starting datafile copy

input datafilefile number=00004 name=+DATA/orcl/datafile/users.279.847934881

output filename=+DGDATA/standby/datafile/users.325.847995547 tag=TAG20140519T180754

channelORA_DISK_1: datafile copy complete, elapsed time: 00:00:07

Finished backup at2014-05-19 18:19:14

sql statement:alter system archive log current

contents of MemoryScript:

{

switch clone datafile all;

}

executing MemoryScript

datafile 1switched to datafile copy

input datafilecopy RECID=7 STAMP=847995571 filename=+DGDATA/standby/datafile/system.348.847995227

datafile 2switched to datafile copy

input datafilecopy RECID=8 STAMP=847995571 filename=+DGDATA/standby/datafile/sysaux.349.847995341

datafile 3switched to datafile copy

input datafilecopy RECID=9 STAMP=847995571 filename=+DGDATA/standby/datafile/undotbs1.383.847995513

datafile 4switched to datafile copy

input datafilecopy RECID=10 STAMP=847995571 filename=+DGDATA/standby/datafile/users.325.847995547

datafile 5switched to datafile copy

input datafilecopy RECID=11 STAMP=847995571 filename=+DGDATA/standby/datafile/example.350.847995447

datafile 6switched to datafile copy

input datafilecopy RECID=12 STAMP=847995571 filename=+DGDATA/standby/datafile/undotbs2.313.847995539

datafile 7switched to datafile copy

input datafilecopy RECID=13 STAMP=847995572 file name=+DGDATA/standby/datafile/plsql.346.847994875

Finished DuplicateDb at 2014-05-19 18:21:07

完成后,standby库被mounted:

以只读的形式打开standby库:

Oracle 11 g duplicate功能_复制dataguard备库

时间: 2024-08-07 08:31:23

Oracle 11 g duplicate功能_复制dataguard备库的相关文章

【原创】oracle ORA-01157 ORA-01110 DataGuard 备库 临时表空间报错

简要: 当查询数据库数据时,提示临时表空间异常,报错ORA-01157 ORA-01110,经过对数据文件处理后,已经解决此故障. 环境:Oracle 11g RAC For Linux 6,该库为DataGuard备库 1. 查询数据时报错,如下: ERROR:ORA-01157: cannot identify/lock data file 226 - see DBWR trace fileORA-01110: data file 226: '+DG_DATA02/racdb/blsp_te

在dataguard备库上找回在主库上被错误的Drop/Truncate/Delete 掉的Table

前提: - Standby Database Must be in Flashback database mode. - Time at which Drop/Truncate/Delete Table happened should be within the db_flashback_retention_target and all the flashback and archive logs should be available     在dataguard备库上找回在主库上被错误的Dr

DataGuard备库ORA-01196故障恢复一则

问题现象 在使用shutdown abort停DataGuard备库后,备库不能open,报ORA-01196错误. 具体如下: 发现一备库不能应用日志,查看备库日志没发现报错,怀疑是备库应用日志服务停止,于是尝试重启备库: 可能因为备库是读业务比较繁忙,在shutdown immediate关闭备库时等时间过长,于是使用了shutdown abort命令: 但后面在启动备库时发生报错,造成数据文件损坏,控制文件和数据文件的scn号不一致. --启动备库时报错 SQL> startup ORAC

11gR2 dataguard 备库文件损坏处理一例

延迟标记像极了线段树,不再多说. 区间反转在树伸展到位之后,也变成了简单的递归交换左右儿子. 愈发感觉到伸展树简直太漂亮了,伸展操作更是诱惑到不行 ,总之数据结构太有魅力了. 比较简单,就直接上模板了. #include <algorithm> #include <iostream> #include <cstring> #include <cstdlib> #include <cstdio> #include <queue> #in

oracle11g dataguard 备库数据同步的检查方法

概述: 一.环境 主库: ip地址:192.168.122.203 oracle根目录:/data/db/oracle SID:qyq 数据文件路径/data/db/oracle/oradata/qyq 归档文件路径:/data/db/oracle/archive' 备库: ip地址:192.168.122.204 oracle根目录:/data/app/oracle SID:qyq 数据文件路径/data/app/oracle/oradata/qyq 归档文件路径:/data/app/orac

tnsping无法ping通的问题,TNS-12535 TNS操作超时 (服务器环境:window server 2008R2 数据库环境:oracle 11 g)

今天新搭建一个测试用的数据库服务器,操作系统为WIN server 2008 r2 版本.系统内已安装oracle 11g database,数据库服务端已配置完毕,监听listener已开启. 我在通局域网内的其他PC端,操作系统为 win 7 64 旗舰. 配置oracle 10g 32 client,客户端配置完毕.命名完毕.tns服务名设置为 test 当我去测试tns联通情况的时候,反馈我TNS-12535 TNS操作超时,无法正常联通. 一.我先查了一下客户端安装路径下的networ

CentOS 6.8安装Oracle 11 g 解决xhost: unable to open display

CentOS 6.8最小安装 1. 安装tigervnc-server [[email protected]]$ yum install -y tigervnc-server 2. 启动vncserver 3. 设置DISPLAY环境变量 [[email protected]]$ export DISPLAY=:1.0 注意:后面的桌面号要根据vncserver启动时的信息来设置 4. 执行xhost命令 [[email protected]]$ xhost +

Oracle 11.2.0.4.0 DG (ASM) 搭建案例

图示:ARC进程 实验环境 主机:CentOS release 6.5 (Final) 软件:Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production 主库:db_unique_name:orcl1 备库:db_unique_name:orcl1dg ============================================================================

Oracle 11g Data Guard 物理备库快速配置指南(上)

缘起 最近做了10g和11g的物理备库配置实验,发现 Data Guard 其实很容易,但是缺少好文档.我是参考官方文档做的实验,觉得它写的不是很清楚的. Google 出来两个pdf文档,读了觉得比官方文档强很多.翻译下,也许会对某些朋友有用.翻译的同时我也好更熟悉下这两个文档.好久没翻译过英文了,可以顺便练练手. 原文档下载地址(墙外): Configure Dataguard 11gR2 Physical Standby Part 1 Configure Dataguard 11gR2 P