[[email protected] ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 28-MAY-2017 10:31:13
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/app/oracle/product/11.2.0/db_1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 11.2.0.4.0 - Production
System parameter file is /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 28-MAY-2017 10:31:15
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/11.2.0/db_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/localhost/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "orcl" has 1 instance(s).
Instance "orcl", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[[email protected] dbs]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.4.0 Production on Sun May 28 22:36:14 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
SQL> conn /as sysdba
Connected.
SQL> create spfile from pfile;
File created.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 1043886080 bytes
Fixed Size 2259840 bytes
Variable Size 654312576 bytes
Database Buffers 381681664 bytes
Redo Buffers 5632000 bytes 11 开始进行 duplicate
[[email protected] ~]$ rman target [email protected] auxiliary [email protected]_st
Recovery Manager: Release 11.2.0.4.0 - Production on Sun May 28 22:42:26 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: LEO (DBID=1717931218)
connected to auxiliary database: LEO (not mounted)
RMAN> duplicate target database for standby from active database dorecover;
Starting Duplicate Db at 2017:05:28 22:42:36
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 '/u01/app/oracle/product/11.2.0/db_1/dbs/orapwleo2' auxiliary format
'/u01/app/oracle/product/11.2.0/db_1/dbs/orapworcl' ;
}
executing Memory Script
Starting backup at 2017:05:28 22:42:37
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=53 instance=leo2 device type=DISK
Finished backup at 2017:05:28 22:42:38
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '/u01/app/oracle/oradata/orcl/control01.ctl';
restore clone controlfile to '/u01/app/oracle/fast_recovery_area/orcl/control02.ctl' from
'/u01/app/oracle/oradata/orcl/control01.ctl';
}
executing Memory Script
Starting backup at 2017:05:28 22:42:38
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/snapcf_leo2.f tag=TAG20170528T224238 RECID=12 STAMP=945211363
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:04
Finished backup at 2017:05:28 22:42:45
Starting restore at 2017:05:28 22:42:45
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: copied control file copy
Finished restore at 2017:05:28 22:42:46
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/oracle/oradata/orcl/tempfile/temp.279.943664427";
switch clone tempfile all;
set newname for datafile 1 to
"/u01/app/oracle/oradata/orcl/data/system.269.943664299";
set newname for datafile 2 to
"/u01/app/oracle/oradata/orcl/data/sysaux.270.943664299";
set newname for datafile 3 to
"/u01/app/oracle/oradata/orcl/data/undotbs1.271.943664301";
set newname for datafile 4 to
"/u01/app/oracle/oradata/orcl/data/users.272.943664301";
set newname for datafile 5 to
"/u01/app/oracle/oradata/orcl/data/undotbs2.280.943665551";
backup as copy reuse
datafile 1 auxiliary format
"/u01/app/oracle/oradata/orcl/data/system.269.943664299" datafile
2 auxiliary format
"/u01/app/oracle/oradata/orcl/data/sysaux.270.943664299" datafile
3 auxiliary format
"/u01/app/oracle/oradata/orcl/data/undotbs1.271.943664301" datafile
4 auxiliary format
"/u01/app/oracle/oradata/orcl/data/users.272.943664301" datafile
5 auxiliary format
"/u01/app/oracle/oradata/orcl/data/undotbs2.280.943665551" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /u01/app/oracle/oradata/orcl/tempfile/temp.279.943664427 in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 2017:05:28 22:42:53
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
input datafile file number=00001 name=+DATA/leo/datafile/system.269.943664299
output file name=/u01/app/oracle/oradata/orcl/data/system.269.943664299 tag=TAG20170528T224253
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:46
channel ORA_DISK_1: starting datafile copy
input datafile file number=00002 name=+DATA/leo/datafile/sysaux.270.943664299
output file name=/u01/app/oracle/oradata/orcl/data/sysaux.270.943664299 tag=TAG20170528T224253
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:45
channel ORA_DISK_1: starting datafile copy
input datafile file number=00003 name=+DATA/leo/datafile/undotbs1.271.943664301
output file name=/u01/app/oracle/oradata/orcl/data/undotbs1.271.943664301 tag=TAG20170528T224253
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:08
channel ORA_DISK_1: starting datafile copy
input datafile file number=00005 name=+DATA/leo/datafile/undotbs2.280.943665551
output file name=/u01/app/oracle/oradata/orcl/data/undotbs2.280.943665551 tag=TAG20170528T224253
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting datafile copy
input datafile file number=00004 name=+DATA/leo/datafile/users.272.943664301
output file name=/u01/app/oracle/oradata/orcl/data/users.272.943664301 tag=TAG20170528T224253
channel ORA_DISK_1: datafile copy complete, elapsed time: 00:00:01
Finished backup at 2017:05:28 22:44:36
sql statement: alter system archive log current
contents of Memory Script:
{
backup as copy reuse
archivelog like "+FRA/leo_pd/archivelog/2017_05_28/thread_2_seq_56.304.945211383" auxiliary format
"/u01/archive/2_56_943664406.arc" archivelog like
"+FRA/leo_pd/archivelog/2017_05_28/thread_1_seq_72.302.945199597" auxiliary format
"/u01/archive/1_72_943664406.arc" archivelog like
"+FRA/leo_pd/archivelog/2017_05_28/thread_2_seq_57.306.945211479" auxiliary format
"/u01/archive/2_57_943664406.arc" archivelog like
"+FRA/leo_pd/archivelog/2017_05_28/thread_1_seq_73.303.945211381" auxiliary format
"/u01/archive/1_73_943664406.arc" archivelog like
"+FRA/leo_pd/archivelog/2017_05_28/thread_1_seq_74.305.945211477" auxiliary format
"/u01/archive/1_74_943664406.arc" ;
catalog clone archivelog "/u01/archive/2_56_943664406.arc";
catalog clone archivelog "/u01/archive/1_72_943664406.arc";
catalog clone archivelog "/u01/archive/2_57_943664406.arc";
catalog clone archivelog "/u01/archive/1_73_943664406.arc";
catalog clone archivelog "/u01/archive/1_74_943664406.arc";
switch clone datafile all;
}
executing Memory Script
Starting backup at 2017:05:28 22:44:39
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log copy
input archived log thread=2 sequence=56 RECID=98 STAMP=945211394
output file name=/u01/archive/2_56_943664406.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=72 RECID=96 STAMP=945199602
output file name=/u01/archive/1_72_943664406.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting archived log copy
input archived log thread=2 sequence=57 RECID=100 STAMP=945211479
output file name=/u01/archive/2_57_943664406.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=73 RECID=97 STAMP=945211393
output file name=/u01/archive/1_73_943664406.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:03
channel ORA_DISK_1: starting archived log copy
input archived log thread=1 sequence=74 RECID=99 STAMP=945211477
output file name=/u01/archive/1_74_943664406.arc RECID=0 STAMP=0
channel ORA_DISK_1: archived log copy complete, elapsed time: 00:00:00
Finished backup at 2017:05:28 22:44:51
cataloged archived log
archived log file name=/u01/archive/2_56_943664406.arc RECID=1 STAMP=945211492
cataloged archived log
archived log file name=/u01/archive/1_72_943664406.arc RECID=2 STAMP=945211492
cataloged archived log
archived log file name=/u01/archive/2_57_943664406.arc RECID=3 STAMP=945211493
cataloged archived log
archived log file name=/u01/archive/1_73_943664406.arc RECID=4 STAMP=945211493
cataloged archived log
archived log file name=/u01/archive/1_74_943664406.arc RECID=5 STAMP=945211493
datafile 1 switched to datafile copy
input datafile copy RECID=12 STAMP=945211493 file name=/u01/app/oracle/oradata/orcl/data/system.269.943664299
datafile 2 switched to datafile copy
input datafile copy RECID=13 STAMP=945211493 file name=/u01/app/oracle/oradata/orcl/data/sysaux.270.943664299
datafile 3 switched to datafile copy
input datafile copy RECID=14 STAMP=945211493 file name=/u01/app/oracle/oradata/orcl/data/undotbs1.271.943664301
datafile 4 switched to datafile copy
input datafile copy RECID=15 STAMP=945211493 file name=/u01/app/oracle/oradata/orcl/data/users.272.943664301
datafile 5 switched to datafile copy
input datafile copy RECID=16 STAMP=945211493 file name=/u01/app/oracle/oradata/orcl/data/undotbs2.280.943665551
contents of Memory Script:
{
set until scn 2749620;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 2017:05:28 22:44:53
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 73 is already on disk as file /u01/archive/1_73_943664406.arc
archived log for thread 1 with sequence 74 is already on disk as file /u01/archive/1_74_943664406.arc
archived log for thread 2 with sequence 56 is already on disk as file /u01/archive/2_56_943664406.arc
archived log for thread 2 with sequence 57 is already on disk as file /u01/archive/2_57_943664406.arc
archived log file name=/u01/archive/1_73_943664406.arc thread=1 sequence=73
archived log file name=/u01/archive/2_56_943664406.arc thread=2 sequence=56
archived log file name=/u01/archive/2_57_943664406.arc thread=2 sequence=57
archived log file name=/u01/archive/1_74_943664406.arc thread=1 sequence=74
media recovery complete, elapsed time: 00:00:00
Finished recover at 2017:05:28 22:44:56
Finished Duplicate Db at 2017:05:28 22:45:14 12 启动备库
--完成 duplicate 之后,备库就是 mount 状态:
SQL> select NAME,open_mode from v$database;
NAME OPEN_MODE
--------- --------------------
LEO MOUNTED
SQL> alter database open;
Database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY 13 启动 MRP 进程
SQL> alter database recover managed standby database disconnect from session;
Database altered.
SQL> select open_mode from v$database;
OPEN_MODE
--------------------
READ ONLY WITH APPLY 14 验证同步
本文来自电脑杂谈,转载请注明本文网址:
https://www.pc-fly.com/a/ruanjian/article-121484-3.html
谢教授正找爹呢