|
1. 模板建库的controlfile creation脚本:dbca模板建库时,设定库名为emrep,保存脚本如下:
- create controlfile reuse set database "emrep"
- MAXINSTANCES 8
- MAXLOGHISTORY 1
- MAXLOGFILES 16
- MAXLOGMEMBERS 3
- MAXDATAFILES 100
- Datafile
- '&&file0',
- '&&file1',
- '&&file2',
- '&&file3'
- LOGFILE GROUP 1 SIZE 1024M,
- GROUP 2 SIZE 1024M,
- GROUP 3 SIZE 1024M,
- GROUP 4 SIZE 1024M,
- GROUP 5 SIZE 1024M RESETLOGS;
复制代码 注意:建库的create controlfile语句里有“set”,而用于恢复controlfile的trace脚本(有set1和set2两段)都没有“set”。下面查看一下该建库的create controlfile语句创建的emrep数据库的化身:
[oracle@classroom ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Sun Feb 13 16:44:13 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: EMREP (DBID=22794985)
RMAN> list incarnation of database;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 EMREP 22794985 PARENT 1 17-APR-19
2 2 EMREP 22794985 CURRENT 1920977 23-JAN-22
RMAN>
发现会记录原模板中的化身,就是说会保留PARENT 化身,而用于恢复controlfile的trace脚本(有set1和set2两段)都清除历史化身,只会留下当前化身。注意区别。
2. 跨平台迁移的controlfile creation脚本(与改数据库名字的脚本一样):
跨平台迁移时,rman的执行“convert database to platform”会话的trace文件里有create controlfile语句保存成脚本如下:- CREATE CONTROLFILE REUSE SET DATABASE mydb RESETLOGS ARCHIVELOG
- MAXLOGFILES 16
- MAXLOGMEMBERS 3
- MAXDATAFILES 100
- MAXINSTANCES 8
- MAXLOGHISTORY 292
- LOGFILE
- GROUP 1 '/u01/app/oracle/oradata/orcl2/redo01.log' SIZE 500M BLOCKSIZE 512,
- GROUP 2 '/u01/app/oracle/oradata/orcl2/redo02.log' SIZE 500M BLOCKSIZE 512,
- GROUP 3 '/u01/app/oracle/oradata/orcl2/redo03.log' SIZE 500M BLOCKSIZE 512
- DATAFILE
- '/u01/app/oracle/oradata/orcl2/sysaux01.dbf',
- '/u01/app/oracle/oradata/orcl2/system01.dbf',
- '/u01/app/oracle/oradata/orcl2/undotbs1.dbf',
- '/u01/app/oracle/oradata/orcl2/users01.dbf'
- CHARACTER SET ZHS16GBK
- ;
复制代码 create controlfile语句里也有“set”,与模板建库情况相同,与用于恢复controlfile的trace脚本(有set1和set2两段)的情况不同,因此化身也会保留PARENT部分:
[oracle@classroom ~]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Sun Feb 13 16:43:16 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: MYDB (DBID=376305118)
RMAN> list incarnation of database;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 MYDB 376305118 PARENT 2103854 13-FEB-22
2 2 MYDB 376305118 CURRENT 2188190 13-FEB-22
3. “nid”命令改dbid和dbname后的数据库会保留历史化身(与改数据库名字的脚本一样):
将上面的mydb数据库改名字成orcl2数据库,使用“nid target=sys/oracle_4U dbname=orcl2”命令,数据库重新启动:
[oracle@classroom dbs]$ sqlplus /nolog
SQL*Plus: Release 19.0.0.0.0 - Production on Sun Feb 13 16:53:49 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle. All rights reserved.
SQL> conn / as sysdba
Connected.
SQL> shutdown abort
ORACLE instance shut down.
SQL> create spfile from pfile;
File created.
SQL> startup
ORACLE instance started.
Total System Global Area 2566913256 bytes
Fixed Size 8899816 bytes
Variable Size 553648128 bytes
Database Buffers 1996488704 bytes
Redo Buffers 7876608 bytes
Database mounted.
ORA-01589: must use RESETLOGS or NORESETLOGS option for database open
SQL> alter database open resetlogs;
Database altered.
SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@classroom dbs]$ rman target /
Recovery Manager: Release 19.0.0.0.0 - Production on Sun Feb 13 16:55:45 2022
Version 19.3.0.0.0
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL2 (DBID=1077418382)
RMAN> list incarnation of database;
using target database control file instead of recovery catalog
List of Database Incarnations
DB Key Inc Key DB Name DB ID STATUS Reset SCN Reset Time
------- ------- -------- ---------------- --- ---------- ----------
1 1 ORCL2 1077418382 PARENT 2103854 13-FEB-22
2 2 ORCL2 1077418382 PARENT 2188190 13-FEB-22
3 3 ORCL2 1077418382 CURRENT 2189976 13-FEB-22
RMAN>
|
|