oracle11g單節點DataGuard搭建

ahfhuang發表於2017-03-21

一、oracle11g DG 搭建

搭建方法(一)
          主機            備機
Version   11.2.0.4        11.2.0.4
IP        192.168.91.131  192.168.91.132
安裝情況  已安裝好資料庫  只安裝資料庫軟體

1、關防火牆(用root使用者再主備節點都執行)
臨時關閉
$ service iptables stop
永久關閉
$ chkconfig iptables off

2、關閉Selinux(用root使用者再主備節點都執行)
$ sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
及時生效
$ setenforce 0

3、主機名能互訪(用root使用者再主備節點都執行)
$ vi /etc/hosts
192.168.91.131    primarydb
192.168.91.132    standbydb

4、主備庫建建立必要的目錄(用oracle使用者再主備節點都執行)
$ mkdir -p /u01/app/archivelog
$ mkdir -p /u01/app/oracle/admin/burton/adump
$ mkdir -p /u01/app/oracle/fast_recovery_area/burton
$ mkdir -p /u01/app/oracle/oradata/burton
$ mkdir -p /u01/app/backup
$ chmod -R 755 /u01/app

5、主機設定引數檔案
SQL> alter database force logging;
SQL> alter system set log_archive_format='burton_%t_%s_%r.arc' scope=spfile;
SQL> alter system set fal_client='burton';
SQL> alter system set fal_server='standby';
SQL> alter system set standby_file_management='AUTO';
SQL> alter system set db_file_name_convert='/u01/app/oracle/oradata/burton','/u01/app/oracle/oradata/burton' scope=spfile;
SQL> alter system set log_file_name_convert='/u01/app/oracle/oradata/burton','/u01/app/oracle/oradata/burton' scope=spfile;
SQL> alter system set log_archive_config='DG_CONFIG=(burton,standby)';
SQL> alter system set log_archive_dest_1='LOCATION=/u01/app/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=burton';
SQL> alter system set log_archive_dest_state_1='enable';
SQL> alter system set log_archive_dest_2='SERVICE=standby lgwr sync affirm VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby';
SQL> alter system set log_archive_dest_state_2='enable';
SQL> alter system set db_unique_name='burton';
SQL> alter database flashback on;
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> create pfile='/tmp/pfile.ora' from spfile;
SQL> exit

6、主機上pfile檔案複製到備庫
6.1 主庫把pfile複製到備庫
$ scp -r /tmp/pfile.ora oracle@192.168.91.132:/tmp
6.2 備庫檢視pfile檔案
$ ll /tmp/pfile.ora

7、修改備庫的pfile
$ vi /tmp/pfile.ora

burton.__db_cache_size=289406976
burton.__java_pool_size=4194304
burton.__large_pool_size=71303168
burton.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
burton.__pga_aggregate_target=335544320
burton.__sga_target=503316480
burton.__shared_io_pool_size=0
burton.__shared_pool_size=130023424
burton.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/burton/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/burton/control01.ctl','/u01/app/oracle/fast_recovery_area/burton/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_name_convert='/u01/app/oracle/oradata/burton','/u01/app/oracle/oradata/burton'
*.db_name='burton'
*.db_unique_name='standby'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=burtonXDB)'
*.fal_client='standby'
*.fal_server='burton'
*.log_archive_config='DG_CONFIG=(burton,standby)'
*.log_archive_dest_1='LOCATION=/u01/app/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
*.log_archive_dest_2='SERVICE=burton lgwr sync affirm VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=burton'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='enable'
*.log_archive_format='burton_%t_%s_%r.arc'
*.log_file_name_convert='/u01/app/oracle/oradata/burton','/u01/app/oracle/oradata/burton'
*.memory_target=836763648
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'

