DG_安裝三
ORACLE DG 的搭建 ( 方法三 )
說明:
備庫生成原理:
1 配置好主庫後將資料庫安裝檔案 /u01 ,備庫控制檔案,歸檔檔案打包傳送到備庫
2 備庫新增 oracle 使用者,組,附加組,解壓來自主庫的壓縮檔案
3 修改引數檔案,網路檔案等相關配置,啟動備庫 mount( 主備庫 sid 相同 )
主機
IP:192.168.1.181
主機名 :chen01
OS:Red Hat Enterprise Linux Server release 6.4 (Santiago)
oracle:11.2.0.1.0
SID:orcl
db_unique_name:orcl
service_names:orcl
備機
IP : 192.168.1.183
主機名 :chen03
OS:Red Hat Enterprise Linux Server release 6.4 (Santiago)
oracle:11.2.0.1.0
SID:orcl
db_unique_name:db01
service_names:db01
一:主機 , 備機分別配置 hosts 檔案
192.168.1.181
[root@chen01 ~]# vim /etc/hosts
192.168.1.181 chen01
192.168.1.183 chen03
[root@chen01 ~]# vim /etc/sysconfig/network
192.168.1.183
[root@chen03 ~]# vim /etc/hosts
192.168.1.183 chen03
192.168.1.181 chen01
二:主機修改為歸檔模式,強制寫日誌
192.168.1.181
SQL> startup mount
SQL> alter database archivelog;
SQL> select force_logging from v$database;
FOR
---
NO
SQL> alter database force logging;
Database altered.
SQL> select force_logging from v$database;
FOR
---
YES
三:主機建立密碼檔案
192.168.1.181
[oracle@chen01 ~]$ cd $ORACLE_HOME/network/admin
[oracle@chen01 admin]$ orapwd file=orapworcl password=oracle
四:主機配置 standby redolog
最佳效能模式可以忽略,如果將來變成備庫且要轉為其它兩種模式則要建立
192.168.1.181
standby redolog 的組數參考公式: (online redolog 組數 + 1) * 資料庫執行緒數;單機執行緒數為 1 , RAC 一般為 2 。
standby redolog 的組成員數和大小也儘量和 online redolog 一樣。
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- ---------------------------------------- ---
3 ONLINE /u01/app/oracle/oradata/orcl/redo03.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log NO
1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log NO
SQL> select group#,members,bytes/1024/1024||'M' M from v$log;
GROUP# MEMBERS M
---------- ---------- -----------------------------------------
1 1 50M
2 1 50M
3 1 50M
SQL> alter database add standby logfile
2 group 4 ('/u01/app/oracle/oradata/orcl/stdby_redo04.log') size 50M,
3 group 5 ('/u01/app/oracle/oradata/orcl/stdby_redo05.log') size 50M,
4 group 6 ('/u01/app/oracle/oradata/orcl/stdby_redo06.log') size 50M;
Database altered.
SQL> select * from v$logfile order by group#;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- --------------------------------------------- ---
1 ONLINE /u01/app/oracle/oradata/orcl/redo01.log NO
2 ONLINE /u01/app/oracle/oradata/orcl/redo02.log NO
3 ONLINE /u01/app/oracle/oradata/orcl/redo03.log NO
4 STANDBY /u01/app/oracle/oradata/orcl/stdby_redo04.log NO
5 STANDBY /u01/app/oracle/oradata/orcl/stdby_redo05.log NO
6 STANDBY /u01/app/oracle/oradata/orcl/stdby_redo06.log NO
6 rows selected.
SQL> select group#,members,bytes/1024/1024||'M' M from v$log;
GROUP# MEMBERS M
---------- ---------- -----------------------------------------
1 1 50M
2 1 50M
3 1 50M
SQL> select group#,bytes/1024/1024||'M' M from v$standby_log;
GROUP# M
---------- -----------------------------------------
4 50M
5 50M
6 50M
五:設定主庫初始化引數
192.168.1.181
備份引數檔案
SQL> create pfile='/home/oracle/pfile.ora' from spfile;
[oracle@chen01 dbs]$ vim initorcl.ora
*.fal_client='ORCL'
*.fal_server='DB01'
*.log_archive_config='dg_config=(orcl,db01)'
*.log_archive_dest_1='location=/home/oracle/arch_orcl valid_for=(all_logfiles,all_roles) db_unique_name=orcl'
*.log_archive_dest_2='service=db01 LGWR ASYNC valid_for=(online_logfiles,primary_roles) db_unique_name=db01'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.standby_archive_dest='location=/home/oracle/arch_orcl'
*.standby_file_management='AUTO'
*.db_unique_name='orcl'
六 備份主庫資料檔案
192.168.1.181
SQL> alter database create standby controlfile as '/home/oracle/stdby_control01.ctl';
SQL> shutdown immediate
[root@chen01 ~]# tar -zcvf arch.tar arch_orcl/
[root@chen01 ~]# tar -zcvf uu.tar /u01
[root@chen01 ~]# scp arch.tar 192.168.1.183:/root
[root@chen01 ~]# scp uu.tar 192.168.1.183:/root
[root@chen01 ~]# scp stdby_control01.ctl 192.168.1.183:/root
七 配置備庫
[root@chen03 ~]# tar -zxvf arch.tar
[root@chen03 ~]# tar -zxvf uu.tar
[root@chen03 ~]# mkdir /u01
[root@chen03 ~]# mv u01/* /u01
[root@chen03 ~]# cp stdby_control01.ctl /u01/app/oracle/oradata/orcl/control01.ctl
[root@chen03 ~]# cp stdby_control01.ctl stdby_control02.ctl
[oracle@chen03 dbs]$ cp stdby_control02.ctl /u01/app/oracle/flash_recovery_area/orcl/control02.ctl
[root@chen03 ~]# chown -R oracle.oinstall /u01
配置備庫引數
[oracle@chen03 ~]$ cd $ORACLE_HOME/dbs
[oracle@chen03 dbs]$ vim initorcl.ora
*.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/flash_recovery_area/orcl/control02.ctl'
*.db_name='orcl'
*.fal_client='DB01'
*.fal_server='ORCL'
*.log_archive_config='dg_config=(orcl,db01)'
*.log_archive_dest_1='location=/home/oracle/arch_orcl valid_for=(all_logfiles,all_roles) db_unique_name=db01'
*.log_archive_dest_2='service=orcl ARCH ASYNC valid_for=(online_logfiles,primary_roles) db_unique_name=orcl'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.standby_archive_dest='location=/home/oracle/arch_orcl'
*.standby_file_management='AUTO'
*.db_unique_name='db01'
八 配置網路
xhost +
netmgr
或者
192.168.1.183
192.168.1.181 (同 183 )
[oracle@chen03 admin]$ pwd
/u01/app/oracle/product/11.2.0/network/admin
[oracle@chen03 admin]$ ls
listener.ora orapworcl samples shrept.lst sqlnet.ora tnsnames.ora
[oracle@chen03 admin]$ vim listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0)
(SID_NAME = ORCL)
)
)
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = chen03)(PORT = 1521))
)
ADR_BASE_LISTENER = /u01/app/oracle
[oracle@chen03 admin]$ vim tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
DB01 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.183)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = db01)
)
)
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.181)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
[oracle@chen03 admin]$ tnsping db_orcl
[oracle@chen03 admin]$ tnsping db_db01
九 啟動 DG
1
啟用備用資料庫
SQL > STARTUP MOUNMT;
2
啟動主庫
SQL> startup
192.168.1.183
SQL> col dest_name for a25
SQL> select dest_name,status from v$archive_dest_status;
DEST_NAME STATUS
------------------------- ---------
LOG_ARCHIVE_DEST_1 VALID
LOG_ARCHIVE_DEST_2 VALID
STANDBY_ARCHIVE_DEST VALID
SQL> select database_role,protection_mode,protection_level from v$database;
DATABASE_ROLE PROTECTION_MODE PROTECTION_LEVEL
---------------- -------------------- --------------------
PHYSICAL STANDBY MAXIMUM PERFORMANCE MAXIMUM PERFORMANCE
歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-1571786/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- DG_安裝二
- DG_安裝一
- DG_三大模式切換模式
- 三、Docker安裝Docker
- ZooKeeper三種安裝模式模式
- Oracle GoldenGate安裝(三)OracleGo
- OpenStack安裝(三) Nova模組
- Statspack之三-安裝statspack
- 如何安裝leapftp,教你三步安裝好leapftpFTP
- oracle管理(三)安裝軟體Oracle
- Innodb plugins 的安裝(三)Plugin
- dg_閃回資料庫實驗資料庫
- MYSQL + MHA +keepalive + VIP安裝配置(三)--keepalived安裝配置MySql
- Solaris裸裝置安裝三節點RAC102(三)
- Centos7.7 安裝FreeIPA (三)CentOS
- 使用Docker安裝Redis - 學習三DockerRedis
- LDAP系列(三)LDAP + Samba 安裝配置LDASamba
- [第三篇]——CentOS Docker 安裝CentOSDocker
- linux安裝postgresql三種方式LinuxSQL
- 【Solaris】Virtualbox 安裝 Oracle Solaris 10(三) 安裝完成後初始配置Oracle
- etcd套路(三)etcd的安裝
- Docker筆記(三):Docker安裝與配置Docker筆記
- redis運維(三)redis6.0.8安裝Redis運維
- ubuntu下安裝程式的三種方法Ubuntu
- powerlinux下安裝10grac(三)Linux
- WindowsXP安裝舊驅動三妙方(轉)Windows
- elk的安裝部署三(kibana的安裝及使用filebeat收集日誌)
- codis安裝 (java 安裝 + zookeeper 安裝 + go 安裝 + codis 安裝JavaGo
- 【Oracle】RHEL6.4-64位 安裝oracle11.2.0.3(三) 安裝Oracle軟體Oracle
- Python 安裝第三方模組的三種方法Python
- 無法安裝第三方包
- go get 安裝 第三方包Go
- CentOS 安裝 jdk1.8 的三種方法CentOSJDK
- k8s的安裝及使用(三)K8S
- Linux 軟體安裝的三種方式Linux
- kvm之三:本地安裝虛擬機器虛擬機
- 在ubuntu中安裝單機Hadoop(三)UbuntuHadoop
- kafka+jstorm版本升級安裝(三)KafkaJSORM