單機上快速搭建一個Data Guard環境
保證主庫test在database logging,archive狀態下,並能正常執行狀態。
一.修改$ORACLE_HOME/dbs/inittest.ora
*.control_files='/u01/app/oracle/oradata/control01.ctl'#Restore Controlfile
*.db_cache_size=37748736
*.db_name='test'
*.db_unique_name='test'
*.local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=blliu)(PORT=1521))'
*.log_archive_dest_1='LOCATION=/u01/app/oracle/archivelogs VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=test'
*.log_archive_dest_state_1=enable
*.log_archive_format='%t_%s_%r.ARC'
*.streams_pool_size=12582912
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.log_archive_config='DG_CONFIG=(test,test222)'
*.log_archive_dest_2='SERVICE=test222 LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=test222'
*.log_archive_dest_state_2=enable
*.compatible=10.2.0.4.0
fal_server='test'
fal_client='test222'
standby_file_management=auto
db_file_name_convert=/u01/app/oracle/test222/oradata,/u01/app/oracle/oradata
log_file_name_convert=/u01/app/oracle/test222/oradata,/u01/app/oracle/oradata
db_recovery_file_dest=/u01/app/oracle/flashback_recovery_area
db_recovery_file_dest_size=2G
二.修改$ORACLE_HOME/dbs/inittest222.ora
control_files='/u01/app/oracle/test222/oradata/ctlstandby.ctl'
db_cache_size=37748736
db_name='test'
db_unique_name='test222'
local_listener='(ADDRESS=(PROTOCOL=tcp)(HOST=blliu)(PORT=1521))'
log_archive_dest_1='LOCATION=/u01/app/oracle/test111/archivelogs VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=test222'
log_archive_dest_state_1=enable
log_archive_format='%t_%s_%r.ARC'
streams_pool_size=12582912
undo_management='AUTO'
undo_tablespace='UNDOTBS1'
log_archive_config='DG_CONFIG=(test,test222)'
log_archive_dest_2='SERVICE=test LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLES) DB_UNIQUE_NAME=test'
log_archive_dest_state_2=enable
db_file_name_convert=/u01/app/oracle/oradata,/u01/app/oracle/test222/oradata
log_file_name_convert=/u01/app/oracle/oradata,/u01/app/oracle/test222/oradata
background_dump_dest=/u01/app/oracle/test222/admin/bdump/
user_dump_dest=/u01/app/oracle/test222/admin/udump/
core_dump_dest=/u01/app/oracle/test222/admin/cdump/
fal_server='test222'
fal_client='test'
standby_file_management=auto
compatible=10.2.0.4.0
三.建立相應目錄:
mkdir -p /u01/app/oracle/test222/admin/bdump
mkdir -p /u01/app/oracle/test222/admin/cdump
mkdir -p /u01/app/oracle/test222/admin/udump
mkdir -p /u01/app/oracle/test222/oradata
mkdir -p /u01/app/oracle/test222/archivelogs
mkdir -p /u01/app/oracle/test222/rman
四.建立密碼檔案:
orapwd file=$ORACLE_HOME/dbs/orapwtest password=oracle entries=5
orapwd file=$ORACLE_HOME/dbs/orapwtest222 password=oracle entries=5
五.修改$ORACLE_HOME/network/admin/listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = test)
(ORACLE_HOME = /u01/app/oracle/db_1)
(SID_NAME = test)
)
(SID_DESC =
(GLOBAL_DBNAME = test222)
(ORACLE_HOME = /u01/app/oracle/db_1)
(SID_NAME = test222)
)
)
完成後重啟監聽!
六.修改$ORACLE_HOME/network/admin/tnsnames.ora
TEST222 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test222)
)
)
TEST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 127.0.0.1)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = test)
)
)
七.啟動standby到nomount模式:
[oracle@blliu admin]$ export ORACLE_SID=test222
[oracle@blliu admin]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.4.0 - Production on Thu Jan 28 23:28:29 2010
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to an idle instance.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 171966464 bytes
Fixed Size 2082496 bytes
Variable Size 125831488 bytes
Database Buffers 37748736 bytes
Redo Buffers 6303744 bytes
八.利用rman工具中的duplicate進行standby控制檔案、資料檔案的建立:
[oracle@blliu dbs]$ echo $ORACLE_SID
test
[oracle@blliu dbs]$ rman target / auxiliary
Recovery Manager: Release 10.2.0.4.0 - Production on Thu Jan 28 23:31:38 2010
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: TEST (DBID=2003741378)
connected to auxiliary database: TEST (not mounted)
RMAN> backup database include current controlfile for standby;
RMAN> duplicate target database for standby;
九.啟動standby到管理模式(第八步完成後,standby已經是mount狀態):
[oracle@blliu dbs]$ export ORACLE_SID=test222
[oracle@blliu dbs]$ sqlplus / as sysdba
SQL> alter database recover managed standby database disconnect from session;
Database altered.
十.重啟主資料庫:
[oracle@blliu dbs]$ export ORACLE_SID=test
[oracle@blliu dbs]$ sqlplus / as sysdba
SQL> shutdown immediate
SQL> startup
十一.檢視/u01/app/oracle/test222/admin/bdump/alert_test222.log
如果有以下文字表示standby建立成功,並開始正常執行了:
Thu Jan 28 23:37:58 2010
Media Recovery Log /u01/app/oracle/test111/archivelogs/1_13_709083440.ARC
Media Recovery Waiting for thread 1 sequence 14 (in transit)
至此,單機上一個最簡單的Data Guard環境搭建完畢。
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23135684/viewspace-624982/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 單機搭建Data Guard
- 主備庫記憶體不一致的Data Guard環境搭建記憶體
- 【DG】Data Guard搭建(physical standby)
- 搭建一個快速、優雅的 Laravel 的開發環境Laravel開發環境
- 基於minikube快速搭建kubernetes單節點環境
- 本地使用 docker 快速搭建一個 PHP7.4 學習環境DockerPHP
- ZooKeeper 系列(二)—— Zookeeper單機環境和叢集環境搭建
- Flink 入門篇之 在 Linux 上搭建 Flink 的單機環境Linux
- 使用 kind 快速搭建 kubernetes 環境
- 使用docker快速搭建hive環境DockerHive
- Storm 系列(三)—— Storm 單機版本環境搭建ORM
- Laradock 快速搭建PHP開發環境PHP開發環境
- 基於ECS快速搭建Docker環境Docker
- Elasticsearch快速入門和環境搭建Elasticsearch
- RabbitMQ系列(一)在Ubuntu上的環境搭建MQUbuntu
- 搭建一個本地 Laravel 執行環境Laravel
- 基於docker 搭建redis環境—redis單機版DockerRedis
- 搭建JAVAEE環境(一)Java
- OpenCV環境搭建(一)OpenCV
- RabbitMQ系列(一)RabbitMQ在Ubuntu上的環境搭建MQUbuntu
- vue cli快速搭建Vue開發環境Vue開發環境
- (WSL) Ubuntu 快速搭建 PHP 開發環境UbuntuPHP開發環境
- React基礎——快速搭建開發環境React開發環境
- 快速搭建本地docker的開發環境Docker開發環境
- 簡單幾步搭建一個基於Docker的Tomcat執行環境!DockerTomcat
- AngularJS 4(一)【搭建環境】AngularJS
- 一、越獄環境搭建
- andriod環境搭建(Mac機器)Mac
- 在CentOS 7上搭建Docker環境CentOSDocker
- macOS 上搭建Flutter開發環境MacFlutter開發環境
- MAC上Flutter環境搭建記錄MacFlutter
- (一)Linux環境的學習環境的搭建Linux
- lua入門之環境搭建、第一個demo
- 快速搭建 Linux(LNMP + Linux 安裝 + 環境配置)LinuxLNMP
- 使用minikube快速搭建k8s環境K8S
- Oracle Data Guard Broker元件Oracle元件
- Oracle Data Guard簡介Oracle
- 以Aliyun體驗機為例,從零搭建LNMPR環境(上)LNMP
- Windows上搭建Standalone模式的Spark環境Windows模式Spark