SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY WITH APPLY
2. 在第二備庫配置靜態(tài)監(jiān)聽:
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. 修改第一個(gè)備庫的tnsname.ora 增加第二備庫的tnsname:
DUP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.38.30.17)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = nyhdbbk1)
)
)
4. 從第一備庫復(fù)制密碼文件到第二備庫:
cp orapwdbv_stby orapwdbv_fga
5. 創(chuàng)建參數(shù)文件,并啟動實(shí)例到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. 在第二備庫創(chuàng)建需要的目錄:
mkdir -p /u01/app/oracle/dbv_fga/adump
7. 如果cluster_interconnections參數(shù)設(shè)置在第一個(gè)備用服務(wù)器上,則需要取消它:
SQL> alter system reset cluster_interconnects scope=spfile sid=dbv_stby1;
SQL> alter system reset cluster_interconnects scope=spfile sid=dbv_stby2;
8. 在第一備庫創(chuàng)建并執(zhí)行rman 復(fù)制腳本:
#/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. 添加數(shù)據(jù)庫資源,重新啟動standby 數(shù)據(jù)庫:
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 數(shù)據(jù)庫:
SQL> alter database open;
Database altered.
SQL> select database_role from v$database;
DATABASE_ROLE
----------------
PRIMARY
5. 將新FGA 數(shù)據(jù)庫以獨(dú)占方式打開到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
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載,若此文章存在違規(guī)行為,您可以聯(lián)系管理員刪除。
轉(zhuǎn)載請注明本文地址:http://systransis.cn/yun/129443.html
pg_rman備份工具(下) img{ display:block; margin:0 auto !important; width:100%; } body{ width:75%; marg...
摘要:高度可用的數(shù)據(jù)庫云計(jì)算時(shí)代的高可用數(shù)據(jù)庫是可擴(kuò)展容錯(cuò)且與任何私有云或公共云兼容的數(shù)據(jù)庫實(shí)例?,F(xiàn)在是企業(yè)通過采用云計(jì)算解決方案運(yùn)行現(xiàn)代數(shù)據(jù)庫來獲得競爭優(yōu)勢的時(shí)候了。公共云和私有云使企業(yè)能夠擺脫容易出錯(cuò)的傳統(tǒng)架構(gòu),并運(yùn)行具有可靠性為5個(gè)9和6個(gè)9的應(yīng)用程序。業(yè)務(wù)應(yīng)用程序可以按需、即時(shí)且經(jīng)濟(jì)高效地進(jìn)行調(diào)整。數(shù)據(jù)庫應(yīng)用程序一直是所有企業(yè)基礎(chǔ)設(shè)施的主要組成部分,但這些應(yīng)用程序(特別是關(guān)系數(shù)據(jù)庫)在使用...
摘要:以下腳本是我在項(xiàng)目工作中使用的備份腳本,腳本都是自己寫的。簡介此套腳本可以實(shí)現(xiàn)對數(shù)據(jù)庫實(shí)現(xiàn)全備份和增量備份。綜合以上兩種利弊,比較好的方式是在出現(xiàn)丟失備份或的情況下,通知管理員處置,手工處理之后備份腳本運(yùn)行恢復(fù)正常。 以下腳本是我在項(xiàng)目工作中使用的備份腳本,腳本都是自己寫的。但在使用過程中,感覺還有提供空間,我這個(gè)人有點(diǎn)懶,所以想用將腳本開源出來的方式督促自己完善這一套腳本。大家如果對...
閱讀 1356·2023-01-11 13:20
閱讀 1707·2023-01-11 13:20
閱讀 1215·2023-01-11 13:20
閱讀 1906·2023-01-11 13:20
閱讀 4165·2023-01-11 13:20
閱讀 2757·2023-01-11 13:20
閱讀 1402·2023-01-11 13:20
閱讀 3671·2023-01-11 13:20