Data Guard不只是一個備份恢復的工具,某些情況下它甚至可以與primary數據庫完全一模一樣。
但是,它存在的目的并不僅僅是為了恢復數據,應該說它的存在是為了確保企業數據的高可用性,數據保護以及災難恢復。
一個處于Open 狀態對外提供服務,這個數據庫叫作Primary Database;
第二個處于恢復狀態,叫作Standby Database。
select protection_mode,protection_level from v$database;
操作系統:Centos7.9
數據庫版本11.2.0.4
主庫IP:192.168.13.30 pri SID=pri
備庫IP:192.168.13.40 std SID=std
select name,log_mode,force_logging from v$database;
alter database force logging;
[oracle@pri dbs]$ scp orapwpri 192.168.13.40:$ORACLE_HOME/dbs/orapwstd
[oracle@pri dbs]$ cd /home/oracle/u01/app/oracle/oradata/
[oracle@pri oradata]$ mkdir standbylog
[oracle@pri oradata]$ sqlplus / as sysdba
SQL> set pagesize 100
SQL> col member for a60
SQL> select group#,member from v$logfile order by group#;
SQL> show parameter spfile;
SQL> create pfile from spfile;
[oracle@pri dbs]$ vi initpri.ora
pri.__db_cache_size=2919235584
pri.__java_pool_size=33554432
pri.__large_pool_size=50331648
pri.__oracle_base=/home/oracle/u01/app/oracle#ORACLE_BASE set from environment
pri.__pga_aggregate_target=1241513984
pri.__sga_target=3724541952
pri.__shared_io_pool_size=0
pri.__shared_pool_size=687865856
pri.__streams_pool_size=0
*.audit_file_dest=/home/oracle/u01/app/oracle/admin/pri/adump
*.audit_trail=db
*.compatible=11.2.0.4.0
*.control_files=/home/oracle/u01/app/oracle/oradata/pri/control01.ctl,/home/oracle/u01/app/oracle/fast_recovery_area/pri/control02.ctl
*.db_block_size=8192
*.db_domain=
*.db_name=pri
*.db_recovery_file_dest=/home/oracle/u01/app/oracle/fast_recovery_area
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest=/home/oracle/u01/app/oracle
*.dispatchers=(PROTOCOL=TCP) (SERVICE=priXDB)
*.open_cursors=300
*.pga_aggregate_target=1240465408
*.processes=150
*.remote_login_passwordfile=EXCLUSIVE
*.sga_target=3721396224
*.undo_tablespace=UNDOTBS1
*.db_unique_name=pri
*.log_archive_config=dg_config=(pri,std)
*.log_archive_dest_1=location=/home/oracle/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=pri
*.log_archive_dest_2=service=std valid_for=(online_logfiles,primary_role) db_unique_name=std
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.log_archive_max_processes=4
*.fal_server=std
*.fal_client=pri
*.db_file_name_convert=/home/oracle/u01/app/oracle/oradata/std,/home/oracle/u01/app/oracle/oradata/pri
*.log_file_name_convert=/home/oracle/u01/app/oracle/oradata/std,/home/oracle/u01/app/oracle/oradata/pri
*.standby_file_management=auto
[oracle@pri dbs]$ mkdir -p /home/oracle/u01/app/oracle/arch
SQL> shu immediate
SQL> startup mount;
SQL> alter database archivelog;
SQL> alter database open;
SQL> archive log list
SQL> show parameter spfile;
[oracle@pri dbs]$ vi /home/oracle/u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.13.30)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = pri)
(ORACLE_HOME = /home/oracle/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = pri)
)
)
ADR_BASE_LISTENER = /home/oracle/u01/app/oracle
~
[oracle@pri dbs]$ vi /home/oracle/u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora
pri =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.13.30)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = pri)
)
)
std =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.13.40)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = std)
)
)
[oracle@std dbs]$ vi /home/oracle/u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.13.40)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = std)
(ORACLE_HOME = /home/oracle/u01/app/oracle/product/11.2.0/db_1)
(SID_NAME = std)
)
)
ADR_BASE_LISTENER = /home/oracle/u01/app/oracle
[oracle@pri dbs]$ lsnrctl start
[oracle@pri dbs]$ tnsping pri
[oracle@pri dbs]$ tnsping std
[oracle@pri dbs]$ scp initpri.ora 192.168.13.40:$ORACLE_HOME/dbs/initstd.ora
[oracle@std dbs]$ vi initstd.ora
pri.__db_cache_size=2919235584
pri.__java_pool_size=33554432
pri.__large_pool_size=50331648
pri.__oracle_base=/home/oracle/u01/app/oracle#ORACLE_BASE set from environment
pri.__pga_aggregate_target=1241513984
pri.__sga_target=3724541952
pri.__shared_io_pool_size=0
pri.__shared_pool_size=687865856
pri.__streams_pool_size=0
*.audit_file_dest=/home/oracle/u01/app/oracle/admin/pri/adump
*.audit_trail=db
*.compatible=11.2.0.4.0
*.control_files=/home/oracle/u01/app/oracle/oradata/pri/control01.ctl,/home/oracle/u01/app/oracle/fast_recovery_area/pri/control02.ctl
*.db_block_size=8192
*.db_domain=
*.db_name=pri
*.db_recovery_file_dest=/home/oracle/u01/app/oracle/fast_recovery_area
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest=/home/oracle/u01/app/oracle
*.dispatchers=(PROTOCOL=TCP) (SERVICE=priXDB)
*.open_cursors=300
*.pga_aggregate_target=1240465408
*.processes=150
*.remote_login_passwordfile=EXCLUSIVE
*.sga_target=3721396224
*.undo_tablespace=UNDOTBS1
*.db_unique_name=pri
*.log_archive_config=dg_config=(pri,std)
*.log_archive_dest_1=location=/home/oracle/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=pri
*.log_archive_dest_2=service=std valid_for=(online_logfiles,primary_role) db_unique_name=std
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
pri.__db_cache_size=1392508928
pri.__java_pool_size=16777216
pri.__large_pool_size=33554432
pri.__oracle_base=/home/oracle/u01/app/oracle#ORACLE_BASE set from environment
pri.__pga_aggregate_target=620756992
pri.__sga_target=1862270976
pri.__shared_io_pool_size=0
pri.__shared_pool_size=402653184
pri.__streams_pool_size=0
*.audit_file_dest=/home/oracle/u01/app/oracle/admin/std/adump
*.audit_trail=db
*.compatible=11.2.0.4.0
*.control_files=/home/oracle/u01/app/oracle/oradata/std/control01.ctl,/home/oracle/u01/app/oracle/oradata/std/control02.ctl
*.db_block_size=8192
*.db_domain=
*.db_name=pri
*.db_recovery_file_dest=/home/oracle/u01/app/oracle/fast_recovery_area
*.db_recovery_file_dest_size=4385144832
*.diagnostic_dest=/home/oracle/u01/app/oracle
*.dispatchers=(PROTOCOL=TCP) (SERVICE=stdXDB)
*.open_cursors=300
*.pga_aggregate_target=2423259136
*.processes=150
*.remote_login_passwordfile=EXCLUSIVE
*.sga_target=4294967296
*.undo_tablespace=UNDOTBS1
*.db_unique_name=std
*.log_archive_config=dg_config=(pri,std)
*.log_archive_dest_1=location=/home/oracle/u01/app/oracle/arch valid_for=(all_logfiles,all_roles) db_unique_name=std
*.log_archive_dest_2=service=pri valid_for=(online_logfiles,primary_role) db_unique_name=pri
*.log_archive_dest_state_1=enable
*.log_archive_dest_state_2=enable
*.log_archive_max_processes=4
*.fal_server=pri
*.fal_client=std
*.db_file_name_convert=/home/oracle/u01/app/oracle/oradata/pri,/home/oracle/u01/app/oracle/oradata/std
*.log_file_name_convert=/home/oracle/u01/app/oracle/oradata/pri,/home/oracle/u01/app/oracle/oradata/std
*.standby_file_management=auto
[oracle@std dbs]$ mkdir -pv /home/oracle/u01/app/oracle/admin/std/adump
[oracle@std dbs]$ mkdir -pv /home/oracle/u01/app/oracle/oradata/std/
[oracle@std dbs]$ mkdir -pv /home/oracle/u01/app/oracle/fast_recovery_area
[oracle@std dbs]$ mkdir -pv /home/oracle/u01/app/oracle/arch
[oracle@std dbs]$ mkdir -pv /home/oracle/u01/app/oracle/diag/rdbms/std/std/trace
[oracle@std dbs]$ mkdir -pv /home/oracle/u01/app/oracle/oradata/standbylog
SQL> create spfile from pfile;
SQL> startup nomount;
[oracle@std dbs]$ rman target sys/123456@pri auxiliary sys/123456@std
RMAN> duplicate target database for standby from active database nofilenamecheck;
SQL> select status from v$instance;
SQL> alter database recover managed standby database disconnect from session;
SQL> archive log list
SQL> alter database recover managed standby database cancel;
SQL> shu immediate
SQL> alter database mount standby database;
SQL> alter database open read only;
SQL> alter database recover managed standby database using current logfile disconnect from session;
SQL> archive log list
SQL> select switchover_status,database_role,open_mode from v$database;
SQL> alter database commit to switchover to physical standby;
alter database commit to switchover to primary;
end
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/129649.html
19C?DG?Broker配置和測試 img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%; ...
DG備庫讀寫測試方案 img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%; margin:0...
摘要:因為是在虛擬機上面模擬搭建,所以我們可以設置六個不同的端口來模擬六臺虛擬機。官網然后將壓縮包上傳的虛擬機的服務器上,這里我用的是版本。把這了的改為接下來執行執行這條命令就可以后臺啟動了查看進程是否啟動成功好了,單機版的版的已經搭建成功了。 首先放一張Redis的架構圖: showImg(https://segmentfault.com/img/remote/14600000174635...
閱讀 1346·2023-01-11 13:20
閱讀 1684·2023-01-11 13:20
閱讀 1132·2023-01-11 13:20
閱讀 1858·2023-01-11 13:20
閱讀 4100·2023-01-11 13:20
閱讀 2704·2023-01-11 13:20
閱讀 1385·2023-01-11 13:20
閱讀 3597·2023-01-11 13:20