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
文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。
转载请注明本文地址:https://www.ucloud.cn/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