Steps to create a new standby from an existing ADG standby (文件 ID 2305009.1)
Some customer want to know if we can create a new standby from an existing ADG standby, because we can reduce the overhead workload on primary when creating new standby by using this way.
SOLUTION
Existing primary database: adgpri
Existing standby database: adgstby
The new standby database to be created: adgnew.
All this primary and standby are running on the same host.
Step 1. Create standby controlfile on primary:
------------------------------------------------------
[[email protected] ~]$ export ORACLE_SID=adgpri
[[email protected] ~]$ sqlplus / as sysdba
SQL> alter database create standby controlfile as '/home/oracle/app/oracle/oradata/adgnew/control01.ctl';
[[email protected] ~]$ export ORACLE_SID=adgnew
Step 2. Configure static listener and tnsnames point to the new standby:
------------------------------------------------------------------------------------
$ cat $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = adg.fsm.com)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
(UR=A)
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = adgstby)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = adgstby)
)
(SID_DESC =
(GLOBAL_DBNAME = adgnew)
(ORACLE_HOME = /home/oracle/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = adgnew)
)
)
ADR_BASE_LISTENER = /home/oracle/app/oracle
[[email protected] ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-AUG-2017 12:27:11
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adg.fsm.com)(PORT=1521))(UR=A))
The command completed successfully
[[email protected] ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 10-AUG-2017 12:27:16
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /home/oracle/app/oracle/product/11.2.0/dbhome_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /home/oracle/app/oracle/diag/tnslsnr/adg/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adg.fsm.com)(PORT=1521))(UR=A))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))(UR=A))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=adg.fsm.com)(PORT=1521))(UR=A))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 10-AUG-2017 12:27:16
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File /home/oracle/app/oracle/diag/tnslsnr/adg/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=adg.fsm.com)(PORT=1521))(UR=A))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521))(UR=A))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "adgnew" has 1 instance(s).
Instance "adgnew", status UNKNOWN, has 1 handler(s) for this service...
Service "adgstby" has 1 instance(s).
Instance "adgstby", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[[email protected] ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ADGSTBY =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.210.98)(PORT = 1521))
)
(SERVICE_NAME = adgstby)
)
)
ADGPRI =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.210.98)(PORT = 1521))
)
(SERVICE_NAME = adgpri)
)
)
ADGNEW =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.210.98)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = adgnew)
)
)
~
"app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora" 32L, 715C written
[[email protected] ~]$ tnsping adgnew
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 10-AUG-2017 12:28:33
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
/home/oracle/app/oracle/product/11.2.0/dbhome_1/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.210.98)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = adgnew)))
OK (20 msec)
Step 3. Create password file for the new standby
------------------------------------------------------
[[email protected] ~]$ cd $ORACLE_HOME/dbs
[[email protected] dbs]$ cp orapwadgpri orapwadgnew
Step 4. Create pfile for the new standby
------------------------------------------------------
( Please be aware of db_file_name_convert, should be the location mapping between two standby database)
[[email protected] ~]$ vi pfilestby.txt
*.audit_file_dest='/home/oracle/app/oracle/admin/adgnew/adump'*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/home/oracle/app/oracle/oradata/adgnew/control01.ctl'
*.db_block_size=8192
*.db_domain=''
*.db_file_name_convert='/home/oracle/app/oracle/oradata/adgstby','/home/oracle/app/oracle/oradata/adgnew'
*.db_name='adgpri'
*.db_unique_name='adgnew'
*.diagnostic_dest='/home/oracle/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=adgnewXDB)'
*.fal_client='ADGPRI'
*.fal_server='ADGSTBY'
*.log_archive_config='DG_CONFIG=(adgpri,adgnew)'
*.log_archive_dest_2='SERVICE=adgpri LGWR SYNC VALID_FOR=(ONLINE_LOGFILES,primary_ROLE) DB_UNIQUE_NAME=adgpri'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='ENABLE'
*.log_file_name_convert='/home/oracle/app/oracle/oradata/adgpri','/home/oracle/app/oracle/oradata/adgnew'
*.open_cursors=300
*.pga_aggregate_target=456130560
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=1368391680
*.standby_file_management='AUTO'
*.undo_tablespace='UNDOTBS1'
Step 5. Create spfile for new standby, and start up new standby to nomount status:
------------------------------------------------------
[[email protected] ~]$ export ORACLE_SID=adgnew
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 10 12:35:33 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown abort
ORACLE instance shut down.
SQL> create spfile from pfile='/home/oracle/pfilestby.txt';
File created.
[[email protected] ~]$ export ORACLE_SID=adgnew
[[email protected] ~]$ sqlplus / as sysdba
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1369579520 bytes
Fixed Size 2253104 bytes
Variable Size 419434192 bytes
Database Buffers 939524096 bytes
Redo Buffers 8368128 bytes
Step 6. Duplicate new standby(adgnew) from the existing standby(adgstby):
---------------------------------------------------------------------------------------
[[email protected] ~]$ export ORACLE_SID=adgstby
[[email protected] ~]$ rman target / auxiliary sys/[email protected]
Recovery Manager: Release 11.2.0.4.0 - Production on Thu Aug 10 12:37:38 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ADGPRI (DBID=1362425892)
connected to auxiliary database: ADGPRI (not mounted)
Starting Duplicate Db at 10-AUG-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
contents of Memory Script:
{
backup as copy reuse
targetfile '/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapwadgstby' auxiliary format
'/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/orapwadgnew' ;
}
executing Memory Script
Starting backup at 10-AUG-17
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=1 device type=DISK
Finished backup at 10-AUG-17
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '/home/oracle/app/oracle/oradata/adgnew/control01.ctl';
}
executing Memory Script
Starting backup at 10-AUG-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/home/oracle/app/oracle/product/11.2.0/dbhome_1/dbs/snapcf_adgstby.f tag=TAG20170810T123746 RECID=7 STAMP=951655066
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 10-AUG-17
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"/home/oracle/app/oracle/oradata/adgnew/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/home/oracle/app/oracle/oradata/adgnew/system01.dbf";
set newname for datafile 2 to
"/home/oracle/app/oracle/oradata/adgnew/sysaux01.dbf";
set newname for datafile 3 to
"/home/oracle/app/oracle/oradata/adgnew/undotbs01.dbf";
set newname for datafile 4 to
"/home/oracle/app/oracle/oradata/adgnew/users01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/home/oracle/app/oracle/oradata/adgnew/system01.dbf" datafile
2 auxiliary format
"/home/oracle/app/oracle/oradata/adgnew/sysaux01.dbf" datafile
3 auxiliary format
"/home/oracle/app/oracle/oradata/adgnew/undotbs01.dbf" datafile
4 auxiliary format
"/home/oracle/app/oracle/oradata/adgnew/users01.dbf" ;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /home/oracle/app/oracle/oradata/adgnew/temp01.dbf in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 10-AUG-17
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=/home/oracle/app/oracle/oradata/adgstby/system01.dbf
output file name=/home/oracle/app/oracle/oradata/adgnew/system01.dbf tag=TAG20170810T123757
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=/home/oracle/app/oracle/oradata/adgstby/sysaux01.dbf
output file name=/home/oracle/app/oracle/oradata/adgnew/sysaux01.dbf tag=TAG20170810T123757
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=/home/oracle/app/oracle/oradata/adgstby/undotbs01.dbf
output file name=/home/oracle/app/oracle/oradata/adgnew/undotbs01.dbf tag=TAG20170810T123757
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=/home/oracle/app/oracle/oradata/adgstby/users01.dbf
output file name=/home/oracle/app/oracle/oradata/adgnew/users01.dbf tag=TAG20170810T123757
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 10-AUG-17
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=7 STAMP=951655166 file name=/home/oracle/app/oracle/oradata/adgnew/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=8 STAMP=951655166 file name=/home/oracle/app/oracle/oradata/adgnew/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=9 STAMP=951655166 file name=/home/oracle/app/oracle/oradata/adgnew/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=10 STAMP=951655166 file name=/home/oracle/app/oracle/oradata/adgnew/users01.dbf
contents of Memory Script:
{
set until scn 1015629;
recover
standby
clone database
noredo
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 10-AUG-17
using channel ORA_AUX_DISK_1
Finished recover at 10-AUG-17
Finished Duplicate Db at 10-AUG-17
Step 7. Configure new parameters related to the new standby for primary:
------------------------------------------------------------------------------------
[[email protected] ~]$ export ORACLE_SID=adgpri
[[email protected] ~]$ sqlplus / as sysdba
SQL> select open_mode,database_role from v$database;
OPEN_MODE DATABASE_ROLE
-------------------- ----------------
READ WRITE PRIMARY
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_3='SERVICE=adgnew NOAFFIRM ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=adgnew';
System altered.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_STATE_3=ENABLE;
System altered.
SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(adgpri,adgstby,adgnew)';
System altered.
SQL> show parameter log_archive_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest string
log_archive_dest_1 string
log_archive_dest_10 string
log_archive_dest_11 string
log_archive_dest_12 string
log_archive_dest_13 string
log_archive_dest_14 string
log_archive_dest_15 string
log_archive_dest_16 string
log_archive_dest_17 string
log_archive_dest_18 string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_19 string
log_archive_dest_2 string SERVICE=adgstby LGWR SYNC VALI
D_FOR=(ONLINE_LOGFILES,primary
_ROLE) DB_UNIQUE_NAME=adgstby
log_archive_dest_20 string
log_archive_dest_21 string
log_archive_dest_22 string
log_archive_dest_23 string
log_archive_dest_24 string
log_archive_dest_25 string
log_archive_dest_26 string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_27 string
log_archive_dest_28 string
log_archive_dest_29 string
log_archive_dest_3 string SERVICE=adgnew NOAFFIRM ASYNC
VALID_FOR=(ONLINE_LOGFILES,PRI
MARY_ROLE) DB_UNIQUE_NAME=adgn
ew
log_archive_dest_30 string
log_archive_dest_31 string
log_archive_dest_4 string
log_archive_dest_5 string
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_6 string
log_archive_dest_7 string
log_archive_dest_8 string
log_archive_dest_9 string
Step 8. Start up the new standby, and start real time redo apply:
-------------------------------------------------------------------------
[[email protected] ~]$ export ORACLE_SID=adgnew
[[email protected] ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Thu Aug 10 12:44:44 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> SQL> startup
ORACLE instance started.
Total System Global Area 1369579520 bytes
Fixed Size 2253104 bytes
Variable Size 419434192 bytes
Database Buffers 939524096 bytes
Redo Buffers 8368128 bytes
Database mounted.
Database opened.
SQL> alter database recover managed standby database using current logfile disconnect from session;
相關推薦
Steps to create a new standby from an existing ADG standby (文件 ID 2305009.1)
Some customer want to know if we can create a new standby from an existing ADG standby, because we can reduce the overhead workload on pri
GitHub Desktop 出現“please upgrade your plan to create a new private repository”的解決辦法
ron net please vat tor blog 解決 pos sdn 轉:https://blog.csdn.net/qq_38584262/article/details/82386805 解決辦法:去掉最下面的勾 GitHub
如何從點雲建立距離影象(How to create a range image from a point cloud)
本教程演示如何從點雲和給定感測器位置建立距離影象。該程式碼建立了漂浮在觀察者前方的矩形示例點雲。 #程式碼 首先,在你最喜歡的編輯器中建立一個叫做range_image_creation.cpp的檔案,並在其中放置下面的程式碼: #include <pcl
How to create a new business with AI?
Artificial intelligence is about to sweep massively in companies because it is a major element of digital transformation. Automation of low value-added tas
How to Create a Cordova Plugin from Scratch
How to Create a Cordova Plugin from Scratchcordova iconIf you heading here, that means you were searching for something or somehow we create custom Cordova
【轉】How to create a new user and grant permissions in MySQL
MySQL is one of the most popular database management systems. In this tutorial we will cover the steps needed to create new MySQL user and grant permission
How to create a new Pull Request (PR) in Github
第一個 Pull Request : - ) Github Create New Pull Request 一、原理圖 1.按順序走下來便是第一次 New 一
How to Determine Real Space used by a Table (Below the High Water Mark) (文件 ID 77635.1)
PURPOSE This article describes how to find out how many blocks are really being used within a table ie. are not empty. Please note that this article
GI ocssd.log rotation fails with error LFI-00142 and logfile grows to huge size (文件 ID 1900986.1)
APPLIES TO: Oracle Database - Enterprise Edition - Version 11.2.0.2 to 11.2.0.4 [Release 11.2] Information in this document applies to any platform.
An experiment to create a zero
React is the very popular library that makes the UI = f(state) dream a reality. But React is just a UI library, it defines itself as ”a JavaScript library
How to Remove A Service Entry From Win10 Service List
console hot list warn oba tor div register ever .warnbanner { width: 600px; background-color: #FFEFCE } .warnbanner.border { border: 0px
Several ways to instantiate a new instance
iat prot create tput tac stream ebean person .... package com.fish.study.instance; import java.io.File; import java.io.FileInputStream;
the pitfull way to create a uClinux image including gdb.
ldr let load cli pla install his sam inux After downloaded and installed the GCT‘s SDK and toolchain, we try to make an our own image whi
MongoDB: exception in initAndListen: 20 Attempted to create a lock file on a read-only directory: /data/db, terminating
mina term spa attempted user create style pre temp 啟動mongodb遇到的一個問題和解決: 轉(http://blog.csdn.net/u012877472/article/details/51001025) Mongo
jquery ----> How to Create a Basic Plugin (翻譯)
app sed 設置 函數表 col 有變 動作 jquery對象 別名 http://learn.jquery.com/plugins/basic-plugin-creation/ 如何創建一個基本的插件 有時候你想在整個代碼中提供一些功能。 例如,也許你想要一個單一的方
How to Create a Perl Based Custom Monitor on NetScaler
serve 5.1 citrix prompt rst sym pri index web How to Create a Perl Based Custom Monitor on NetScaler https://support.citrix.com/article/C
Maven:Failed to create a Maven project ‘…pom.xml’ already exists in VFS 解決
轉自:https://blog.csdn.net/chenyufeng1991/article/details/73724686 有時候我們在建立Maven專案的時候會出現上述的問題,導致Maven專案建立失敗,報錯的提示如下: &nbs
How To Order A New Tile Adhesive Manufacturing Plant
When placing tile within a bathroom or kitchen, you have got to use some form of adhesive. Among the more popular varieties of adhesive is mortar.
This is very likely to create a memory leak. Stack trace of thread錯誤分析
1、問題描述 啟動tomcat部署專案時,報This is very likely to create a memory leak. Stack trace of thread錯誤。 29-May-2018 12:30:09.322 SEVERE [localhos
【MySQL】MySQL5.7 匯入時報“cannot create a JSON value from a string with CHARACTER SET 'binary'.”錯誤的解決辦法
json是mysql 5.7版本才新增的資料型別,用mysql-front 6.0匯出時json欄位會自動轉換成十六進位制“X’7B226……227D”,而不是json格式。 所以在匯入時就會報錯。 我的解決辦法: 1.用notepad++等文字編輯器開啟.sql檔案;