注:
  (a)db_name:資料庫名字,需要保持同一個Data Guard中所有資料庫db_name相同(靜態引數,8個字元限制,大小寫不敏感)。
  (b)db_unique_name:用來區分資料庫的唯一名。
  (c)db_file_name_convert:主庫和備庫的資料檔案路徑轉換。如果有多個,逐一指明對映關係(靜態引數,成對出現)。
  (d)log_file_name_convert:主庫和備庫的online redo log檔案路徑轉換。如果有多個,逐一指明對映關係(靜態引數,成對出現)。
  (e)log_archive_format:指定歸檔檔案格式,這裡在主備端應保持一樣的格式(靜態引數)。
  (f)log_archive_config:該引數通過DG_CONFIG設定同一個Data Guard中所有db_unique_name,以逗號分隔(動態引數)。
  (g)log_archive_dest_n與log_archive_dest_state_n:設定歸檔路徑。location即本地路徑;service即tnsnames.ora中配置的遠端服務,
     指向standby,此時的歸檔路徑即為standby的歸檔路徑。(動態引數)。
  (h)fal_server和fal_client:FAL即Fetch Archive Log,其值為Oracle Net service name,即 tnsnames.ora中的服務名。設定這兩個引數
     可以用來解決Archive Gaps。一旦產生了gap,fal_client會自動向fal_server請求傳輸gap的archivelog。設定了這2個引數,就不需要在
     產生gap時手動向standby註冊歸檔日誌了。所需要做的就是確認主庫有這些歸檔日誌,並且主庫的控制檔案中有這些日誌的註冊資訊。
     fal_client設定為資料庫自身的service name,fal_server設定為遠端資料庫的service name。
  (i)standby_file_management:如果primary 資料庫資料檔案發生修改(如新建,重新命名等)則按照本引數的設定在standby中做相應修改。
     設為AUTO 表示自動管理。設為MANUAL表示需要手工管理。
  (j)dispatchers="(PROTOCOL=TCP)(SERVICE=XDB)"。

8、備庫用引數檔案啟動到nomount,並建立spfile
$ sqlplus / as sysdba
SQL> startup nomount pfile='/tmp/pfile.ora';
SQL> create spfile from pfile='/tmp/pfile.ora';
SQL> shutdown abort
SQL> startup nomount

9、主庫複製密碼檔案到備庫
$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs
$ scp -r ./orapwburton oracle@192.168.91.132:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwburton
備庫檢視
$ ll /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwburton

10、修改主庫和備庫的監聽
10.1 修改主備庫tnsnames.ora(tnsnames.ora主備庫一樣)
$ cd $ORACLE_HOME/network/admin/
$ vi tnsnames.ora

BURTON =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.91.131)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = burton)
    )
  )

STANDBY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.91.132)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = burton)
    )
  )

10.2 新增備庫listener.ora
$ vi listener.ora
SID_LIST_LISTENER =
 (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = standby)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = burton)
    )
  )

LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
      (ADDRESS = (PROTOCOL = TCP)(HOST = standbydb)(PORT = 1521))
    )
  )

ADR_BASE_LISTENER = /u01/app/oracle

注:listener.ora中的GLOBAL_DBNAME向外提供服務名,listener.ora中的SID_NAME提供註冊的例項名

10.3 重啟主備監聽
$ lsnrctl stop
$ lsnrctl start
$ lsnrctl status

11、測試聯通性
主->備
$ sqlplus sys/oracle4U@standby as sysdba
備->主
$ sqlplus sys/oracle4U@burton as sysdba

12、在主機上新增standby日誌檔案
12.1 檢視原日誌組檔案
SQL> set lines 200
SQL> col member for a50
SQL> select  group#,type,member from v$logfile;
    GROUP# TYPE    MEMBER
---------- ------- --------------------------------------------------
  3 ONLINE  /u01/app/oracle/oradata/burton/redo03.log
  2 ONLINE  /u01/app/oracle/oradata/burton/redo02.log
  1 ONLINE  /u01/app/oracle/oradata/burton/redo01.log

SQL> select group#,sequence#,BYTES/1024/1024 sizeM,members from v$log;
    GROUP#  SEQUENCE#     SIZEM   MEMBERS
---------- ---------- ---------- ----------
  1     7       50   1
  2     8       50   1
  3     9       50   1

12.2 增加standy日誌組檔案(原組數+1)
SQL> alter database add standby logfile thread 1 group 4 ('/u01/app/oracle/oradata/burton/redo_dg04.log') size 50M;
Database altered.
SQL> alter database add standby logfile thread 1 group 5 ('/u01/app/oracle/oradata/burton/redo_dg05.log') size 50M;
Database altered.
SQL> alter database add standby logfile thread 1 group 6 ('/u01/app/oracle/oradata/burton/redo_dg06.log') size 50M;
Database altered.
SQL> alter database add standby logfile thread 1 group 7 ('/u01/app/oracle/oradata/burton/redo_dg07.log') size 50M;
Database altered.

