Oracle DataGuard是一種數據庫級別的HA方案
在生產數據庫的
一:Oracle DataGuard環境概述
操作系統Red Linux Enterprise as
數據庫版本Oracle
IP:
ORACLE_SID=db
db_unique_name=db
IP:
ORACLE_SID=standby
db_unique_name=standby
二
SQL> alter database force logging;
cd $ORACLE_HOME/dbs/
orapwdfile=orapwdb
alter system set log_archive_config=
alter system set log_archive_dest_
alter system set db_unique_name=
RMAN> connect target sys/
RMAN> backup database format=
[oracle@oracle rmanback]$ ls
DB
SQL>alter database create standby controlfile as
啟動lintener
[oracle@oracle dbs]$ lsnrctl status
LSNRCTL for Linux: Version
Service
Instance
Service
Instance
The command completed successfully
配置rnsnames
vi $ORACLE_HOME/network/admin/tnsnames
db
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
)
(CONNECT_DATA =
(SERVICE_NAME = db
standby =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST =
)
(CONNECT_DATA =
(SERVICE_NAME = standby)
)
)
三
#環境變量設成與主庫一樣
#只安裝軟件不安裝庫
cd $ORACLE_HOME/dbs/
orapwdfile=orapwSID password=
#注要密碼要與主庫的一樣
cd $ORACLE_HOME/dbs/
orapwd file=orapwSID password=
#注要密碼要與主庫的一樣
db_name = standby
shared_pool_size =
undo_management = AUTO
undo_tablespace = undotbs
sga_max_size =
sga_target =
db_
standby_file_management=AUTO
fal_server=
fal_client=
log_archive_dest_
log_archive_dest_
log_archive_dest_state_
log_archive_dest_state_
注意:備份存放位置要與primary database RMAN備份文件的位置相同
scp /oracle/rmanback/*
scp /oracle/rmanback/*
SQL>connect / as sysdba
connnpcted to an idle instance.
SQL>startup nomount pfile=$ORACLE_HOME/dbs/initstandby
SQL>alter database mount standby database
與主庫相同啟動listener
當主備庫的監聽都啟動後
tnsping db
tnsping standby
SQL> sqlplus sys/
SQL> sqlplus sys/
RMAN>connect target /
connected to target database
RMAN> restore database
SQL>recover managed standby database disconnect from session
#如果有需要應用的日志並想手工應用
SQL>recover automatic standby database
a
SQL> alter system switch logfile
b
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
c
SQL> select sequence#
SEQUENCE# APP
若在上步中的max sequence#在的的app狀態為YES說明standby database 成功創建
SQL> create spfile from pfile;
SQL> shutdown immedaite
SQL> startup mount
SQL> alter database recover managed standby database disconnect from session;
SQL> alter database open read only;
以上就是Oracle DataGuard數據備份的操作流程
From:http://tw.wingwit.com/Article/program/Oracle/201311/17534.html