In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-07 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
1 description
Use rman duplicate to create standby database on the same host.
2 operating environment
OEL7.2
Oracle database 12.1.0.2.0
DB_NAME=S12102
Primary
Standby
Parameter
LOG_ARCHIVE_CONFIG='DG_CONFIG= (S12102 S12102D)'
LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=S12102'
LOG_ARCHIVE_DEST_2='SERVICE=S12102D ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=S12102D'
FAL_SERVER=S12102D
FAL_CLIENT=S12102
STANDBY_FILE_MANAGEMENT=AUTO
Control_files='/u01/app/product/oradata/S12102D/control01.ctl','/u01/app/product/fast_recovery_area/S12102D/control02.ctl'
DB_UNIQUE_NAME='S12102D'
LOG_ARCHIVE_CONFIG='DG_CONFIG= (S12102D ·S12102)'
LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=S12102D'
LOG_ARCHIVE_DEST_2='SERVICE=S12102 ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=S12102'
FAL_SERVER='S12102'
FAL_CLIENT='S12102D'
DB_FILE_NAME_CONVERT='/u01/app/product/oradata/S12102','/u01/app/product/oradata/S12102D'
LOG_FILE_NAME_CONVERT='/u01/app/product/oradata/S12102','/u01/app/product/oradata/S12102D'
STANDBY_FILE_MANAGEMENT='AUTO'
Datafile dire
/ u01/app/product/oradata/S12102
/ u01/app/product/oradata/S12102D
3 process design 3.1 main library DG configuration 3.2 operating system user DG environment configuration 3.3 listener.ora and tnsnames.ora configuration 3.4 rman duplicate4 detailed steps operation 4.1 main library DG configuration
Shutdown immediate
Startup mount
Alter database archivelog
Alter database open
Create pfile from spfile
ALTER DATABASE FORCE LOGGING
ALTER DATABASE ADD STANDBY LOGFILE ('/ u01Accord SIZE SIZE 50m)
ALTER DATABASE ADD STANDBY LOGFILE ('/ u01Accord SIZE SIZE 50m)
ALTER DATABASE ADD STANDBY LOGFILE ('/ u01Accord SIZE SIZE 50m)
ALTER DATABASE ADD STANDBY LOGFILE ('/ u01Accord SIZE SIZE 50m)
-- standby redo is work on the slave database, and the main library can also be added to facilitate future use when switchover changes to maxprotected mode. Add it to the main library, and when you create a DataGuard, you will naturally have a backup library, which is easier. -- The standby redo log must have at least one more redo log group than the redo log at the redo source database, for each redo thread at the redo source database. At the redo source database, query the V$LOG view to determine how many redo log groups are in the redo log at the redo source database and query the V$THREAD view to determine how many redo threads exist at the redo source database.
Alter system set LOG_ARCHIVE_CONFIG='DG_CONFIG= (S12102 S12102D)'
Alter system set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=S12102'
Alter system set LOG_ARCHIVE_DEST_2='SERVICE=S12102D ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=S12102D'
Alter system set FAL_SERVER=S12102D
Alter system set FAL_CLIENT=S12102
Alter system set STANDBY_FILE_MANAGEMENT=AUTO
-- these two items need to restart the database to take effect
Alter system set DB_FILE_NAME_CONVERT='/u01/app/product/oradata/S12102D/','/u01/app/product/oradata/S12102' scope=spfile
Alter system set LOG_FILE_NAME_CONVERT='/u01/app/product/oradata/S12102D/','/u01/app/product/oradata/S12102' scope=spfile
4.2 operating system user DG environment configuration
Cd $ORACLE_HOME/dbs
Cp initS12102.ora initS12102D.ora
Cp orapwS12102 orapwS12102D
Chmod 775 $TNS_ADMIN
Edit standby db parameter file, create standby database directory, configure standby system environment variables briefly
4.3 listener.ora and tnsnames.ora configuration (this environment uses GRID snooping)
[grid@localhost 12.1.0.2.0: (+ ASM) network] $cat listener.ora
# listener.ora Network Configuration File: / u01/app/product/admin/network/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = S12102)
(ORACLE_HOME = / u01/app/product/database/12.1.0.2.0)
(SID_NAME = S12102)
)
(SID_DESC =
(GLOBAL_DBNAME = S12102D)
(ORACLE_HOME = / u01/app/product/database/12.1.0.2.0)
(SID_NAME = S12102D)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC) (KEY = EXTPROC1521))
)
)
ADR_BASE_LISTENER = / u01/app/product
[grid@localhost 12.1.0.2.0: (+ ASM) network] $cat tnsnames.ora
# tnsnames.ora Network Configuration File: / u01/app/product/admin/network/tnsnames.ora
# Generated by Oracle configuration tools.
S12102D =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = S12102D)
)
)
S12102 =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP) (HOST = localhost) (PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = S12102)
)
)
4.4 rman duplicate
-- A brief description of the status of enabling the standby library to nomount
Rman target sys/oracle@S12102 auxiliary sys/oracle@S12102D
Startup clone nomount
Run {
Duplicate target database for standby from active database nofilenamecheck
SPFILE
Set control_files='/u01/app/product/oradata/S12102D/control01.ctl','/u01/app/product/fast_recovery_area/S12102D/control02.ctl'
Set DB_UNIQUE_NAME='S12102D'
Set LOG_ARCHIVE_CONFIG='DG_CONFIG= (S12102D ·S12102)'
Set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=S12102D'
Set LOG_ARCHIVE_DEST_2='SERVICE=S12102 ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=S12102'
Set FAL_SERVER='S12102'
Set FAL_CLIENT='S12102D'
Set DB_FILE_NAME_CONVERT='/u01/app/product/oradata/S12102','/u01/app/product/oradata/S12102D'
Set LOG_FILE_NAME_CONVERT='/u01/app/product/oradata/S12102','/u01/app/product/oradata/S12102D'
Set STANDBY_FILE_MANAGEMENT='AUTO'
}
The following is the detailed output of the duplicate process
[oracle@localhost 12.1.0.2.0: (S12102) bin] $rman target sys/oracle@S12102 auxiliary sys/oracle@S12102D
Recovery Manager: Release 12.1.0.2.0-Production on Fri Jun 1 17:35:24 2018
Copyright (c) 1982, 2014, Oracle and/or its affiliates. All rights reserved.
Connected to target database: S12102 (DBID=2197238228)
Connected to auxiliary database (not started)
RMAN > startup clone nomount
Oracle instance started
Total System Global Area 3070230528 bytes
Fixed Size 2929112 bytes
Variable Size 754978344 bytes
Database Buffers 2298478592 bytes
Redo Buffers 13844480 bytes
RMAN > run {
Duplicate target database for standby from active database nofilenamecheck
SPFILE
Set control_files='/u01/app/product/oradata/S12102D/control01.ctl','/u01/app/product/fast_recovery_area/S12102D/control02.ctl'
Set DB_UNIQUE_NAME='S12102D'
Set LOG_ARCHI2 > 3 > 4 > 5 > 6 > VE_CONFIG='DG_CONFIG= (S12102D Magi S12102)'
Set LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=S12102D'
Set LOG_ARCHIVE_DEST_2='SERVICE=S12102 ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NA7 > 8 > ME=S12102'
Set FAL_SERVER='S12102'
Set FAL_CLIENT='S12102D'
Set DB_FILE_NAME_CONVERT='/u01/app/product/oradata/S12102','/u01/app/product/oradata/S12102D'
Set LOG_FILE_NAME_CONVERT='/u01/app/product/oradata/S12102','/u01/app/product/oradata/S12102D'
Set STA9 > 10 > 11 > 12 > 13 > NDBY_FILE_MANAGEMENT='AUTO'
}
14 >
Starting Duplicate Db at 01-JUN-2018 17:36:46
Using target database control file instead of recovery catalog
Allocated channel: ORA_AUX_DISK_1
Channel ORA_AUX_DISK_1: SID=240 device type=DISK
Contents of Memory Script:
{
Backup as copy reuse
Targetfile'/ u01qapapwS12102 'auxiliary format
'/ u01apapwS12102D'
Restore clone from service 'S12102' spfile to
'/ u01ActionAccording to productdatabaseUniverse 12.1.0.2.0anddbsUnigram spfileS12102D.ora'
Sql clone "alter system set spfile='/ u01 * * app *
}
Executing Memory Script
Starting backup at 01-JUN-2018 17:36:47
Allocated channel: ORA_DISK_1
Channel ORA_DISK_1: SID=37 device type=DISK
Finished backup at 01-JUN-2018 17:36:49
Starting restore at 01-JUN-2018 17:36:49
Using channel ORA_AUX_DISK_1
Channel ORA_AUX_DISK_1: starting datafile backup set restore
Channel ORA_AUX_DISK_1: using network backup set from service S12102
Channel ORA_AUX_DISK_1: restoring SPFILE
Output file name=/u01/app/product/database/12.1.0.2.0/dbs/spfileS12102D.ora
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 01-JUN-2018 17:36:50
Sql statement: alter system set spfile=''/ u01 * App *
Contents of Memory Script:
{
Sql clone "alter system set control_files =
'' / u01According to productPlacement oradata comment= S12102D Universe control01.ctlharmless,'/ u01According to ApplicationAccordingAccording to recoveryAccording to the area of S12102Dhand control02.ctlareas' comment=
'scope=spfile''
Sql clone "alter system set db_unique_name =
'S12102During 'comment=
'scope=spfile''
Sql clone "alter system set LOG_ARCHIVE_CONFIG =
'' DG_CONFIG= (S12102DJ S12102)''comment=
'scope=spfile''
Sql clone "alter system set LOG_ARCHIVE_DEST_1 =
'' LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=S12102D'' comment=
'scope=spfile''
Sql clone "alter system set LOG_ARCHIVE_DEST_2 =
'' SERVICE=S12102 ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=S12102'' comment=
'scope=spfile''
Sql clone "alter system set FAL_SERVER =
'S12102 'comment=
'scope=spfile''
Sql clone "alter system set FAL_CLIENT =
'S12102During 'comment=
'scope=spfile''
Sql clone "alter system set db_file_name_convert =
'' / u01qapqqproductqqoradata comment= S12102During','/ u01Grexamplet productUniplicateoradataGrease S12102During'
'scope=spfile''
Sql clone "alter system set LOG_FILE_NAME_CONVERT =
'' / u01qapqqproductqqoradata comment= S12102During','/ u01Grexamplet productUniplicateoradataGrease S12102During'
'scope=spfile''
Sql clone "alter system set STANDBY_FILE_MANAGEMENT =
'' AUTO'' comment=
'scope=spfile''
Shutdown clone immediate
Startup clone nomount
}
Executing Memory Script
Sql statement: alter system set control_files ='/ u01ActureAccording to an oradata scope=spfile S12102Dash control01.ctlyield,''/ u01ActionActureAccording to recoveryproductionareareaS12102D control 'comment=''
Sql statement: alter system set db_unique_name =''S12102D' comment= 'scope=spfile
Sql statement: alter system set LOG_ARCHIVE_CONFIG =''DG_CONFIG= (S12102D, S12102)' 'comment=' 'scope=spfile
Sql statement: alter system set LOG_ARCHIVE_DEST_1 =''LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR= (ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=S12102D'' comment=' scope=spfile
Sql statement: alter system set LOG_ARCHIVE_DEST_2 =''SERVICE=S12102 ASYNC VALID_FOR= (ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=S12102'' comment=' scope=spfile
Sql statement: alter system set FAL_SERVER =''S12102' comment= 'scope=spfile
Sql statement: alter system set FAL_CLIENT =''S12102D' comment= 'scope=spfile
Sql statement: alter system set db_file_name_convert ='/ u01 *
Sql statement: alter system set LOG_FILE_NAME_CONVERT ='/ u01 *
Sql statement: alter system set STANDBY_FILE_MANAGEMENT =''AUTO'' comment=' scope=spfile
Oracle instance shut down
Connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 3070230528 bytes
Fixed Size 2929112 bytes
Variable Size 754978344 bytes
Database Buffers 2298478592 bytes
Redo Buffers 13844480 bytes
Contents of Memory Script:
{
Restore clone from service 'S12102' standby controlfile
}
Executing Memory Script
Starting restore at 01-JUN-2018 17:37:39
Allocated channel: ORA_AUX_DISK_1
Channel ORA_AUX_DISK_1: SID=12 device type=DISK
Channel ORA_AUX_DISK_1: starting datafile backup set restore
Channel ORA_AUX_DISK_1: using network backup set from service S12102
Channel ORA_AUX_DISK_1: restoring control file
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
Output file name=/u01/app/product/oradata/S12102D/control01.ctl
Output file name=/u01/app/product/fast_recovery_area/S12102D/control02.ctl
Finished restore at 01-JUN-2018 17:37:44
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
"/ u01/app/product/oradata/S12102D/temp01.dbf"
Switch clone tempfile all
Set newname for datafile 1 to
"/ u01/app/product/oradata/S12102D/system01.dbf"
Set newname for datafile 3 to
"/ u01/app/product/oradata/S12102D/sysaux01.dbf"
Set newname for datafile 4 to
"/ u01/app/product/oradata/S12102D/undotbs01.dbf"
Set newname for datafile 5 to
"/ u01/app/product/oradata/S12102D/example01.dbf"
Set newname for datafile 6 to
"/ u01/app/product/oradata/S12102D/users01.dbf"
Restore
From service 'S12102' clone database
Sql 'alter system archive log current'
}
Executing Memory Script
Executing command: SET NEWNAME
Renamed tempfile 1 to / u01/app/product/oradata/S12102D/temp01.dbf in control file
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Starting restore at 01-JUN-2018 17:37:50
Using channel ORA_AUX_DISK_1
Channel ORA_AUX_DISK_1: starting datafile backup set restore
Channel ORA_AUX_DISK_1: using network backup set from service S12102
Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
Channel ORA_AUX_DISK_1: restoring datafile 00001 to / u01/app/product/oradata/S12102D/system01.dbf
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:36
Channel ORA_AUX_DISK_1: starting datafile backup set restore
Channel ORA_AUX_DISK_1: using network backup set from service S12102
Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
Channel ORA_AUX_DISK_1: restoring datafile 00003 to / u01/app/product/oradata/S12102D/sysaux01.dbf
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:35
Channel ORA_AUX_DISK_1: starting datafile backup set restore
Channel ORA_AUX_DISK_1: using network backup set from service S12102
Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
Channel ORA_AUX_DISK_1: restoring datafile 00004 to / u01/app/product/oradata/S12102D/undotbs01.dbf
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:16
Channel ORA_AUX_DISK_1: starting datafile backup set restore
Channel ORA_AUX_DISK_1: using network backup set from service S12102
Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
Channel ORA_AUX_DISK_1: restoring datafile 00005 to / u01/app/product/oradata/S12102D/example01.dbf
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:06
Channel ORA_AUX_DISK_1: starting datafile backup set restore
Channel ORA_AUX_DISK_1: using network backup set from service S12102
Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
Channel ORA_AUX_DISK_1: restoring datafile 00006 to / u01/app/product/oradata/S12102D/users01.dbf
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
Finished restore at 01-JUN-2018 17:40:25
Sql statement: alter system archive log current
Contents of Memory Script:
{
Switch clone datafile all
}
Executing Memory Script
Datafile 1 switched to datafile copy
Input datafile copy RECID=1 STAMP=977679627 file name=/u01/app/product/oradata/S12102D/system01.dbf
Datafile 3 switched to datafile copy
Input datafile copy RECID=2 STAMP=977679627 file name=/u01/app/product/oradata/S12102D/sysaux01.dbf
Datafile 4 switched to datafile copy
Input datafile copy RECID=3 STAMP=977679627 file name=/u01/app/product/oradata/S12102D/undotbs01.dbf
Datafile 5 switched to datafile copy
Input datafile copy RECID=4 STAMP=977679627 file name=/u01/app/product/oradata/S12102D/example01.dbf
Datafile 6 switched to datafile copy
Input datafile copy RECID=5 STAMP=977679627 file name=/u01/app/product/oradata/S12102D/users01.dbf
Finished Duplicate Db at 01-JUN-2018 17:40:46
RMAN >
5 personal summary
When listening is initiated by the gird user, note that the $TNS_ADMIN directory permission should be 775.
6 references to materials
Https://docs.oracle.com/database/121/SBYDB/rcmbackp.htm#SBYDB4987
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.