13、複製資料庫
主庫:
$ rman target sys/oracle4U auxiliary sys/oracle4U@standby nocatalog
RMAN> duplicate target database for standby from active database nofilenamecheck;

注:此操作主要執行Memory Script,複製密碼檔案,控制檔案,資料檔案,線上日誌檔案和歸檔日誌檔案。在此期間,
指令碼執行了alter database mount standby database,是備庫啟動到mount狀態。

14、啟動備庫
14.1 正常啟動流程
原nomount狀態,但在duplicate時,已啟動到mount狀態。
SQL> alter database open read only;
Database altered.
SQL> alter database flashback on;
Database altered.
SQL> recover managed standby database disconnect from session;
Media recovery complete.
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.

14.2 可以延遲應用日誌(一般略過)
方法1: 在備庫應用主庫日誌的語句中指定delay屬性
備庫延遲120分鐘應用主庫日誌
SQL> alter database recover managed standby database delay 120 disconnect from session;
方法2: log_ archive_dest_n引數中指定了delay屬性
SQL> alter system set log_archive_dest_3='service=standby2 lgwr async delay=5 valid_for=(all_logfiles,all_roles) db_unique_name=standby2';

注:delay屬性並不是說延遲從主庫傳送日誌到備庫,而是指日誌到備庫後,延遲多長時間應用主庫日誌。
    select ora_rowscn,to_char(scn_to_timestamp(ora_rowscn),'yyyy-mm-dd hh24:mi:ss') opertime,id ,name from scntest;

15、驗證主備庫同步
15.1 檢查歸檔目錄是否有誤
SQL> select error from v$archive_dest where error is not null;
正常,沒有錯誤。

15.2 在主庫手工切換歸檔
SQL> alter system switch logfile;

15.3 檢視主備庫歸檔情況(主備是一致的)
SQL> select max(sequence#) from v$archived_log;

15.4 檢視standby管理情況
備庫:
SQL> select process,pid,status from v$managed_standby;
PROCESS   PID STATUS
--------- ---------- ------------
ARCH  7728 CONNECTED
ARCH  7730 CONNECTED
ARCH  7732 CONNECTED
ARCH  7734 CLOSING
RFS    7826 IDLE
RFS    7766 IDLE
RFS    7768 IDLE
RFS    7824 IDLE
MRP0  7807 APPLYING_LOG

ARCH、MRPO和RFS都有表示正常
主庫:
SQL> select process,pid,status from v$managed_standby;
PROCESS   PID STATUS
--------- ---------- ------------
ARCH        33377 CLOSING
ARCH        33379 CLOSING
ARCH        33381 CONNECTED
ARCH        33383 CLOSING
LNS          33385 WRITING

沒有RFS程式和MRP程式,有LNS程式

16、主備機配置最大可用模式:
SQL> alter database set standby database to maximize availability;
Database altered.

17、Data Guard 配置
17.1 主庫 PROTECTION_MODE
SQL> select name,dbid,database_role,protection_mode from v$database;
NAME  DBID DATABASE_ROLE    PROTECTION_MODE
--------- ---------- ---------------- --------------------
BURTON   3893622323 PRIMARY       MAXIMUM AVAILABILITY

17.2 備庫 PROTECTION_MODE
SQL> select name,dbid,database_role,protection_mode from v$database;
NAME  DBID DATABASE_ROLE    PROTECTION_MODE
--------- ---------- ---------------- --------------------
BURTON   3893622323 PHYSICAL STANDBY MAXIMUM AVAILABILITY

17.3 檢視主備flashback database情況開啟
SQL> select name,flashback_on from v$database;
NAME   FLASHBACK_ON
--------- ------------------
BURTON   YES

 

搭建方法(二)

一、安裝ORACLE DG
1、關防火牆(用root使用者再主備節點都執行)
臨時關閉
$ service iptables stop
永久關閉
$ chkconfig iptables off

2、關閉Selinux(用root使用者再主備節點都執行)
$ sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
及時生效
$ setenforce 0

3、主機名能互訪(用root使用者再主備節點都執行)
$ vi /etc/hosts
192.168.91.131    primarydb
192.168.91.132    standbydb

4、主備庫建建立必要的目錄(用oracle使用者再主備節點都執行)
$ mkdir -p /u01/app/archivelog
$ mkdir -p /u01/app/oracle/admin/burton/adump
$ mkdir -p /u01/app/oracle/fast_recovery_area/burton
$ mkdir -p /u01/app/oracle/oradata/burton
$ mkdir -p /u01/app/backup
$ chmod -R 755 /u01/app

5、增加主庫standby日誌組檔案
SQL> select member from v$logfile;
SQL> select group#,thread#,bytes/1024/1024 M ,STATUS from v$log;
SQL> alter database add standby logfile thread 1 group 4 ('/u01/app/oracle/oradata/burton/redo_dg04.log') size 50M;
SQL> alter database add standby logfile thread 1 group 5 ('/u01/app/oracle/oradata/burton/redo_dg05.log') size 50M;
SQL> alter database add standby logfile thread 1 group 6 ('/u01/app/oracle/oradata/burton/redo_dg06.log') size 50M;
SQL> alter database add standby logfile thread 1 group 7 ('/u01/app/oracle/oradata/burton/redo_dg07.log') size 50M;
SQL> col member for a50;
SQL> select group#,status,type,member from v$logfile;

6、修改主庫和備庫的tnsnames.ora
$ cd $ORACLE_HOME/network/admin/
$ vi tnsnames.ora
BURTON =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.91.131)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = burton)
    )
  )

