|操作系统 | release 6.7 | release 6.7 |
|主机名 | stuaapp01 | stuaapp02 |
|IP | 192.168.20.234 | 192.168.20.235 |
|数据库软件版本 | Oracle 11.2.0.4.0 | oracle 11.2.0.4.0 |
|ORACLE_BASE | /u01/app/oracle/ | /u01/app/oracle/ |
|ORACLE_HOME |$ORACLE_BASE/product/11.2.0/db_1 | $ORACLE_BASE/product/11.2.0/db_1 |
|ORACLE_SID | orcl | |
|闪回区 | 4G | |
|归档 | 开启 | |
---------------------------------------------------------------------------------------------
查看数据库版本
SQL> select * from v$version;
一.Primary 数据库配置及相关操作
1.确认primary库处于归档模式
2.将primary库置为FORCE LOGGING 模式
3.添加STANDBY日志文件
4.创建primary库客户端初始化参数文件
1).创建主库中的pfile
2).备份到backup目录用于创建备库的pfile
3).修改后主库pfile中内容如下
4).通过pfile 重建spfile
5).修改监听配置文件
6).配置tnsnames.ora文件
7).启动数据库,测试
5.rman备份数据库,在闪回区中
二.Standby数据库配置及相关操作
1.创建所需目录(注意OMF管理的文件)
2.复制数据文件到standby库对应的目录
1).拷贝闪回区内容
2).拷贝参数文件
3).拷贝密码文件
4).拷贝监听文件和tns文件
3.修改相应配置
1).修改监听配置文件
2).修改TNS配置文件
3).重启监听服务
4).standby的初始化参数如下
5).通过该pfile 创建spfile
4.恢复数据库
5.启动redo 应用
6.验证
7.切换到只读模式
8.切换到同步模式(不需要停库)
一.Primary 数据库配置及相关操作
1.确认primary库处于归档模式
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 2
Next log sequence to archive 4
Current log sequence 4
2.将primary库置为FORCE LOGGING 模式
SQL> alter database force logging;
SQL> select force_logging from v$database;
FOR
---
YES
Database altered.
3.添加STANDBY日志文件
alter database add standby logfile group 4 ('/u01/app/oracle/oradata/orcl/redo04.log') size 50m;
alter database add standby logfile group 5 ('/u01/app/oracle/oradata/orcl/redo05.log') size 50m;
alter database add standby logfile group 6 ('/u01/app/oracle/oradata/orcl/redo06.log') size 50m;
alter database add standby logfile group 7 ('/u01/app/oracle/oradata/orcl/redo07.log') size 50m;
4.创建primary库客户端初始化参数文件
1).创建主库中的pfile
SQL> create pfile from spfile;
File created.
2).备份到backup目录用于创建备库的pfile
[oracle@rac1 dbs]$ pwd
/u01/app/oracle/product/11.2.0/db_1/dbs
[oracle@rac1 dbs]$ cp ./initorcl.ora /home/oracle/backup/
3).修改后主库pfile中内容如下
orcl.__db_cache_size=327155712
orcl.__java_pool_size=4194304
orcl.__large_pool_size=8388608
orcl.__oracle_base='/u01/app/oracle'
#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=318767104
orcl.__sga_target=469762048
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=121634816
orcl.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/u01/app/oracle/oradata/orcl/control01.ctl','/u01/app/oracle/fast_recovery_area/orcl/control02.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest='/u01/app/oracle/fast_recovery_area'
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=786432000
*.open_cursors=300
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.undo_tablespace='UNDOTBS1'
#################################################################
#Parameters for Primary Database.
#################################################################
*.DB_NAME='orcl'
*.DB_UNIQUE_NAME=orcl
*.LOG_ARCHIVE_FORMAT=log%t_%s_%r.arc
*.LOG_ARCHIVE_CONFIG='DG_CONFIG=(orcl,orcldg)'
*.LOG_ARCHIVE_DEST_1='LOCATION=/u01/app/oracle/archivelog VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'
*.LOG_ARCHIVE_DEST_2='SERVICE=orcldg LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcldg'
*.LOG_ARCHIVE_DEST_STATE_1=ENABLE
*.LOG_ARCHIVE_DEST_STATE_2=ENABLE
*.REMOTE_LOGIN_PASSWORDFILE=EXCLUSIVE
*.standby_file_management=auto
#################################################################
#Parameters which using for switch over from Primary to Standby.
#################################################################
*.FAL_SERVER=orcldg
*.FAL_CLIENT=orcl
*.DB_FILE_NAME_CONVERT='/u01/app/oracle/oradata/orcldg','/u01/app/oracle/oradata/orcl'
*.log_file_name_convert='/u01/app/oracle/oradata/orcldg','/u01/app/oracle/oradata/orcl'
*.standby_archive_dest='/u01/app/oracle/archive_log'
4).通过pfile 重建spfile
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> create spfile from pfile='initorcl.ora';
File created.
5).修改监听配置文件
# listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.20.241)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)