原库:orcl 新库:oracle
SQL> alter system archive log current;
System altered.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@11g ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Mar 13 02:09:48 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1447019099)
RMAN> backup database include current controlfile plus archivelog delete input;
Starting backup at 13-MAR-17
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=53 device type=DISK
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=1 RECID=1 STAMP=938484540
input archived log thread=1 sequence=2 RECID=2 STAMP=938484581
input archived log thread=1 sequence=3 RECID=3 STAMP=938484608
channel ORA_DISK_1: starting piece 1 at 13-MAR-17
channel ORA_DISK_1: finished piece 1 at 13-MAR-17
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/01rv08s1_1_1 tag=TAG20170313T021009 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/arch/1_1_919238363.dbf RECID=1 STAMP=938484540
archived log file name=/arch/1_2_919238363.dbf RECID=2 STAMP=938484581
archived log file name=/arch/1_3_919238363.dbf RECID=3 STAMP=938484608
Finished backup at 13-MAR-17
Starting backup at 13-MAR-17
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=/oradata/ORCL/datafile/o1_mf_system_ctdyf4d0_.dbf
input datafile file number=00002 name=/oradata/ORCL/datafile/o1_mf_sysaux_ctdyf4f3_.dbf
input datafile file number=00003 name=/oradata/ORCL/datafile/o1_mf_undotbs1_ctdyf4fg_.dbf
input datafile file number=00004 name=/oradata/ORCL/datafile/o1_mf_users_ctdyf4fv_.dbf
channel ORA_DISK_1: starting piece 1 at 13-MAR-17
channel ORA_DISK_1: finished piece 1 at 13-MAR-17
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/02rv08s8_1_1 tag=TAG20170313T021016 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:16
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
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 13-MAR-17
channel ORA_DISK_1: finished piece 1 at 13-MAR-17
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/03rv08ul_1_1 tag=TAG20170313T021016 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-MAR-17
Starting backup at 13-MAR-17
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=4 RECID=4 STAMP=938484695
channel ORA_DISK_1: starting piece 1 at 13-MAR-17
channel ORA_DISK_1: finished piece 1 at 13-MAR-17
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/04rv08un_1_1 tag=TAG20170313T021135 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=/arch/1_4_919238363.dbf RECID=4 STAMP=938484695
Finished backup at 13-MAR-17
RMAN> exit
Recovery Manager complete.
创建参数文件
[oracle@11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 13 02:12:34 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> create pfile='/tmp/pfile.ora' from spfile;
File created.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
将orcl改为oracle
[oracle@11g ~]$ vi /tmp/pfile.ora
*.audit_file_dest='/u01/app/oracle/admin/oracle/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/oradata/ORACLE/controlfile/o1_mf_ctdygv67_.ctl'
*.db_block_size=8192
*.db_create_file_dest='/oradata'
*.db_domain=''
*.db_name='oracle'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=oracleXDB)'
*.log_archive_dest_1='LOCATION=/arch'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=314572800
*.processes=1500
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=1655
*.sga_target=1258291200
*.undo_tablespace='UNDOTBS1'
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/tmp/pfile.ora" 19L, 593C written
创建相关路径
[oracle@11g ~]$ mkdir -p /u01/app/oracle/admin/oracle/adump
[oracle@11g ~]$ mkdir -p /oradata/ORACLE/controlfile/
[oracle@11g ~]$ mkdir -p /oradata/ORACLE/datafile/
[oracle@11g ~]$ mkdir -p /oradata/ORACLE/onlinelog/
创建密码文件
[oracle@11g ~]$ orapwd file=$ORACLE_HOME/dbs/orapworacle password=oracle_4U entries=100
修改监听
[oracle@11g ~]$ vi $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/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 = 11g)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 11g)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = oracle)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = oracle)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
<uct/11.2.0/dbhome_1/network/admin/listener.ora" 22L, 605C written
重启监听
[oracle@11g ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 13-MAR-2017 02:16:12
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=11g)(PORT=1521)))
The command completed successfully
[oracle@11g ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 13-MAR-2017 02:16:18
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/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 /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/11g/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11g)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11g)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=11g)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 13-MAR-2017 02:16:18
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/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/11g/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11g)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11g)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "oracle" has 1 instance(s).
Instance "oracle", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
修改tns
[oracle@11g ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 11g)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORACLE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 11g)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oracle)(UR=A)
)
)
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
<uct/11.2.0/dbhome_1/network/admin/tnsnames.ora" 20L, 499C written
测试tns
[oracle@11g ~]$ tnsping orcl
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 13-MAR-2017 02:17:37
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 11g)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (20 msec)
[oracle@11g ~]$ tnsping oracle
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 13-MAR-2017 02:17:40
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 11g)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oracle)(UR=A)))
OK (0 msec)
启动新库到nomount
[oracle@11g ~]$ export ORACLE_SID=oracle
[oracle@11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 13 02:18:16 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile='/tmp/pfile.ora';
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 956305384 bytes
Database Buffers 285212672 bytes
Redo Buffers 8892416 bytes
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
复制数据库
[oracle@11g ~]$ rman target sys/oracle_4U@orcl auxiliary sys/oracle_4U@oracle
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Mar 13 02:21:48 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1447019099)
connected to auxiliary database: ORACLE (not mounted)
RMAN> run{
2> set newname for datafile 1 to '/oradata/ORACLE/datafile/system01.dbf';
3> set newname for datafile 2 to '/oradata/ORACLE/datafile/sysaux01.dbf';
4> set newname for datafile 3 to '/oradata/ORACLE/datafile/undotbs01.dbf';
5> set newname for datafile 4 to '/oradata/ORACLE/datafile/users01.dbf';
6> set newname for tempfile 1 to '/oradata/ORACLE/datafile/temp01.dbf';
7> duplicate target database to oracle
8> logfile
9> group 1 ('/oradata/ORACLE/onlinelog/redo01.log') size 256m,
10> group 2 ('/oradata/ORACLE/onlinelog/redo02.log') size 256m,
11> group 3 ('/oradata/ORACLE/onlinelog/redo03.log') size 256m,
12> group 4 ('/oradata/ORACLE/onlinelog/redo04.log') size 256m;
13> switch datafile all;
14> }
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting Duplicate Db at 13-MAR-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK
contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 973082600 bytes
Database Buffers 268435456 bytes
Redo Buffers 8892416 bytes
contents of Memory Script:
{
sql clone "alter system set control_files =
''/oradata/ORACLE/controlfile/o1_mf_ctdygv67_.ctl'' comment=
''Set by RMAN'' scope=spfile";
sql clone "alter system set db_name =
''ORCL'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''ORACLE'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set control_files = ''/oradata/ORACLE/controlfile/o1_mf_ctdygv67_.ctl'' comment= ''Set by RMAN'' scope=spfile
sql statement: alter system set db_name = ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''ORACLE'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 973082600 bytes
Database Buffers 268435456 bytes
Redo Buffers 8892416 bytes
Starting restore at 13-MAR-17
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/03rv08ul_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/03rv08ul_1_1 tag=TAG20170313T021016
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oradata/ORACLE/controlfile/o1_mf_ctdygv67_.ctl
Finished restore at 13-MAR-17
database mounted
contents of Memory Script:
{
set until scn 983942;
set newname for datafile 1 to
"/oradata/ORACLE/datafile/system01.dbf";
set newname for datafile 2 to
"/oradata/ORACLE/datafile/sysaux01.dbf";
set newname for datafile 3 to
"/oradata/ORACLE/datafile/undotbs01.dbf";
set newname for datafile 4 to
"/oradata/ORACLE/datafile/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 13-MAR-17
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 /oradata/ORACLE/datafile/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /oradata/ORACLE/datafile/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oradata/ORACLE/datafile/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oradata/ORACLE/datafile/users01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/02rv08s8_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/02rv08s8_1_1 tag=TAG20170313T021016
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 13-MAR-17
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=938485395 file name=/oradata/ORACLE/datafile/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=938485395 file name=/oradata/ORACLE/datafile/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=938485395 file name=/oradata/ORACLE/datafile/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=938485395 file name=/oradata/ORACLE/datafile/users01.dbf
contents of Memory Script:
{
set until scn 983942;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 13-MAR-17
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=4
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/04rv08un_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/04rv08un_1_1 tag=TAG20170313T021135
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=/arch/1_4_919238363.dbf thread=1 sequence=4
channel clone_default: deleting archived log(s)
archived log file name=/arch/1_4_919238363.dbf RECID=4 STAMP=938485396
media recovery complete, elapsed time: 00:00:01
Finished recover at 13-MAR-17
Oracle instance started
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 973082600 bytes
Database Buffers 268435456 bytes
Redo Buffers 8892416 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''ORACLE'' 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 = ''ORACLE'' 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 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 973082600 bytes
Database Buffers 268435456 bytes
Redo Buffers 8892416 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORACLE" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/oradata/ORACLE/onlinelog/redo01.log' ) SIZE 256 M ,
GROUP 2 ( '/oradata/ORACLE/onlinelog/redo02.log' ) SIZE 256 M ,
GROUP 3 ( '/oradata/ORACLE/onlinelog/redo03.log' ) SIZE 256 M ,
GROUP 4 ( '/oradata/ORACLE/onlinelog/redo04.log' ) SIZE 256 M
DATAFILE
'/oradata/ORACLE/datafile/system01.dbf'
CHARACTER SET ZHS16GBK
contents of Memory Script:
{
set newname for tempfile 1 to
"/oradata/ORACLE/datafile/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/oradata/ORACLE/datafile/sysaux01.dbf",
"/oradata/ORACLE/datafile/undotbs01.dbf",
"/oradata/ORACLE/datafile/users01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /oradata/ORACLE/datafile/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/oradata/ORACLE/datafile/sysaux01.dbf RECID=1 STAMP=938485407
cataloged datafile copy
datafile copy file name=/oradata/ORACLE/datafile/undotbs01.dbf RECID=2 STAMP=938485407
cataloged datafile copy
datafile copy file name=/oradata/ORACLE/datafile/users01.dbf RECID=3 STAMP=938485407
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=938485407 file name=/oradata/ORACLE/datafile/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=938485407 file name=/oradata/ORACLE/datafile/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=938485407 file name=/oradata/ORACLE/datafile/users01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 13-MAR-17
RMAN> exit
Recovery Manager complete.
复制完成
查看是否生成新库
[oracle@11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 13 02:24:40 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> select name,dbid,open_mode from v$database;
NAME DBID OPEN_MODE
--------- ---------- --------------------
ORACLE 1811562846 READ WRITE
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@11g ~]$ export ORACLE_SID=orcl
[oracle@11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 13 02:25:03 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> select name,dbid,open_mode from v$database;
NAME DBID OPEN_MODE
--------- ---------- --------------------
ORCL 1447019099 READ WRITE
SQL> quit
Disconnected from 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> alter system archive log current;
System altered.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@11g ~]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Mar 13 02:09:48 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1447019099)
RMAN> backup database include current controlfile plus archivelog delete input;
Starting backup at 13-MAR-17
current log archived
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=53 device type=DISK
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=1 RECID=1 STAMP=938484540
input archived log thread=1 sequence=2 RECID=2 STAMP=938484581
input archived log thread=1 sequence=3 RECID=3 STAMP=938484608
channel ORA_DISK_1: starting piece 1 at 13-MAR-17
channel ORA_DISK_1: finished piece 1 at 13-MAR-17
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/01rv08s1_1_1 tag=TAG20170313T021009 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/arch/1_1_919238363.dbf RECID=1 STAMP=938484540
archived log file name=/arch/1_2_919238363.dbf RECID=2 STAMP=938484581
archived log file name=/arch/1_3_919238363.dbf RECID=3 STAMP=938484608
Finished backup at 13-MAR-17
Starting backup at 13-MAR-17
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=/oradata/ORCL/datafile/o1_mf_system_ctdyf4d0_.dbf
input datafile file number=00002 name=/oradata/ORCL/datafile/o1_mf_sysaux_ctdyf4f3_.dbf
input datafile file number=00003 name=/oradata/ORCL/datafile/o1_mf_undotbs1_ctdyf4fg_.dbf
input datafile file number=00004 name=/oradata/ORCL/datafile/o1_mf_users_ctdyf4fv_.dbf
channel ORA_DISK_1: starting piece 1 at 13-MAR-17
channel ORA_DISK_1: finished piece 1 at 13-MAR-17
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/02rv08s8_1_1 tag=TAG20170313T021016 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:01:16
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
including current SPFILE in backup set
channel ORA_DISK_1: starting piece 1 at 13-MAR-17
channel ORA_DISK_1: finished piece 1 at 13-MAR-17
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/03rv08ul_1_1 tag=TAG20170313T021016 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 13-MAR-17
Starting backup at 13-MAR-17
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=4 RECID=4 STAMP=938484695
channel ORA_DISK_1: starting piece 1 at 13-MAR-17
channel ORA_DISK_1: finished piece 1 at 13-MAR-17
piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/04rv08un_1_1 tag=TAG20170313T021135 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=/arch/1_4_919238363.dbf RECID=4 STAMP=938484695
Finished backup at 13-MAR-17
RMAN> exit
Recovery Manager complete.
创建参数文件
[oracle@11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 13 02:12:34 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> create pfile='/tmp/pfile.ora' from spfile;
File created.
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
将orcl改为oracle
[oracle@11g ~]$ vi /tmp/pfile.ora
*.audit_file_dest='/u01/app/oracle/admin/oracle/adump'
*.audit_trail='db'
*.compatible='11.2.0.4.0'
*.control_files='/oradata/ORACLE/controlfile/o1_mf_ctdygv67_.ctl'
*.db_block_size=8192
*.db_create_file_dest='/oradata'
*.db_domain=''
*.db_name='oracle'
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=oracleXDB)'
*.log_archive_dest_1='LOCATION=/arch'
*.log_archive_format='%t_%s_%r.dbf'
*.open_cursors=300
*.pga_aggregate_target=314572800
*.processes=1500
*.remote_login_passwordfile='EXCLUSIVE'
*.sessions=1655
*.sga_target=1258291200
*.undo_tablespace='UNDOTBS1'
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
"/tmp/pfile.ora" 19L, 593C written
创建相关路径
[oracle@11g ~]$ mkdir -p /u01/app/oracle/admin/oracle/adump
[oracle@11g ~]$ mkdir -p /oradata/ORACLE/controlfile/
[oracle@11g ~]$ mkdir -p /oradata/ORACLE/datafile/
[oracle@11g ~]$ mkdir -p /oradata/ORACLE/onlinelog/
创建密码文件
[oracle@11g ~]$ orapwd file=$ORACLE_HOME/dbs/orapworacle password=oracle_4U entries=100
修改监听
[oracle@11g ~]$ vi $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/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 = 11g)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 11g)(PORT = 1522))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = oracle)
(ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
(SID_NAME = oracle)
)
)
ADR_BASE_LISTENER = /u01/app/oracle
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
<uct/11.2.0/dbhome_1/network/admin/listener.ora" 22L, 605C written
重启监听
[oracle@11g ~]$ lsnrctl stop
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 13-MAR-2017 02:16:12
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=11g)(PORT=1521)))
The command completed successfully
[oracle@11g ~]$ lsnrctl start
LSNRCTL for Linux: Version 11.2.0.4.0 - Production on 13-MAR-2017 02:16:18
Copyright (c) 1991, 2013, Oracle. All rights reserved.
Starting /u01/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 /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Log messages written to /u01/app/oracle/diag/tnslsnr/11g/listener/alert/log.xml
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11g)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11g)(PORT=1522)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=11g)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 11.2.0.4.0 - Production
Start Date 13-MAR-2017 02:16:18
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/dbhome_1/network/admin/listener.ora
Listener Log File /u01/app/oracle/diag/tnslsnr/11g/listener/alert/log.xml
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11g)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=11g)(PORT=1522)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "oracle" has 1 instance(s).
Instance "oracle", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
修改tns
[oracle@11g ~]$ vi $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 11g)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl)
)
)
ORACLE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 11g)(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = oracle)(UR=A)
)
)
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
~
<uct/11.2.0/dbhome_1/network/admin/tnsnames.ora" 20L, 499C written
测试tns
[oracle@11g ~]$ tnsping orcl
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 13-MAR-2017 02:17:37
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 11g)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = orcl)))
OK (20 msec)
[oracle@11g ~]$ tnsping oracle
TNS Ping Utility for Linux: Version 11.2.0.4.0 - Production on 13-MAR-2017 02:17:40
Copyright (c) 1997, 2013, Oracle. All rights reserved.
Used parameter files:
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = 11g)(PORT = 1522)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = oracle)(UR=A)))
OK (0 msec)
启动新库到nomount
[oracle@11g ~]$ export ORACLE_SID=oracle
[oracle@11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 13 02:18:16 2017
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Connected to an idle instance.
SQL> startup nomount pfile='/tmp/pfile.ora';
ORACLE instance started.
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 956305384 bytes
Database Buffers 285212672 bytes
Redo Buffers 8892416 bytes
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
复制数据库
[oracle@11g ~]$ rman target sys/oracle_4U@orcl auxiliary sys/oracle_4U@oracle
Recovery Manager: Release 11.2.0.4.0 - Production on Mon Mar 13 02:21:48 2017
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1447019099)
connected to auxiliary database: ORACLE (not mounted)
RMAN> run{
2> set newname for datafile 1 to '/oradata/ORACLE/datafile/system01.dbf';
3> set newname for datafile 2 to '/oradata/ORACLE/datafile/sysaux01.dbf';
4> set newname for datafile 3 to '/oradata/ORACLE/datafile/undotbs01.dbf';
5> set newname for datafile 4 to '/oradata/ORACLE/datafile/users01.dbf';
6> set newname for tempfile 1 to '/oradata/ORACLE/datafile/temp01.dbf';
7> duplicate target database to oracle
8> logfile
9> group 1 ('/oradata/ORACLE/onlinelog/redo01.log') size 256m,
10> group 2 ('/oradata/ORACLE/onlinelog/redo02.log') size 256m,
11> group 3 ('/oradata/ORACLE/onlinelog/redo03.log') size 256m,
12> group 4 ('/oradata/ORACLE/onlinelog/redo04.log') size 256m;
13> switch datafile all;
14> }
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting Duplicate Db at 13-MAR-17
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=20 device type=DISK
contents of Memory Script:
{
sql clone "create spfile from memory";
}
executing Memory Script
sql statement: create spfile from memory
contents of Memory Script:
{
shutdown clone immediate;
startup clone nomount;
}
executing Memory Script
Oracle instance shut down
connected to auxiliary database (not started)
Oracle instance started
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 973082600 bytes
Database Buffers 268435456 bytes
Redo Buffers 8892416 bytes
contents of Memory Script:
{
sql clone "alter system set control_files =
''/oradata/ORACLE/controlfile/o1_mf_ctdygv67_.ctl'' comment=
''Set by RMAN'' scope=spfile";
sql clone "alter system set db_name =
''ORCL'' comment=
''Modified by RMAN duplicate'' scope=spfile";
sql clone "alter system set db_unique_name =
''ORACLE'' comment=
''Modified by RMAN duplicate'' scope=spfile";
shutdown clone immediate;
startup clone force nomount
restore clone primary controlfile;
alter clone database mount;
}
executing Memory Script
sql statement: alter system set control_files = ''/oradata/ORACLE/controlfile/o1_mf_ctdygv67_.ctl'' comment= ''Set by RMAN'' scope=spfile
sql statement: alter system set db_name = ''ORCL'' comment= ''Modified by RMAN duplicate'' scope=spfile
sql statement: alter system set db_unique_name = ''ORACLE'' comment= ''Modified by RMAN duplicate'' scope=spfile
Oracle instance shut down
Oracle instance started
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 973082600 bytes
Database Buffers 268435456 bytes
Redo Buffers 8892416 bytes
Starting restore at 13-MAR-17
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/03rv08ul_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/03rv08ul_1_1 tag=TAG20170313T021016
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/oradata/ORACLE/controlfile/o1_mf_ctdygv67_.ctl
Finished restore at 13-MAR-17
database mounted
contents of Memory Script:
{
set until scn 983942;
set newname for datafile 1 to
"/oradata/ORACLE/datafile/system01.dbf";
set newname for datafile 2 to
"/oradata/ORACLE/datafile/sysaux01.dbf";
set newname for datafile 3 to
"/oradata/ORACLE/datafile/undotbs01.dbf";
set newname for datafile 4 to
"/oradata/ORACLE/datafile/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 13-MAR-17
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 /oradata/ORACLE/datafile/system01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00002 to /oradata/ORACLE/datafile/sysaux01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00003 to /oradata/ORACLE/datafile/undotbs01.dbf
channel ORA_AUX_DISK_1: restoring datafile 00004 to /oradata/ORACLE/datafile/users01.dbf
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/02rv08s8_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/02rv08s8_1_1 tag=TAG20170313T021016
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:45
Finished restore at 13-MAR-17
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=5 STAMP=938485395 file name=/oradata/ORACLE/datafile/system01.dbf
datafile 2 switched to datafile copy
input datafile copy RECID=6 STAMP=938485395 file name=/oradata/ORACLE/datafile/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=7 STAMP=938485395 file name=/oradata/ORACLE/datafile/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=8 STAMP=938485395 file name=/oradata/ORACLE/datafile/users01.dbf
contents of Memory Script:
{
set until scn 983942;
recover
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 13-MAR-17
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=4
channel ORA_AUX_DISK_1: reading from backup piece /u01/app/oracle/product/11.2.0/dbhome_1/dbs/04rv08un_1_1
channel ORA_AUX_DISK_1: piece handle=/u01/app/oracle/product/11.2.0/dbhome_1/dbs/04rv08un_1_1 tag=TAG20170313T021135
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=/arch/1_4_919238363.dbf thread=1 sequence=4
channel clone_default: deleting archived log(s)
archived log file name=/arch/1_4_919238363.dbf RECID=4 STAMP=938485396
media recovery complete, elapsed time: 00:00:01
Finished recover at 13-MAR-17
Oracle instance started
Total System Global Area 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 973082600 bytes
Database Buffers 268435456 bytes
Redo Buffers 8892416 bytes
contents of Memory Script:
{
sql clone "alter system set db_name =
''ORACLE'' 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 = ''ORACLE'' 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 1252663296 bytes
Fixed Size 2252824 bytes
Variable Size 973082600 bytes
Database Buffers 268435456 bytes
Redo Buffers 8892416 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "ORACLE" RESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 ( '/oradata/ORACLE/onlinelog/redo01.log' ) SIZE 256 M ,
GROUP 2 ( '/oradata/ORACLE/onlinelog/redo02.log' ) SIZE 256 M ,
GROUP 3 ( '/oradata/ORACLE/onlinelog/redo03.log' ) SIZE 256 M ,
GROUP 4 ( '/oradata/ORACLE/onlinelog/redo04.log' ) SIZE 256 M
DATAFILE
'/oradata/ORACLE/datafile/system01.dbf'
CHARACTER SET ZHS16GBK
contents of Memory Script:
{
set newname for tempfile 1 to
"/oradata/ORACLE/datafile/temp01.dbf";
switch clone tempfile all;
catalog clone datafilecopy "/oradata/ORACLE/datafile/sysaux01.dbf",
"/oradata/ORACLE/datafile/undotbs01.dbf",
"/oradata/ORACLE/datafile/users01.dbf";
switch clone datafile all;
}
executing Memory Script
executing command: SET NEWNAME
renamed tempfile 1 to /oradata/ORACLE/datafile/temp01.dbf in control file
cataloged datafile copy
datafile copy file name=/oradata/ORACLE/datafile/sysaux01.dbf RECID=1 STAMP=938485407
cataloged datafile copy
datafile copy file name=/oradata/ORACLE/datafile/undotbs01.dbf RECID=2 STAMP=938485407
cataloged datafile copy
datafile copy file name=/oradata/ORACLE/datafile/users01.dbf RECID=3 STAMP=938485407
datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=938485407 file name=/oradata/ORACLE/datafile/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=938485407 file name=/oradata/ORACLE/datafile/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=938485407 file name=/oradata/ORACLE/datafile/users01.dbf
contents of Memory Script:
{
Alter clone database open resetlogs;
}
executing Memory Script
database opened
Finished Duplicate Db at 13-MAR-17
RMAN> exit
Recovery Manager complete.
复制完成
查看是否生成新库
[oracle@11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 13 02:24:40 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> select name,dbid,open_mode from v$database;
NAME DBID OPEN_MODE
--------- ---------- --------------------
ORACLE 1811562846 READ WRITE
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@11g ~]$ export ORACLE_SID=orcl
[oracle@11g ~]$ sqlplus / as sysdba
SQL*Plus: Release 11.2.0.4.0 Production on Mon Mar 13 02:25:03 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> select name,dbid,open_mode from v$database;
NAME DBID OPEN_MODE
--------- ---------- --------------------
ORCL 1447019099 READ WRITE
SQL> quit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options