日期:2014-05-16 浏览次数:20594 次
ORACLE10G DATAGUARD配置笔记
ORACLE10G DATAGUARD配置笔记
环境:
OS:RHL4+ORACLE10G10.2.0.1
IP:172.17.61.160(primary) 172.17.61.161(standby)
ORACLE_SID:orcl
ORACLE_HOME:/oracle/product/10.2.0
一、配置standby database为MAXIMIZE PERFORMANCE模式
二、转换模式由MAXIMIZE PERFORMANCE到MAXIMIZE PROTECTION
三、主库和备库的switchover.
?
一、配置standby database为MAXIMIZE PERFORMANCE模式
1.设置主库为force logging
SQL> alter database force logging;
2.设置主库为归档模式:
SQL> archive log list
SQL> shutdown immediate
SQL> startup mount
SQL> alter database archivelog;
SQL> archive log list
3.检查主机是否有口令文件,如没有需建立
orapwd file='/oracle/product/10.2.0/dbs/orawdorcl.ora' password=sys entries=5
4.为主数据库添加"备用联机日志文件"
SQL> alter database add standby logfile group 4
('/oracle/oradata/orcl/redo04.log') size 50m;
SQL> alter database add standby logfile group 5
('/oracle/oradata/orcl/redo05.log') size 50m;
SQL> alter database add standby logfile group 6
('/oracle/oradata/orcl/redo06.log') size 50m;
SQL> alter database add standby logfile group 7
('/oracle/oradata/orcl/redo07.log') size 50m;
5.修改主库参数文件
SQL> create pfile='/oracle/admin/orcl/pfile/init.ora' from spfile;
orcl.__db_cache_size=100663296
orcl.__java_pool_size=4194304
orcl.__large_pool_size=4194304
orcl.__shared_pool_size=54525952
orcl.__streams_pool_size=0
*.audit_file_dest='/oracle/admin/orcl/adump'
*.background_dump_dest='/oracle/admin/orcl/bdump'
*.compatible='10.2.0.1.0'
*.control_files='/oracle/oradata/orcl/control01.ctl','/oracle/oradata/orcl/control02.ctl','/oracle/oradata/orcl/control03.ctl'
*.core_dump_dest='/oracle/admin/orcl/cdump'
*.db_block_size=8192
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_name='orcl'
*.db_recovery_file_dest='/oracle/flash_recovery_area'
*.db_recovery_file_dest_size=2147483648
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.job_queue_processes=10
*.log_archive_format='%T%S%r.ARC'
*.log_archive_max_processes=3
*.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='/oracle/admin/orcl/udump'
#add below parameter for standy database
*.DB_UNIQUE_NAME='10gpri'
*.log_archive_config='DG_CONFIG=(10gpri,10gstandby)'
*.log_archive_dest_1='location=/oracle/oradata/orcl/archive/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=10gpri'
*.log_archive_dest_2='SERVICE=10gstandby arch ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=10gstandby'
*.STANDBY_FILE_MANAGEMENT=AUTO
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.FAL_SERVER='10gstandby'
*.FAL_CLIENT='10gpri'
6.主库用PFILE建立SPFILE
[oracle@host160 pfile]$ sqlplus '/ as sysdba'
SQL> create spfile from pfile='/oracle/admin/orcl/pfile/init.ora';
7.建立备用库的控制文件
SQL> alter database create standby controlfile as '/tmp/standby_ctl01.ctl';
8.配置主数据库listener及tnsnames
[oracle@host160 admin]$ cat listener.ora
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /oracle/product/10.2.0)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host160)(PORT = 1521))
)
)
#加1522端口供以后做switchover
SID_LIST_LISTENER1 =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl)
(ORACLE_HOME = /oracle/product/10.2.0)
(SID_NAME = orcl)
)
)
LISTENER1 =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host160)(PORT = 1522))
)
)
[oracle@host160 admin]$ cat tnsnames.ora
#