一:修改主庫(kù)參數(shù)文件:
專注于為中小企業(yè)提供成都網(wǎng)站制作、網(wǎng)站設(shè)計(jì)服務(wù),電腦端+手機(jī)端+微信端的三站合一,更高效的管理,為中小企業(yè)雞東免費(fèi)做網(wǎng)站提供優(yōu)質(zhì)的服務(wù)。我們立足成都,凝聚了一批互聯(lián)網(wǎng)行業(yè)人才,有力地推動(dòng)了上1000+企業(yè)的穩(wěn)健成長(zhǎng),幫助中小企業(yè)通過網(wǎng)站建設(shè)實(shí)現(xiàn)規(guī)模擴(kuò)充和轉(zhuǎn)變。*.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'二:安裝備庫(kù)oracle軟件:
安裝操作系統(tǒng):略
修改主機(jī)名和hosts文件:
4.修改系統(tǒng)參數(shù):
[root@dg ~]# cat >>/etc/sysctl.conf <5.修改資源限制配置文件:
[root@dg ~]# cat >>/etc/security/limits.conf <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-onlyyum -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 pdksh7.建立用戶,用戶組,安裝目錄:
[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 /u018.配置環(huán)境變量:
[root@dg ~]# cat >>/home/grid/.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 ('[]'). Hitting9.上傳安裝文件安裝grid和oracle軟件:略
二.配置DG:(主庫(kù)實(shí)例PHUB,備庫(kù)實(shí)例MECBS)
1.備庫(kù)配置靜態(tài)監(jiān)聽:()
在grid的監(jiān)聽文件中加入:
SID_LIST_LISTENER= (SID_LIST= (SID_DESC= (GLOBAL_DBNAME=MECBS) (ORACLE_HOME=/u01/app/oracle/product/11.2.0/db_1) (SID_NAME=MECBS) ) )重啟監(jiān)聽:
Service "MECBS" has 1 instance(s). Instance "MECBS", status UNKNOWN, has 1 handler(s) for this service... The command completed successfully2.配置主庫(kù)和備庫(kù)的tns:(注意把主機(jī)名換成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驗(yàn)證:
[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.編輯備庫(kù)參數(shù)文件:
[oracle@dg dbs]$ more initMECBS.ora *.db_name='PHUB' 這里和主庫(kù)一樣的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='' 數(shù)據(jù)庫(kù)文件路徑不一樣需要詳細(xì)寫出來 #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.啟動(dòng)備庫(kù)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.主庫(kù)配置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.在主庫(kù)上執(zhí)行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 是實(shí)時(shí)應(yīng)用。把數(shù)據(jù)庫(kù)注冊(cè):
[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 總結(jié):忘記LOG_ARCHIVE_CONFIG 報(bào)以下錯(cuò): 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另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)cdcxhl.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。