目的
搭建一個(gè)Oracle 11gR2支持?jǐn)?shù)據(jù)熱備份的驗(yàn)證環(huán)境,對應(yīng)用系統(tǒng)進(jìn)行集群部署驗(yàn)證。
準(zhǔn)備
安裝CentOS 7 64位系統(tǒng)上的Oracle 11gR2服務(wù)器兩臺(tái)(primary、standby)
確定主從數(shù)據(jù)庫全局唯一名稱(db_unique_name):primary(xiaoji)、standby(xiaoji_standby)
開始安裝
1 打開Forced Logging模式
操作對象:primary
操作用戶:oracle
sqlplus xiaoji as sysdba
archive log list;
確認(rèn)歸檔模式
SQL> archive log list;
Database log mode? ? ? ? ? ? ? No Archive Mode
Automatic archival? ? ? ? ? ? Disabled
Archive destination? ? ? ? ? ? USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence? ? 7
Current log sequence? ? ? ? ? 9
啟動(dòng)歸檔模式
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.SQL> startup mount;
ORACLE instance started.
Total System Global Area? 534462464 bytes
Fixed Size? ? ? ? ? ? ? ? ? 2215064 bytes
Variable Size? ? ? ? ? ? 402654056 bytes
Database Buffers? ? ? ? ? 121634816 bytes
Redo Buffers? ? ? ? ? ? ? ? 7958528 bytes
Database mounted.SQL> alter database archivelog;
Database altered.
確認(rèn)歸檔模式
SQL> archive log list;
Database log mode? ? ? ? ? ? ? Archive Mode
Automatic archival? ? ? ? ? ? Enabled
Archive destination? ? ? ? ? ? USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence? ? 14
Next log sequence to archive? 16
Current log sequence? ? ? ? ? 16
確認(rèn)強(qiáng)制歸檔
SQL> select force_logging from v$database;
FOR
---
YES
強(qiáng)制歸檔
alter database force logging;
執(zhí)行結(jié)果
SQL> alter database force logging;
Database altered.
確認(rèn)歸檔模式
SQL> select force_logging from v$database;
FOR
---
YES
2 添加standby日志文件
操作對象:primary
操作用戶:oracle
sqlplus xiaoji as sysdba
alter database add standby logfile group 4 ('/home/oracle/tools/oracle11g/oradata/xiaoji/redo_standby_01.log') size 20M;
alter database add standby logfile group 5 ('/home/oracle/tools/oracle11g/oradata/xiaoji/redo_standby_02.log') size 20M;
alter database add standby logfile group 6 ('/home/oracle/tools/oracle11g/oradata/xiaoji/redo_standby_03.log') size 20M;
alter database drop standby logfile group 4;
alter database drop standby logfile group 5;
alter database drop standby logfile group 6;select * from v$logfile order by 1;
確認(rèn)日志文件
[oracle@vmco0240 xiaoji]$ pwd
/home/oracle/tools/oracle11g/oradata/xiaoji
[oracle@vmco0240 xiaoji]$ ls -la
total 1418624
drwxr-x---. 2 oracle asmadmin? ? ? 4096 Jan? 5 16:31 .
drwxr-x---. 5 oracle asmadmin? ? ? 4096 Jan? 4 11:40 ..
-rw-r-----. 1 oracle asmadmin? 9748480 Jan? 4 13:01 control01.ctl
-rw-r-----. 1 oracle asmadmin? 52429312 Jan? 4 11:18 redo01.log
-rw-r-----. 1 oracle asmadmin? 52429312 Jan? 4 11:18 redo02.log
-rw-r-----. 1 oracle asmadmin? 52429312 Jan? 4 13:00 redo03.log
-rw-r-----. 1 oracle asmadmin 20972032 Jan 7 13:17 redo_standby_01.log
-rw-r-----. 1 oracle asmadmin 20972032 Jan 7 13:17 redo_standby_02.log
-rw-r-----. 1 oracle asmadmin 20972032 Jan 7 13:18 redo_standby_03.log
-rw-r-----. 1 oracle asmadmin 482353152 Jan? 4 13:00 sysaux01.dbf
-rw-r-----. 1 oracle asmadmin 702554112 Jan? 4 12:58 system01.dbf
-rw-r-----. 1 oracle asmadmin? 20979712 Jan? 4 12:18 temp01.dbf
-rw-r-----. 1 oracle asmadmin? 31465472 Jan? 4 12:53 undotbs01.dbf
-rw-r-----. 1 oracle asmadmin? 5251072 Jan? 4 11:18 users01.dbf
3 準(zhǔn)備參數(shù)文件
生成pfile
SQL> create pfile from spfile;
File created.
關(guān)閉數(shù)據(jù)庫
SQL> shutdown immediate
修改pfile
參考資料
ORACLE 11G 搭建dataguard詳細(xì)步驟(所有操作總結(jié))
http://blog.itpub.net/26230597/viewspace-1432637/