STANDBY =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.91.132)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = standby)
    )
  )

重啟下監聽
$ lsnrctl stop
$ lsnrctl start
$ lsnrctl status

7、測試聯通性
主->備
$ sqlplus sys/oracle4U@standby as sysdba
備->主
$ sqlplus sys/oracle4U@burton as sysdba

8、主庫複製密碼檔案到備庫
$ cd /u01/app/oracle/product/11.2.0/dbhome_1/dbs
$ scp -r ./orapwburton oracle@192.168.91.132:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwburton

9、修改主庫配置
SQL> alter database force logging;
SQL> alter system set log_archive_dest='' scope=spfile;
SQL> alter system set log_archive_format='burton_%t_%s_%r.arc' scope=spfile;
SQL> alter system set fal_client='burton';
SQL> alter system set fal_server='standby';
SQL> alter system set standby_file_management='AUTO';
SQL> alter system set db_file_name_convert='/u01/app/oracle/oradata/burton','/u01/app/oracle/oradata/burton' scope=spfile;
SQL> alter system set log_file_name_convert='/u01/app/oracle/oradata/burton','/u01/app/oracle/oradata/burton' scope=spfile;
SQL> alter system set log_archive_config='DG_CONFIG=(burton,standby)';
SQL> alter system set log_archive_dest_1='LOCATION=/u01/app/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=burton';
SQL> alter system set log_archive_dest_state_1='enable';
SQL> alter system set log_archive_dest_2='SERVICE=standby lgwr async affirm VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=standby';
SQL> alter system set log_archive_dest_state_2='enable';
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> alter database open;
SQL> archive log list;
SQL> create pfile='/tmp/pfile.ora' from spfile;
$ scp -r /tmp/pfile.ora oracle@192.168.91.132:/tmp/

10、修改備庫的pfile
*.audit_file_dest='/u01/app/oracle/admin/burton/adump'
*.audit_trail='DB'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/burton/control01.ctl','/u01/app/oracle/fast_recovery_area/burton/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_name_convert='/u01/app/oracle/oradata/burton','/u01/app/oracle/oradata/burton'
*.db_name='burton'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4070572032
*.db_unique_name='standby'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=burtonXDB)'
*.fal_client='standby'
*.fal_server='burton'
*.log_archive_config='DG_CONFIG=(burton,standby)'
*.log_archive_dest=''
*.log_archive_dest_1='LOCATION=/u01/app/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=standby'
*.log_archive_dest_2='SERVICE=burton  lgwr async affirm VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=burton'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='enable'
*.log_archive_format='burton_%t_%s_%r.arc'
*.log_file_name_convert='/u01/app/oracle/oradata/burton','/u01/app/oracle/oradata/burton'
*.open_cursors=300
*.pga_aggregate_target=25242370048
*.processes=1000
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=1536
*.sga_target=1610612736
*.shared_servers=100
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'

