通过RMAN克隆数据库(基于备份)

 
SQL> show parameter name;
 
NAME                                     TYPE        VALUE
------------------------------------ -----------------------------------------
db_file_name_convert                     string
db_name                            string         orcl
db_unique_name                            string         orcl
global_names                            boolean         FALSE
instance_name                            string         orcl
lock_name_space                     string
log_file_name_convert                     string
service_names                            string         orcl
 
SQL> select current_scn from v$database;
 
CURRENT_SCN
-----------
    1015897

备份数据库

[[email protected]]$ rman target /

RecoveryManager: Release 11.2.0.1.0 - Production on Wed Jan 27 23:18:24 2016

Copyright(c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.

connectedto target database: ORCL (DBID=1426154421)

RMAN> run{
allocate channel c1 type disk;
allocate channel c2 type disk;
backup filesperset 3 database format‘/u01/app/backup/full_%d_%T_%s_%p‘;
sql ‘alter system archive log current‘;
sql ‘alter system archive log current‘;
sql ‘alter system archive log current‘;
backup archivelog all format‘/u01/app/backup/arch_%d_%T_%s_%p‘ delete input;
backup current controlfile format‘/u01/app/backup/ctl_%d_%T_%s_%p‘;
}
SQL> col file_name for a50
SQL> select FILE_ID,FILE_NAME,TABLESPACE_NAME fromdba_data_files;
 
   FILE_IDFILE_NAME                                              TABLESPACE_NAME
---------- --------------------------------------------------------------------------------
 4/u01/app/oracle/oradata/orcl/users01.dbf              USERS
 3/u01/app/oracle/oradata/orcl/undotbs01.dbf              UNDOTBS1
 2/u01/app/oracle/oradata/orcl/sysaux01.dbf              SYSAUX
 1/u01/app/oracle/oradata/orcl/system01.dbf              SYSTEM
 5/u01/app/oracle/oradata/orcl/example01.dbf              EXAMPLE
 6/u01/app/oracle/oradata/orcl/heleitbs01.dbf              HELEITBS
 
6 rows selected.

建立Pfile文件

SQL>create pfile from spfile;
 
Filecreated.

建立克隆库的目录

[[email protected] ~]$ mkdir -p$ORACLE_BASE/admin/clonedb/bdump
[[email protected] ~]$ mkdir -p$ORACLE_BASE/admin/clonedb/cdump
[[email protected] ~]$ mkdir -p$ORACLE_BASE/admin/clonedb/udump
[[email protected] ~]$ mkdir -p $ORACLE_BASE/oradata/clonedb

将主库pfile拷贝成名为克隆库名的文件,将其拷贝至备机,并在备机生成克隆库的口令文件

[[email protected]]$ cp initorcl.ora initclonedb.ora
[[email protected]]$ orapwd file=orapwclonedb password=MANAGER entries=30

vi initclonedb.ora

将orcl替换为clonedb,并增加以下内容:

db_file_name_convert = ("/u01/app/oracle/oradata/db01","/u01/app/oracle/oradata/clonedb")log_file_name_convert =("/disk1/oradata/db01","/disk1/oradata/clonedb","/disk2/oradata/db01","/disk2/oradata/clonedb")

注:11g默认开启审计,我们这里不需要,所以上述克隆步骤不包含审计目录,如果没关审计功能,pfile注释掉*.audit_file_dest这行,*.audit_trail=‘none‘即可,

如何查看和关闭审计功能:

SQL>show parameter audi; 
 
NAME                                     TYPE        VALUE
----------------------------------------------- ------------------------------
audit_file_dest                    string        /u01/app/oracle/admin/orcl/adu
 mp
audit_sys_operations                    boolean         FALSE
audit_syslog_level                     string
audit_trail                            string         DB
SQL>alter system set audit_trail=none scope=spfile;
 
Systemaltered.
SQL>shutdown immediate;
Databaseclosed.
Databasedismounted.
ORACLEinstance shut down.
SQL>startup
ORACLEinstance started.

将主库之前创建的initclonedb拷贝到备库

将clone库启动到nomount

[[email protected] dbs]$ export ORACLE_SID=clonedb
[[email protected] dbs]$ sqlplus / as sysdba
 
SQL*Plus: Release 11.2.0.1.0 Production on Thu Jan 28 00:42:58 2016
 
Copyright (c) 1982, 2009, Oracle. All rights reserved.
 
Connected to an idle instance.
 
SQL> startup pfile=$ORACLE_HOME/dbs/initclonedb.ora nomount;
ORACLE instance started.

用RMAN连接主库和clone库

[[email protected]]$ rman target sys/[email protected] auxiliary sys/MANAGER
 
RecoveryManager: Release 11.2.0.1.0 - Production on Thu Jan 28 01:24:35 2016
 
Copyright(c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
 
connectedto target database: ORCL (DBID=1426154421)
connectedto auxiliary database: CLONEDB (not mounted)
 
RMAN>
RMAN>list backup;
 
 
Listof Backup Sets
===================
 
 
BSKey  Type LV Size       Device Type Elapsed Time Completion Time
----------- -- ---------- ----------- ------------ ---------------
1       Full   436.71M    DISK        00:01:02     27-JAN-16     
        BP Key: 1   Status: AVAILABLE  Compressed: NO  Tag: TAG20160127T231840
        Piece Name:/u01/app/backup/full_ORCL_20160127_2_1
  List of Datafiles in backup set 1
  File LV Type Ckp SCN    Ckp Time Name
  ---- -- ---- ---------- --------- ----
  2      Full 1015955    27-JAN-16/u01/app/oracle/oradata/orcl/sysaux01.dbf
  3      Full 1015955    27-JAN-16/u01/app/oracle/oradata/orcl/undotbs01.dbf
  6      Full 1015955    27-JAN-16/u01/app/oracle/oradata/orcl/heleitbs01.dbf
 
BSKey  Type LV Size       Device Type Elapsed Time Completion Time
----------- -- ---------- ----------- ------------ ---------------
2       Full   9.33M      DISK        00:00:08     27-JAN-16     
        BP Key: 2   Status: AVAILABLE  Compressed: NO  Tag: TAG20160127T231840
        Piece Name:/u01/app/backup/full_ORCL_20160127_3_1
  Control File Included: Ckp SCN: 1015986      Ckp time: 27-JAN-16
 
BSKey  Type LV Size       Device Type Elapsed Time Completion Time
----------- -- ---------- ----------- ------------ ---------------
3       Full   660.65M    DISK        00:01:22     27-JAN-16     
        BP Key: 3   Status: AVAILABLE  Compressed: NO  Tag: TAG20160127T231840
        Piece Name:/u01/app/backup/full_ORCL_20160127_1_1
  List of Datafiles in backup set 3
  File LV Type Ckp SCN    Ckp Time Name
  ---- -- ---- ---------- --------- ----
  1      Full 1015954    27-JAN-16/u01/app/oracle/oradata/orcl/system01.dbf
  4      Full 1015954    27-JAN-16/u01/app/oracle/oradata/orcl/users01.dbf
  5      Full 1015954    27-JAN-16/u01/app/oracle/oradata/orcl/example01.dbf
 
BSKey  Type LV Size       Device Type Elapsed Time Completion Time
----------- -- ---------- ----------- ------------ ---------------
4       Full   80.00K     DISK        00:00:04     27-JAN-16     
        BP Key: 4   Status: AVAILABLE  Compressed: NO  Tag: TAG20160127T231840
        Piece Name:/u01/app/backup/full_ORCL_20160127_4_1
  SPFILE Included: Modification time: 27-JAN-16
  SPFILE db_unique_name: ORCL
 
BSKey  Size       Device Type Elapsed Time Completion Time
----------------- ----------- ------------ ---------------
5       14.34M     DISK       00:00:01     27-JAN-16     
        BP Key: 5   Status: AVAILABLE  Compressed: NO  Tag: TAG20160127T232008
        Piece Name:/u01/app/backup/arch_ORCL_20160127_5_1
 
  List of Archived Logs in backup set 5
  Thrd Seq    Low SCN    Low Time  Next SCN  Next Time
  ---- ------- ---------- --------- -------------------
  1   5       1011640    13-DEC-15 1016002    27-JAN-16
 
BSKey  Size       Device Type Elapsed Time Completion Time
----------------- ----------- ------------ ---------------
6       3.00K      DISK        00:00:01     27-JAN-16     
        BP Key: 6   Status: AVAILABLE  Compressed: NO  Tag: TAG20160127T232008
        Piece Name:/u01/app/backup/arch_ORCL_20160127_6_1
 
  List of Archived Logs in backup set 6
  Thrd Seq    Low SCN    Low Time  Next SCN  Next Time
  ---- ------- ---------- --------- -------------------
  1   6       1016002    27-JAN-16 1016011    27-JAN-16
  1   7       1016011    27-JAN-16 1016020    27-JAN-16
 
BSKey  Size       Device Type Elapsed Time Completion Time
----------------- ----------- ------------ ---------------
7       2.00K      DISK        00:00:01     27-JAN-16     
        BP Key: 7   Status: AVAILABLE  Compressed: NO  Tag: TAG20160127T232008
        Piece Name:/u01/app/backup/arch_ORCL_20160127_7_1
 
  List of Archived Logs in backup set 7
  Thrd Seq    Low SCN    Low Time  Next SCN  Next Time
  ---- ------- ---------- --------- -------------------
  1   8       1016020    27-JAN-16 1016028    27-JAN-16
 
BSKey  Type LV Size       Device Type Elapsed Time Completion Time
----------- -- ---------- ----------- ------------ ---------------
8       Full   9.33M      DISK        00:00:01     27-JAN-16     
        BP Key: 8   Status: AVAILABLE  Compressed: NO  Tag: TAG20160127T232010
        Piece Name:/u01/app/backup/ctl_ORCL_20160127_8_1
  Control File Included: Ckp SCN: 1016045      Ckp time: 27-JAN-16

将主库备份文件拷贝至备库相应备份目录后,执行RMAN复制

RMAN>duplicate target database to clonedb;
 
StartingDuplicate Db at 28-JAN-16
usingtarget database control file instead of recovery catalog
allocatedchannel: ORA_AUX_DISK_1
channelORA_AUX_DISK_1: SID=20 device type=DISK
 
contentsof Memory Script:
{
   sql clone "create spfile frommemory";
}
executingMemory Script
 
sqlstatement: create spfile from memory
 
contentsof Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
}
executingMemory Script
 
Oracleinstance shut down
 
connectedto auxiliary database (not started)
Oracleinstance started
 
TotalSystem Global Area     630501376 bytes
 
FixedSize                     2215984 bytes
VariableSize                188747728 bytes
DatabaseBuffers             436207616 bytes
RedoBuffers                   3330048 bytes
 
contentsof Memory Script:
{
   sql clone "alter system set  db_name =
 ‘‘ORCL‘‘ comment=
 ‘‘Modified by RMAN duplicate‘‘scope=spfile";
   sql clone "alter system set  db_unique_name =
 ‘‘CLONEDB‘‘ comment=
 ‘‘Modified by RMAN duplicate‘‘scope=spfile";
   shutdown clone immediate;
   startup clone force nomount
   restore clone primary controlfile;
   alter clone database mount;
}
executingMemory Script
 
sqlstatement: alter system set  db_name=  ‘‘ORCL‘‘ comment= ‘‘Modified by RMANduplicate‘‘ scope=spfile
 
sqlstatement: alter system set db_unique_name =  ‘‘CLONEDB‘‘comment= ‘‘Modified by RMAN duplicate‘‘ scope=spfile
 
Oracleinstance shut down
 
Oracleinstance started
 
TotalSystem Global Area     630501376 bytes
 
FixedSize                     2215984 bytes
VariableSize                188747728 bytes
DatabaseBuffers             436207616 bytes
RedoBuffers                   3330048 bytes
 
Startingrestore at 28-JAN-16
allocatedchannel: ORA_AUX_DISK_1
channelORA_AUX_DISK_1: SID=19 device type=DISK
 
channelORA_AUX_DISK_1: starting datafile backup set restore
channelORA_AUX_DISK_1: restoring control file
channelORA_AUX_DISK_1: reading from backup piece /u01/app/backup/ctl_ORCL_20160127_8_1
channelORA_AUX_DISK_1: piece handle=/u01/app/backup/ctl_ORCL_20160127_8_1tag=TAG20160127T232010
channelORA_AUX_DISK_1: restored backup piece 1
channelORA_AUX_DISK_1: restore complete, elapsed time: 00:00:04
outputfile name=/u01/app/oracle/oradata/clonedb/control01.ctl
outputfile name=/u01/app/oracle/oradata/clonedb/control02.ctl
Finishedrestore at 28-JAN-16
 
databasemounted
 
contentsof Memory Script:
{
   set until scn  1019371;
   set newname for datafile  1 to
 "/u01/app/oracle/oradata/clonedb/system01.dbf";
   set newname for datafile  2 to
 "/u01/app/oracle/oradata/clonedb/sysaux01.dbf";
   set newname for datafile  3 to
 "/u01/app/oracle/oradata/clonedb/undotbs01.dbf";
   set newname for datafile  4 to
 "/u01/app/oracle/oradata/clonedb/users01.dbf";
   set newname for datafile  5 to
 "/u01/app/oracle/oradata/clonedb/example01.dbf";
   set newname for datafile  6 to
 "/u01/app/oracle/oradata/clonedb/heleitbs01.dbf";
   restore
   clone database
   ;
}
executingMemory Script
 
executingcommand: SET until clause
 
executingcommand: SET NEWNAME
 
executingcommand: SET NEWNAME
 
executingcommand: SET NEWNAME
 
executingcommand: SET NEWNAME
 
executingcommand: SET NEWNAME
 
executingcommand: SET NEWNAME
 
Startingrestore at 28-JAN-16
usingchannel ORA_AUX_DISK_1
 
channelORA_AUX_DISK_1: starting datafile backup set restore
channelORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channelORA_AUX_DISK_1: restoring datafile 00002 to/u01/app/oracle/oradata/clonedb/sysaux01.dbf
channelORA_AUX_DISK_1: restoring datafile 00003 to/u01/app/oracle/oradata/clonedb/undotbs01.dbf
channelORA_AUX_DISK_1: restoring datafile 00006 to/u01/app/oracle/oradata/clonedb/heleitbs01.dbf
channelORA_AUX_DISK_1: reading from backup piece/u01/app/backup/full_ORCL_20160127_2_1
channelORA_AUX_DISK_1: piece handle=/u01/app/backup/full_ORCL_20160127_2_1tag=TAG20160127T231840
channelORA_AUX_DISK_1: restored backup piece 1
channelORA_AUX_DISK_1: restore complete, elapsed time: 00:00:56
channelORA_AUX_DISK_1: starting datafile backup set restore
channelORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channelORA_AUX_DISK_1: restoring datafile 00001 to/u01/app/oracle/oradata/clonedb/system01.dbf
channelORA_AUX_DISK_1: restoring datafile 00004 to/u01/app/oracle/oradata/clonedb/users01.dbf
channelORA_AUX_DISK_1: restoring datafile 00005 to/u01/app/oracle/oradata/clonedb/example01.dbf
channelORA_AUX_DISK_1: reading from backup piece/u01/app/backup/full_ORCL_20160127_1_1
channelORA_AUX_DISK_1: piece handle=/u01/app/backup/full_ORCL_20160127_1_1tag=TAG20160127T231840
channelORA_AUX_DISK_1: restored backup piece 1
channelORA_AUX_DISK_1: restore complete, elapsed time: 00:01:07
Finishedrestore at 28-JAN-16
 
contentsof Memory Script:
{
   switch clone datafile all;
}
executingMemory Script
 
datafile1 switched to datafile copy
inputdatafile copy RECID=8 STAMP=902341117 filename=/u01/app/oracle/oradata/clonedb/system01.dbf
datafile2 switched to datafile copy
inputdatafile copy RECID=9 STAMP=902341117 filename=/u01/app/oracle/oradata/clonedb/sysaux01.dbf
datafile3 switched to datafile copy
inputdatafile copy RECID=10 STAMP=902341117 filename=/u01/app/oracle/oradata/clonedb/undotbs01.dbf
datafile4 switched to datafile copy
inputdatafile copy RECID=11 STAMP=902341117 filename=/u01/app/oracle/oradata/clonedb/users01.dbf
datafile5 switched to datafile copy
inputdatafile copy RECID=12 STAMP=902341118 filename=/u01/app/oracle/oradata/clonedb/example01.dbf
datafile6 switched to datafile copy
inputdatafile copy RECID=13 STAMP=902341118 filename=/u01/app/oracle/oradata/clonedb/heleitbs01.dbf
 
contentsof Memory Script:
{
   set until scn  1019371;
   recover
   clone database
    delete archivelog
   ;
}
executingMemory Script
 
executingcommand: SET until clause
 
Startingrecover at 28-JAN-16
usingchannel ORA_AUX_DISK_1
 
startingmedia recovery
 
archivedlog for thread 1 with sequence 9 is already on disk as file/u01/archivelog/1_9_898373685.dbf
channelORA_AUX_DISK_1: starting archived log restore to default destination
channelORA_AUX_DISK_1: restoring archived log
archivedlog thread=1 sequence=5
channelORA_AUX_DISK_1: reading from backup piece/u01/app/backup/arch_ORCL_20160127_5_1
channelORA_AUX_DISK_1: piece handle=/u01/app/backup/arch_ORCL_20160127_5_1tag=TAG20160127T232008
channelORA_AUX_DISK_1: restored backup piece 1
channelORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
archivedlog file name=/u01/archivelog/1_5_898373685.dbf thread=1 sequence=5
channelclone_default: deleting archived log(s)
archivedlog file name=/u01/archivelog/1_5_898373685.dbf RECID=5 STAMP=902341120
channelORA_AUX_DISK_1: starting archived log restore to default destination
channelORA_AUX_DISK_1: restoring archived log
archivedlog thread=1 sequence=6
channelORA_AUX_DISK_1: restoring archived log
archivedlog thread=1 sequence=7
channelORA_AUX_DISK_1: reading from backup piece/u01/app/backup/arch_ORCL_20160127_6_1
channelORA_AUX_DISK_1: piece handle=/u01/app/backup/arch_ORCL_20160127_6_1tag=TAG20160127T232008
channelORA_AUX_DISK_1: restored backup piece 1
channelORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archivedlog file name=/u01/archivelog/1_6_898373685.dbf thread=1 sequence=6
channelclone_default: deleting archived log(s)
archivedlog file name=/u01/archivelog/1_6_898373685.dbf RECID=7 STAMP=902341122
archivedlog file name=/u01/archivelog/1_7_898373685.dbf thread=1 sequence=7
channelclone_default: deleting archived log(s)
archivedlog file name=/u01/archivelog/1_7_898373685.dbf RECID=6 STAMP=902341122
channelORA_AUX_DISK_1: starting archived log restore to default destination
channelORA_AUX_DISK_1: restoring archived log
archivedlog thread=1 sequence=8
channelORA_AUX_DISK_1: reading from backup piece/u01/app/backup/arch_ORCL_20160127_7_1
channelORA_AUX_DISK_1: piece handle=/u01/app/backup/arch_ORCL_20160127_7_1tag=TAG20160127T232008
channelORA_AUX_DISK_1: restored backup piece 1
channelORA_AUX_DISK_1: restore complete, elapsed time: 00:00:01
archivedlog file name=/u01/archivelog/1_8_898373685.dbf thread=1 sequence=8
channelclone_default: deleting archived log(s)
archivedlog file name=/u01/archivelog/1_8_898373685.dbf RECID=8 STAMP=902341123
archivedlog file name=/u01/archivelog/1_9_898373685.dbf thread=1 sequence=9
mediarecovery complete, elapsed time: 00:00:05
Finishedrecover at 28-JAN-16
 
contentsof Memory Script:
{
   shutdown clone immediate;
   startup clone nomount;
   sql clone "alter system set  db_name =
 ‘‘CLONEDB‘‘ 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;
}
executingMemory Script
 
databasedismounted
Oracleinstance shut down
 
connectedto auxiliary database (not started)
Oracleinstance started
 
TotalSystem Global Area     630501376 bytes
 
FixedSize                     2215984 bytes
VariableSize                188747728 bytes
DatabaseBuffers             436207616 bytes
RedoBuffers                   3330048 bytes
 
sqlstatement: alter system set  db_name=  ‘‘CLONEDB‘‘ comment= ‘‘Reset tooriginal value by RMAN‘‘ scope=spfile
 
sqlstatement: alter system reset db_unique_name scope=spfile
 
Oracleinstance shut down
 
connectedto auxiliary database (not started)
Oracleinstance started
 
TotalSystem Global Area     630501376 bytes
 
FixedSize                     2215984 bytes
VariableSize                188747728 bytes
DatabaseBuffers             436207616 bytes
RedoBuffers                   3330048 bytes
sqlstatement: CREATE CONTROLFILE REUSE SET DATABASE "CLONEDB" RESETLOGSARCHIVELOG
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP 1 ( ‘/u01/app/oracle/oradata/clonedb/redo01.log‘ ) SIZE 50 M  REUSE,
  GROUP 2 ( ‘/u01/app/oracle/oradata/clonedb/redo02.log‘ ) SIZE 50 M  REUSE,
  GROUP 3 ( ‘/u01/app/oracle/oradata/clonedb/redo03.log‘ ) SIZE 50 M  REUSE
 DATAFILE
 ‘/u01/app/oracle/oradata/clonedb/system01.dbf‘
 CHARACTER SET ZHS16GBK
 
 
contentsof Memory Script:
{
   set newname for tempfile  1 to
 "/u01/app/oracle/oradata/clonedb/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy "/u01/app/oracle/oradata/clonedb/sysaux01.dbf",
 "/u01/app/oracle/oradata/clonedb/undotbs01.dbf",
 "/u01/app/oracle/oradata/clonedb/users01.dbf",
 "/u01/app/oracle/oradata/clonedb/example01.dbf",
 "/u01/app/oracle/oradata/clonedb/heleitbs01.dbf";
   switch clone datafile all;
}
executingMemory Script
 
executingcommand: SET NEWNAME
 
renamedtempfile 1 to /u01/app/oracle/oradata/clonedb/temp01.dbf in control file
 
catalogeddatafile copy
datafilecopy file name=/u01/app/oracle/oradata/clonedb/sysaux01.dbf RECID=1STAMP=902341136
catalogeddatafile copy
datafilecopy file name=/u01/app/oracle/oradata/clonedb/undotbs01.dbf RECID=2STAMP=902341136
catalogeddatafile copy
datafilecopy file name=/u01/app/oracle/oradata/clonedb/users01.dbf RECID=3STAMP=902341136
catalogeddatafile copy
datafilecopy file name=/u01/app/oracle/oradata/clonedb/example01.dbf RECID=4STAMP=902341136
catalogeddatafile copy
datafilecopy file name=/u01/app/oracle/oradata/clonedb/heleitbs01.dbf RECID=5STAMP=902341136
 
datafile2 switched to datafile copy
inputdatafile copy RECID=1 STAMP=902341136 filename=/u01/app/oracle/oradata/clonedb/sysaux01.dbf
datafile3 switched to datafile copy
inputdatafile copy RECID=2 STAMP=902341136 filename=/u01/app/oracle/oradata/clonedb/undotbs01.dbf
datafile4 switched to datafile copy
inputdatafile copy RECID=3 STAMP=902341136 filename=/u01/app/oracle/oradata/clonedb/users01.dbf
datafile5 switched to datafile copy
inputdatafile copy RECID=4 STAMP=902341136 filename=/u01/app/oracle/oradata/clonedb/example01.dbf
datafile6 switched to datafile copy
inputdatafile copy RECID=5 STAMP=902341136 filename=/u01/app/oracle/oradata/clonedb/heleitbs01.dbf
 
contentsof Memory Script:
{
   Alter clone database open resetlogs;
}
executingMemory Script
 
databaseopened
FinishedDuplicate Db at 28-JAN-16

克隆成功,打开克隆库查看

SQL>show parameter name;
 
NAME                                     TYPE        VALUE
----------------------------------------------- ------------------------------
db_file_name_convert                    string        /u01/app/oracle/oradata/orcl,
 /u01/app/oracle/oradata/cloned
 b
db_name                            string         CLONEDB
db_unique_name                            string         CLONEDB
global_names                            boolean         FALSE
instance_name                            string         clonedb
lock_name_space                     string
log_file_name_convert                    string        /u01/app/oracle/oradata/orcl,
 /u01/app/oracle/oradata/cloned
 b
 
NAME                                     TYPE        VALUE
----------------------------------------------- ------------------------------
service_names                            string         CLONEDB
SQL>select status from v$instance;
 
STATUS
------------
OPEN
 
SQL>select name from v$datafile;
 
NAME
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/clonedb/system01.dbf
/u01/app/oracle/oradata/clonedb/sysaux01.dbf
/u01/app/oracle/oradata/clonedb/undotbs01.dbf
/u01/app/oracle/oradata/clonedb/users01.dbf
/u01/app/oracle/oradata/clonedb/example01.dbf
/u01/app/oracle/oradata/clonedb/heleitbs01.dbf
 
6rows selected.
 
SQL>select * from v$log;
 
    GROUP#   THREAD#  SEQUENCE#      BYTES BLOCKSIZE          MEMBERS ARC
-------------------- ---------- ---------- ---------- ---------- ---
STATUS                FIRST_CHANGE# FIRST_TIME   NEXT_CHANGE#NEXT_TIME
----------------------------- ------------ ------------ ------------
 1           1               1  52428800          512                1NO
CURRENT               1019372 28-JAN-16      2.8147E+14
 
 2           1               0  52428800          512                1YES
UNUSED                            0                               0
 
 3           1               0  52428800          512                1YES
UNUSED                            0                               0
 
 
SQL>alter system switch logfile;
 
Systemaltered.
 
SQL>/
 
Systemaltered.
 
SQL>/
 
Systemaltered.
 
SQL>select * from v$log;
 
    GROUP#   THREAD#  SEQUENCE#      BYTES BLOCKSIZE          MEMBERS ARC
-------------------- ---------- ---------- ---------- ---------- ---
STATUS                FIRST_CHANGE# FIRST_TIME   NEXT_CHANGE#NEXT_TIME
----------------------------- ------------ ------------ ------------
 1           1               4  52428800          512                1NO
CURRENT               1020327 28-JAN-16      2.8147E+14
 
 2           1               2  52428800          512                1YES
INACTIVE               102032028-JAN-16         1020323 28-JAN-16
 
 3           1               3  52428800          512                1YES
INACTIVE               102032328-JAN-16         1020327 28-JAN-16
时间: 2024-07-30 04:01:37

通过RMAN克隆数据库(基于备份)的相关文章

-Oracle 11gR2通过RMAN克隆数据库

Oracle Study之--Oracle 11gR2通过RMAN克隆数据库 Purpose of Database Duplication A duplicate database is useful for a variety of purposes, most of which involve testing. You can perform the following tasks in a duplicate database: Test backup and recovery proc

Oracle Study之--Oracle 11gR2通过RMAN克隆数据库

Oracle Study之--Oracle 11gR2通过RMAN克隆数据库 Purpose of Database Duplication A duplicate database is useful for a variety of purposes, most of which involve testing. You can perform the following tasks in a duplicate database: Test backup and recovery proc

示例在同一台机器上RMAN克隆数据库

1.查看主库ZDJS并使用RMAM进行备份 [[email protected] ~]$ sqlplus '/as sysdba' SQL*Plus: Release 10.2.0.1.0 - Production on Wed Jan 14 14:13:14 2015 Copyright (c) 1982, 2005, Oracle. All rights reserved. Connected to an idle instance. SQL> startup ORACLE instance

oracle 11g 基于备份的rman duplicate

基于备份的rman duplicate 命令来创建standby database 前提条件: 保证原库数据库的备份,归档对于standby 端是完全可见的, 这里假设原库和目标端数据文件,日志文件等所有文件存放结构完全相同: 配置主库,备库静态监听,主库处于归档模式,和force logging 1.对主数据库进行必要的更改. a. 启用 force logging. b. 如果没有密码文件,则创建密码文件. c. 创建备用 redo 日志. d. 修改参数文件,使其适用于 Dataguard

ORACLE RMAN备份及还原 RMAN可以进行增量备份:数据库,表空间,数据文件

ORACLE RMAN备份及还原 RMAN可以进行增量备份:数据库,表空间,数据文件 只有使用过的block可以被备份成backup set 表空间与数据文件对应关系:dba_data_files / v$datafile_header 在noarchivelog模式下,可以使用RMAN备份read-only和offline的表空间 ORACLE RMAN停机备份: 备份 RMAN连接上ORACLE,WINDOWS下在命令模式下 RMAN TARGET / 连接本地数据库用的是本地认证模式.RM

MariaDB之基于Percona Xtrabackup备份大数据库[完整备份与增量备份]

MariaDB之基于Percona Xtrabackup备份大数据库[完整备份与增量备份] 1.Xtrabackup的安装 MariaDB之基于Percona Xtrabackup备份大数据库[完整备份与增量备份]

使用rman迁移数据库到异机

迁移数据库的方法有多种,较为常用的则是使用RMAN来迁移.使用RMAN迁移数据库属于数据库的物理备份与恢复范畴,整个过程中数据库的相关信息是完整地镜像.因此,基于此种方式还原恢复的数据库用于测试会使得与真实的生产环境差异相对较小. 一.主要步骤     1.备份数据库     2.拷贝备份到目的服务器     3.为目标数据库创建项目目录     4.为目标数据库创建pfile或spfile(使用RMAN还原或复制原pfile到目的服务器)     5.还原控制文件     6.还原数据文件  

RMAN冷备份、一致性备份脚本

RMAN冷备份.一致性备份脚本 run{ shutdown immediate; startup mount; allocate channel c1 type disk; allocate channel c2 type disk; backup database format '/home/oracle/rman_bak/cold_bak/%d_%s_%p.bak'; alter database open; } RMAN热备份.非一致性备份脚本 简化版: run{ sql 'alter s

RMAN综合学习之备份

rman是最经济实惠的oracle备份工具,在这里做一个rman的整体学习. 文章中大多是rman命令的语法,还是最好做做实验,以便印象深刻,因为大多数数据库的备份就是按时跑脚本,恢复也不是经常能遇到,时间长了就会生疏,多多复习吧. [terry笔记]RMAN综合学习之备份http://www.cnblogs.com/kkterry/p/3308405.html [terry笔记]RMAN综合学习之恢复 http://www.cnblogs.com/kkterry/p/3308407.html