Oracle Data Guardʵʩ
SQL > ALTER DATABASE ARCHIVELOG; SQL > ALTER DATABASE OPEN;
5.10 ݿ
$scp -rp /home/db/oracle/oradata/ORCL oracle@192.168.204.132://home/db/oracle/oradata/ $scp Crp /home/db/oracle/admin/orcl oracle@192.168.204.132://home/db/oracle/admin
5.11 ıpfile
[oracle@localhost dbs]$vi initorcl.ora
*.db_unique_name=orcldg
*.log_archive_config='dg_config=(orcldg,orcl)'
*.log_archive_dest_1='location=/home/db/oracle/oradata/ORCL/archive valid_for=(all_logfiles,all_roles) db_unique_name=orcldg' *.log_archive_dest_2='service=orcl lgwr async
valid_for=(online_logfiles,primary_role) db_unique_name=orcl' *.log_archive_dest_state_1=enable *.log_archive_dest_state_2=enable *.log_archive_format=%t_%s_%r.arc *.fal_server=orcl *.fal_client=orcldg
*.standby_file_management=auto
*.control_files='/home/db/oracle/oradata/ORCL/controlfile/stdby_control01.ctl','/home/db/oracle/flash_recovery_area/ORCL/controlfile/stdby_control01.ctl'
5.12 ڱϴspfile
sql>shutdown immediate
sql>create spfile from pfile;
Oracle Data Guardʵʩ
5.13 ݿ
SQL>startup nomount
SQL>alter database mount standby database;
5.14 Standby Redo Log
߶standby redo log
鿴־ÿ־ļĴС SQL> SELECT GROUP#, BYTES FROM V$LOG;
ڱ鿴־ÿ־ļĴС SQL> SELECT GROUP#, BYTES FROM V$STANDBY_LOG; ⴴ־redo logļ
SQL> ALTER DATABASE ADD STANDBY LOGFILE group 4('/home/db/oracle/product/11.2.0/db_1/dbs/slog4.rdo') SIZE 50M; SQL> ALTER DATABASE ADD STANDBY LOGFILE group 5 ('/home/db/oracle/product/11.2.0/db_1/dbs/slog5.rdo') SIZE 50M; SQL>ALTER DATABASE ADD STANDBY LOGFILE group 6 ('/home/db/oracle/product/11.2.0/db_1/dbs/slog6.rdo') SIZE 50M; SQL>ALTER DATABASE ADD STANDBY LOGFILE group 7('/home/db/oracle/product/11.2.0/db_1/dbs/slog7.rdo') SIZE 50M;
ע
ɾ־redo logļķ
SQL>ALTER DATABASE DROP STANDBY LOGFILE GROUP N;(N)
5.15 Start Redo Apply
ݿDataGuardıģʽ.ݿmount״̬úDataGuardıģʽ.
SQL>alter system set log_archive_dest_state_2=ENABLE scope=both; SQL>shutdown immediate; SQL>startup mount;
SQL>alter database set standby database to maximize availability; SQL>alter database open;
Oracle Data Guardʵʩ
ڱݿ־ #ʵʱӦ־
SQL>alter database recover managed standby database using current logfile disconnect from session;
鿴Щ鵵־APPLY
SQL>select sequence#,applied from v$archived_log order by sequence#;
ǿ־лǰonline redo log file. SQL>alter system archive log current;
ڱ
鿴µı鵵redo data
SQL> SELECT SEQUENCE#, FIRST_TIME, NEXT_TIME FROM V$ARCHIVED_LOG ORDER BY SEQUENCE#;
ڱ鿴յıӦõredo
SQL> select sequence#,applied from v$archived_log order by sequence#;
鿴ݿĽɫ
SQL>select database_role,protection_mode,protection_level from v$database;
鿴־
SQL> Select dest_name,status,error from v$archive_dest;
DEST_NAME STATUS ERROR
-------------------- --------- ------------------------------------------------- LOG_ARCHIVE_DEST_1 VALID LOG_ARCHIVE_DEST_2 VALID 31 rows selected.
ڵ㶼
֤ͬ
л־
SQL> alter system switch logfile;
Oracle Data Guardʵʩ
System altered.
SQL> select sequence# from v$archived_log; SEQUENCE# ----------
15 16
SQL> alter system switch logfile;
System altered.
SQL> select sequence# from v$archived_log; SEQUENCE# ----------
17 18
ڱ֤
SQL> select sequence#,applied from v$archived_log;
SEQUENCE# APP ---------- ---
13 YES 4 NO 14 YES 15 YES 16 YES 18 NO 16 YES