11、通過主庫建立備庫的控制檔案
主庫
SQL> sqlplus / as sysdba
SQL> shutdown immediate
SQL> startup mount
SQL> alter database create standby controlfile as '/u01/app/oracle/oradata/burton/controldg01.ctl';
$ scp -r /u01/app/oracle/oradata/burton/controldg01.ctl oracle@192.168.91.132:/u01/app/oracle/oradata/burton/control01.ctl
$ scp -r /u01/app/oracle/oradata/burton/controldg01.ctl oracle@192.168.91.132:/u01/app/oracle/fast_recovery_area/burton/control02.ctl

12、備份
$ mkdir -p /u01/app/backup
$ rman target /
$ backup database format '/u01/app/backup/full_%d_%T_%s_%U' plus archivelog FORMAT '/u01/app/backup/arc_%d_%s_%p.bak';
$ list backup;

13、複製備份集到備庫(具體操作看實際情況)
$ scp -r /u01/app/backup/*  oracle@192.168.91.132:/u01/app/backup

14、備庫用pfile啟動到mount
$ sqlplus / as sysdba
SQL> startup nomount pfile='/tmp/pfile.ora';
SQL> create spfile from pfile='/tmp/pfile.ora';
SQL> alter database mount;

15、恢復standby (14和15同一個視窗操作)
$ rman target /
RMAN> crosscheck backup;
RMAN> delete expired backup;
RMAN> list backup;
RMAN> catalog start with '/u01/app/backup';
RMAN> list backup;
RMAN> restore database;

16、啟動主庫
SQL> alter database open;

17、同步及啟動備庫
SQL> alter database open read only;
SQL> recover managed standby database disconnect from session;
SQL> alter database recover managed standby database cancel;
SQL> alter database recover managed standby database using current logfile disconnect from session;

18、驗證主備庫同步
18.1 檢查歸檔目錄是否有誤
SQL> select dest_name,error,status  from v$archive_dest where error is not null;
正常,沒有錯誤。
18.2 在主庫手工切換歸檔
SQL> alter system switch logfile;
18.3 檢視主庫歸檔情況
SQL> select max(sequence#) from v$archived_log;
18.4 檢視備庫歸檔情況
SQL> select sequence#,applied from v$archived_log;

19、primary上配置最大可用模式:
SQL> alter database set standby database to maximize availability;


二、主備機切換

192.168.91.131 主庫--->備庫
192.168.91.132 備庫--->主庫

1、主機切換到備機,在192.168.91.131操作
SQL> select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE  PROTECTION_LEVEL     PROTECTION_MODE
---------------- -------------------- --------------------
PRIMARY   MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE

SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
SESSIONS ACTIVE

正常是 TO STANDBY,SESSIONS ACTIVE說明有活動會話,切換時必須加with session shutdown

SQL> alter database commit to switchover to physical standby with session shutdown;
Database altered.

2、備機切換到主機,在192.168.91.132操作
SQL> select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE  PROTECTION_LEVEL     PROTECTION_MODE
---------------- -------------------- --------------------
PHYSICAL STANDBY MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE

SQL> select switchover_status from v$database;
SWITCHOVER_STATUS
--------------------
TO PRIMARY

SQL> alter database commit to switchover to primary;
Database altered.
SQL> alter database open;
Database altered.

3、啟動現備機,在192.168.91.131操作
SQL> startup nomount
ORACLE instance started.
SQL> alter database mount standby database;
Database altered.
SQL> alter database open read only;
Database altered.
SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.

4、驗證資料同步
4.1 先檢視192.168.91.132
主庫手工切換歸檔
SQL> alter system switch logfile;
stem altered.
SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
     20
SQL> select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE  PROTECTION_LEVEL     PROTECTION_MODE
---------------- -------------------- --------------------
PRIMARY   MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE

4.2 檢視 192.168.91.131
SQL> select database_role,protection_level,protection_mode from v$database;
DATABASE_ROLE  PROTECTION_LEVEL     PROTECTION_MODE
---------------- -------------------- --------------------
PHYSICAL STANDBY MAXIMUM PERFORMANCE  MAXIMUM PERFORMANCE

SQL> select max(sequence#) from v$archived_log;
MAX(SEQUENCE#)
--------------
     20

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/30590361/viewspace-2135720/,如需轉載,請註明出處,否則將追究法律責任。

相關文章