真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

DG的搭建記錄是怎樣的

DG的搭建記錄是怎樣的,相信很多沒有經(jīng)驗(yàn)的人對(duì)此束手無策,為此本文總結(jié)了問題出現(xiàn)的原因和解決方法,通過這篇文章希望你能解決這個(gè)問題。

創(chuàng)新互聯(lián)建站成立與2013年,先為北海街道等服務(wù)建站,北海街道等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為北海街道企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

單實(shí)例DG搭建手冊

規(guī)劃

ip

db_name

db_unique_name

sid

tns

192.168.10.103

test

test

test

test

192.168.10.104

test

dgdb

dgdb

dgdb


配置監(jiān)聽
主庫listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2/network/admin/listener.ora
# Generated by Oracle configuration tools.


SID_LIST_DG =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = test)
      (ORACLE_HOME = /u01/app/oracle/product/11.2)
      (SID_NAME = test)
    )
  )
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = lzl)(PORT = 1521))
    )
  )


ADR_BASE_LISTENER = /u01/app/oracle


備庫listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2/network/admin/listener.ora
# Generated by Oracle configuration tools.


SID_LIST_DG =
  (SID_LIST =
    (SID_DESC =
      (GLOBAL_DBNAME = dgdb)
      (ORACLE_HOME = /u01/app/oracle/product/11.2)
      (SID_NAME = dgdb)
    )
  )


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = l2l)(PORT = 1521))
    )
  )


ADR_BASE_LISTENER = /u01/app/oracle


主備庫的tnsnames.ora
test =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = lzl)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = test)
      (SERVER = DEDICATED)
    )
  )


dgdb =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = l2l)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SID = dgdb)
      (SERVER = DEDICATED)
    )
  )




主庫準(zhǔn)備
更改日志模式
防止使用no logging子句造成主備庫數(shù)據(jù)不一致
SQL> alter database force logging
  2  /


Database altered.
SQL> select force_logging from v$database;


FOR
---
YES


是否歸檔
SQL> select log_mode from v$database;


LOG_MODE
------------
ARCHIVELOG




更改log_archive_config
SQL>  alter system set log_archive_config=‘DG_CONFIG=(test,dgdb)' scope=both ;


System altered.


SQL> show parameter archive_config


NAME     TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_config     string DG_CONFIG=(test,dgdb)
SQL> 


配置DG參數(shù)
alter system set log_archive_dest_1='location=/home/oracle/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=test' scope=both;
alter system set log_archive_dest_2 ='SERVICE=dgdb LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=dgdb' scope=both;
alter system set log_archive_dest_state_1 = ENABLE;                
alter system set log_archive_dest_state_2 = ENABLE;
數(shù)據(jù)文件自動(dòng)添加
alter system set standby_file_management=auto scope=both;


alter system set fal_server=dgdb scope=both;
alter system set fal_client=test scope=both;


1800s自動(dòng)切換redo log
alter system set archive_lag_target=1800;


文件位置調(diào)整
alter system set db_file_name_convert='/u01/app/oracle/oradata/test/','/u01/app/oracle/oradata/dgdb/' scope=spfile; 
alter system set log_file_name_convert='/u01/app/oracle/oradata/logfile/','/u01/app/oracle/oradata/logfile/' scope=spfile; 


2.密碼文件
使用以前的密碼文件或者直接創(chuàng)建一個(gè)密碼文件
[oracle@lzl ~]$ orapwd password=oracle file='/home/oracle/orapwd.ora' force=y ignorecase=y
[oracle@lzl ~]$ ls
orapwd.ora


3.備份數(shù)據(jù)庫
backup database


4.生成pfile
create pfile='/home/oracle/initdgdb.ora' from spfile;
修改參數(shù)
*.db_unique_name='dgdb'
*.fal_client='dgdb'
*.fal_server='test'
*.service_names='dgdb'
*.log_archive_dest_1='location=/home/oracle VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dgdb'
*.log_archive_dest_2='SERVICE=dgdb LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=test'




db_name應(yīng)與主庫保持一致


6.生成stanby controlfile
SQL> alter database create standby controlfile as '/home/oracle/control01.ctl';


Database altered.


備庫準(zhǔn)備
備庫是一個(gè)只有數(shù)據(jù)庫軟件的環(huán)境
1.拷貝stanby controlfile,pfile,orapwd 文件到備庫
控制文件拷貝到pfile指定的目錄中
密碼文件更改sid到/oracle/home/dbs中


[oracle@l2l ~]$ ls
 control01.ctl  initdgdb.ora  orapwd.ora
2.創(chuàng)建pfile中的目錄
審計(jì)目錄、控制文件目錄、數(shù)據(jù)文件目錄等


3.啟動(dòng)備庫到mount階段


[oracle@l2l ~]$ sqlplus / as sysdba


SQL*Plus: Release 11.2.0.3.0 Production on Thu Jul 27 17:04:07 2017


