失效链接处理 |
Oracle11g搭建物理DG PDF 下载
本站整理下载:
相关截图:
主要内容:
1.服务器配置修改
(一)配置网络
主库dg1:
[root@dg1 ~]# vi /etc/hosts
[root@dg1 ~]# scp /etc/hosts dg2:/etc/
The authenticity of host 'dg2 (192.168.169.201)' can't be established.
RSA key fingerprint is 26:5c:d2:36:66:2b:e2:b3:12:0d:c4:fb:a6:44:97:7b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'dg2,192.168.169.201' (RSA) to the list of known hosts.
root@dg2's password: 123456
(二)修改备库实例名
备库dg2:
[root@dg2 ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
192.168.169.200 dg1
192.168.169.201 dg2
[root@dg2 ~]# su - oracle
[oracle@dg2 ~]$ vi .bash_profile
[oracle@dg2 ~]$ source .bash_profile
[oracle@dg2 ~]$ env |grep SID
ORACLE_SID=prod_stdby
(三)建立备库目录
备库dg2:
[oracle@dg2 ~]$ mkdir -p /u01/oradata/prod_stdby
[oracle@dg2 ~]$ mkdir -p /u01/arch
[oracle@dg2 ~]$ mkdir -p /u01/fast_recovery_area/prod_stdby/
2.建立物理DG
(一)主库强制记录日志
主库dg1:
[oracle@dg1 ~]$ sqlplus / as sysdba
SQL> select log_mode,force_logging from v$database;
LOG_MODE FOR
------------ ---
NOARCHIVELOG NO
SQL> alter database force logging;
SQL> select log_mode,force_logging from v$database;
LOG_MODE FOR
------------ ---
NOARCHIVELOG YES
SQL> shutdown immediate
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;
SQL> select log_mode,force_logging from v$database;
LOG_MODE FOR
------------ ---
ARCHIVELOG YES
(二)配置主备监听
[oracle@dg1 ~]$ cd /u01/oracle/network/admin/
[oracle@dg1 admin]$ vi tnsnames.ora
uni_dg1 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dg1)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = uni_dg1)
)
)
uni_dg2 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dg2)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = uni_dg2)
)
)
[oracle@dg1 admin]$ scp ./tnsnames.ora dg2:/u01/oracle/network/admin/
The authenticity of host 'dg2 (192.168.169.221)' can't be established.
RSA key fingerprint is 26:5c:d2:36:66:2b:e2:b3:12:0d:c4:fb:a6:44:97:7b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'dg2,192.168.169.221' (RSA) to the list of known hosts.
oracle@dg2's password:
Permission denied, please try again.
oracle@dg2's password:
Permission denied, please try again.
oracle@dg2's password:
tnsnames.ora
[oracle@dg2 ~]$ cd /u01/oracle/network/admin/
[oracle@dg2 admin]$ cat tnsnames.ora
(三)配置主库信息
主库dg1:
SQL> create pfile='/home/oracle/dg1_spfile' from spfile;
SQL> exit
[oracle@dg1 ~]$ vi dg1_spfile
DB_UNIQUE_NAME=uni_dg1
LOG_ARCHIVE_CONFIG='DG_CONFIG=(uni_dg1,uni_dg2)'
LOG_ARCHIVE_DEST_1=
'LOCATION=/u01/arch/
VALID_FOR=(ALL_LOGFILES,ALL_ROLES)
DB_UNIQUE_NAME=uni_dg1'
LOG_ARCHIVE_DEST_2=
'SERVICE=uni_dg2 ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE)
DB_UNIQUE_NAME=uni_dg2'
LOG_ARCHIVE_DEST_STATE_1=ENABLE
LOG_ARCHIVE_DEST_STATE_2=ENABLE
FAL_SERVER=uni_dg2
DB_FILE_NAME_CONVERT='/u01/oradata/prod_stdby','/u01/oradata/prod'
LOG_FILE_NAME_CONVERT='/u01/oradata/prod_stdby','/u01/oradata/prod'
STANDBY_FILE_MANAGEMENT=AUTO
[oracle@dg1 ~]$ cd /u01/
[oracle@dg1 u01]$ mkdir arch
[oracle@dg1 u01]$ ll |grep arch
drwxr-xr-x 2 oracle oinstall 4096 Apr 22 18:19 arch
[oracle@dg1 u01]$ sqlplus / as sysdba
SQL> shutdown immediate
[oracle@dg1 u01]$ sqlplus / as sysdba
SQL> startup force nomount pfile=/home/oracle/dg1_spfile
ORACLE instance started.
Total System Global Area 521936896 bytes
SQL> show parameter name
NAME TYPE VALUE
------------------------- ------------------------------- ---------------------------------------
cell_offloadgroup_name string
db_file_name_convert string /u01/oradata/prod_stdby, /u01/oradata/prod
db_name string prod
db_unique_name string uni_dg1
global_names boolean FALSE
instance_name string prod
lock_name_space string
log_file_name_convert string /u01/oradata/prod_stdby, /u01/oradata/prod
processor_group_name string
service_names string uni_dg1
SQL> create spfile from pfile='/home/oracle/dg1_spfile';
SQL> startup force
Database opened.
SQL> show parameter name
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
cell_offloadgroup_name string
db_file_name_convert string /u01/oradata/prod_stdby, /u01/oradata/prod
db_name string prod
db_unique_name string uni_dg1
global_names boolean FALSE
instance_name string prod
lock_name_space string
log_file_name_convert string /u01/oradata/prod_stdby, /u01/oradata/prod
processor_group_name string
service_names string uni_dg1
SQL> alter database create standby controlfile as '/home/oracle/stdby_ctrl_file.bak';
Database altered.
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@dg1 u01]$ cd
[oracle@dg1 ~]$ ll |grep ctrl
-rw-r----- 1 oracle oinstall 9748480 Apr 22 18:34 stdby_ctrl_file.bak
[oracle@dg1 ~]$ cd /u01/oradata/prod/
[oracle@dg1 prod]$ ll
total 3531072
|