主备: 修改/etc/hosts
192.168.77.136 liumh 192.168.77.137 liu
修改listener.ora # listener.ora Network Configuration File: /u01/oracle/network/admin/listener.ora # Generated by Oracle configuration tools. ?SID_LIST_LISTENER = ?(SID_LIST= ??? ? (SID_DESC = ?? ? ?(GLOBAL_DBNAME =orcldg) ?? ? ?(SID_NAME =orcl) ? ) ?(SID_LIST= ??? ? (SID_DESC = ??? ? (GLOBAL_DBNAME =orcl) ??? ? (SID_NAME =orcl) ? ) ?) ?)
LISTENER = ? (DESCRIPTION_LIST = ? ? (DESCRIPTION = ? ? ? (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521)) ? ? ? (ADDRESS = (PROTOCOL = TCP)(HOST = liumh)(PORT = 1521)) ? ? ) ? )
ADR_BASE_LISTENER = /u01
? ? tnsnames.ora ?? ?ORCL = ? (DESCRIPTION = ? ? (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.77.136)(PORT = 1521)) ? ? (CONNECT_DATA = ? ? ? (SERVER = DEDICATED) ? ? ? (SERVICE_NAME = orcl) ? ? ) ? )
ORCLDG = ? (DESCRIPTION = ? ? (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.77.137)(PORT = 1521)) ? ? (CONNECT_DATA = ? ? ? (SERVER = DEDICATED) ? ? ? (SERVICE_NAME = orcldg) ? ? ) ? )
主: cat .bash_profile PATH=$PATH:$HOME/bin
export PATH
ORACLE_BASE=/u01
ORACLE_HOME=$ORACLE_BASE/oracle
ORACLE_SID=orcl
PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
生成密码文件:orapwd file=orapwvicdb password=oracle ? 编辑pfile文件 initorcl.ora? ? orcl.__db_cache_size=146800640 orcl.__java_pool_size=4194304 orcl.__large_pool_size=8388608 orcl.__oracle_base='/u01'#ORACLE_BASE set from environment orcl.__pga_aggregate_target=142606336 orcl.__sga_target=268435456 orcl.__shared_io_pool_size=0 orcl.__shared_pool_size=100663296 orcl.__streams_pool_size=0 *.audit_file_dest='/u01/admin/orcl/adump' *.audit_trail='db' *.compatible='11.2.0.4.0' *.control_files='/u01/oradata/orcl/control01.ctl','/u01/fast_recovery_area/orcl/control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='orcl' *.db_recovery_file_dest='/u01/fast_recovery_area' *.db_recovery_file_dest_size=4385144832 *.diagnostic_dest='/u01' *.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)' *.local_listener='LISTENER_ORCL' *.log_archive_dest_1='location=/u01/app/oracle/archivelog' *.memory_target=411041792 *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.undo_tablespace='UNDOTBS1'
*.db_unique_name='orcl' *.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 sync affirm valid_for=(online_logfiles,primary_role) ?db_unique_name=orcldg' *.log_archive_dest_state_1=enable *.log_archive_dest_state_2=enable *.log_archive_max_processes=10
*.db_file_name_convert='/u01/oradata/orcl', '/u01/oradata/orcl' *.log_file_name_convert='/u01/oradata/orcl', '/u01/oradata/orcl' *.fal_server=orcldg *.fal_client=orcl *.standby_file_management=auto
startup nomount pfile='/u01/oracle/dbs/initorcl.ora'; create spfile from pfile; shutdown immediate; startup;
scp 密码文件和pfile到备机 alter database add standby logfile group 7 '/u01/oradata/orcl/redo07.log' size 50M; alter system switch logfile;
备: cat .bash_profile PATH=$PATH:$HOME/bin
export PATH ORACLE_BASE=/u01
ORACLE_HOME=$ORACLE_BASE/oracle
ORACLE_SID=orcl
PATH=$ORACLE_HOME/bin:$PATH:$HOME/bin
export ORACLE_BASE ORACLE_HOME ORACLE_SID PATH
修改pfile文件 initorcl.ora? orcl.__db_cache_size=146800640 orcl.__java_pool_size=4194304 orcl.__large_pool_size=8388608 orcl.__oracle_base='/u01'#ORACLE_BASE set from environment orcl.__pga_aggregate_target=142606336 orcl.__sga_target=268435456 orcl.__shared_io_pool_size=0 orcl.__shared_pool_size=100663296 orcl.__streams_pool_size=0 *.audit_file_dest='/u01/admin/orcl/adump' *.audit_trail='db' *.compatible='11.2.0.4.0' *.control_files='/u01/oradata/orcl/control01.ctl','/u01/fast_recovery_area/orcl/control02.ctl' *.db_block_size=8192 *.db_domain='' *.db_name='orcl' *.db_recovery_file_dest='/u01/fast_recovery_area' *.db_recovery_file_dest_size=4385144832 *.diagnostic_dest='/u01' *.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)' *.local_listener='LISTENER_ORCL' *.log_archive_dest_1='location=/u01/app/oracle/archivelog' *.memory_target=411041792 *.open_cursors=300 *.processes=150 *.remote_login_passwordfile='EXCLUSIVE' *.undo_tablespace='UNDOTBS1'
*.db_unique_name='orcldg' *.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=orcl ?lgwr sync affirm valid_for=(online_logfiles,primary_role) ?db_unique_name=orcl' *.log_archive_dest_state_1=enable *.log_archive_dest_state_2=enable *.log_archive_max_processes=10
*.db_file_name_convert='/u01/oradata/orcl', '/u01/oradata/orcl' *.log_file_name_convert='/u01/oradata/orcl', '/u01/oradata/orcl' *.fal_server=orcldg *.fal_client=orcl *.standby_file_management=auto
startup nomount pfile='/u01/oracle/dbs/initorcl.ora'; create spfile from pfile; 主: rman target sys/oracle auxiliary sys/oracle@orcldg
duplicate target database for standby from active database NOFILENAMECHECK;
备:
shutdown immediate; startup;
select process,pid,client_process,thread#,sequence#,status from v$managed_standby;
select NAME ,VALUE from v$dataguard_stats;
alter database recover managed standby database cancel;
alter database recover managed standby database using current logfile disconnect;
select switchover_status from v$database;
|