一:修改主库参数文件:
创新互联专注于郓城网站建设服务及定制,我们拥有丰富的企业做网站经验。 热诚为您提供郓城营销型网站建设,郓城网站制作、郓城网页设计、郓城网站官网定制、微信小程序开发服务,打造郓城网络公司原创品牌,更为您提供郓城网站排名全网营销落地服务。
*.DB_UNIQUE_NAME=PHUB *.LOG_ARCHIVE_CONFIG='DG_CONFIG=(MECBS,PHUB)' *.LOG_ARCHIVE_DEST_2='SERVICE=MECBS LGWR SYNC AFFIRM VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=MECBS' *.log_archive_dest_state_1=enable *.log_archive_dest_state_2=enable *.standby_file_management=auto *.log_archive_dest_1='location=+DATA valid_for=(all_logfiles,all_roles) db_unique_name=PHUB'
二:安装备库oracle软件:
安装操作系统:略
修改主机名和hosts文件:
[root@dg ~]# more /etc/hosts # Do not remove the following line, or various programs # that require network functionality will fail. 127.0.0.1localhost.localdomain localhost ::1localhost6.localdomain6 localhost6 172.16.30.228dg
4.修改系统参数:
[root@dg ~]# cat >>/etc/sysctl.conf <fs.file-max = 6815744 > kernel.sem = 250 32000 100 128 > kernel.shmmni = 4096 > kernel.shmall = 1073741824 > kernel.shmmax = 4398046511104 > net.core.rmem_default = 262144 > net.core.rmem_max = 4194304 > net.core.wmem_default = 262144 > net.core.wmem_max = 1048576 > fs.aio-max-nr = 1048576 > net.ipv4.ip_local_port_range = 9000 65500 > eof
[root@dg ~]# sysctl -p net.ipv4.ip_forward = 0 net.ipv4.conf.default.rp_filter = 2 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 0 kernel.core_uses_pid = 1 net.ipv4.tcp_syncookies = 1 kernel.msgmnb = 65536 kernel.msgmax = 65536 kernel.shmmax = 68719476736 kernel.shmall = 4294967296 fs.file-max = 6815744 kernel.sem = 250 32000 100 128 kernel.shmmni = 4096 kernel.shmall = 1073741824 kernel.shmmax = 4398046511104 net.core.rmem_default = 262144 net.core.rmem_max = 4194304 net.core.wmem_default = 262144 net.core.wmem_max = 1048576 fs.aio-max-nr = 1048576 net.ipv4.ip_local_port_range = 9000 65500
5.修改资源限制配置文件:
[root@dg ~]# cat >>/etc/security/limits.conf <grid soft nofile 1024 > grid hard nofile 65536 > grid soft nproc 2047 > grid hard nproc 16384 > grid soft stack 10240 > grid hard stack 32768 > oracle soft nofile 1024 > oracle hard nofile 65536 > oracle soft nproc 2047 > oracle hard nproc 16384 > oracle soft stack 10240 > oracle hard stack 32768 > eof [root@dg ~]# tail -20 /etc/security/limits.conf grid soft nofile 1024 grid hard nofile 65536 grid soft nproc 2047 grid hard nproc 16384 grid soft stack 10240 grid hard stack 32768 oracle soft nofile 1024 oracle hard nofile 65536 oracle soft nproc 2047 oracle hard nproc 16384 oracle soft stack 10240 oracle hard stack 3276
6.配置yum源并安装依赖包:
[root@dg ~]# cat /etc/yum.repos.d/local.repo [Redhat6] name= Enterpress6.5 baseurl=file:///mnt/Server enabled=1 gpgcheck=0 [root@dg ~]# mount /dev/sr0 /mnt/ mount: block device /dev/sr0 is write-protected, mounting read-only
yum -y install binutils compat-libstdc++-33elfutils-libelf \ elfutils-libelf-devel elfutils-libelf-devel-static gccgcc-c++ glibc glibc-common \ glibc-devel kernel-headers ksh libaio libaio-devel libgcclibgomp libstdc++ libstdc++-devel \ make numactl-devel sysstatunixODBC unixODBC-devel pdksh
7.建立用户,用户组,安装目录:
[root@dg ~]# /usr/sbin/groupadd -g 54321 oinstall [root@dg ~]# /usr/sbin/groupadd -g 54322 dba [root@dg ~]# /usr/sbin/groupadd -g 54323 oper [root@dg ~]# /usr/sbin/groupadd -g 54324 backupdba [root@dg ~]# /usr/sbin/groupadd -g 54325 dgdba [root@dg ~]# /usr/sbin/groupadd -g 54327 asmdba [root@dg ~]# /usr/sbin/groupadd -g 54328 asmoper [root@dg ~]# /usr/sbin/groupadd -g 54329 asmadmin [root@dg ~]# /usr/sbin/useradd -u 54321 -g oinstall -G asmadmin,asmdba,asmoper,dba grid [root@dg ~]# /usr/sbin/useradd -u 54322 -g oinstall -G dba,backupdba,dgdba,asmadmin,asmdba orac [root@dg ~]# passwd grid Changing password for user grid. New UNIX password: BAD PASSWORD: it is too short Retype new UNIX password: Sorry, passwords do not match. New UNIX password: BAD PASSWORD: it is too short Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@dg ~]# passwd oracle Changing password for user oracle. New UNIX password: BAD PASSWORD: it is based on a dictionary word Retype new UNIX password: passwd: all authentication tokens updated successfully. [root@dg ~]# mkdir -p /u01/app/grid [root@dg ~]# mkdir -p /u01/app/11.2.0/grid [root@dg ~]# mkdir -p /u01/app/oracle/product/11.2.0/db_1 [root@dg ~]# chown -R grid.oinstall /u01 [root@dg ~]# chown -R oracle.oinstall /u01/app/oracle [root@dg ~]# chmod -R 775 /u01
8.配置环境变量:
[root@dg ~]# cat >>/home/grid/.bash_profile <eof [root@dg ~]# source /home/grid/.bash_profile [root@dg ~]# cat >>/home/oracle/.bash_profile < 9.配置ASM磁盘:
[root@dg Server]# rpm -ivh oracleasm-support-2.1.7-1.el5.x86_64.rpm warning: oracleasm-support-2.1.7-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 Preparing... ########################################### [100%] 1:oracleasm-support ########################################### [100%] [root@dg Server]# rpm -ivh oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm warning: oracleasm-2.6.18-308.el5-2.0.5-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 Preparing... ########################################### [100%] 1:oracleasm-2.6.18-308.el########################################### [100%] [root@dg Server]# cd [root@dg ~]# rpm -ivh oracleasmlib-2.0.4-1.el5.x86_64.rpm warning: oracleasmlib-2.0.4-1.el5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 1e5e0159 Preparing... ########################################### [100%] 1:oracleasmlib ########################################### [100%][root@dg ~]# /etc/init.d/oracleasm configure -i Configuring the Oracle ASM library driver. This will configure the on-boot properties of the Oracle ASM library driver. The following questions will determine whether the driver is loaded on boot and what permissions it will have. The current values will be shown in brackets ('[]'). Hittingwithout typing an answer will keep that current value. Ctrl-C will abort. Default user to own the driver interface []: grid Default group to own the driver interface []: asmadmin Start Oracle ASM library driver on boot (y/n) [n]: y Scan for Oracle ASM disks on boot (y/n) [y]: y Writing Oracle ASM library driver configuration: done Initializing the Oracle ASMLib driver: [ OK ] Scanning the system for Oracle ASMLib disks: [ OK ] [root@dg ~]# /etc/init.d/oracleasm createdisk CRS /dev/sdb1 Marking disk "CRS" as an ASM disk: [ OK ] [root@dg ~]# /etc/init.d/oracleasm createdisk DATA1 /dev/sdc1 Marking disk "DATA1" as an ASM disk: [ OK ] [root@dg ~]# /etc/init.d/oracleasm createdisk DATA2 /dev/sdd1 Marking disk "DATA2" as an ASM disk: [ OK ] [root@dg ~]# /etc/init.d/oracleasm scandisks Scanning the system for Oracle ASMLib disks: [ OK ] [root@dg ~]# /etc/init.d/oracleasm listdisks CRS DATA1 DATA29.上传安装文件安装grid和oracle软件:略
二.配置DG:(主库实例PHUB,备库实例MECBS)
1.备库配置静态监听:()
在grid的监听文件中加入:
SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (GLOBAL_DBNAME=MECBS) (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1) (SID_NAME=MECBS) ) )重启监听:
Service "MECBS" has 1 instance(s). Instance "MECBS", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully2.配置主库和备库的tns:(注意把主机名换成IP)
PHUB = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.30.228)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PHUB) ) ) MECBS = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dg)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = MECBS) ) )用tnsping验证:
[oracle@cwogg admin]$ tnsping PHUB TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 22-SEP-2015 16:20:37 Copyright (c) 1997, 2013, Oracle. All rights reserved. Used parameter files: /u01/app/oracle/product/11.2.0/db_1/network/admin/sqlnet.ora Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = cwogg)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PHUB))) OK (50 msec)3.编辑备库参数文件:
[oracle@dg dbs]$ more initMECBS.ora *.db_name='PHUB' 这里和主库一样的4.拷贝密码文件:
[oracle@cwogg dbs]$ scp orapwPHUB 172.16.30.228:/u01/app/oracle/product/11.2.0/db_1/dbs/orapwMECBS oracle@172.16.30.228's password: orapwPHUB100% 1536 1.5KB/s 00:00
5.编辑duplicate.sql
[oracle@cwogg ~]$ vim duplicate.sql duplicate target database for standby from active database nofilenamecheck DORECOVER spfile set service_names='MECBS' set db_unique_name='MECBS' set log_archive_config='dg_config=(MECBS,PHUB)' set log_archive_dest_1='location=+DATA VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MECBS' set log_archive_dest_2='SERVICE=PHUB LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHUB' set standby_file_management='AUTO' set diagnostic_dest='/u01/app/oracle' set audit_file_dest='/u01/app/oracle/admin/MECBS/adump' set fal_server='PHUB' set fal_client='MECBS' set control_files='+DATA/mecbs/controlfile/control01.ctl','+DATA/mecbs/controlfile/control02.ctl' set cluster_database='false' #set DB_FILE_NAME_CONVERT='' 数据库文件路径不一样需要详细写出来 #set LOG_FILE_NAME_CONVERT='' set db_create_file_dest='+DATA' set db_recovery_file_dest='+DATA' set db_recovery_file_dest_size='4G';6.启动备库nomount:
[oracle@dg oracle]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 22 16:43:28 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to an idle instance. SQL> startup nomount; ORACLE instance started. Total System Global Area 217157632 bytes Fixed Size 2251816 bytes Variable Size 159384536 bytes Database Buffers 50331648 bytes Redo Buffers 5189632 bytes7.主库配置standbylog,flashback,归档模式:
[oracle@cwogg dbs]$ sqlplus / as sysdba SQL*Plus: Release 11.2.0.4.0 Production on Tue Sep 22 16:45:56 2015 Copyright (c) 1982, 2013, Oracle. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production With the Partitioning, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options SQL> select thread#,bytes/1024/1024 "SIZE(MB)",MEMBERS FROM V$LOG; THREAD# SIZE(MB) MEMBERS ---------- ---------- ---------- 1 50 2 1 50 2 1 50 2 SQL> alter database add standby logfile thread 1('+DATA') size 50M; Database altered. SQL> alter database add standby logfile thread 1('+DATA') size 50M; Database altered. SQL> alter database add standby logfile thread 1('+DATA') size 50M; Database altered. SQL> select thread#,bytes/1024/1024 "SIZE(MB)",MEMBERS FROM V$LOG; THREAD# SIZE(MB) MEMBERS ---------- ---------- ---------- 1 50 2 1 50 2 1 50 2 SQL> select thread#,bytes/1024/1024 "SIZE(MB)" FROM V$standby_LOG; THREAD# SIZE(MB) ---------- ---------- 1 50 1 50 1 50 SQL> select flashback_on from v$database; FLASHBACK_ON ------------------ YES SQL> archive log list; Database log mode Archive Mode Automatic archival Enabled Archive destination USE_DB_RECOVERY_FILE_DEST Oldest online log sequence 25 Next log sequence to archive 27 Current log sequence 277.在主库上执行duplicate:
[oracle@cwogg ~]$ rman target / auxiliary sys/123123@172.16.30.228/MECBS Recovery Manager: Release 11.2.0.4.0 - Production on Tue Sep 22 16:50:55 2015 Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved. connected to target database: PHUB (DBID=536511065) connected to auxiliary database: PHUB (not mounted) RMAN> @duplicate.sql RMAN> duplicate target database 2> for standby 3> from active database nofilenamecheck 4> DORECOVER 5> spfile 6> set service_names='MECBS' 7> set db_unique_name='MECBS' 8> set log_archive_dest_1='location=+DATA VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MECBS' 9> set log_archive_dest_2='SERVICE=PHUB LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHUB' 10> set standby_file_management='AUTO' 11> set diagnostic_dest='/u01/app/oracle' 12> set audit_file_dest='/u01/app/oracle/admin/MECBS/adump' 13> set fal_server='PHUB' 14> set fal_client='MECBS' 15> set control_files='+DATA/mecbs/controlfile/control01.ctl','+DATA/mecbs/controlfile/control02.ctl' 16> set cluster_database='false' 17> #set DB_FILE_NAME_CONVERT='/oradata/rpt','+DATA/cwrptb/datafile','/oradata/smt','+DATA/cwrptb/datafile','/oradata/fol','+DATA/cwrptb/datafile','/oradata/acf','+DATA/cwrptb/datafile','/oradata/eol','+DATA/cwrptb/datafile','/oracle/product/ora11gr2/oradata/CWRPT','+DATA/cwrptb/datafile' 18> #set LOG_FILE_NAME_CONVERT='/arch/CWRPT/onlinelog','+DATA/cwrptb/onlinelog' 19> set db_create_file_dest='+DATA' 20> set db_recovery_file_dest='+DATA' 21> set db_recovery_file_dest_size='4G'; Starting Duplicate Db at 22-SEP-15 using target database control file instead of recovery catalog allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=20 device type=DISK allocated channel: ORA_AUX_DISK_2 channel ORA_AUX_DISK_2: SID=21 device type=DISK contents of Memory Script: { backup as copy reuse targetfile '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwPHUB' auxiliary format '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwMECBS' targetfile '+DATA/phub/spfilephub.ora' auxiliary format '/u01/app/oracle/product/11.2.0/db_1/dbs/spfileMECBS.ora' ; sql clone "alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfileMECBS.ora''"; } executing Memory Script Starting backup at 22-SEP-15 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=9 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=191 device type=DISK Finished backup at 22-SEP-15 sql statement: alter system set spfile= ''/u01/app/oracle/product/11.2.0/db_1/dbs/spfileMECBS.ora'' contents of Memory Script: { sql clone "alter system set service_names = ''MECBS'' comment= '''' scope=spfile"; sql clone "alter system set db_unique_name = ''MECBS'' comment= '''' scope=spfile"; sql clone "alter system set log_archive_dest_1 = ''location=+DATA VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MECBS'' comment= '''' scope=spfile"; sql clone "alter system set log_archive_dest_2 = ''SERVICE=PHUB LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHUB'' comment= '''' scope=spfile"; sql clone "alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile"; sql clone "alter system set diagnostic_dest = ''/u01/app/oracle'' comment= '''' scope=spfile"; sql clone "alter system set audit_file_dest = ''/u01/app/oracle/admin/MECBS/adump'' comment= '''' scope=spfile"; sql clone "alter system set fal_server = ''PHUB'' comment= '''' scope=spfile"; sql clone "alter system set fal_client = ''MECBS'' comment= '''' scope=spfile"; sql clone "alter system set control_files = ''+DATA/mecbs/controlfile/control01.ctl'', ''+DATA/mecbs/controlfile/control02.ctl'' comment= '''' scope=spfile"; sql clone "alter system set cluster_database = false comment= '''' scope=spfile"; sql clone "alter system set db_create_file_dest = ''+DATA'' comment= '''' scope=spfile"; sql clone "alter system set db_recovery_file_dest = ''+DATA'' comment= '''' scope=spfile"; sql clone "alter system set db_recovery_file_dest_size = 4G comment= '''' scope=spfile"; shutdown clone immediate; startup clone nomount; } executing Memory Script sql statement: alter system set service_names = ''MECBS'' comment= '''' scope=spfile sql statement: alter system set db_unique_name = ''MECBS'' comment= '''' scope=spfile sql statement: alter system set log_archive_dest_1 = ''location=+DATA VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=MECBS'' comment= '''' scope=spfile sql statement: alter system set log_archive_dest_2 = ''SERVICE=PHUB LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=PHUB'' comment= '''' scope=spfile sql statement: alter system set standby_file_management = ''AUTO'' comment= '''' scope=spfile sql statement: alter system set diagnostic_dest = ''/u01/app/oracle'' comment= '''' scope=spfile sql statement: alter system set audit_file_dest = ''/u01/app/oracle/admin/MECBS/adump'' comment= '''' scope=spfile sql statement: alter system set fal_server = ''PHUB'' comment= '''' scope=spfile sql statement: alter system set fal_client = ''MECBS'' comment= '''' scope=spfile sql statement: alter system set control_files = ''+DATA/mecbs/controlfile/control01.ctl'', ''+DATA/mecbs/controlfile/control02.ctl'' comment= '''' scope=spfile sql statement: alter system set cluster_database = false comment= '''' scope=spfile sql statement: alter system set db_create_file_dest = ''+DATA'' comment= '''' scope=spfile sql statement: alter system set db_recovery_file_dest = ''+DATA'' comment= '''' scope=spfile sql statement: alter system set db_recovery_file_dest_size = 4G comment= '''' scope=spfile Oracle instance shut down connected to auxiliary database (not started) Oracle instance started Total System Global Area 835104768 bytes Fixed Size 2257840 bytes Variable Size 541068368 bytes Database Buffers 289406976 bytes Redo Buffers 2371584 bytes contents of Memory Script: { backup as copy current controlfile for standby auxiliary format '+DATA/mecbs/controlfile/control01.ctl'; restore clone controlfile to '+DATA/mecbs/controlfile/control02.ctl' from '+DATA/mecbs/controlfile/control01.ctl'; } executing Memory Script Starting backup at 22-SEP-15 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting datafile copy copying standby control file output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_PHUB.f tag=TAG20150922T165146 RECID=2 STAMP=891103907 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07 Finished backup at 22-SEP-15 Starting restore at 22-SEP-15 allocated channel: ORA_AUX_DISK_1 channel ORA_AUX_DISK_1: SID=23 device type=DISK allocated channel: ORA_AUX_DISK_2 channel ORA_AUX_DISK_2: SID=24 device type=DISK channel ORA_AUX_DISK_2: skipped, AUTOBACKUP already found channel ORA_AUX_DISK_1: copied control file copy Finished restore at 22-SEP-15 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 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; 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 ; sql 'alter system archive log current'; } executing Memory Script executing command: SET NEWNAME renamed tempfile 1 to +DATA 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 22-SEP-15 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting datafile copy input datafile file number=00006 name=+DATA/phub/datafile/llc01.dbf channel ORA_DISK_2: starting datafile copy input datafile file number=00001 name=+DATA/phub/datafile/system.287.890482863 output file name=+DATA/mecbs/datafile/system.259.891103927 tag=TAG20150922T165212 channel ORA_DISK_2: datafile copy complete, elapsed time: 00:02:25 channel ORA_DISK_2: starting datafile copy input datafile file number=00002 name=+DATA/phub/datafile/sysaux.269.890482863 output file name=+DATA/mecbs/datafile/sysaux.260.891104071 tag=TAG20150922T165212 channel ORA_DISK_2: datafile copy complete, elapsed time: 00:01:55 channel ORA_DISK_2: starting datafile copy input datafile file number=00005 name=+DATA/phub/datafile/example.271.890482863 output file name=+DATA/mecbs/datafile/example.261.891104187 tag=TAG20150922T165212 channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:55 channel ORA_DISK_2: starting datafile copy input datafile file number=00003 name=+DATA/phub/datafile/undotbs1.272.890482863 output file name=+DATA/mecbs/datafile/undotbs1.262.891104243 tag=TAG20150922T165212 channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:25 channel ORA_DISK_2: starting datafile copy input datafile file number=00004 name=+DATA/phub/datafile/users.260.890482863 output file name=+DATA/mecbs/datafile/users.263.891104267 tag=TAG20150922T165212 channel ORA_DISK_2: datafile copy complete, elapsed time: 00:00:15 output file name=+DATA/mecbs/datafile/llc.258.891103925 tag=TAG20150922T165212 channel ORA_DISK_1: datafile copy complete, elapsed time: 00:08:27 Finished backup at 22-SEP-15 sql statement: alter system archive log current contents of Memory Script: { backup as copy reuse archivelog like "+DATA/phub/archivelog/2015_09_22/thread_1_seq_27.325.891104439" auxiliary format "+DATA" ; catalog clone start with "+DATA"; switch clone datafile all; } executing Memory Script Starting backup at 22-SEP-15 using channel ORA_DISK_1 using channel ORA_DISK_2 channel ORA_DISK_1: starting archived log copy input archived log thread=1 sequence=27 RECID=54 STAMP=891104440 output file name=+DATA/mecbs/archivelog/2015_09_22/thread_1_seq_27.264.891104435 RECID=0 STAMP=0 channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01 Finished backup at 22-SEP-15 searching for all files that match the pattern +DATA List of Files Unknown to the Database ===================================== File Name: +data/mecbs/ARCHIVELOG/2015_09_22/thread_1_seq_27.264.891104435 File Name: +data/mecbs/DATAFILE/LLC.258.891103925 File Name: +data/mecbs/DATAFILE/SYSTEM.259.891103927 File Name: +data/mecbs/DATAFILE/SYSAUX.260.891104071 File Name: +data/mecbs/DATAFILE/EXAMPLE.261.891104187 File Name: +data/mecbs/DATAFILE/UNDOTBS1.262.891104243 File Name: +data/mecbs/DATAFILE/USERS.263.891104267 File Name: +data/ASM/ASMPARAMETERFILE/REGISTRY.253.891100399 cataloging files... cataloging done List of Cataloged Files ======================= File Name: +data/mecbs/ARCHIVELOG/2015_09_22/thread_1_seq_27.264.891104435 File Name: +data/mecbs/DATAFILE/LLC.258.891103925 File Name: +data/mecbs/DATAFILE/SYSTEM.259.891103927 File Name: +data/mecbs/DATAFILE/SYSAUX.260.891104071 File Name: +data/mecbs/DATAFILE/EXAMPLE.261.891104187 File Name: +data/mecbs/DATAFILE/UNDOTBS1.262.891104243 File Name: +data/mecbs/DATAFILE/USERS.263.891104267 List of Files Which Where Not Cataloged ======================================= File Name: +data/ASM/ASMPARAMETERFILE/REGISTRY.253.891100399 RMAN-07518: Reason: Foreign database file DBID: 0 Database Name: datafile 1 switched to datafile copy input datafile copy RECID=8 STAMP=891104436 file name=+DATA/mecbs/datafile/system.259.891103927 datafile 2 switched to datafile copy input datafile copy RECID=9 STAMP=891104436 file name=+DATA/mecbs/datafile/sysaux.260.891104071 datafile 3 switched to datafile copy input datafile copy RECID=10 STAMP=891104436 file name=+DATA/mecbs/datafile/undotbs1.262.891104243 datafile 4 switched to datafile copy input datafile copy RECID=11 STAMP=891104436 file name=+DATA/mecbs/datafile/users.263.891104267 datafile 5 switched to datafile copy input datafile copy RECID=12 STAMP=891104436 file name=+DATA/mecbs/datafile/example.261.891104187 datafile 6 switched to datafile copy input datafile copy RECID=13 STAMP=891104436 file name=+DATA/mecbs/datafile/llc.258.891103925 contents of Memory Script: { set until scn 1889761; recover standby clone database delete archivelog ; } executing Memory Script executing command: SET until clause Starting recover at 22-SEP-15 using channel ORA_AUX_DISK_1 using channel ORA_AUX_DISK_2 starting media recovery archived log for thread 1 with sequence 27 is already on disk as file +DATA/mecbs/archivelog/2015_09_22/thread_1_seq_27.264.891104435 archived log file name=+DATA/mecbs/archivelog/2015_09_22/thread_1_seq_27.264.891104435 thread=1 sequence=27 media recovery complete, elapsed time: 00:00:00 Finished recover at 22-SEP-15 Finished Duplicate Db at 22-SEP-15SQL> select status,instance_name from v$instance; STATUS INSTANCE_NAME ------------ ---------------- MOUNTED MECBS SQL> alter database open; Database altered. SQL> select open_mode,name from v$database; OPEN_MODE NAME -------------------- --------- READ ONLY PHUB开启日志同步:
SQL> alter database recover managed standby database disconnect from session; Database altered. alter database recover managed standby database using current logfile disconnect from session 是实时应用。把数据库注册:
[oracle@dg oracle]$ srvctl status listener -l listener Listener LISTENER is enabled Listener LISTENER is running on node(s): dg [oracle@dg oracle]$ srvctl add database -d MECBS -o /u01/app/oracle/product/11.2.0/db_1/ [oracle@dg oracle]$ srvctl status database -d MECBS Database is not running. [oracle@dg oracle]$ srvctl start database -d MECBS [oracle@dg oracle]$ srvctl status database -d MECBS Database is running. [oracle@dg oracle]$ su - grid Password: [grid@dg ~]$ crsctl stat res -t -------------------------------------------------------------------------------- NAME TARGET STATE SERVER STATE_DETAILS -------------------------------------------------------------------------------- Local Resources -------------------------------------------------------------------------------- ora.DATA.dg ONLINE ONLINE dg ora.LISTENER.lsnr ONLINE ONLINE dg ora.asm ONLINE ONLINE dg Started ora.ons OFFLINE OFFLINE dg -------------------------------------------------------------------------------- Cluster Resources -------------------------------------------------------------------------------- ora.cssd 1 ONLINE ONLINE dg ora.diskmon 1 OFFLINE OFFLINE ora.evmd 1 ONLINE ONLINE dg ora.mecbs.db 1 ONLINE ONLINE dg Open 总结:忘记LOG_ARCHIVE_CONFIG 报以下错: PING[ARC2]: Heartbeat failed to connect to standby 'MECBS'. Error is 1034. Tue Sep 22 19:41:39 2015 Using STANDBY_ARCHIVE_DEST parameter default value as +DATA ALTER SYSTEM SET log_archive_dest_state_2='ENABLE' SCOPE=MEMORY SID='*'; Tue Sep 22 19:41:41 2015 ****************************************************************** LGWR: Setting 'active' archival for destination LOG_ARCHIVE_DEST_2 ****************************************************************** LGWR: Standby redo logfile selected for thread 1 sequence 40 for destination LOG_ARCHIVE_DEST_2 Thread 1 advanced to log sequence 40 (LGWR switch) Current log# 1 seq# 40 mem# 0: +DATA/phub/onlinelog/group_1.262.890480943 Current log# 1 seq# 40 mem# 1: +DATA/phub/onlinelog/group_1.263.890480945
分享文章:Oracle11g配置DG
转载来源:http://cxhlcq.com/article/pdjpoe.html