RAC環境下建立物理DATAGUARD(2)
五、備庫環境準備
1、在備庫新增指向主庫的tnsnames
在備庫的tnsnames.ora新增如下內容:
primary =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 200.200.200.11)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 200.200.200.22)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = primary)
(FAILOVER_MODE =
(TYPE = SELECT)
(METHOD = BASIC)
(RETRIES = 180)
(DELAY = 5)
)
)
)2、在備庫建立相關目錄
包括adump,bdump,cdump,udump及資料檔案目錄等。
3、複製主庫的密碼檔案到備庫上
--複製rac1的密碼檔案到備庫的$ORACLE_HOME/dbs下,並把該密碼檔案修改為orapwd
[oracle@rac1 dbs]$ scp orapwrac1 172.25.0.35:`pwd`
orapwrac1 100% 1536 1.5KB/s 00:00
4、配置備庫的監聽
[oracle@standby admin]$ more listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = standby)
(ORACLE_HOME = /opt/oracle/product/10.2/database)
(SID_NAME = rac1)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = standby)(PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))
)
)
啟動備庫監聽:lsnrctl start
5、設定備庫引數檔案
從主庫rac1上根據spfile建立一個pfile檔案,並傳到備庫上。
SQL> create pfile from spfile;
File created.
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production
With the Partitioning, Real Application Clusters and Data Mining options
[oracle@rac1 ~]$ cd $ORACLE_HOME/dbs
[oracle@rac1 dbs]$ scp initrac1.ora 172.25.0.35:`pwd`
initrac1.ora
在備庫上修改引數檔案:
Ø 刪除所有非”*”打頭的引數設定及rac相關引數
Ø 設定dataguard引數
修改後引數如下:
[oracle@standby dbs]$ more initrac1.ora
*.audit_file_dest='/opt/oracle/admin/rac/adump'
*.background_dump_dest='/opt/oracle/admin/rac/bdump'
*.compatible='10.2.0.3'
*.control_files='/soft/oradata/rac/control01.ctl','/soft/oradata/rac/control02.ctl','/soft/oradata/rac/control03.ctl'
*.core_dump_dest='/opt/oracle/admin/rac/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_file_name_convert='/DEV/RAW/','/SOFT/ORADATA/RAC/'
*.db_name='rac'
*.db_unique_name='STANDBY'
*.fal_client='STANDBY'
*.fal_server='PRIMARY'
*.job_queue_processes=10
*.log_archive_config='DG_CONFIG=(primary,standby)'
*.log_archive_dest_1='LOCATION= /soft/oradata/archivelog/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
*.log_archive_dest_2='SERVICE=primary LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=primary'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_archive_format='%t_%s_%r.arc'
*.log_archive_max_processes=4
*.log_file_name_convert='/DEV/RAW/','/SOFT/ORADATA/RAC/'
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_max_size=157286400
*.sga_target=157286400
*.standby_file_management='AUTO'
*.undo_management='AUTO'
undo_tablespace='UNDOTBS1'
*.user_dump_dest='/opt/oracle/admin/rac/udump'
以上有些引數非必須設定的,但是為了switchover更方便,建議都修改上。
Undo表空間保留其中一個就可以。
路徑轉換相關引數要設定對,否則會報錯。
6、把備庫啟動到nomount狀態
[oracle@standby ~]$ sqlplus "/as sysdba"
SQL*Plus: Release 10.2.0.3.0 - Production on Wed Apr 30 18:42:39 2008
Copyright (c) 1982, 2006, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 159383552 bytes
Fixed Size 1260672 bytes
Variable Size 62915456 bytes
Database Buffers 92274688 bytes
Redo Buffers 2932736 bytes
7、從主庫複製備份到備庫上
之前備份的所有檔案都複製到備庫上,路徑要和主庫備份路徑保持一致。如果不一致,linux下可以用ln的方式解決。
注意:兩個節點都有歸檔的備份,要把這些備份都複製到備庫上。
RAC1:
[oracle@rac1 backup]$ scp * 172.25.0.35:`pwd`
01jf4fqq_1_1 100% 23MB 3.8MB/s 00:06
03jf4fr9_1_1 100% 194KB 194.0KB/s 00:00
04jf4frg_1_1 100% 315MB 3.4MB/s 01:34
08jf4fv9_1_1 100% 13KB 13.0KB/s 00:00
09jf4fvf_1_1 100% 4608 4.5KB/s 00:00
CON_0ajf4gqi_1_1 100% 15MB 3.7MB/s 00:04
RAC2:
[oracle@rac2 backup]$ scp * 172.25.0.35:`pwd`
02jf4fql_1_1 100% 7145KB 3.5MB/s 00:02
05jf4frg_1_1 100% 175MB 3.4MB/s 00:52
06jf4ft0_1_1 100% 15MB 1.5MB/s 00:10
07jf4ftm_1_1 100% 96KB 96.0KB/s 00:00
、恢復備庫
1、在主庫新增指向備庫的tnsname
在主庫的tnsnames.ora新增如下內容:
STANDBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST =200.200.200.123)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = standby)
)
2、在主庫執行,利用auxiliary來恢復備庫
[oracle@rac1 ~]$ $ORACLE_HOME/bin/rman target / auxiliary sys/6212327@standby
Recovery Manager: Release 10.2.0.3.0 - Production on Wed Apr 30 19:37:05 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: RAC (DBID=2232067446)
connected to auxiliary database: RAC (not mounted)
RMAN> run
{
allocate channel c1 device type disk format '/soft/backup/%U' connect sys/6212327@rac1;
2> 3> 4> allocate channel c2 device type disk format '/soft/backup/%U' connect sys/6212327@rac2;
5> allocate auxiliary channel ac1 device type disk format '/soft/backup/%U';
6> allocate auxiliary channel ac2 device type disk format '/soft/backup/%U';
7> duplicate target database for standby;
8> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: sid=132 instance=rac1 devtype=DISK
allocated channel: c2
channel c2: sid=134 instance=rac2 devtype=DISK
allocated channel: ac1
channel ac1: sid=155 devtype=DISK
allocated channel: ac2
channel ac2: sid=154 devtype=DISK
Starting Duplicate Db at 30-APR-08
contents of Memory Script.:
{
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script
Starting restore at 30-APR-08
channel ac1: starting datafile backupset restore
channel ac1: restoring control file
channel ac1: reading from backup piece /soft/backup/CON_0ajf4gqi_1_1
channel ac1: restored backup piece 1
piece handle=/soft/backup/CON_0ajf4gqi_1_1 tag=TAG20080430T150554
channel ac1: restore complete, elapsed time: 00:00:04
output filename=/soft/oradata/rac/control01.ctl
output filename=/soft/oradata/rac/control02.ctl
output filename=/soft/oradata/rac/control03.ctl
Finished restore at 30-APR-08
sql statement: alter database mount standby database
contents of Memory Script.:
{
set newname for tempfile 1 to
"/soft/oradata/rac/raw6";
switch clone tempfile all;
set newname for datafile 1 to
"/soft/oradata/rac/raw1";
set newname for datafile 2 to
"/soft/oradata/rac/raw3";
set newname for datafile 3 to
"/soft/oradata/rac/raw2";
set newname for datafile 4 to
"/soft/oradata/rac/raw5";
set newname for datafile 5 to
"/soft/oradata/rac/raw7";
restore
check readonly
clone database
;
}
executing Memory Script
executing command: SET NEWNAME
renamed temporary file 1 to /soft/oradata/rac/raw6 in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 30-APR-08
channel ac1: starting datafile backupset restore
channel ac1: specifying datafile(s) to restore from backup set
restoring datafile 00002 to /soft/oradata/rac/raw3
restoring datafile 00004 to /soft/oradata/rac/raw5
channel ac1: reading from backup piece /soft/backup/05jf4frg_1_1
channel ac2: starting datafile backupset restore
channel ac2: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /soft/oradata/rac/raw1
restoring datafile 00003 to /soft/oradata/rac/raw2
restoring datafile 00005 to /soft/oradata/rac/raw7
channel ac2: reading from backup piece /soft/backup/04jf4frg_1_1
channel ac1: restored backup piece 1
piece handle=/soft/backup/05jf4frg_1_1 tag=TAG20080430T144919
channel ac1: restore complete, elapsed time: 00:01:22
channel ac2: restored backup piece 1
piece handle=/soft/backup/04jf4frg_1_1 tag=TAG20080430T144919
channel ac2: restore complete, elapsed time: 00:01:32
Finished restore at 30-APR-08
contents of Memory Script.:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy recid=6 stamp=653426781 filename=/soft/oradata/rac/raw1
datafile 2 switched to datafile
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/231499/viewspace-258727/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RAC環境下建立物理DATAGUARD(1)
- RAC和ASM環境下打patchASM
- Oracle RAC 環境下的連線管理Oracle
- Oracle 11.2 DataGuard RAC To RAC搭建Oracle
- oracle 11G RAC的建立(VM虛擬環境)Oracle
- RAC+ASM+DATAGUARDASM
- 【Dataguard】Oracle多租戶環境對Dataguard的影響Oracle
- Oracle RAC環境下ASM磁碟組擴容OracleASM
- 建立Python虛擬環境——下Python
- 10GR2下建立物理standby STEP BY STEP
- 建立環境
- RAC環境下的SEQUENCE對應用的影響
- AIX 5.3/6.1環境下安裝Oracle 10gR2 RAC常見報錯AIOracle 10g
- 非域環境下SQL Server mirror建立SQLServer
- RAC環境修改spfile的位置
- KingbaseES RAC部署案例之---SAN環境構建RAC
- 【DATAGUARD】Oracle Dataguard物理備庫切換最佳實踐(sqlplus)OracleSQL
- 開發環境下PP檔案的建立開發環境
- gym建立環境、自定義gym環境
- 手工清理19c RAC環境
- Anaconda建立環境、刪除環境、環境重新命名、檢視環境名
- 在Windows下如何建立指定的虛擬環境Windows
- maven環境下建立一個spring的java工程MavenSpringJava
- python pipenv建立環境Python
- 如何在rac環境中增加監聽
- 超大記憶體環境下的Oracle RAC引數設定建議記憶體Oracle
- anaconda建立虛擬環境
- 建立python虛擬環境Python
- pycharm+anaconda環境建立PyCharm
- 建立 Python 虛擬環境Python
- ORACLE 12C DATAGUARD環境搭建和主從切換Oracle
- Windows 環境下 Python 環境安裝WindowsPython
- window環境下testlink環境搭建(xammp)
- Windows環境下的Nginx環境搭建WindowsNginx
- Mac 下 vue 開發環境的搭建以及專案建立MacVue開發環境
- DataGuard---->物理StandBy的角色切換之switchover
- 物理DATAGUARD庫上的KSVCREATE: PROCESS(M000)
- ORA-00600: internal error code, arguments: [kzsrsea] DataGuard環境的異常Error