SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
2. 在第二備庫配置靜態監聽:
LISTENER_duplicate =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = hwzsc-nyhd-bbk-db01)(PORT = 1521))
)
)
SID_LIST_LISTENER_duplicate =
(SID_LIST =
(SID_DESC =
(SID_NAME = nyhdbbk1)
(ORACLE_HOME = /db/oracle/product/19.3)
)
)
3. 修改第一個備庫的tnsname.ora 增加第二備庫的tnsname:
DUP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.38.30.17)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = nyhdbbk1)
)
)
4. 從第一備庫復制密碼文件到第二備庫:
cp orapwdbv_stby orapwdbv_fga
5. 創建參數文件,并啟動實例到nomount:
cd $ORACLE_HOME/dbs
vi initdbv_fga.ora
db_name=dbv
db_unique_name=dbv_fga
sga_target=5g
sqlplus / as sysdba
startup nomount;
6. 在第二備庫創建需要的目錄:
mkdir -p /u01/app/oracle/dbv_fga/adump
7. 如果cluster_interconnections參數設置在第一個備用服務器上,則需要取消它:
SQL> alter system reset cluster_interconnects scope=spfile sid=dbv_stby1;
SQL> alter system reset cluster_interconnects scope=spfile sid=dbv_stby2;
8. 在第一備庫創建并執行rman 復制腳本:
#/bin/bash
source /home/oracle/.bash_profile
rman target / auxiliary sys/xxxx@dup msglog=/home/oracle/dup.log< run {
allocate channel prmy1 type disk;
allocate channel prmy2 type disk;
allocate channel prmy3 type disk;
allocate channel prmy4 type disk;
allocate auxiliary channel stby type disk;
duplicate target database for standby from active database
spfile
parameter_value_convert dbv_sdby,dbv_fga
set db_unique_name= dbv_fga
set db_create_file_dest=/db/oracle/oradata
set db_recovery_file_dest=/db/oracle/oradata/fast_recovery_area
set db_file_name_convert=+DATA1,DATA1 ,+ARCH,+ARCH
set log_file_name_convert=+DATA1,DATA1 ,+ARCH,+ARCH
set control_files=/db/oracle/oradata/dbv_stby/control01.ctl, /db/oracle/oradata/stby/control02.ctl
set log_archive_max_processes=5
set fal_client=dbv_fga
set fal_server=dbv_stby
set standby_file_management=MANUAL
set log_archive_config=dg_config=(dbv,dbv_stby,dbv_fga)
set log_archive_dest_2=service=nyhd ASYNC valid_for=(ONLINE_LOGFILE,PRIMARY_ROLE) db_unique_name=dbv_fga
set cluster_database=false
;
}
exit
EOF
SQL> create pfile=/tmp/p.ora from spfile;
SQL> create spfile=+/dbv_fga/spfile_fga.ora from pfile=/tmp/p.ora;
3. 添加數據庫資源,重新啟動standby 數據庫:
srvctl add database -d dbv_fga –o
srvctl add instance -d dbv_fga -i dbv_fga1 -n exa505
srvctl add instance -d dbv_fga -i dbv_fga2 -n exa506
srvctl modify database –d dbv_fga –r physical_standby
SQL> alter system set log_archive_config=DG_CONFIG=(db112,dbv_stby,dbv_fga) scope=both;
SQL> alter system set fal_server=dbv_stby scope=both;
SQL> alter system set log_archive_config=DG_CONFIG=(db112,dbv_stby,dbv_fga) scope=both;
SQL> alter system set log_archive_dest_3=service=dbv_fga ASYNC valid_for=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=dbv_fga scope=both;
set linesize 150;
set pagesize 20;
column name format a13;
column value format a20;
column unit format a30;
column TIME_COMPUTED format a30;
select name,value,unit,time_computed from v$dataguard_stats where name in (transport lag,apply lag);
select registrar,creator,thread#,sequence#,first_change#,
next_change#,applied from v$archived_log;
SQL> alter system set log_archive_dest_state_3=defer scope=both;
SQL> alter system reset log_archive_config;
SQL> alter system reset fal_server;
3. 停止dbv_fga 的recover ,并激活第二備庫:
SQL> recover managed standby database cancel;
Media recovery complete.
SQL> recover managed standby database finish;
Media recovery complete.
SQL> alter database commit to switchover to primary with session shutdown;
Database altered.
SQL> alter system reset log_archive_config;
SQL> alter system set log_archive_dest_state_2=defer scope=both;
SQL> alter system set log_archive_dest_state_3=defer scope=both;
4. 打開dbv_fga 數據庫:
SQL> alter database open;
Database altered.
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PRIMARY
5. 將新FGA 數據庫以獨占方式打開到mount階段:
SQL> alter system set cluster_database=false scope=spfile;
SQL> shutdown immediate
SQL> startup mount
$ nid target=system/ dbname=fga
DBNEWID: Release 11.2.0.4.0 - Production on Tue Mar 11 14:20:54 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to database DBV (DBID=830667753)
Connected to server version 11.2.0
Control Files in database:
+ /dbv_fga/standby.ctl
Change database ID and database name DBV to FGA? (Y/[N]) => y
Proceeding with operation
Changing database ID from 3753909469 to 1201662104
Changing database name from DBV to FGA
Control File + /dbv_fga/standby.ctl – modified
Datafile + /DBV_FGA/DATAFILE/system.410.84192081 - dbid changed, wrote new name
Datafile + /DBV_FGA/DATAFILE/sysaux.411.84192080 - dbid changed, wrote new name
Datafile + /DBV_FGA/DATAFILE/undotbs1.414.84192081 - dbid changed, wrote new name
Datafile + /DBV_FGA/DATAFILE/undotbs2.412.84192081 - dbid changed, wrote new name
Datafile + /DBV_FGA/DATAFILE/users.423.84192081 - dbid changed, wrote new name
Datafile + /DBV_FGA/TEMPFILE/temp.427.84192190 - dbid changed, wrote new name
Control File + /dbv_fga/standby.ctl - dbid changed, wrote new name
Instance shut down
Database name changed to FGA.
Modify parameter file and generate a new password file before restarting.
Database ID for database FGA changed to 1201662104.
All previous backups and archived redo logs for this database are unusable.
Database is not aware of previous backups and archived logs in Recovery Area.
SQL> startup nomount
SQL> alter system set db_name=fga scope=spfile;
SQL> startup mount force;
SQL> alter database open resetlogs;
SQL> select name,dbid from v$database;
NAME DBID
-------- ----------
FGA 1201662104
文章版權歸作者所有,未經允許請勿轉載,若此文章存在違規行為,您可以聯系管理員刪除。
轉載請注明本文地址:http://specialneedsforspecialkids.com/yun/129443.html
pg_rman備份工具(下) img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%; marg...
摘要:高度可用的數據庫云計算時代的高可用數據庫是可擴展容錯且與任何私有云或公共云兼容的數據庫實例。現在是企業通過采用云計算解決方案運行現代數據庫來獲得競爭優勢的時候了。公共云和私有云使企業能夠擺脫容易出錯的傳統架構,并運行具有可靠性為5個9和6個9的應用程序。業務應用程序可以按需、即時且經濟高效地進行調整。數據庫應用程序一直是所有企業基礎設施的主要組成部分,但這些應用程序(特別是關系數據庫)在使用...
摘要:以下腳本是我在項目工作中使用的備份腳本,腳本都是自己寫的。簡介此套腳本可以實現對數據庫實現全備份和增量備份。綜合以上兩種利弊,比較好的方式是在出現丟失備份或的情況下,通知管理員處置,手工處理之后備份腳本運行恢復正常。 以下腳本是我在項目工作中使用的備份腳本,腳本都是自己寫的。但在使用過程中,感覺還有提供空間,我這個人有點懶,所以想用將腳本開源出來的方式督促自己完善這一套腳本。大家如果對...
閱讀 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