设为首页 收藏本站
查看: 415|回复: 0

[经验分享] 通过RMAN克隆数据库(基于备份)

[复制链接]
累计签到:1 天
连续签到:1 天
发表于 2016-2-1 10:39:03 | 显示全部楼层 |阅读模式
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


备份数据库
[oracle@HE3app]$ 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)

1
2
3
4
5
6
7
8
9
10
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';
}





1
2
3
4
5
6
7
8
9
10
11
12
13
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文件
1
2
3
SQL>create pfile from spfile;

Filecreated.



建立克隆库的目录
1
2
3
4
[oracle@HE4 ~]$ mkdir -p$ORACLE_BASE/admin/clonedb/bdump
[oracle@HE4 ~]$ mkdir -p$ORACLE_BASE/admin/clonedb/cdump
[oracle@HE4 ~]$ mkdir -p$ORACLE_BASE/admin/clonedb/udump
[oracle@HE4 ~]$ mkdir -p $ORACLE_BASE/oradata/clonedb





将主库pfile拷贝成名为克隆库名的文件,将其拷贝至备机,并在备机生成克隆库的口令文件
1
2
[oracle@HE3dbs]$ cp initorcl.ora initclonedb.ora
[oracle@HE4dbs]$ 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'即可,
如何查看和关闭审计功能:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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
1
2
3
4
5
6
7
8
9
10
11
[oracle@HE4 dbs]$ export ORACLE_SID=clonedb
[oracle@HE4 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库
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
[oracle@HE4admin]$ rman target sys/MANAGER@orcl 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复制
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
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






克隆成功,打开克隆库查看
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
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






运维网声明 1、欢迎大家加入本站运维交流群:群②:261659950 群⑤:202807635 群⑦870801961 群⑧679858003
2、本站所有主题由该帖子作者发表,该帖子作者与运维网享有帖子相关版权
3、所有作品的著作权均归原作者享有,请您和我们一样尊重他人的著作权等合法权益。如果您对作品感到满意,请购买正版
4、禁止制作、复制、发布和传播具有反动、淫秽、色情、暴力、凶杀等内容的信息,一经发现立即删除。若您因此触犯法律,一切后果自负,我们对此不承担任何责任
5、所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其内容的准确性、可靠性、正当性、安全性、合法性等负责,亦不承担任何法律责任
6、所有作品仅供您个人学习、研究或欣赏,不得用于商业或者其他用途,否则,一切后果均由您自己承担,我们对此不承担任何法律责任
7、如涉及侵犯版权等问题,请您及时通知我们,我们将立即采取措施予以解决
8、联系人Email:admin@iyunv.com 网址:www.yunweiku.com

所有资源均系网友上传或者通过网络收集,我们仅提供一个展示、介绍、观摩学习的平台,我们不对其承担任何法律责任,如涉及侵犯版权等问题,请您及时通知我们,我们将立即处理,联系人Email:kefu@iyunv.com,QQ:1061981298 本贴地址:https://www.yunweiku.com/thread-172270-1-1.html 上篇帖子: ORACLE进程占用CPU情况分析 下篇帖子: ORA-03113: end-of-file on communication channel 数据库
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

扫码加入运维网微信交流群X

扫码加入运维网微信交流群

扫描二维码加入运维网微信交流群,最新一手资源尽在官方微信交流群!快快加入我们吧...

扫描微信二维码查看详情

客服E-mail:kefu@iyunv.com 客服QQ:1061981298


QQ群⑦:运维网交流群⑦ QQ群⑧:运维网交流群⑧ k8s群:运维网kubernetes交流群


提醒:禁止发布任何违反国家法律、法规的言论与图片等内容;本站内容均来自个人观点与网络等信息,非本站认同之观点.


本站大部分资源是网友从网上搜集分享而来,其版权均归原作者及其网站所有,我们尊重他人的合法权益,如有内容侵犯您的合法权益,请及时与我们联系进行核实删除!



合作伙伴: 青云cloud

快速回复 返回顶部 返回列表