Copyright (c) 1982, 2011, Oracle.  All rights reserved.


Connected to an idle instance.


SQL> startup nomount pfile='/home/oracle/initdgdb.ora';
ORACLE instance started.


Total System Global Area 1048059904 bytes
Fixed Size    2235000 bytes
Variable Size  310379912 bytes
Database Buffers  729808896 bytes
Redo Buffers    5636096 bytes
SQL> alter database mount;


Database altered.


SQL> select database_role from v$database;


DATABASE_ROLE
----------------
PHYSICAL STANDBY

4.rman數(shù)據(jù)恢復(fù)
使用rman將主庫的備份應(yīng)用于備庫
RMAN> catalog start with ‘/home/oracle/liu/’
RMAN> restore database;


5.創(chuàng)建standby redo log files,數(shù)量至少是主庫的兩倍
standby redo log 與redo log是很相似的,但是standby redo log是用來在standby庫上接收主庫的redo data的。
備庫上不會(huì)使用online redo log
為了方便任意切換,最好是主備庫都創(chuàng)建standby redo log files
SQL> alter database add standby logfile group 11 ('/u01/app/oracle/oradata/test/dg_redo11.log' ) size 50M;

Database altered.
SQL> alter database add standby logfile group 12 ('/u01/app/oracle/oradata/test/dg_redo12.log' ) size 50M;


Database altered.
SQL> alter database add standby logfile group 13 ('/u01/app/oracle/oradata/test/dg_redo13.log' ) size 50M;


Database altered.
SQL> alter database add standby logfile group 14 ('/u01/app/oracle/oradata/test/dg_redo14.log' ) size 50M;


Database altered.
SQL> alter database add standby logfile group 15 ('/u01/app/oracle/oradata/test/dg_redo15.log' ) size 50M;


Database altered.
SQL> alter database add standby logfile group 16 ('/u01/app/oracle/oradata/test/dg_redo16.log' ) size 50M;


Database altered.


查看v$standby_log
SQL> select group# from v$standby_log;


    GROUP#
----------
10
11
12
13
14
15


6 rows selected.


SQL> select group# from v$log;


    GROUP#
----------
1
3
2
查看文件還是需要v$logfile
SQL> select member from v$logfile;


MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/test/redo03.log
/u01/app/oracle/oradata/test/redo02.log
/u01/app/oracle/oradata/test/redo01.log
/u01/app/oracle/oradata/test/dg_redo11.log
/u01/app/oracle/oradata/test/dg_redo12.log
/u01/app/oracle/oradata/test/dg_redo13.log
/u01/app/oracle/oradata/test/dg_redo14.log
/u01/app/oracle/oradata/test/dg_redo15.log
/u01/app/oracle/oradata/test/dg_redo16.log


9 rows selected.




建立主備庫DG關(guān)系


備庫
SQL>  alter database recover managed standby database using current logfile disconnect from session ;


Database altered.


告警日志信息:
 alter database recover managed standby database using current logfile disconnect from session 
Attempt to start background Managed Standby Recovery process (dgdb)
Sat Jul 28 19:28:48 2017
MRP0 started with pid=25, OS id=3264 
MRP0: Background Managed Standby Recovery process started (dgdb)
Serial Media Recovery started
Managed Standby Recovery starting Real Time Apply
Waiting for all non-current ORLs to be archived...
All non-current ORLs have been archived.
Media Recovery Waiting for thread 1 sequence 100
Completed:  alter database recover managed standby database using current logfile disconnect from session 


查看備庫角色
SQL>  select PROTECTION_MODE ,PROTECTION_LEVEL ,GUARD_STATUS,DATABASE_ROLE,to_char(current_scn) from v$database;


PROTECTION_MODE      PROTECTION_LEVEL  GUARD_S DATABASE_ROLE
-------------------- -------------------- ------- ----------------
TO_CHAR(CURRENT_SCN)
----------------------------------------
MAXIMUM AVAILABILITY MAXIMUM AVAILABILITY NONE  PHYSICAL STANDBY
2481074


主庫檢查


備庫檢查
SQL>  select PROTECTION_MODE ,PROTECTION_LEVEL ,GUARD_STATUS,DATABASE_ROLE,to_char(current_scn) from v$database;


PROTECTION_MODE      PROTECTION_LEVEL  GUARD_S DATABASE_ROLE
-------------------- -------------------- ------- ----------------
TO_CHAR(CURRENT_SCN)
----------------------------------------
MAXIMUM AVAILABILITY RESYNCHRONIZATION  NONE  PRIMARY
2482972

看完上述內(nèi)容,你們掌握DG的搭建記錄是怎樣的的方法了嗎?如果還想學(xué)到更多技能或想了解更多相關(guān)內(nèi)容,歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道,感謝各位的閱讀!


本文標(biāo)題:DG的搭建記錄是怎樣的
網(wǎng)頁路徑:http://weahome.cn/article/ihdeih.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部