In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This example tests that ORACLE 11g uses rman to replicate the database. 11g RMAN duplicate can be realized by Active database duplicate and Backup-based duplicate. The test here uses Backup-based duplicate.
Apply the scenario. Reference http://hbxztc.blog.51cto.com/1587495/1872754 based on Active database duplicate
1. The old library or network is not available, but there is a backup
Experimental environment:
Target db:
Ip 192.168.56.10
Oracle_sid=mydb
Oracle_version=11.2.0.3
Auxiliary db:
Ip 192.168.56.150
Oracle_sid=oradu
Oracle_version=11.2.0.3
1. Backup target db
RMAN > backup database include current controlfile plus archivelog delete all input
Starting backup at 20-MAR-16
Current log archived
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=25 RECID=47 STAMP=906998693
Input archived log thread=1 sequence=26 RECID=48 STAMP=906999061
Channel ORA_DISK_1: starting piece 1 at 20-MAR-16
Channel ORA_DISK_1: finished piece 1 at 20-MAR-16
Piece handle=/u01/app/oracle/product/11.2.0/db/dbs/34r0vd8l_1_1 tag=TAG20160320T161101 comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u01/app/oracle/product/11.2.0/db/dbs/arch/1_25_906314379.dbf RECID=47 STAMP=906998693
Archived log file name=/u01/app/oracle/product/11.2.0/db/dbs/arch/1_26_906314379.dbf RECID=48 STAMP=906999061
Finished backup at 20-MAR-16
Starting backup at 20-MAR-16
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting full datafile backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set
Input datafile file number=00001 name=/u01/app/oracle/oradata/mydb/system01.dbf
Input datafile file number=00002 name=/u01/app/oracle/oradata/mydb/sysaux01.dbf
Input datafile file number=00003 name=/u01/app/oracle/oradata/mydb/undotbs01.dbf
Input datafile file number=00004 name=/u01/app/oracle/oradata/mydb/users01.dbf
Channel ORA_DISK_1: starting piece 1 at 20-MAR-16
Channel ORA_DISK_1: finished piece 1 at 20-MAR-16
Piece handle=/u01/app/oracle/product/11.2.0/db/dbs/35r0vd8m_1_1 tag=TAG20160320T161102 comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:55
Channel ORA_DISK_1: starting full datafile backup set
Channel ORA_DISK_1: specifying datafile (s) in backup set
Including current control file in backup set
Channel ORA_DISK_1: starting piece 1 at 20-MAR-16
Channel ORA_DISK_1: finished piece 1 at 20-MAR-16
Piece handle=/u01/app/oracle/product/11.2.0/db/dbs/36r0vdad_1_1 tag=TAG20160320T161102 comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 20-MAR-16
Starting backup at 20-MAR-16
Current log archived
Using channel ORA_DISK_1
Channel ORA_DISK_1: starting archived log backup set
Channel ORA_DISK_1: specifying archived log (s) in backup set
Input archived log thread=1 sequence=27 RECID=49 STAMP=906999120
Channel ORA_DISK_1: starting piece 1 at 20-MAR-16
Channel ORA_DISK_1: finished piece 1 at 20-MAR-16
Piece handle=/u01/app/oracle/product/11.2.0/db/dbs/37r0vdag_1_1 tag=TAG20160320T161200 comment=NONE
Channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Channel ORA_DISK_1: deleting archived log (s)
Archived log file name=/u01/app/oracle/product/11.2.0/db/dbs/arch/1_27_906314379.dbf RECID=49 STAMP=906999120
Finished backup at 20-MAR-16
Starting Control File and SPFILE Autobackup at 20-MAR-16
Piece handle=/u01/app/oracle/product/11.2.0/db/dbs/c-2820637901-20160320-05 comment=NONE
Finished Control File and SPFILE Autobackup at 20-MAR-16
2. Copy parameter files and create password files
-- the passwords of target DB and auxiliary DB must be kept consistent. Here, I directly copy the password file of target db to the corresponding directory of auxiliary db.
-- execute on target db
[oracle@localhost ~] $cd $ORACLE_HOME/dbs
[oracle@localhost dbs] $scp orapwmydb oracle@192.168.56.150:/home/oracle
Oracle@192.168.56.150's password:
Orapwmydb 100% 1536 1.5KB/s 00:00
[oracle@localhost dbs] $scp initmydb.ora oracle@192.168.56.150:/home/oracle
Oracle@192.168.56.150's password:
Initmydb.ora 100% 193 0.2KB/s 00:00
3. Copy the backup of the old machine to the corresponding directory on the new machine
[oracle@localhost dbs] $scp / u01/app/oracle/product/11.2.0/db/dbs/34r0vd8l_1_1 oracle@192.168.56.150:/home/oracle/bak
Oracle@192.168.56.150's password:
34r0vd8l_1_1 100% 5457KB 5.3MB/s 00:00
[oracle@localhost dbs] $scp / u01/app/oracle/product/11.2.0/db/dbs/35r0vd8m_1_1 oracle@192.168.56.150:/home/oracle/bak
Oracle@192.168.56.150's password:
35r0vd8m_1_1 100% 1049MB 15.0MB/s 01:10
[oracle@localhost dbs] $scp / u01/app/oracle/product/11.2.0/db/dbs/36r0vdad_1_1 oracle@192.168.56.150:/home/oracle/bak
Oracle@192.168.56.150's password:
36r0vdad_1_1 100% 9952KB 9.7MB/s 00:00
[oracle@localhost dbs] $scp / u01/app/oracle/product/11.2.0/db/dbs/37r0vdag_1_1 oracle@192.168.56.150:/home/oracle/bak
Oracle@192.168.56.150's password:
37r0vdag_1_1 100% 10KB 10.0KB/s 00:00
4. Change the name of the password file, the file name of the parameter file and the corresponding instance name in the parameter file (no need to execute when the instance name remains the same)
Add directory conversion parameters to the parameter file (not needed when the instance name and directory remain the same)
The updated instance in this lab is named oradu
[oracle@localhost ~] $mv initmydb.ora initoradu.ora
[oracle@localhost ~] $mv orapwmydb orapworadu
Vi initoradu.ora changed all the old instance names mydb to oradu and added the conversion parameters
Db_file_name_convert= ('/ u01Accord oradataPlacement')
Log_file_name_convert= ('/ u01Accord oradataPlacement')
Create a new directory
Mkdir-p / u01/app/oracle/oradata/oradu/
You only need to create a new directory without changing the instance name.
Mkdir-p / u01/app/oracle/oradata/mydb/
Move parameter files and password files to the default directory / u01/app/oracle/product/11.2.0/db/dbs/
[oracle@localhost ~] $mv initoradu.ora / u01/app/oracle/product/11.2.0/db/dbs/
[oracle@localhost ~] $mv orapworadu / u01/app/oracle/product/11.2.0/db/dbs/
5. Boot to nomount
[oracle@localhost ~] $export ORACLE_SID=oradu
[oracle@localhost ~] $sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Mar 2016: 31:43 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to an idle instance.
SQL > create spfile from pfile
File created.
SQL > startup nomount
ORACLE instance started.
Total System Global Area 238034944 bytes
Fixed Size 2227136 bytes
Variable Size 180356160 bytes
Database Buffers 50331648 bytes
Redo Buffers 5120000 bytes
SQL >
6. Start replication using RMAN
[oracle@localhost ~] $rman auxiliary /
Recovery Manager: Release 11.2.0.3.0-Production on Sun Mar 2016: 33:11 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Connected to auxiliary database: ORADU (not mounted)
RMAN > duplicate database to oradu backup location'/ home/oracle/bak'
Starting Duplicate Db at 20-MAR-16
Contents of Memory Script:
{
Sql clone "alter system set db_name =
'' MYDB'' comment=
'' Modified by RMAN duplicate'' scope=spfile''
Sql clone "alter system set db_unique_name =
'' ORADU'' comment=
'' Modified by RMAN duplicate'' scope=spfile''
Shutdown clone immediate
Startup clone force nomount
Restore clone primary controlfile from'/ home/oracle/bak/36r0vdad_1_1'
Alter clone database mount
}
Executing Memory Script
Sql statement: alter system set db_name =''MYDB'' comment=' 'Modified by RMAN duplicate'' scope=spfile
Sql statement: alter system set db_unique_name =''ORADU'' comment=' 'Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 238034944 bytes
Fixed Size 2227136 bytes
Variable Size 180356160 bytes
Database Buffers 50331648 bytes
Redo Buffers 5120000 bytes
Starting restore at 20-MAR-16
Allocated channel: ORA_AUX_DISK_1
Channel ORA_AUX_DISK_1: SID=18 device type=DISK
Channel ORA_AUX_DISK_1: restoring control file
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:02
Output file name=/u01/app/oracle/oradata/oradu/control01.ctl
Output file name=/u01/app/oracle/oradata/oradu/control02.ctl
Finished restore at 20-MAR-16
Database mounted
Released channel: ORA_AUX_DISK_1
Allocated channel: ORA_AUX_DISK_1
Channel ORA_AUX_DISK_1: SID=18 device type=DISK
Contents of Memory Script:
{
Set until scn 2815228
Set newname for datafile 1 to
"/ u01/app/oracle/oradata/oradu/system01.dbf"
Set newname for datafile 2 to
"/ u01/app/oracle/oradata/oradu/sysaux01.dbf"
Set newname for datafile 3 to
"/ u01/app/oracle/oradata/oradu/undotbs01.dbf"
Set newname for datafile 4 to
"/ u01/app/oracle/oradata/oradu/users01.dbf"
Restore
Clone database
}
Executing Memory Script
Executing command: SET until clause
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Executing command: SET NEWNAME
Starting restore at 20-MAR-16
Using channel ORA_AUX_DISK_1
Channel ORA_AUX_DISK_1: starting datafile backup set restore
Channel ORA_AUX_DISK_1: specifying datafile (s) to restore from backup set
Channel ORA_AUX_DISK_1: restoring datafile 00001 to / u01/app/oracle/oradata/oradu/system01.dbf
Channel ORA_AUX_DISK_1: restoring datafile 00002 to / u01/app/oracle/oradata/oradu/sysaux01.dbf
Channel ORA_AUX_DISK_1: restoring datafile 00003 to / u01/app/oracle/oradata/oradu/undotbs01.dbf
Channel ORA_AUX_DISK_1: restoring datafile 00004 to / u01/app/oracle/oradata/oradu/users01.dbf
Channel ORA_AUX_DISK_1: reading from backup piece / home/oracle/bak/35r0vd8m_1_1
Channel ORA_AUX_DISK_1: piece handle=/home/oracle/bak/35r0vd8m_1_1 tag=TAG20160320T161102
Channel ORA_AUX_DISK_1: restored backup piece 1
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:01:05
Finished restore at 20-MAR-16
Contents of Memory Script:
{
Switch clone datafile all
}
Executing Memory Script
Datafile 1 switched to datafile copy
Input datafile copy RECID=5 STAMP=907000504 file name=/u01/app/oracle/oradata/oradu/system01.dbf
Datafile 2 switched to datafile copy
Input datafile copy RECID=6 STAMP=907000504 file name=/u01/app/oracle/oradata/oradu/sysaux01.dbf
Datafile 3 switched to datafile copy
Input datafile copy RECID=7 STAMP=907000504 file name=/u01/app/oracle/oradata/oradu/undotbs01.dbf
Datafile 4 switched to datafile copy
Input datafile copy RECID=8 STAMP=907000504 file name=/u01/app/oracle/oradata/oradu/users01.dbf
Contents of Memory Script:
{
Set until scn 2815228
Recover
Clone database
Delete archivelog
}
Executing Memory Script
Executing command: SET until clause
Starting recover at 20-MAR-16
Using channel ORA_AUX_DISK_1
Starting media recovery
Channel ORA_AUX_DISK_1: starting archived log restore to default destination
Channel ORA_AUX_DISK_1: restoring archived log
Archived log thread=1 sequence=27
Channel ORA_AUX_DISK_1: reading from backup piece / home/oracle/bak/37r0vdag_1_1
Channel ORA_AUX_DISK_1: piece handle=/home/oracle/bak/37r0vdag_1_1 tag=TAG20160320T161200
Channel ORA_AUX_DISK_1: restored backup piece 1
Channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
Archived log file name=/u01/app/oracle/product/11.2.0/db/dbs/arch2_27_906314379.dbf thread=1 sequence=27
Channel clone_default: deleting archived log (s)
Archived log file name=/u01/app/oracle/product/11.2.0/db/dbs/arch2_27_906314379.dbf RECID=1 STAMP=907000505
Media recovery complete, elapsed time: 00:00:01
Finished recover at 20-MAR-16
Oracle instance started
Total System Global Area 238034944 bytes
Fixed Size 2227136 bytes
Variable Size 180356160 bytes
Database Buffers 50331648 bytes
Redo Buffers 5120000 bytes
Contents of Memory Script:
{
Sql clone "alter system set db_name =
'' ORADU'' comment=
'' Reset to original value by RMAN'' scope=spfile''
Sql clone "alter system reset db_unique_name scope=spfile"
Shutdown clone immediate
Startup clone nomount
}
Executing Memory Script
Sql statement: alter system set db_name =''ORADU'' comment=' 'Reset to original value by RMAN'' scope=spfile
Sql statement: alter system reset db_unique_name scope=spfile
Oracle instance shut down
Connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 238034944 bytes
Fixed Size 2227136 bytes
Variable Size 180356160 bytes
Database Buffers 50331648 bytes
Redo Buffers 5120000 bytes
Sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORADU" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ('/ u01 REUSE SIZE SIZE REUSE)
GROUP 2 ('/ u01 REUSE SIZE SIZE REUSE)
GROUP 3 ('/ u01 SIZE REUSE) SIZE 100m REUSE
GROUP 4 ('/ u01 SIZE REUSE) SIZE 100m REUSE
DATAFILE
'/ u01 apprenticeship oradata'oradata 'system 01.dbf'
CHARACTER SET ZHS16GBK
Contents of Memory Script:
{
Set newname for tempfile 1 to
"/ u01/app/oracle/oradata/oradu/temp01.dbf"
Switch clone tempfile all
Catalog clone datafilecopy "/ u01/app/oracle/oradata/oradu/sysaux01.dbf"
"/ u01/app/oracle/oradata/oradu/undotbs01.dbf"
"/ u01/app/oracle/oradata/oradu/users01.dbf"
Switch clone datafile all
}
Executing Memory Script
Executing command: SET NEWNAME
Renamed tempfile 1 to / u01/app/oracle/oradata/oradu/temp01.dbf in control file
Cataloged datafile copy
Datafile copy file name=/u01/app/oracle/oradata/oradu/sysaux01.dbf RECID=1 STAMP=907000517
Cataloged datafile copy
Datafile copy file name=/u01/app/oracle/oradata/oradu/undotbs01.dbf RECID=2 STAMP=907000517
Cataloged datafile copy
Datafile copy file name=/u01/app/oracle/oradata/oradu/users01.dbf RECID=3 STAMP=907000517
Datafile 2 switched to datafile copy
Input datafile copy RECID=1 STAMP=907000517 file name=/u01/app/oracle/oradata/oradu/sysaux01.dbf
Datafile 3 switched to datafile copy
Input datafile copy RECID=2 STAMP=907000517 file name=/u01/app/oracle/oradata/oradu/undotbs01.dbf
Datafile 4 switched to datafile copy
Input datafile copy RECID=3 STAMP=907000517 file name=/u01/app/oracle/oradata/oradu/users01.dbf
Reenabling controlfile options for auxiliary database
Executing: alter database add supplemental log data
Contents of Memory Script:
{
Alter clone database open resetlogs
}
Executing Memory Script
Database opened
Finished Duplicate Db at 20-MAR-16
RMAN >
7. Verify that it is available
[oracle@localhost ~] $sqlplus / as sysdba
SQL*Plus: Release 11.2.0.3.0 Production on Sun Mar 2016: 36:52 2016
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0-64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL > select name,open_mode from v$database
NAME OPEN_MODE
--
ORADU READ WRITE
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.