当前位置:操作系统 > Unix/Linux >>

物理dataguard傻瓜实战

物理dataguard傻瓜实战
 
一、环境
1、环境准备
虚拟机连接方式:注意连接方式虚拟机net,同时点击edit,查看虚拟机网段
操作系统:Red Hat Enterprise Linux Server release 5.1 (Tikanga)
主库地址:192.168.220.3--虚拟机,安装数据库
备库地址:192.168.220.4--虚拟机,未安装数据库,只安装软件
检查数据库版本必须一致:
select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE    10.2.0.1.0      Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
检查db_name、sid必须一致
select instance_name from v$instance; 
INSTANCE_NAME
----------------
orcl
SQL>  show parameter db_name        
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_name                              string      ice
二、主库配置
1、open数据库,
SQL> alter database force logging;
2、确认归档:
SQL> archive log list;
数据库日志模式            存档模式
自动存档             启用
最早的联机日志序列     6
下一个存档日志序列   10
当前日志序列           10
3、修改主库tnsnames(增加备库服务命名
只修改ip,数据库名和主库一致)
# tnsnames.ora Network Configuration File: /home/app/oracle10/product/10.2.0.1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
orcl  =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.220.3)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )
orcl2204  =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.220.4)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )
 
EXTPROC_CONNECTION_DATA =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
    (CONNECT_DATA =
      (SID = PLSExtProc)
      (PRESENTATION = RO)
    )
  )
4、监听配置:
# listener.ora Network Configuration File: /home/app/oracle10/product/10.2.0.1/network/admin/listener.ora
# Generated by Oracle configuration tools.
 
SID_LIST_LISTENER =
  (SID_LIST =
    (SID_DESC =
      (SID_NAME = PLSExtProc)
      (ORACLE_HOME = /home/app/oracle10/product/10.2.0.1)
      (PROGRAM = extproc)
     )
      (SID_DESC =
      (SID_NAME = orcl)
      (ORACLE_HOME =  /home/app/oracle10/product/10.2.0.1)
    )
  )
 
LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.220.3)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
    )
  )
5、虚拟机上测试是否能连主库,
注意连接方式虚拟机net,同时点击edit,查看虚拟机网段
本次虚拟机ip:192.168.220.3
[oracle@localhost ~]$ sqlplus /nolog
 
SQL*Plus: Release 10.2.0.1.0 - Production on Fri May 3 08:24:19 2013
 
Copyright (c) 1982, 2005, Oracle.  All rights reserved.
 
SQL> conn system/orcl@orcl1
Connected.
 
 
 
6、创建pfile--主库
SQL> conn sys/orcl@orcl1 as sysdba
已连接。
SQL> create pfile ='/home/app/oracle10/initorcl.ora' from spfile;
文件已创建。
 
7、修改参数文件:
[oracle@localhost dbs]$ cat initorcl.ora
orcl.__db_cache_size=92274688
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__shared_pool_size=62914560
orcl.__streams_pool_size=0
*.audit_file_dest='/home/app/oracle10/admin/ice/adump'
*.background_dump_dest='/home/app/oracle10/admin/ice/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/home/app/oracle10/oradata/ice/control01.ctl','/home/app/oracle10/oradata/ice/control02.ctl','/home/app/oracle10/oradata/ice/control03.ctl'
*.core_dump_dest='/home/app/oracle10/admin/ice/cdump'
*.db_block_size=8192
*.db_domain='orcl'
*.db_file_multiblock_read_count=16
*.db_name='ice'
*.db_recovery_file_dest='/home/app/oracle10/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.job_queue_processes=10
*.open_cursors=300
*.pga_aggregate_target=16777216
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=167772160
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/home/app/oracle10/admin/ice/udump'
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,orcl2204)'
log_archive_dest_1='LOCATION=/home/app/oracle10/archive01 VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl '
log_archive_dest_state_1=enable
log_archive_dest_2='SERVICE=orcl2204 LGWR ASYNC=40960 VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl2204 '
log_archive_dest_state_2=enable
log_archive_start=true
log_archive_format='%t_%s_%r.arc'
log_archive_max_processes=2
fal_server=orcl2204
fal_client=orcl
db_unique_name=orcl
8、创建口令文件-主库
orapwd file=/home/app/oracle10/orapworcl password=oracle entries=5
 
9、启动主库到mount,创建控制文件
SQL> startup mount
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE 例程已经启动。
Total System Global Area  612368384 bytes
Fixed Size                  1292036 bytes
Variable Size             411044092 bytes
Database Buffers          192937984 bytes
Redo Buffers &n
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,