Oracle 11gR2建立物理Data Guard

來源:互聯網
上載者:User

環境:OS:Red Hat Linux As 5DB:11.2.0.1 11G版本對Dataguard上有了比較大的改進,就是在open備庫的情況下,備庫依然可以應用主庫傳過來的歸檔日誌,記得在10g的時候,想開啟備庫查看資料資料是否已經傳輸過來,還必須先停掉日誌應用.下面是介紹如何建立物理備庫的過程,資料庫採用的是普通檔案管理的方式(主備庫資料檔案路徑保持一致),過程是比較有點繁瑣,呵呵. --------------------------主庫上的操作-------------------------------------------1.設定主庫為force logging模式SQL> alter database force logging;
Database altered.
 2.編輯初始化參數
SQL> create pfile='/u01/export/home/Oracle/pfile.txt' from spfile;
File created.
 Vi pfile.txt 添加紅色部分的內容
[oracle@primary ~]$ more pfile.txt
oracl.__db_cache_size=272629760
oracl.__java_pool_size=4194304
oracl.__large_pool_size=4194304
oracl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
oracl.__pga_aggregate_target=276824064
oracl.__sga_target=415236096
oracl.__shared_io_pool_size=0
oracl.__shared_pool_size=125829120
oracl.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/oracl/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='/u01/app/oracle/oradata/oracl/control01.ctl','/u02/app/oracle/oradata/oracl/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='oracl'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=oraclXDB)'
*.memory_target=692060160
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
 *.db_unique_name=oracl
*.log_archive_config='dg_config=(oracl,oraclbak)'
*.log_archive_dest_1=
 'location=/u02/archive_log/
  valid_for=(all_logfiles,all_roles)
  db_unique_name=oracl'
*.log_archive_dest_2=
 'service=dup_oracl async
  valid_for=(online_logfiles,primary_role)
  db_unique_name=oraclbak'
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.standby_file_management=auto
*.fal_server=dup_oracl
*.fal_client=tar_oracl
*.db_file_name_convert='/u01/app/oracle/oradata/oracl/','/u01/app/oracle/oradata/oracl/'
*.log_file_name_convert='/u01/app/oracle/oradata/oracl/','/u01/app/oracle/oradata/oracl/','/u02/app/oracle/oradata/oracl/','/u02/app/oracle/oradata/oracl/'
 3.使用步驟2修改的參數啟動主庫SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile='/u01/export/home/oracle/pfile.txt';
File created.
SQL> startup
ORACLE instance started.
Total System Global Area  690503680 bytes
Fixed Size                  1338756 bytes
Variable Size             411042428 bytes
Database Buffers          272629760 bytes
Redo Buffers                5492736 bytes
Database mounted.
Database opened.
 4.添加standby記錄檔,大小跟v$log中的記錄檔大小保持一致,這裡的日誌組從4開始,因為主庫已經建立了3組online日誌組了.alter database add standby logfile group 4 ('/u02/app/oracle/oradata/oracl/stdbyredo01.log') SIZE 512m;
alter database add standby logfile group 5 ('/u02/app/oracle/oradata/oracl/stdbyredo02.log') SIZE 512m;
alter database add standby logfile group 6 ('/u02/app/oracle/oradata/oracl/stdbyredo03.log') SIZE 512m;
alter database add standby logfile group 7 ('/u02/app/oracle/oradata/oracl/stdbyredo04.log') SIZE 512m;
 5.建立standby控制檔案SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORACLE instance started.
Total System Global Area  690503680 bytes
Fixed Size                  1338756 bytes
Variable Size             411042428 bytes
Database Buffers          272629760 bytes
Redo Buffers                5492736 bytes
Database mounted.
SQL> alter database create standby controlfile AS '/u01/export/home/oracle/standby.ctl';
Database altered.SQL> alter database open;Database altered. 6.配置tnsnames檔案使用netca配置tnsnames,檔案內容如下:
[oracle@primary admin]$ more tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/n
etwork/admin/tnsnames.ora
# Generated by Oracle configuration tools.
TAR_ORACL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.102)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = oracl)
    )
  )
 DUP_ORACL =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.103)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = oraclbak)
    )
  )
 7.查看資料檔案和記錄檔的目錄,以便在備庫也建立相應��目錄
SQL> select name from v$datafile;
NAME
--------------------------------------------------
/u01/app/oracle/oradata/oracl/system01.dbf
/u01/app/oracle/oradata/oracl/sysaux01.dbf
/u01/app/oracle/oradata/oracl/undotbs01.dbf
/u01/app/oracle/oradata/oracl/users01.dbf
/u01/app/oracle/oradata/oracl/hxl001.dbf
/u01/app/oracle/oradata/oracl/hxl002.dbf
 SQL> select member from v$logfile;MEMBER
--------------------------------------------------
/u01/app/oracle/oradata/oracl/redo0301.log
/u02/app/oracle/oradata/oracl/redo0302.log
/u01/app/oracle/oradata/oracl/redo0201.log
/u02/app/oracle/oradata/oracl/redo0202.log
/u01/app/oracle/oradata/oracl/redo0101.log
/u02/app/oracle/oradata/oracl/redo0102.log
/u02/app/oracle/oradata/oracl/stdbyredo01.log
/u02/app/oracle/oradata/oracl/stdbyredo02.log
/u02/app/oracle/oradata/oracl/stdbyredo03.log
/u02/app/oracle/oradata/oracl/stdbyredo04.log

SQL>select name from v$controlfile;

NAME---------------------------------------------/u01/app/oracle/oradata/oracl/control01.ctl
/u02/app/oracle/oradata/oracl/control02.ctl
  • 1
  • 2
  • 下一頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.