欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  数据库

Oracle 10g Physical DataGuard 详细搭建过程

程序员文章站 2022-06-16 19:36:08
...

Oracle 10g Physical DataGuard 详细搭建过程

primary 环境
DB version:Oracle10.2.0.4
IP:192.168.1.7
hostname:vzwc
db_name:dbserver
db_unique_name:dbserver
service_name:dbserver
instance_name:ORCL

standby 环境
DB version:oracle10.2.0.4
IP:192.168.1.6
hostname:dgstb
db_name:dbserver
db_unique_name:standby
service_name:standby
instance_name:standby


*********************************************
配置primary


--开启force logging和归档,设置归档目录
SQL> startup mount
ORACLE instance started.


Total System Global Area 612368384 bytes
Fixed Size 2085872 bytes
Variable Size 167775248 bytes
Database Buffers 436207616 bytes
Redo Buffers 6299648 bytes
Database mounted.
SQL> alter database force logging;


Database altered.


SQL> alter database archivelog;


Database altered.


SQL> alter database open;


Database altered.


SQL> alter system set log_archive_dest_1='location=/arch';


System altered.


--创建standby controlfile和pfile,,并且连口令文件一起传到standby端
SQL> alter database create standby controlfile as '/u01/app/oracle/standby.ctl';


Database altered.


SQL> create pfile='/u01/app/oracle/init.ora' from spfile;


File created.


SQL> !scp /u01/app/oracle/*.ctl oracle@192.168.1.6:/u01/app/oracle
The authenticity of host '192.168.1.6 (192.168.1.6)' can't be established.
RSA key fingerprint is 9c:7e:6b:4f:ad:6a:bd:2e:b0:34:ef:5c:a5:ff:69:1f.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '192.168.1.6' (RSA) to the list of known hosts.
oracle@192.168.1.6's password:
standby.ctl 100% 7152KB 7.0MB/s 00:00


SQL> !scp /u01/app/oracle/*.ora oracle@192.168.1.6:/u01/app/oracle
oracle@192.168.1.6's password:
init.ora 100% 1225 1.2KB/s 00:00


SQL> !scp $ORACLE_HOME/dbs/orapwORCL oracle@192.168.1.6:/u01/app/oracle
oracle@192.168.1.6's password:
orapwORCL 100% 2048 2.0KB/s 00:00


*********************************************
配置standby


--rename pfile和口令文件
[oracle@dgstb ~]$ cd $ORACLE_HOME/dbs
[oracle@dgstb dbs]$ mv /u01/app/oracle/orapwORCL orapwstandby
[oracle@dgstb dbs]$ mv /u01/app/oracle/init.ora initstandby.ora


--配置standby环境变量
alias ls="ls -FA"
export ORACLE_BASE=/u01/app/oracle
export ORACLE_HOME=$ORACLE_BASE/product/10.2.0/db_1
export ORACLE_PATH=$ORACLE_BASE/common/oracle/sql:.:$ORACLE_HOME/rdbms/admin
export ORACLE_SID=standby
export PATH=.:${JAVA_HOME}/bin:${PATH}:$HOME/bin:$ORACLE_HOME/bin
export PATH=${PATH}:/usr/bin:/bin:/usr/bin/X11:/usr/local/bin
export PATH=${PATH}:$ORACLE_BASE/common/oracle/bin
export ORACLE_TERM=xterm
export TNS_ADMIN=$ORACLE_HOME/network/admin
export ORA_NLS10=$ORACLE_HOME/nls/data
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$ORACLE_HOME/oracm/lib
export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/lib:/usr/lib:/usr/local/lib
export CLASSPATH=$ORACLE_HOME/JRE
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/rdbms/jlib
export CLASSPATH=${CLASSPATH}:$ORACLE_HOME/network/jlib
export THREADS_FLAG=native
export TEMP=/tmp
export TMPDIR=/tmp
alias sqlplus="rlwrap sqlplus"
alias rman="rlwrap rman"
alias base="cd $ORACLE_BASE"
alias home="cd $ORACLE_HOME"